News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

How to use ExpandEnvironmentStringsA in NASM ?

Started by hpuser, December 25, 2012, 10:14:58 PM

Previous topic - Next topic

hpuser

Hello all,

i need to use the function ExpandEnvironmentStringsA in nasm to use shourtcuts such as %appdata% and %tmp% .. etc.

i tried an example on the internet but it wont running and give errors, i think the problem with parameters.

can i find complete illustrated example about using this function...

thanks alot !

jj2007

Post the code that throws errors, and the errors themselves, and we'll see if we can help you.

dedndave

pretty simple function
more than likely, the destination buffer is too small
the return value tells you the size of the required buffer

hpuser

   jmp GetFilePAth         
FilePAthReturn:           
    pop ecx 
             
   xor Eax,Eax             
   Push Eax
   Push ebx
   Push ecx
   ;Call ExpandEnvironmentStringsA
   call [ebp+0x10]

GetFilePAth:
    call FilePAthReturn
    db "%appdata%\xxx.xx"     
    db 0x00   

this is code don't work correctly

thanks alot !

jj2007

That it doesn't work is a big surprise indeed :eusa_boohoo:

;Call ExpandEnvironmentStringsA
   call [ebp+0x10]

What is that, an attempt to cheat the AV brigade?

GetFilePAth:
What's your error message on that, "symbol not found"?

    call FilePAthReturn
    db "%appdata%\xxx.xx"

So Nasm knows by some magic that these two lines are in different segments?
Where did you copy that code from? Or do you pretend it's your own, and you understand what you are doing??