mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
[ADVAPI32][SECLOGON] CreateProcessWithLogonW: Pass the environment to the callee
This commit is contained in:
parent
59e74584ac
commit
c3db5e9c8e
3 changed files with 61 additions and 1 deletions
|
@ -126,11 +126,13 @@ SeclCreateProcessWithLogonW(
|
|||
}
|
||||
}
|
||||
|
||||
/* Initialize the startup information */
|
||||
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
|
||||
StartupInfo.cb = sizeof(StartupInfo);
|
||||
|
||||
/* FIXME: Get startup info from the caller */
|
||||
|
||||
/* Initialize the process information */
|
||||
ZeroMemory(&ProcessInfo, sizeof(ProcessInfo));
|
||||
|
||||
/* Create Process */
|
||||
|
@ -141,7 +143,7 @@ SeclCreateProcessWithLogonW(
|
|||
NULL, // lpThreadAttributes,
|
||||
FALSE, // bInheritHandles,
|
||||
pRequest->dwCreationFlags,
|
||||
NULL, // lpEnvironment,
|
||||
pRequest->Environment, // lpEnvironment,
|
||||
pRequest->CurrentDirectory,
|
||||
&StartupInfo,
|
||||
&ProcessInfo);
|
||||
|
|
|
@ -3472,6 +3472,53 @@ ConvertSidToStringSidA(PSID Sid,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
DWORD
|
||||
GetUnicodeEnvironmentSize(
|
||||
PVOID pEnvironment)
|
||||
{
|
||||
INT Length, TotalLength = 0;
|
||||
PWCHAR Ptr;
|
||||
|
||||
if (pEnvironment == NULL)
|
||||
return 0;
|
||||
|
||||
Ptr = (PWCHAR)pEnvironment;
|
||||
while (*Ptr != UNICODE_NULL)
|
||||
{
|
||||
Length = wcslen(Ptr) + 1;
|
||||
TotalLength += Length;
|
||||
Ptr = Ptr + Length;
|
||||
}
|
||||
|
||||
return (TotalLength + 1) * sizeof(WCHAR);
|
||||
}
|
||||
|
||||
|
||||
static
|
||||
DWORD
|
||||
GetAnsiEnvironmentSize(
|
||||
PVOID pEnvironment)
|
||||
{
|
||||
INT Length, TotalLength = 0;
|
||||
PCHAR Ptr;
|
||||
|
||||
if (pEnvironment == NULL)
|
||||
return 0;
|
||||
|
||||
Ptr = (PCHAR)pEnvironment;
|
||||
while (*Ptr != ANSI_NULL)
|
||||
{
|
||||
Length = strlen(Ptr) + 1;
|
||||
TotalLength += Length;
|
||||
Ptr = Ptr + Length;
|
||||
}
|
||||
|
||||
return TotalLength + 1;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* @unimplemented
|
||||
*/
|
||||
|
@ -3535,6 +3582,15 @@ CreateProcessWithLogonW(
|
|||
Request.CommandLine = (LPWSTR)lpCommandLine;
|
||||
Request.CurrentDirectory = (LPWSTR)lpCurrentDirectory;
|
||||
|
||||
if (dwCreationFlags & CREATE_UNICODE_ENVIRONMENT)
|
||||
Request.dwEnvironmentSize = GetUnicodeEnvironmentSize(lpEnvironment);
|
||||
else
|
||||
Request.dwEnvironmentSize = GetAnsiEnvironmentSize(lpEnvironment);
|
||||
Request.Environment = lpEnvironment;
|
||||
|
||||
TRACE("Request.dwEnvironmentSize %lu\n", Request.dwEnvironmentSize);
|
||||
TRACE("Request.Environment %p\n", Request.Environment);
|
||||
|
||||
Request.dwLogonFlags = dwLogonFlags;
|
||||
Request.dwCreationFlags = dwCreationFlags;
|
||||
|
||||
|
|
|
@ -12,6 +12,8 @@ typedef struct _SECL_REQUEST
|
|||
[string] WCHAR *ApplicationName;
|
||||
[string] WCHAR *CommandLine;
|
||||
[string] WCHAR *CurrentDirectory;
|
||||
[size_is(dwEnvironmentSize)] BYTE *Environment;
|
||||
DWORD dwEnvironmentSize;
|
||||
DWORD dwLogonFlags;
|
||||
DWORD dwCreationFlags;
|
||||
DWORD dwProcessId;
|
||||
|
|
Loading…
Reference in a new issue