Hi all,
I am working on something which uses the OpenFileDialog function. It says:
QuoteReturn Value
The return value in EAX is the offset of a dedicated 260 byte buffer for this procedure. If the user selects a file name it will be written to the buffer, if the user cancels the dialog, the first byte in the buffer is set to ascii zero.
That would mean that the value in EAX is a pointer to a buffer? Now, if I wanted to move, for example, the first character of that buffer (first byte) into another buffer, how would I do it? I'd assume with BYTE ptr but I can't get it to work (I keep getting errors).
Also then, how could I move the next character after that, and add it to the buffer again (without erasing the first character?).
Thanks in advance!
Hmm ok, I did it a messy way:
invoke lstrlen, pathpointer
mov ebx, eax
sub ebx, 9
invoke szLeft, pathpointer, ADDR pathbuffer, ebx
It works but there must be a better way of moving the first x amount of characters from one buffer to another!
I think this should work.
push esi
push edi
mov esi, src ; In your case pathpointer
mov edi, dst ; In your case OFFSET pathbuffer
; or if path buffer is LOCAL
; lea edi, pathbuffer
mov ecx, count ; In your case 9
rep movsb
pop edi
pop esi
Note that if you want to transfer DWORDs (for speed) shift the count down by 2 (add 3 to it first to round up), and use "rep movsd".
Mirno