flat assembler
Message board for the users of flat assembler.

Index > Windows > ShouldTheSetModulePath?

Author
Thread Post new topic Reply to topic
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 22 Apr 2009, 15:36
Code:
 ; MyModule.exe
include '%fasm%\win32ax.inc'

section '.code' code readable executable
start:
        invoke SetCurrentDirectory,lpPathName

        invoke CopyFile,lpExistingFileName,\
        lpNewFileName,TRUE
        invoke ExitProcess,0

section '.data' data readable writeable

        lpPathName db '%SystemRoot%\Apps\HprSnap',0 ; < problem!

        lpExistingFileName db 'HprSnap6.h',0
        lpNewFileName db 'HprSnap6.hs6lic',0

data import

        library kernel32,'KERNEL32.DLL'
        import kernel32,ExitProcess,'ExitProcess',\
        CopyFile,'CopyFileA',\
        SetCurrentDirectory,'SetCurrentDirectoryA'

end data
    


How can I do create module then start him from relative path.
It's need for software that maybe installed into unknown dir
and not reason to recompile it every time.

example
@start C:\Apps\HprSnap\MyModule.exe
@start D:\Program Files\HprSnap\MyModule.exe
etc...

_________________
Windows 9, FL Studio 19
Post 22 Apr 2009, 15:36
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19871
Location: In your JS exploiting you and your system
revolution 22 Apr 2009, 15:46
Maybe: GetCurrentDirectory - The GetCurrentDirectory function retrieves the current directory for the current process.
Post 22 Apr 2009, 15:46
View user's profile Send private message Visit poster's website Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 22 Apr 2009, 16:12
GetCurrentDirectory Function
lpBuffer [out]
...This null-terminated string specifies the absolute path to the current directory.

I don't need absolute! I need some like %1 or .\ not predefined path
(before I install it in different copy Windows or computers)
Maybe I don't understand this api some...

"..string specifies the" hm... It's returned for me?
Post 22 Apr 2009, 16:12
View user's profile Send private message Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 22 Apr 2009, 16:30
Code:
...
section '.code' code readable executable
start:
        invoke GetCurrentDirectory,\
        nBufferLength,\
        lpBuffer

        invoke CopyFile,nBufferLength + lpExistingFileName,\
        nBufferLength + lpNewFileName,TRUE
        invoke ExitProcess,0

section '.data' data readable writeable

        nBufferLength dw 255
        lpBuffer db ?

        lpExistingFileName db '\HprSnap6.h',0
        lpNewFileName db '\HprSnap6.hs6lic',0    

My lame code...
Very Happy Not valid


Last edited by semiono on 22 Apr 2009, 16:31; edited 1 time in total
Post 22 Apr 2009, 16:30
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19871
Location: In your JS exploiting you and your system
revolution 22 Apr 2009, 16:31
Do you want to convert %SystemRoot%? GetEnvironmentVariable?
Post 22 Apr 2009, 16:31
View user's profile Send private message Visit poster's website Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 22 Apr 2009, 16:32
Yes! I not sure... but it's idea!
Post 22 Apr 2009, 16:32
View user's profile Send private message Reply with quote
semiono



Joined: 31 Aug 2007
Posts: 184
Location: section '.code' executable
semiono 22 Apr 2009, 19:36
Imsorry. How can to append a Returns from
LPTCH WINAPI GetEnvironmentStrings(void);
to lpExistingFileName, and lpNewFileName ?
Where is result gets for asm? Is it in [eax] ?

It's could has not asm supported -
$var = GetEnvironmentStrings(void);

Very Happy
Post 22 Apr 2009, 19:36
View user's profile Send private message Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 19871
Location: In your JS exploiting you and your system
revolution 23 Apr 2009, 01:32
semiono wrote:
How can to append ...
lstrcat
Post 23 Apr 2009, 01:32
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.