Commit d01d3b74 authored by Myah Caron's avatar Myah Caron Committed by Alexandre Julliard

kernelbase: Use command_lineW for GetCommandLineW.

parent f4a66ad2
......@@ -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)
......
......@@ -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;
}
......
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