Skip to content

Commit

Permalink
Set current directory to that of launching exe
Browse files Browse the repository at this point in the history
The relative paths were not relative to the exe as originally claimed,
but towards current working directory - which caused problems with
things like desktop shortcuts. This is now fixed by simply setting
working directory where the exe lies in.
  • Loading branch information
1waP2toxuw committed Jul 17, 2017
1 parent 092919f commit 6c297ce
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions ChainDLL/loader.asm
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,32 @@ good:

chaindll_entry:
cld
sub esp, 1024
mov eax, esp
push 1024
push eax
push 0
call nn1
db "GetModuleFileNameA", 0
nn1: call getapi
call edi
lea esi, [esp+eax]
trim:
dec esi
cmp esi, esp
jle meh
cmp byte ptr [esi], '\'
jnz trim
mov byte ptr [esi], 0
push esp
call nn2
db "SetCurrentDirectoryA", 0
nn2: call getapi
call edi
meh:
add esp, 1024

call skip1
db "SetDllDirectoryA", 0
skip1:
Expand Down

0 comments on commit 6c297ce

Please sign in to comment.