Posted February 26, 200718 yr Chars from 3 input strings are XOR'ed in loop for make serialBefore loop again: AL contains part of serial. This is format to string in calls (see below for code)This string is same as hex value in ALExample: values for AL 42 3D 58 6C 19 44 75 5A make serial: 423D586C1944755AHow write serial in serialbox??? I try all day with SetDlgItemText, wsprintf, SetWindowTextA, SetDlgItemIntNot is possible??? I go throw PC out of windowFor complete, here is important from end of reg code: xor esi,esi@@: mov cl,byte ptr ds:[esi+edx] ; char from string1 mov dl,byte ptr ds:[esi+eax] ; char from string2 mov al,byte ptr ds:[esi+ebx] ; char from string3 xor al,dl xor al,cl;next, AL format in string (example: AL == 3B --> format in string "3B") movsx ecx,al push ecx push dump_00501c50 push edx call #2818_?Format@CString@@QAAXPBDZZ ;<= prepare value in ECX (AL) push eax call #939_??YCString@@QAEABV0@ABV0@@Z ;<= output hex value as string inc esi cmp esi,8 jl @bLoop is 8 time. Serial is always 8 bytes --> 16 digitSomeone help with code for write hex values in AL in serial box as serial string.
February 27, 200718 yr Try this code - I haven't tested it but should be ok.data hexformat db '%02X',0 tempstring dd 0 genedserial db 32 dup(0).codemov byte ptr ds:[genedserial], 0 ; clear serial stringxor esi,esi@@: mov cl,byte ptr ds:[esi+edx] ; char from string1 mov dl,byte ptr ds:[esi+eax] ; char from string2 mov al,byte ptr ds:[esi+ebx] ; char from string3 xor al,dl xor al,cl;next, AL format in string (example: AL == 3B --> format in string "3B") movsx ecx,al ;push ecx ;push dump_00501c50 ;push edx ;call #2818_?Format@CString@@QAAXPBDZZ ;<= prepare value in ECX (AL) ;push eax ;call #939_??YCString@@QAEABV0@ABV0@@Z ;<= output hex value as stringpush esiinvoke wsprintf, addr tempstring, addr hexformat, ecx ; print the hex value to tempstringinvoke lstrcat, addr genedserial, addr tempstring ; concatenate tempstr with serialpop esi inc esi cmp esi,8 jl @bThen use SetDlgItemText or SetWindowTextA (depending on the type of dialog box) to output "genedserial" to the dialog box.BTW - what's the target?cheersZ Edited February 27, 200718 yr by Ziggy
February 27, 200718 yr Author Thank Ziggy. It work good.hexformat db '%02X',0I not know this. I try with %d and %ls and %lh and all from api help file but %02X not in api help file. Not work! Thank again.Target is MP3 Recorder 1.11
February 27, 200718 yr "%x" is for hex as "%s" is for string etc... are you sure thats not ducmented?
February 27, 200718 yr Author "%x" is for hex as "%s" is for string etc... are you sure thats not ducmented?Perhaps is documented but I not find.I look in api help file and find with wsprintf:c A single character. C A single character. d A signed decimal integer argument. This sequence is equivalent to the i sequence.hc, hC A single character. The wsprintf function ignores character arguments with a numeric value of zero. hs, hS A string. This sequence is always interpreted as type LPSTRi A signed decimal integer. This sequence is equivalent to the d sequence.lc, lC A single character. The wsprintf function ignores character arguments with a numeric value of zero.ld A long signed decimal integer. This sequence is equivalent to the li sequence.li A long signed decimal integer. This sequence is equivalent to the ld sequence.ls, lS A string. This sequence is always interpreted as type LPWSTRlu A long unsigned integer.lx, lX A long unsigned hexadecimal integer in lowercase or uppercase.s A string. S A string. u An unsigned integer argument.x, X An unsigned hexadecimal integer in lowercase or uppercase.No 02X is mention!I find another way: make 2 variabel from AL by split hex in 2 digits and add 30h if digit <Ah or add 37h if digit >9. Next concatenate in genedserial. Next use usual invoke SetDlgItemText,hWnd,IDC_SERIAL,addr genedserial. By this is difficult and ugly and long. Ziggy way is great and easy.Thank for help. PC not throw out of window (yet)
February 28, 200718 yr I think the format descriptors are described in the winapi help but you really need to play with them to understand how they all work. In this case '%02X' means % - start format descriptor 0 - insert leading zeros if necessary 2 - length of the digit string. If the number is less than 2 places the '0' above means there will be a leading 0 inserted X - uppercase hexadecimal characters. x means lower case. your PC should be safer now cheers Z
Create an account or sign in to comment