the one in masm32.lib dosnt work when in loop such as process 32 first and next HELP?????!!!! :cry: :cry: :cry: :cry: :oops:
edit: sorry, wrong topic
ExtractShortFileName proc uses esi fnm:DWORD, incldir:DWORD
mov esi, fnm
invoke lstrlen, esi
add esi, eax
std
@@:
lodsb
.IF al == '\'
.IF incldir > 0h
dec incldir
.ELSE
add esi, 2d
jmp FoundBackslash
.ENDIF
.ENDIF
cmp esi, fnm
ja @b
FoundBackslash:
cld
mov eax, esi
ret
ExtractShortFileName endp
The Usage:
wholefile db 'D:\masm32\bin\file.asm', 0h
invoke ExtractShortFileName, addr wholefile, 0h
...gives a pointer to "file.asm"...
invoke ExtractShortFileName, addr wholefile, 1d
...gives a pointer to "bin\file.asm"...
feel free to re-write the procedure...
Dominik
this is the same thing as the strrchr() proceduce in VC. I use it for the same reason, for stripping off a filename from a fullpath.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strrchr.2c_.wcsrchr.2c_._mbsrchr.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt_strrchr.2c_.wcsrchr.2c_._mbsrchr.asp
Thanx :lol: :-D
There's also PathFindFileName, in shwlapi.dll if I recall correctly.