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
11 #include <ndk/ntndk.h>
13 #include "CmdLineUtil.h"
15 int APIENTRY
wWinMain(HINSTANCE hInstance
,
16 HINSTANCE hPrevInstance
,
21 * Get the unparsed command line as seen in Win32 mode,
22 * and the NT-native mode one.
24 LPWSTR CmdLine
= GetCommandLineW();
25 UNICODE_STRING CmdLine_U
= NtCurrentPeb()->ProcessParameters
->CommandLine
;
27 /* Write the results into a file. */
28 HANDLE hFile
= CreateFileW(DATAFILE
,
32 FILE_ATTRIBUTE_NORMAL
,
34 if (hFile
!= INVALID_HANDLE_VALUE
)
36 DWORD dwSize
, dwStringSize
;
39 * Format of the data file :
41 * [size_of_string 4 bytes][null_terminated_C_string]
42 * [size_of_string 4 bytes][null_terminated_C_string]
43 * [UNICODE_STRING_structure][string_buffer_of_UNICODE_STRING]
46 /* 1- Write the WinMain's command line. */
47 dwStringSize
= (wcslen(lpCmdLine
) + 1) * sizeof(WCHAR
);
61 /* 2- Write the Win32 mode command line. */
62 dwStringSize
= (wcslen(CmdLine
) + 1) * sizeof(WCHAR
);
76 /* 3- Finally, write the UNICODE_STRING command line. */
89 /* Now close the file. */