flat assembler
Message board for the users of flat assembler.
Index
> Windows > GetCommandLineA problem |
Author |
|
revolution 19 Jul 2019, 12:10
There shouldn't be any difference.
Which debugger are you using? How are you starting the program for debugging? |
|||
19 Jul 2019, 12:10 |
|
int0x50 19 Jul 2019, 12:19
x64dbg.
|
|||
19 Jul 2019, 12:19 |
|
edfed 19 Jul 2019, 12:24
hum... maybe under the debugger you don't pass all the command line....
in cmd, you will pass the full command, including the executable name. in the debugger, it's maybe possible this token is not present. if it's that, the solution would be to ignore the first token only if it's equal the executable name. |
|||
19 Jul 2019, 12:24 |
|
revolution 19 Jul 2019, 13:14
You can do a comparison by simply printing the full string returned by GetCommandLineA and look for any differences.
|
|||
19 Jul 2019, 13:14 |
|
DimonSoft 19 Jul 2019, 14:15
Seems to be the case of which parameters CreateProcess ends up being passed by different means of running the program. Since you skip everything until the first space whenever command line parameters get passed through a separate parameter to CreateProcess the first space becomes the one after your 11111 parameter.
|
|||
19 Jul 2019, 14:15 |
|
bitRAKE 19 Jul 2019, 19:23
When I use x64dbg and change the commandline, it will provide the executable name as the first parameter by default - there is no need to leave it unchanged unless one wants the same effect of using the shell. The shell execution interface is a subset of what CreateProcess/x64dbg allows.
_________________ ¯\(°_o)/¯ “languages are not safe - uses can be” Bjarne Stroustrup |
|||
19 Jul 2019, 19:23 |
|
int0x50 20 Jul 2019, 03:45
cmd.exe adds extra space between the program name and the first argument. that's the reason my validation failed. The debugger does not do this, hence my validation worked.
Now whenever I run it in cmd.exe, I have to add ' inc esi '. Remark this line whenever I debug it. thank you all. |
|||
20 Jul 2019, 03:45 |
|
revolution 20 Jul 2019, 05:09
If the user types two or more spaces between arguments then it will fail also.
|
|||
20 Jul 2019, 05:09 |
|
int0x50 21 Jul 2019, 08:58
revolution, exactly. I am trying to figure out how to solve this problem. I think I have to traverse till i get a character.
|
|||
21 Jul 2019, 08:58 |
|
revolution 21 Jul 2019, 11:51
int0x50 wrote: I think I have to traverse till i get a character. You can make it a function call to make the code easier to understand. |
|||
21 Jul 2019, 11:51 |
|
Furs 22 Jul 2019, 11:49
You also need to handle quotes and stuff if you don't want to confuse the user, the "rules" are not that straightforward. Better use CommandLineToArgvW.
|
|||
22 Jul 2019, 11:49 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.