flat assembler
Message board for the users of flat assembler.
Index
> DOS > Environment variable not visible |
Author |
|
macomics 09 Jan 2023, 22:33
A semicolon is needed at the end. Without it, the latter value does not see
Code: set include=inc; fasm test.bat |
|||
09 Jan 2023, 22:33 |
|
Tomasz Grysztar 09 Jan 2023, 23:12
You can test the GetEnvironmentVariableA results with a small program like this:
Code: format PE console entry start section '.text' code readable executable start: push 0FFFFFFF5h ; STD_OUTPUT_HANDLE call [GetStdHandle] mov ebx,eax call [GetCommandLineA] mov esi,eax @@: lodsb test al,al jz fail cmp al,20h jne @b @@: lodsb cmp al,20h je @b dec esi push 1000h push buffer push esi call [GetEnvironmentVariableA] push 0 push tmp push eax push buffer push ebx call [WriteFile] fail: push 0 call [ExitProcess] display_string: ret section '.data' data readable writeable buffer rb 1000h tmp dd ? section '.idata' import data readable writeable dd 0,0,0,RVA kernel_name,RVA kernel_table dd 0,0,0,0,0 kernel_table: ExitProcess dd RVA _ExitProcess GetCommandLineA dd RVA _GetCommandLineA GetEnvironmentVariableA dd RVA _GetEnvironmentVariableA GetStdHandle dd RVA _GetStdHandle WriteFile dd RVA _WriteFile dd 0 kernel_name db 'KERNEL32.DLL',0 _ExitProcess dw 0 db 'ExitProcess',0 _GetCommandLineA dw 0 db 'GetCommandLineA',0 _GetEnvironmentVariableA dw 0 db 'GetEnvironmentVariableA',0 _GetStdHandle dw 0 db 'GetStdHandle',0 _WriteFile dw 0 db 'WriteFile',0 section '.reloc' fixups data readable discardable ; needed for Win32s Code: C:\ASM\HXRT217\BIN>set include=C:\INCLUDE C:\ASM\HXRT217\BIN>getenv include C:\ASM\HXRT217\BIN>getenv INCLUDE C:\INCLUDE |
|||
09 Jan 2023, 23:12 |
|
CandyMan 11 Jan 2023, 15:29
Now I will know to use capital letters.
Thanks Tomasz! I can always count on you to solve any problem. _________________ smaller is better |
|||
11 Jan 2023, 15:29 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.