Is there any api that can do the work?
Thank u~
Posted on 2004-07-28 10:01:11 by krakers
two buffers:



Buffer1 db "C:WINDOWSSYSTEMTEST.exe
Buffer2 dup 256 (?)

mov esi, offset Buffer 1
mov edi, offset Buffer2
.WHILE BYTE PTR [esi] != 0
.IF BYTE PTR [esi] == "\"
movsb
dec esi
.ENDIF
movsb
.ENDW
Posted on 2004-07-28 11:40:01 by JimmyClif
may i ask you why you want to do that?
Posted on 2004-07-29 03:42:16 by Mbee
i guess he wants to use some function from C lib, but path name he gets with help of API.
Posted on 2004-07-30 04:07:34 by happyfly
No, it sounds more like he wants to create a source file in a language where the double backslash is used. Functions in a C lib of course use the same representation of filenames as Windows, of course...

May I suggest this code:


mov esi,offset Buffer1
mov edi,offset Buffer2
again:
lodsb
cmp al,92
jnz nobackslash
stosb
nobackslash:
stosb
test al,al
jnz again
Posted on 2004-07-30 05:09:39 by Sephiroth3
i meant something like this printf("C:\WINDOWS\SYSTEM\TEST.exe
")
;)
Posted on 2004-07-30 05:30:05 by happyfly
Printf doesn't assign any special meaning to backslashes. The meaning of the backslashes is defined by the C programming language. The strings are not like that in the exe.
Posted on 2004-07-30 06:19:55 by Sephiroth3
hmm... you're right...
my fault...
int main(int argc, char* argv[])
{
printf("a\\c\\n");
return 0;
}

...
aABC db 'ac\',0Ah,0 ; DATA XREF: sub_401000+3o
...

00401000 sub_401000 proc near ; CODE XREF: start+AFp
00401000 push ebp
00401001 mov ebp, esp
00401003 push offset aABC ; "a\\c\\n"
00401008 call sub_401014
0040100D add esp, 4
00401010 xor eax, eax
00401012 pop ebp
00401013 retn
00401013 sub_401000 endp
Posted on 2004-07-30 11:29:46 by happyfly
indeed, and i expected that mistake, that's why i asked it ;)
Posted on 2004-07-31 03:34:22 by Mbee