flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 07 Apr 2010, 17:42
Two options:
1. Edit include\api\shell32.inc 2. Create your own import table (add other commands as necessary): Code: section '.idata' import data readable dd 0,0,0,RVA shell_name,RVA shell_table dd 0,0,0,0,0 shell_table: CommandLineToArgvW dd RVA _CommandLineToArgvW dd 0 shell_name db 'SHELL32.DLL',0 _CommandLineToArgvW db 0,0,'CommandLineToArgvW',0 |
|||
![]() |
|
LocoDelAssembly 07 Apr 2010, 19:22
3. Create your own import table (add other commands as necessary), but easier
![]() Code: section '.idata' import data readable library kernel32, 'KERNEL32.dll',\ ; Add other libraries here shell32,'SHELL32.DLL' ; Include the headers of the libraries you are not adding new functions include 'api/kernel32.inc' import shell32,\ CommandLineToArgvW, 'CommandLineToArgvW' BTW, in both, revolution's version and mine, don't use ".end start", use "entry start" instead, because otherwise the import table will be attempted to be build twice. |
|||
![]() |
|
revolution 08 Apr 2010, 02:50
I imagine the reason that CommandLineToArgvW is not listed is because it is not present in Win95. Although, surprisingly, is was part of Win32s.
Anyhow, by using CommandLineToArgvW you also limit the number Windows systems that can run your code. Maybe this is not an issue for you, maybe it is, but it is something to consider. |
|||
![]() |
|
mindcooler 08 Apr 2010, 10:16
This was kind of a downer; do the first one and you contaminate the "standard library", do the other you lose the functionality of the "standard library" altogether.
I don't care about win9x that much, but it seems like an awful lot of hassle to add the entry, more than writing my own function. Oh well. |
|||
![]() |
|
mindcooler 08 Apr 2010, 10:38
Before I run off making an ascii/utf-16 command line slicer, perhaps I should ask how you are doing it. Is there any other WINAPI call that I can use? If not, any hints on making a macro that takes either one- or two-byte strings depending on the header you're using?
|
|||
![]() |
|
bitRAKE 11 Apr 2010, 22:40
Just patch the includes and make note of the dependency within your project. Only a single line needs to be added to .\FASM\INCLUDE\API\SHELL32.INC -- there are even programs on the board to generate the API include file for any DLL. The structure of the "standard library" facilitates augmentation, imho. There are also many examples of other Windows API support macros in the macro section of the board.
|
|||
![]() |
|
mindcooler 12 Apr 2010, 18:57
I realised I only needed one parameter, while it would have been nice to have, it would have been overkill.
I came up with this, works on a pointer from GetCommandLineW: Code: GetParameter: ;eax cmp word [eax],'"' je .quote cmp word [eax],0 je .out .nqloop: cmp word [eax],' ' je .lastspace inc eax inc eax jmp .nqloop .quote: inc eax inc eax cmp word [eax],'"' jne .quote .lastspace: inc eax inc eax cmp word [eax],' ' jne .out inc eax inc eax .out: ret Any magic way to make this work when sizeof.TCHAR = 1? _________________ This is a block of text that can be added to posts you make. |
|||
![]() |
|
baldr 13 Apr 2010, 10:40
mindcooler,
I've posted kind of solution to the importing problem here. TCHAR equ word, cmp TCHAR [eax], ' ' and add eax, sizeof.TCHAR probably can fit the bill. |
|||
![]() |
|
mindcooler 13 Apr 2010, 11:30
That's some voodoo alright, but I hope TG catches on the idea of being able to easily extend the import tables.
That looks that something I thought of, but I didn't get it to work. I gave up the idea of one-byters as I found more w2k+ calls that I want to use, such as VirtualAlloc. |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.