ReactOS 0.4.15-dev-8131-g4988de4
CmdLineUtil.c File Reference
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <ndk/rtlfuncs.h>
#include "CmdLineUtil.h"
Include dependency graph for CmdLineUtil.c:

Go to the source code of this file.

Macros

#define WIN32_NO_STATUS
 

Functions

int APIENTRY wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, int nCmdShow)
 

Macro Definition Documentation

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 8 of file CmdLineUtil.c.

Function Documentation

◆ wWinMain()

int APIENTRY wWinMain ( HINSTANCE  hInstance,
HINSTANCE  hPrevInstance,
LPWSTR  lpCmdLine,
int  nShowCmd 
)

This file has no copyright assigned and is placed in the Public Domain. This file is part of the w64 mingw-runtime package. No warranty is given; refer to the file DISCLAIMER.PD within this package.

Definition at line 16 of file CmdLineUtil.c.

20{
21 /*
22 * Get the unparsed command line as seen in Win32 mode,
23 * and the NT-native mode one.
24 */
26 UNICODE_STRING CmdLine_U = NtCurrentPeb()->ProcessParameters->CommandLine;
27
28 /* Write the results into a file. */
31 0, NULL,
34 NULL);
36 {
37 DWORD dwSize, dwStringSize;
38
39 /*
40 * Format of the data file :
41 *
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]
45 */
46
47 /* 1- Write the WinMain's command line. */
48 dwStringSize = (lstrlenW(lpCmdLine) + 1) * sizeof(WCHAR);
49
51 &dwStringSize,
52 sizeof(dwStringSize),
53 &dwSize,
54 NULL);
55
57 lpCmdLine,
58 dwStringSize,
59 &dwSize,
60 NULL);
61
62 /* 2- Write the Win32 mode command line. */
63 dwStringSize = (lstrlenW(CmdLine) + 1) * sizeof(WCHAR);
64
66 &dwStringSize,
67 sizeof(dwStringSize),
68 &dwSize,
69 NULL);
70
72 CmdLine,
73 dwStringSize,
74 &dwSize,
75 NULL);
76
77 /* 3- Finally, write the UNICODE_STRING command line. */
79 &CmdLine_U,
80 sizeof(CmdLine_U),
81 &dwSize,
82 NULL);
83
85 CmdLine_U.Buffer,
86 CmdLine_U.Length,
87 &dwSize,
88 NULL);
89
90 /* Now close the file. */
92 }
93
94 return 0;
95}
#define DATAFILE
Definition: CmdLineUtil.h:11
#define NtCurrentPeb()
Definition: FLS.c:22
#define NULL
Definition: types.h:112
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
#define lstrlenW
Definition: compat.h:750
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
LPWSTR WINAPI GetCommandLineW(VOID)
Definition: proc.c:2013
static const WCHAR CmdLine[]
Definition: install.c:48
unsigned long DWORD
Definition: ntddk_ex.h:95
#define CREATE_ALWAYS
Definition: disk.h:72
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
_In_ HANDLE hFile
Definition: mswsock.h:90
#define GENERIC_WRITE
Definition: nt_native.h:90
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184