Commit 3f814c42 authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

kernelbase: No longer cache GetStartupInfoW() results.

parent 76018fbb
......@@ -5240,20 +5240,15 @@ static void test_startupinfo( void )
startup_afterW.hStdInput = (HANDLE)0x43210000;
GetStartupInfoW(&startup_afterW);
todo_wine
ok(~startup_beforeW.dwX == startup_afterW.dwX, "Unexpected field value\n");
if (startup_beforeW.dwFlags & STARTF_USESTDHANDLES)
{
todo_wine
ok(params->hStdInput == startup_afterW.hStdInput, "Unexpected field value\n");
todo_wine
ok((HANDLE)~(DWORD_PTR)startup_beforeW.hStdInput == startup_afterW.hStdInput, "Unexpected field value\n");
}
else
{
todo_wine
ok(startup_beforeW.hStdInput == (HANDLE)0x12340000, "Unexpected field value\n");
todo_wine
ok(startup_afterW.hStdInput == (HANDLE)0x43210000, "Unexpected field value\n");
}
......@@ -5263,11 +5258,9 @@ static void test_startupinfo( void )
startup_afterW.hStdInput = (HANDLE)0x43210000;
GetStartupInfoW(&startup_afterW);
todo_wine
ok((startup_beforeW.dwFlags ^ STARTF_USESTDHANDLES) == startup_afterW.dwFlags, "Unexpected field value\n");
if (startup_afterW.dwFlags & STARTF_USESTDHANDLES)
{
todo_wine
ok(params->hStdInput == startup_afterW.hStdInput, "Unexpected field value\n");
ok(startup_afterW.hStdInput != (HANDLE)0x43210000, "Unexpected field value\n");
}
......
......@@ -1254,7 +1254,6 @@ BOOL WINAPI DECLSPEC_HOTPATCH TerminateProcess( HANDLE handle, DWORD exit_code )
***********************************************************************/
static STARTUPINFOW startup_infoW;
static char *command_lineA;
static WCHAR *command_lineW;
......@@ -1265,34 +1264,6 @@ void init_startup_info( RTL_USER_PROCESS_PARAMETERS *params )
{
ANSI_STRING ansi;
startup_infoW.cb = sizeof(startup_infoW);
startup_infoW.lpReserved = NULL;
startup_infoW.lpDesktop = params->Desktop.Buffer;
startup_infoW.lpTitle = params->WindowTitle.Buffer;
startup_infoW.dwX = params->dwX;
startup_infoW.dwY = params->dwY;
startup_infoW.dwXSize = params->dwXSize;
startup_infoW.dwYSize = params->dwYSize;
startup_infoW.dwXCountChars = params->dwXCountChars;
startup_infoW.dwYCountChars = params->dwYCountChars;
startup_infoW.dwFillAttribute = params->dwFillAttribute;
startup_infoW.dwFlags = params->dwFlags;
startup_infoW.wShowWindow = params->wShowWindow;
startup_infoW.cbReserved2 = params->RuntimeInfo.MaximumLength;
startup_infoW.lpReserved2 = params->RuntimeInfo.MaximumLength ? (void *)params->RuntimeInfo.Buffer : NULL;
if (params->dwFlags & STARTF_USESTDHANDLES)
{
startup_infoW.hStdInput = params->hStdInput;
startup_infoW.hStdOutput = params->hStdOutput;
startup_infoW.hStdError = params->hStdError;
}
else
{
startup_infoW.hStdInput = NULL;
startup_infoW.hStdOutput = NULL;
startup_infoW.hStdError = NULL;
}
command_lineW = params->CommandLine.Buffer;
if (!RtlUnicodeStringToAnsiString( &ansi, &params->CommandLine, TRUE )) command_lineA = ansi.Buffer;
}
......@@ -1332,7 +1303,40 @@ LPWSTR WINAPI GetCommandLineW(void)
*/
void WINAPI DECLSPEC_HOTPATCH GetStartupInfoW( STARTUPINFOW *info )
{
*info = startup_infoW;
RTL_USER_PROCESS_PARAMETERS *params;
RtlAcquirePebLock();
params = RtlGetCurrentPeb()->ProcessParameters;
info->cb = sizeof(*info);
info->lpReserved = NULL;
info->lpDesktop = params->Desktop.Buffer;
info->lpTitle = params->WindowTitle.Buffer;
info->dwX = params->dwX;
info->dwY = params->dwY;
info->dwXSize = params->dwXSize;
info->dwYSize = params->dwYSize;
info->dwXCountChars = params->dwXCountChars;
info->dwYCountChars = params->dwYCountChars;
info->dwFillAttribute = params->dwFillAttribute;
info->dwFlags = params->dwFlags;
info->wShowWindow = params->wShowWindow;
info->cbReserved2 = params->RuntimeInfo.MaximumLength;
info->lpReserved2 = params->RuntimeInfo.MaximumLength ? (void *)params->RuntimeInfo.Buffer : NULL;
if (params->dwFlags & STARTF_USESTDHANDLES)
{
info->hStdInput = params->hStdInput;
info->hStdOutput = params->hStdOutput;
info->hStdError = params->hStdError;
}
else
{
info->hStdInput = NULL;
info->hStdOutput = NULL;
info->hStdError = NULL;
}
RtlReleasePebLock();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment