MASM32 Downloads
include \masm32\include\masm32rt.inc.codestart: print "[" invoke GetCommandLine inkey eax, "]" exitend start
<- lots of whitespace (9, 9, 9, 32, 32, 32)
@REM test commandlineGetCommandLine.exe 12345GetCommandLine64.exe 12345"GetCommandLine.exe" 12345"GetCommandLine64.exe" 12345"GetCommandLine.exe" 12345"GetCommandLine64.exe" 12345pause
Parses a Unicode command line string and returns an array of pointers to the command line arguments, along with a count of such arguments, in a way that is similar to the standard C run-time argv and argc values.
include \masm32\include\masm32rt.inc.dataformat db 'Parameter %d = %s',13,10,0.data?buffer db 256 dup(?).codestart: call main invoke ExitProcess,0main PROC uses esi edi ebxLOCAL argc:DWORD invoke GetCommandLineW lea ecx,argc invoke CommandLineToArgvW,eax,ecx mov esi,eax mov ebx,argc xor edi,edi@@: inc edi; Convert UNICODE string to ANSI invoke WideCharToMultiByte,CP_ACP,0,\ DWORD PTR [esi],-1,ADDR buffer,\ 256,0,0 invoke crt_printf,ADDR format,edi,ADDR buffer add esi,4 dec ebx jnz @b retmain ENDPEND start
CommandLineToArgvW.exe test1 abc xyzParameter 1 = CommandLineToArgvW.exeParameter 2 = test1Parameter 3 = abcParameter 4 = xyz