...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".
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
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
Here is the tweaked version that will handle bare file names as well.
Regards,
hutch@movsd.com
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
thumbs up, hutch!
(havent tested it, assume it works ^_^)
(havent tested it, assume it works ^_^)
thumbs down, hutch!
The last three lines aren't needed
Just take a look of my code
The last three lines aren't needed
Just take a look of my code
How about creating a LONG directory ?
Here is how to do it in C:
How much bytes in ASM ?
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 ?
Lingo,
interesting idea, when I have a bit more brain I will try and digest it.
Regards,
hutch@movsd.com
interesting idea, when I have a bit more brain I will try and digest it.
Regards,
hutch@movsd.com