kernelbase: Use command_lineW for GetCommandLineW.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48861
Signed-off-by: Myah Caron <qsniyg@protonmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Myah Caron 2020-10-13 19:43:01 +00:00 committed by Alexandre Julliard
parent f4a66ad257
commit d01d3b749d
2 changed files with 12 additions and 1 deletions

View File

@ -872,6 +872,7 @@ static void test_CommandLine(void)
PROCESS_INFORMATION info;
STARTUPINFOA startup;
BOOL ret;
LPWSTR cmdline, cmdline_backup;
memset(&startup, 0, sizeof(startup));
startup.cb = sizeof(startup);
@ -1074,6 +1075,16 @@ static void test_CommandLine(void)
ret = CreateProcessA(NULL, buffer2, NULL, NULL, FALSE, 0L, NULL, NULL, &startup, &info);
ok(!ret, "CreateProcessA unexpectedly succeeded\n");
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Expected ERROR_FILE_NOT_FOUND, got %d\n", GetLastError());
/* Test whether GetCommandLineW reads directly from TEB or from a cached address */
cmdline = GetCommandLineW();
ok(cmdline == NtCurrentTeb()->Peb->ProcessParameters->CommandLine.Buffer, "Expected address from TEB, got %p\n", cmdline);
cmdline_backup = cmdline;
NtCurrentTeb()->Peb->ProcessParameters->CommandLine.Buffer = NULL;
cmdline = GetCommandLineW();
ok(cmdline == cmdline_backup, "Expected cached address from TEB, got %p\n", cmdline);
NtCurrentTeb()->Peb->ProcessParameters->CommandLine.Buffer = cmdline_backup;
}
static void test_Directory(void)

View File

@ -1289,7 +1289,7 @@ LPSTR WINAPI DECLSPEC_HOTPATCH GetCommandLineA(void)
*/
LPWSTR WINAPI DECLSPEC_HOTPATCH GetCommandLineW(void)
{
return NtCurrentTeb()->Peb->ProcessParameters->CommandLine.Buffer;
return command_lineW;
}