flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
pearlz 22 Oct 2010, 09:59
that's mean S=S1+S2 (S: String) as VB, C, ............ ?
|
|||
![]() |
|
Overflowz 22 Oct 2010, 10:01
Nope, lpBuffer = Current Path and szBuffer = Size of Path.
|
|||
![]() |
|
pearlz 22 Oct 2010, 10:06
Code: mov edi,szBuffer add edi,dword[lpBuffer] add edi,1 mov edi,'\' add edi mov edi,0 it's true? |
|||
![]() |
|
Overflowz 22 Oct 2010, 10:14
Nope.. Do you tested it before you post ? >.> Cause it doesn't work for me. and also "add edi" = syntax error. removed that and not working also. and why mov edi,szBuffer and then add edi,dword[lpbuffer] ? it should result for example size is 25, it will be 25C:\users... not the 25+C:\Users... and BTW It should be CHAR string for MessageBox API.
|
|||
![]() |
|
revolution 22 Oct 2010, 10:38
Try this:
Code: format PE GUI 4.0 include 'WIN32A.INC' entry main section '.data' data readable writeable lpBuffer rb 256 ;; szBuffer rb 256 ;not needed section '.text' code readable executable proc main invoke GetCurrentDirectory,256,lpBuffer mov ecx,-1 mov edi,lpBuffer xor al,al cld repne scasb not ecx dec ecx ;; mov dword[szBuffer],ecx ;not needed lea edi,[lpBuffer+ecx] mov al,5ch stosb mov al,0 ;null terminate stosb invoke MessageBox,0,lpBuffer,lpBuffer,MB_OK invoke ExitProcess,0 endp section '.idata' import data readable library user32,'user32.dll',kernel32,'kernel32.dll' include 'API\USER32.INC' include 'API\KERNEL32.INC' section '.reloc' fixups data discardable |
|||
![]() |
|
Overflowz 22 Oct 2010, 10:45
Worked Fine! Thank you! BTW I don't understand whats difference between LEA and MOV ? I can't understand on sites what difference is there.. can you tell me please ?
|
|||
![]() |
|
pearlz 22 Oct 2010, 10:47
my way!
Code: proc main invoke GetCurrentDirectory,256,lpBuffer mov esi,lpBuffer mov edi,szBuffer .count: lodsb stosb test al,al jnz .count sub esi,1 mov byte [esi],'\' add esi,1 mov byte[esi],0 invoke MessageBox,0,lpBuffer,szBuffer,MB_OK invoke ExitProcess,0 endp |
|||
![]() |
|
pearlz 22 Oct 2010, 10:50
that's true?
|
|||
![]() |
|
Overflowz 22 Oct 2010, 10:53
Yes it is. Thanks
![]() |
|||
![]() |
|
pearlz 22 Oct 2010, 10:53
if not copy
Code: format PE GUI 4.0 include 'WIN32A.INC' entry main section '.data' data readable writeable lpBuffer rb 256 section '.text' code readable executable proc main invoke GetCurrentDirectory,256,lpBuffer mov esi,lpBuffer .count: lodsb test al,al jnz .count sub esi,1 mov byte [esi],'\' add esi,1 mov byte[esi],0 invoke MessageBox,0,lpBuffer,lpBuffer,MB_OK invoke ExitProcess,0 endp section '.idata' import data readable library user32,'user32.dll',\ kernel32,'kernel32.dll' include 'API\USER32.INC' include 'API\KERNEL32.INC' section '.reloc' fixups data discardable |
|||
![]() |
|
Overflowz 22 Oct 2010, 10:56
Works fine. Thank you
![]() |
|||
![]() |
|
shoorick 22 Oct 2010, 10:57
lea lets to provide address calculation (sometimes used not only for address):
lea esi,[eax] = mov esi,eax lea esi,[eax + edx*4 + 5] has no mov equivalent if you have in ebx pointer to array of dwords and in ecx current element, you can load pointer to this element into esi with this way: lea esi,[ebx + ecx*4] ; (4 - size of dword, maximal multiplicator for lea is 8 ) -------------- btw, instruction mnemonics have sence. LEA means Load Effective Address. Last edited by shoorick on 22 Oct 2010, 11:00; edited 1 time in total |
|||
![]() |
|
pearlz 22 Oct 2010, 10:59
or
Code: sub esi,1 mov word[esi],0x005c |
|||
![]() |
|
Overflowz 22 Oct 2010, 11:03
shoorick, thanks that was pretty new good example for me.
pearlz, I understand other thanks ![]() |
|||
![]() |
|
baldr 22 Oct 2010, 13:13
Overflowz,
GetCurrentDirectory() returns number of characters (i.e. words for Unicode flavor) that are written to lpBuffer. Code: include "Win32WX.Inc"; Win32AX works too .code here: invoke GetCurrentDirectory, sizeof.buffer, buffer if 1=sizeof.TCHAR mov word [buffer+sizeof.TCHAR*eax], '\'; ANSI else mov dword [buffer+sizeof.TCHAR*eax], '\'; Unicode end if invoke MessageBox, HWND_DESKTOP, buffer, NULL, MB_OK ret .data sizeof.buffer = MAX_PATH buffer TCHAR sizeof.buffer dup ? .end here |
|||
![]() |
|
Overflowz 22 Oct 2010, 20:21
hmm interesting but thats not for me..
![]() ![]() |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.