2 * PROJECT: ReactOS API Tests
3 * LICENSE: GPLv2+ - See COPYING in the top level directory
4 * PURPOSE: Test for CRT command-line handling - Utility GUI program.
5 * PROGRAMMER: Hermès BÉLUSCA - MAÏTO <hermes.belusca@sfr.fr>
8 #define WIN32_NO_STATUS
12 #include <ndk/rtlfuncs.h>
14 #include "CmdLineUtil.h"
16 int APIENTRY
wWinMain(HINSTANCE hInstance
,
17 HINSTANCE hPrevInstance
,
22 * Get the unparsed command line as seen in Win32 mode,
23 * and the NT-native mode one.
25 LPWSTR CmdLine
= GetCommandLineW();
26 UNICODE_STRING CmdLine_U
= NtCurrentPeb()->ProcessParameters
->CommandLine
;
28 /* Write the results into a file. */
29 HANDLE hFile
= CreateFileW(DATAFILE
,
33 FILE_ATTRIBUTE_NORMAL
,
35 if (hFile
!= INVALID_HANDLE_VALUE
)
37 DWORD dwSize
, dwStringSize
;
40 * Format of the data file :
42 * [size_of_string 4 bytes][null_terminated_C_string]
43 * [size_of_string 4 bytes][null_terminated_C_string]
44 * [UNICODE_STRING_structure][string_buffer_of_UNICODE_STRING]
47 /* 1- Write the WinMain's command line. */
48 dwStringSize
= (wcslen(lpCmdLine
) + 1) * sizeof(WCHAR
);
62 /* 2- Write the Win32 mode command line. */
63 dwStringSize
= (wcslen(CmdLine
) + 1) * sizeof(WCHAR
);
77 /* 3- Finally, write the UNICODE_STRING command line. */
90 /* Now close the file. */