the one in masm32.lib dosnt work when in loop such as process 32 first and next HELP?????!!!! :cry: :cry: :cry: :cry: :oops:
Posted on 2004-12-03 04:07:58 by Retsim_X
edit: sorry, wrong topic
Posted on 2004-12-03 04:26:12 by Scorpie


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
Posted on 2004-12-03 05:00:33 by Dom
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
Posted on 2004-12-03 07:56:20 by mark_larson
Thanx :lol: :-D
Posted on 2004-12-03 21:52:31 by Retsim_X
There's also PathFindFileName, in shwlapi.dll if I recall correctly.
Posted on 2004-12-04 11:37:21 by QvasiModo