Log in

View Full Version : Asm function: Hex to Decimal ?


Clandestiny
November 4th, 2000, 14:42
Hi,

I am working on coding a key gen for Moving Pix now that I understand the algorithm. It is actually my *first* attempt at a Win32 asm program and I am outputting the key in a MessageBox. My keygen is actually working *beautifully* with one small problem...the output to my MessageBox is in hex and the output key needs to be in decimal. I have looked everywhere for some library function that would convert hex to decimal (with no success). I finally decided to write a function myself, but it is still outputting the results of all of my calculations in hex. The GetVolumeInformationA function returns the serial in hex and all I need to be able to do is convert it to decimal. Surely, this can't be very difficult. Are there any functions for this purpose ???

Thx,
Clandestiny

hz
November 4th, 2000, 15:27
hi,
As I recall, wsprintf will do it.
regards
hz

goatass
November 4th, 2000, 16:13
Here is what I use:

szKey db 13 dup(?)
eax = the hex value the program calculated

invoke dwtoa, eax, ADDR szKey

and then: invoke SetDlgItemText,hWnd,IDC_KEY,ADDR szKey
will put the decimal value into a text box.

goatass

ThRaX
November 4th, 2000, 19:05
dwtoa? what does that do? If that makes an ascii string out of a hex value like i think it does, that would have saved me a LONG time on my keygen...lol

goatass
November 4th, 2000, 19:23
dwtoa = DWord To Ascii (I think)


goatass

ThRaX
November 5th, 2000, 11:41
Hmmm...goatass, say that the dword was the hex value 4C12A145, right? than wouldnt dwtoa (dword to ascii) simply make the string "4C12A145"? There would have to be some intermediate step to convert 4C12A145 to its dec. equivilant, 1276289349....then, the string "1276289349" would be created...Or does the dwtoa function already cover that? (hex to dec, to the ascii string of the dec value)?

hz
November 5th, 2000, 12:02
hi,
yes dwtoa does handle the conversion as
does wsprintf which is more flexible, come on guys, you really should be testing these things out for yourself if you want to learn.

regards
hz