...improbable string "\filename.exe",0.

Actually that isn't a very improbably string. I use paths like "\filename.txt" all the time when saving stuff in my editor. If you make a routine for getting at the filename of a path, you might as well make it work with "realistic input" instead of just claiming "this was made for full paths".
Posted on 2003-04-08 02:05:00 by f0dder
I don't see what the big deal is, John suggested a simple solution if you want it for both full paths and file names without paths. Just put a condition on the trailing INC EAX.

The untested INC EAX is only a problem with a bare file name as it increments past the last "\" location for the return address so it will handle \partial\file\names\fine.

Regards,

hutch@movsd.com
Posted on 2003-04-08 03:30:52 by hutch--
Here is the tweaked version that will handle bare file names as well.


FileFromPath2 proc lppath:DWORD

mov ecx, lppath
strt:
mov eax, ecx ; reset EAX to ECX
@@:
inc ecx
cmp BYTE PTR [ecx], "\" ; test if "\"
je strt ; jump to reset of EAX
cmp BYTE PTR [ecx], 0
jne @B ; exit on zero

cmp eax, lppath
je @F
inc eax ; inc EAX if "\" in string
@@:

ret

FileFromPath2 endp

Regards,

hutch@movsd.com
Posted on 2003-04-09 05:12:51 by hutch--
thumbs up, hutch!
(havent tested it, assume it works ^_^)
Posted on 2003-04-09 05:29:56 by f0dder
thumbs down, hutch!
The last three lines aren't needed
Just take a look of my code
Posted on 2003-04-09 07:21:18 by lingo12
How about creating a LONG directory ?
Here is how to do it in C:


char *p;
p = directory;
while (*p)
{
while (*p != '\\' && *p) p++;
if (!*p)
{
CreateDirectory(directory,NULL);
}
else
{
*p=0;
CreateDirectory(directory,NULL);
*p++ = '\\';
}
}


How much bytes in ASM ?
Posted on 2003-04-09 13:05:22 by MCoder
Lingo,

interesting idea, when I have a bit more brain I will try and digest it.

Regards,

hutch@movsd.com
Posted on 2003-04-09 20:33:17 by hutch--