Log in

View Full Version : One final masm question about register parsing


kittmaster
March 17th, 2006, 09:56
I want to directly display the contents of a register EBX. My invoke strings keep converting it to decimal so I commented it out. That doesn't seem to work either, so I created a varialbe in the data section SzTemp and copied the EBX there to that variable. But that doesn't seem to keep the hex value correctly and corrupts it somehow.

The answer to the keygen is the hex value that is stored in the EBX, I need to get that data to my wsprintf invoking command. The screenshot shows all the iterations and none seem to work. With the addr decimalformat, that works, but is the wrong comparison because it wants to be in hex not decimal. I've search to keep try and convert the decimalformat command to hexidecimalformat, but there is not data on that either..........?????

Chris

http://www.kittmaster.com/vette/ScreenShot003.png

evlncrn8
March 17th, 2006, 10:20
paste the wsprintfa 'decimal format' bit...

should be something like
"%0Xh",00h

screenshots dont really help, try posting the code, that way people can work with it...(and see the whole thing)

blabberer
March 17th, 2006, 10:25
it seems stingduk answered your same question in rea forum with some crap code check it out and see if it is what you are looking for

kittmaster
March 17th, 2006, 11:11
Quote:
[Originally Posted by evlncrn8]paste the wsprintfa 'decimal format' bit...

should be something like
"%0Xh",00h

screenshots dont really help, try posting the code, that way people can work with it...(and see the whole thing)


I'm using Ziggy's keygen template. The routine is absolute when verification with olly is used. The final data string will be in ebx which needs to be displayed as the final key. Before I go any further: Thanks guys for the response......

Other than cosmetics, the only other thing I added was this to the data section:

Code:
szTemp db 100 dup(?) ; reserve 100 bytes of RAM


Code:
invoke lstrlenA, addr namebuffer
mov edx,eax
xor ecx,ecx
xor ebx,ebx
@keygenme_004010f0:
movzx eax,byte ptr ds:[ecx+namebuffer]
xor eax,031337h
add eax,0deadbeefh
imul eax,eax,0666h
sub eax,01badbab3h
shl eax,3
xor eax,0d34dd00dh
add ebx,eax
inc ecx
cmp edx,ecx
jnz @keygenme_004010f0

mov eax, ebx ; move correct serial to eax
;mov addr szTemp,eax ; move eax hex value to temp var; not working
invoke SetDlgItemTextA,handle,IDC_SERIAL, addr szTemp ; display serial

;invoke wsprintf, addr tempbuffer, addr decimalformat, ebx ; display serial
;invoke lstrcpyA, addr genedserial, addr fixedstring ; write "FIT-" or any other fixed constant within the serial base NOT REQUIRED to a buffer
;invoke lstrcatA, addr genedserial, addr tempbuffer ;merge fixed string to actual serial number
;invoke SetDlgItemTextA,handle,IDC_SERIAL, addr genedserial ; display serial
;invoke SetDlgItemTextA,handle,IDC_SERIAL,addr szEBX,addr ctrl_str,valEBX ; display serial
;invoke wsprintf,addr szEAX,addr ctrl_str,valEAX ;not working as desired
;invoke wsprintf,addr szEBX,addr ctrl_str,valEBX ;not working as desired
;invoke wsprintf,addr szECX,addr ctrl_str,valECX ;not working as desired
;invoke wsprintf,addr szEDX,addr ctrl_str,valEDX ;not working as desired

kittmaster
March 17th, 2006, 12:17
Quote:
[Originally Posted by evlncrn8]paste the wsprintfa 'decimal format' bit...

screenshots dont really help, try posting the code, that way people can work with it...(and see the whole thing)


This is what it was:
Code:
decimalformat db "%d",0


Quote:
should be something like
Code:
"%0Xh",00h


I found that this is almost right > it adds an h to the string value so I adjusted it like

should be something like
Code:
"%0X",00h



this is what nailed it. Should have realized that the call to the string is necessary and then needs a decision as to what TYPE of output it should be. So I've adjusted my models to include a program switch that will display both if needed.

Thanks for this...........Life saver!!

Chris