flat assembler
Message board for the users of flat assembler.
Index
> Windows > Easy Question |
Author |
|
wanderer 26 Sep 2003, 20:19
Just place the following code after wsprintf call:
Code: mov edx, szSerial+4 mov eax, [edx] mov [edx+1], eax mov byte [edx], '-' _________________ Best regards, Antoch Victor |
|||
26 Sep 2003, 20:19 |
|
Alessio 26 Sep 2003, 20:32
Thank you,
but it display an X after the serial (1234-1234X) I think it came from fmt. |
|||
26 Sep 2003, 20:32 |
|
Tommy 26 Sep 2003, 20:41
You have to increase the size of the buffer to receive the formatted string from 8 to 9 bytes.
|
|||
26 Sep 2003, 20:41 |
|
Alessio 26 Sep 2003, 23:00
Ehm, I change from 8 to 7 'cause from 8 to 9 bytes the outputted string is 1234-1234X%
|
|||
26 Sep 2003, 23:00 |
|
wanderer 26 Sep 2003, 23:04
Sorry, I forgot to tell you how szSerial should be declared:
Code: szSerial rb 10
_________________ Best regards, Antoch Victor |
|||
26 Sep 2003, 23:04 |
|
Alessio 26 Sep 2003, 23:15
It (seems) to works
invoke GetVolumeInformation,0,0,0,ddSerial,0,0,0,0 invoke wsprintf,szSerial,fmt,[ddSerial] mov edx,szSerial+4 mov eax,[edx] mov [edx+1],eax mov byte[edx],'-' invoke MessageBox,0,szSerial,szCaption,MB_ICONQUESTION invoke ExitProcess,0 ddSerial dd 7 szSerial rb 7 fmt db '%X',0 szCaption db 'GetVolumeInformation',0 Thank you all. |
|||
26 Sep 2003, 23:15 |
|
wanderer 26 Sep 2003, 23:18
Well, but you should know, that this code overwrites the "%X" string.
_________________ Best regards, Antoch Victor |
|||
26 Sep 2003, 23:18 |
|
Alessio 26 Sep 2003, 23:31
Thank you again, I'm new to assembler and I don't understand this F***ING registers very well.
|
|||
26 Sep 2003, 23:31 |
|
wanderer 27 Sep 2003, 00:33
They are not hard to understand. What does my code is:
1. Get last 4 bytes of serial into eax 2. Place them 1 byte upper in memory 3. Place '-' on the 4th position of serial This means that string should be at least 10 bytes long: 8 bytes serial code, 1 byte '-', 1 byte terminating zero. The problems were because on the place of terminating zero there was beginning of string "%X". When you defined serial buffer 7 bytes long, the position of terminating zero of serial became equal with the position of terminating zero of "%X". That's all. _________________ Best regards, Antoch Victor |
|||
27 Sep 2003, 00:33 |
|
Tommy 27 Sep 2003, 06:50
.. Oh....10 bytes...sorry...
|
|||
27 Sep 2003, 06:50 |
|
wanderer 27 Sep 2003, 07:07
_________________ Best regards, Antoch Victor |
|||
27 Sep 2003, 07:07 |
|
Alessio 27 Sep 2003, 09:31
Thanks.
|
|||
27 Sep 2003, 09:31 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.