Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
9c57e23d
Commit
9c57e23d
authored
Jun 21, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement RtlExpandEnvironmentStrings().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
3624b7c6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
17 deletions
+25
-17
env.c
dlls/ntdll/env.c
+23
-17
ntdll.spec
dlls/ntdll/ntdll.spec
+1
-0
winternl.h
include/winternl.h
+1
-0
No files found.
dlls/ntdll/env.c
View file @
9c57e23d
...
...
@@ -281,21 +281,14 @@ done:
return
nts
;
}
/******************************************************************
* RtlExpandEnvironmentStrings_U (NTDLL.@)
*
/******************************************************************************
* RtlExpandEnvironmentStrings (NTDLL.@)
*/
NTSTATUS
WINAPI
RtlExpandEnvironmentStrings
_U
(
PCWSTR
renv
,
const
UNICODE_STRING
*
us_src
,
PUNICODE_STRING
us_dst
,
PULONG
plen
)
NTSTATUS
WINAPI
RtlExpandEnvironmentStrings
(
const
WCHAR
*
renv
,
WCHAR
*
src
,
SIZE_T
src_len
,
WCHAR
*
dst
,
SIZE_T
count
,
SIZE_T
*
plen
)
{
DWORD
src_len
,
len
,
count
,
total_size
=
1
;
/* 1 for terminating '\0' */
LPCWSTR
env
,
src
,
p
,
var
;
LPWSTR
dst
;
src
=
us_src
->
Buffer
;
src_len
=
us_src
->
Length
/
sizeof
(
WCHAR
);
count
=
us_dst
->
MaximumLength
/
sizeof
(
WCHAR
);
dst
=
count
?
us_dst
->
Buffer
:
NULL
;
SIZE_T
len
,
total_size
=
1
;
/* 1 for terminating '\0' */
LPCWSTR
env
,
p
,
var
;
if
(
!
renv
)
{
...
...
@@ -353,15 +346,28 @@ NTSTATUS WINAPI RtlExpandEnvironmentStrings_U(PCWSTR renv, const UNICODE_STRING*
if
(
!
renv
)
RtlReleasePebLock
();
/* Null-terminate the string */
if
(
dst
&&
count
)
*
dst
=
'\0'
;
us_dst
->
Length
=
(
dst
)
?
(
dst
-
us_dst
->
Buffer
)
*
sizeof
(
WCHAR
)
:
0
;
if
(
plen
)
*
plen
=
total_size
*
sizeof
(
WCHAR
);
if
(
plen
)
*
plen
=
total_size
;
return
(
count
)
?
STATUS_SUCCESS
:
STATUS_BUFFER_TOO_SMALL
;
}
/******************************************************************
* RtlExpandEnvironmentStrings_U (NTDLL.@)
*/
NTSTATUS
WINAPI
RtlExpandEnvironmentStrings_U
(
const
WCHAR
*
env
,
const
UNICODE_STRING
*
src
,
UNICODE_STRING
*
dst
,
ULONG
*
plen
)
{
SIZE_T
len
;
NTSTATUS
ret
;
ret
=
RtlExpandEnvironmentStrings
(
env
,
src
->
Buffer
,
src
->
Length
/
sizeof
(
WCHAR
),
dst
->
Buffer
,
dst
->
MaximumLength
/
sizeof
(
WCHAR
),
&
len
);
if
(
plen
)
*
plen
=
len
*
sizeof
(
WCHAR
);
/* FIXME: check for overflow? */
if
(
len
>
UNICODE_STRING_MAX_CHARS
)
ret
=
STATUS_BUFFER_TOO_SMALL
;
if
(
!
ret
)
dst
->
Length
=
(
len
-
1
)
*
sizeof
(
WCHAR
);
return
ret
;
}
static
inline
void
normalize
(
void
*
base
,
WCHAR
**
ptr
)
{
...
...
dlls/ntdll/ntdll.spec
View file @
9c57e23d
...
...
@@ -596,6 +596,7 @@
@ stdcall RtlEraseUnicodeString(ptr)
@ stdcall RtlExitUserProcess(long)
@ stdcall RtlExitUserThread(long)
@ stdcall RtlExpandEnvironmentStrings(ptr wstr long ptr long ptr)
@ stdcall RtlExpandEnvironmentStrings_U(ptr ptr ptr ptr)
@ stub RtlExtendHeap
@ stdcall -arch=win32 -ret64 RtlExtendedIntegerMultiply(int64 long)
...
...
include/winternl.h
View file @
9c57e23d
...
...
@@ -2630,6 +2630,7 @@ NTSYSAPI BOOLEAN WINAPI RtlEqualString(const STRING*,const STRING*,BOOLEAN);
NTSYSAPI
BOOLEAN
WINAPI
RtlEqualUnicodeString
(
const
UNICODE_STRING
*
,
const
UNICODE_STRING
*
,
BOOLEAN
);
NTSYSAPI
void
DECLSPEC_NORETURN
WINAPI
RtlExitUserProcess
(
ULONG
);
NTSYSAPI
void
DECLSPEC_NORETURN
WINAPI
RtlExitUserThread
(
ULONG
);
NTSYSAPI
NTSTATUS
WINAPI
RtlExpandEnvironmentStrings
(
const
WCHAR
*
,
WCHAR
*
,
SIZE_T
,
WCHAR
*
,
SIZE_T
,
SIZE_T
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlExpandEnvironmentStrings_U
(
PCWSTR
,
const
UNICODE_STRING
*
,
UNICODE_STRING
*
,
ULONG
*
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFindActivationContextSectionString
(
ULONG
,
const
GUID
*
,
ULONG
,
const
UNICODE_STRING
*
,
PVOID
);
NTSYSAPI
NTSTATUS
WINAPI
RtlFindActivationContextSectionGuid
(
ULONG
,
const
GUID
*
,
ULONG
,
const
GUID
*
,
PVOID
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment