flat assembler
Message board for the users of flat assembler.
Index
> Windows > Help, problems with stings |
Author |
|
||CyrUS|| 02 Apr 2006, 14:21
Quote:
I just want to do a string with 16 chars and to put for example: AA until the lenght of this string his 16. |
|||
02 Apr 2006, 14:21 |
|
||CyrUS|| 02 Apr 2006, 15:17
ok I've found but there is an other problem :
Code: format PE GUI 4.0 entry start include 'win32a.inc' section '.data' data readable writable IDC_EDIT1 = 1000 name db 40 strtemp db 16,0 serial db 17,0 StrToGen db '_r <()<1-Z2[l5,^',0 section '.code' code readable executable start: invoke GetModuleHandle,0 invoke DialogBoxParam,eax,101,HWND_DESKTOP,DialogProc,0 or eax,eax jz exit exit: invoke ExitProcess,0 proc DialogProc hwnddlg,msg,wparam,lparam push ebx esi edi cmp [msg],WM_INITDIALOG je wminitdialog cmp [msg],WM_COMMAND je wmcommand cmp [msg],WM_CLOSE je wmclose xor eax,eax jmp finish wminitdialog: jmp processed wmcommand: cmp [wparam],BN_CLICKED shl 16 + IDCANCEL je wmclose cmp [wparam],BN_CLICKED shl 16 + IDOK jne processed invoke GetDlgItemText,[hwnddlg],IDC_EDIT1,name,16 mov ecx,eax mov ebx,ecx xor esi,esi loop0: dec ecx cmp ecx,0 jnz loop0 loop1: mov al,[name+ecx] mov byte [strtemp+esi],al cmp ecx,ebx inc ecx ja loop0 inc esi cmp esi,17 jnz loop1 xor eax,eax xor ecx,ecx xor ebx,ebx xor esi,esi xor edx,edx mov ebx,19h loopsr: mov al,[strtemp+ecx] mov dl,[StrToGen+ecx] ; doesn't move strtogen it moves strtemp. xor al,dl IDIV ebx add al,41 mov [serial+ecx],al inc ecx cmp ecx,17 jnz loopsr invoke MessageBox,HWND_DESKTOP,serial,serial,MB_OK jmp processed wmclose: invoke EndDialog,[hwnddlg],0 processed: mov eax,1 finish: pop edi esi ebx ret endp section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetModuleHandle,'GetModuleHandleA',\ ExitProcess,'ExitProcess',\ CreateFile,'CreateFileA',\ WriteFile,'WriteFile',\ CloseHandle,'CloseHandle' import user,\ DialogBoxParam,'DialogBoxParamA',\ EndDialog,'EndDialog',\ GetDlgItemText,'GetDlgItemTextA',\ MessageBox,'MessageBoxA' section '.rsrc' resource from 'C:\fasmw165\projects\falcon1\dlg.res' data readable |
|||
02 Apr 2006, 15:17 |
|
AsmER 02 Apr 2006, 15:29
If I understand you good, you should try:
Code: invoke GetDlgItemText,[hwnddlg],IDC_EDIT1,name,16 MOV EDI, EAX ; result of function call in EDI & EAX XOR ECX, ECX ; set ECX & ESI to zero XOR ESI, ESI Loop1: ;FIND THE END OF RETUNED STRING CMP BYTE [ECX+EDI], 0h JE Loop2 ; if('ret_str'[ecx] == 0) goto Loop2 INC ECX ; ECX++ // increase index JMP Loop1 ;repeat Loop2: ;ADD OTHER STRING TO STRING RETURNED BY GetDlgItemText CMP ECX, 10h ;IF LETTERS COUNT IS EQUAL 16? JE End_Loop2 ; goto End_Loop2 MOV AL, BYTE [String+ESI] ;else AL = String[ESI]; MOV BYTE [ECX+EDI], AL ;ret_str[EDI] = AL INC ESI ;ESI++ //increase index of String INC ECX ;ECX++ //increase index of 'ret_str' JMP Loop2 ; repeat End_Loop2: ; Finished I hope it helped |
|||
02 Apr 2006, 15:29 |
|
UCM 03 Apr 2006, 22:33
You could just use the lstrcat API call (its in kernel32.dll), considering you're using Windows.
P.S. It is not a C call!!!!!! |
|||
03 Apr 2006, 22:33 |
|
vid 03 Apr 2006, 23:46
UCM: well, it is C call adopted by windoze too. i believe you can find it in msvcrt.dll too.
|
|||
03 Apr 2006, 23:46 |
|
OzzY 03 Apr 2006, 23:53
lstrcat is from kernel32.dll
strcat is from msvcrt.dll both work in the same way, but I think lstrcat is faster, 'coz strcat would be calling it anyway, I don't know... |
|||
03 Apr 2006, 23:53 |
|
RedGhost 04 Apr 2006, 05:44
if you have a problem with stings, maybe you should stay away from scorpions (sorry )
_________________ redghost.ca |
|||
04 Apr 2006, 05:44 |
|
vid 04 Apr 2006, 07:10
Here I Am
Rock You Like Hurricane .... Babe, you 'r you'r Dynamiiiiiiiiiiiiiiite |
|||
04 Apr 2006, 07:10 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.