I am having trouble with the following script:
.386 .model flat, stdcall option casemap:none include \masm32\include\windows.inc include \masm32\include\kernel32.inc include \masm32\include\user32.inc includelib \masm32\lib\kernel32.lib includelib \masm32\lib\user32.lib ;adding all my libs .data nsv db "APPDATA", 0 ;i want to use this in getenv(); fnsv db 260 dUP(0) ; char fnsv; ffn db 260 dUP(0) ; char ffn; mbt db "Test", 0 tl db "getenv", 0 ;to call this later .code start: push offset nsv ;pushing APPDATA push 260 ;pushing the max size? 260 call tl ;calling getenv ;getenv("APPDATA") should be stored in eax now mov ffn, eax ;move the path into char ffn; invoke MessageBox, NULL, addr fnsv, addr mbt, MB_OK + MB_ICONINFORMATION ;show a msgbox displaying path invoke ExitProcess, NULL ;exit end start
I get these errors:
C:\Users\Canada FTW\Desktop\nsv.asm(26) : error A2024: invalid operand size for
C:\Users\Canada FTW\Desktop\nsv.asm(28) : error A2070: invalid instruction opera
I am new to mASM, so I am not really sure what the problem would be. I left a few notes so you guys could understand what I was doing. I am not really sure how to fix this, can you even call getenv in assembly? or would it be more difficult than this?
char *ffn = getenv("APPDATA"); but in massembly. This script was made from looking at the following script in ollydbg.
char *path = getenv("APPDATA");
Edited 7 Years Ago by scriptkiddy: n/a