flat assembler
Message board for the users of flat assembler.
Index
> Windows > Command Line Arguments Help. Goto page Previous 1, 2, 3 Next |
Author |
|
Tyler 25 Oct 2010, 01:51
Oh, that's a really big problem... How could one use Unicode in Fasm, or is it possible?
|
|||
25 Oct 2010, 01:51 |
|
Overflowz 25 Oct 2010, 09:58
Someone maybe can write some (if possible) small example with comments please ?
|
|||
25 Oct 2010, 09:58 |
|
shoorick 25 Oct 2010, 10:05
look there:
http://board.flatassembler.net/topic.php?t=6663 it's not a small example, but command line parsing is in separate inc there +++++++++++++++++++++++ look at simplified version in attach. try to run it with any parameters
Last edited by shoorick on 25 Oct 2010, 10:26; edited 1 time in total |
|||||||||||
25 Oct 2010, 10:05 |
|
Overflowz 25 Oct 2010, 10:26
shoorick, thanks but thats hard for me too..... can't someone just type smallest example as posible please ? cause I dont understand when you're making macro "GeParameter" and things like that.. just only small piece of code from there so I can learn that..
|
|||
25 Oct 2010, 10:26 |
|
sinsi 25 Oct 2010, 11:02
Small piece of code
Code: argc dd argv dd ... invoke GetCommandLineW invoke CommandLineToArgvW,eax,argc mov [argv],eax argc = count (should be at least 1) argv = pointer to a list of pointers to each param (unicode), param0 = exe's name Strips quote chars for each param. Only works for NT-based OSs, not 9x. |
|||
25 Oct 2010, 11:02 |
|
Overflowz 25 Oct 2010, 11:31
Sorry all. just was my mistake.. shell32.inc doesn't import CommandLineToArgvW and added in include but had mistake, I've added this line and fixed now..
"CommandLineToArgvW,'CommandLineArgvW'" < just missed "To".. I'll try now learn things. Thanks 4 all |
|||
25 Oct 2010, 11:31 |
|
Overflowz 25 Oct 2010, 11:56
ehh.. another question.. here's my code but I dont understand nothing from here:
Code: format PE console 4.0 include 'WIN32AX.INC' entry main section '.data' data readable writeable buffer rb 20 argc dd ? argv dd ? section '.text' code readable executable proc main invoke GetCommandLine invoke CommandLineToArgvW,eax,argc mov [argv],eax invoke printf,argv invoke printf,argc invoke ExitProcess,0 endp section '.idata' import data readable library kernel32,'kernel32.dll',msvcrt,'msvcrt.dll',shell32,'shell32.dll' include 'API\KERNEL32.INC' include 'API\SHELL32.INC' import msvcrt,printf,'printf' printf shows nothing strange things.. can someone fix my code ? |
|||
25 Oct 2010, 11:56 |
|
mindcooler 25 Oct 2010, 12:10
cinvoke for printf
|
|||
25 Oct 2010, 12:10 |
|
revolution 25 Oct 2010, 12:17
Overflowz: printf needs more than one parameter.
BTW: The first result from Google for "printf" is the place to start. |
|||
25 Oct 2010, 12:17 |
|
sinsi 25 Oct 2010, 12:28
win32ax.inc will give you the ansi version of GetCommandLine, sending that to CommandLineToArgvW won't work.
Here is the original code I wrote, but it's masm syntax. Easy to convert. |
|||
25 Oct 2010, 12:28 |
|
Overflowz 25 Oct 2010, 14:26
mindcooler, never mind I'm destroying stacks no point from that.
revolution, I've also tried printf,'%s',buffer.. %s %d %u %x etc etc but nothing from there was valid. sinsi, same problem and I don't understand what's problem.. Code: format PE console 4.0 include 'WIN32A.INC' entry main section '.data' data readable writeable CR equ 0Dh LF equ 0Ah buffer rb 20 argc dd ? argv dd ? env dd ? section '.text' code readable executable proc main invoke GetCommandLine invoke CommandLineToArgvW,eax,argc mov [argv],eax mov edi,eax mov ebx,argc invoke printf,'%s',argv,CR,LF invoke printf,argc invoke ExitProcess,0 endp section '.idata' import data readable library user32,'user32.dll',kernel32,'kernel32.dll',msvcrt,'msvcrt.dll',shell32,'shell32.dll' include 'API\USER32.INC' include 'API\KERNEL32.INC' include 'API\SHELL32.INC' import msvcrt,printf,'printf' |
|||
25 Oct 2010, 14:26 |
|
revolution 25 Oct 2010, 14:28
Code: cinvoke printf,<'%d',13,10>,[argv] |
|||
25 Oct 2010, 14:28 |
|
f0dder 25 Oct 2010, 16:06
revolution wrote: Overflowz: printf needs more than one parameter. (If you only want to display a single string, you should use puts(), anyway). _________________ - carpe noctem |
|||
25 Oct 2010, 16:06 |
|
Overflowz 25 Oct 2010, 18:19
revolution, have you tested code ? cause I'm getting same problem. just weird simbols are displayed..
|
|||
25 Oct 2010, 18:19 |
|
mindcooler 25 Oct 2010, 20:10
Is printf utf-16?
CommandLineToArgvW _________________ This is a block of text that can be added to posts you make. |
|||
25 Oct 2010, 20:10 |
|
semiono 25 Oct 2010, 21:13
sinsi wrote: Small piece of code Hello! Please give me whole working src ? Code: include '%fasm%\win32wx.inc' section '.code' code executable start: invoke GetCommandLineW invoke CommandLineToArgW,eax,argc mov [argv],eax invoke wsprintf,z,'%s',[argv] invoke MessageBox,NULL,z,'',MB_OK exit: invoke ExitProcess,NULL section '.data' data readable writable argc dd ? argv dd ? z dd ? section '.idata' readable library kernel32,'KERNEL32.DLL',user32,'USER32.DLL' import kernel32,ExitProcess,'ExitProcess',wsprintf,'wsprintf' import user32,GetCommandLineW,'GetCommandLine',\ CommandLineToArgW,'CommandLineToArgW',MessageBox,'MessageBoxA' I use WinXP. This code cry error! _________________ Windows 9, FL Studio 19 |
|||
25 Oct 2010, 21:13 |
|
mindcooler 25 Oct 2010, 21:16
argc is not initialized
|
|||
25 Oct 2010, 21:16 |
|
semiono 25 Oct 2010, 21:22
fasm code? procedure? i not sure to understand...
Code: proc aa argc dd argv dd invoke GetCommandLineW invoke CommandLineToArgW,eax,argc mov [argv],eax invoke wsprintf,z,'%s',[argv] invoke MessageBox,NULL,z,'',MB_OK endp call [aa] ? |
|||
25 Oct 2010, 21:22 |
|
mindcooler 25 Oct 2010, 21:48
Sorry, I was mistaken
|
|||
25 Oct 2010, 21:48 |
|
Goto page Previous 1, 2, 3 Next < Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.