flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
Overflowz 17 Sep 2011, 12:37
because of EDX.
Quote: lpNumberOfBytesWritten [out, optional] It's pointer. try: Code: invoke WriteFile, [Handle], buf, eax, wbytes, NULL wbytes dd ? also, read this: Quote: This parameter can be NULL only when the lpOverlapped parameter is not NULL. You can also reserve some space and point EDX to it. |
|||
![]() |
|
tutenhamon 17 Sep 2011, 13:05
its 2 another problems
if i wrote Code: invoke WriteFile, [Handle], buf, eax, d, NULL d dd 0 Code: invoke ExitProcess, NULL was crashes and file "plik" was contain Code: 589841 865732571 -536840879 it is not today date |
|||
![]() |
|
revolution 17 Sep 2011, 13:17
The offsets wDay, wMonth and wYear are word values. You need to zero the high portion of the dword before passing to wsprintf.
Code: ;... movzx eax,[lpSystemTime.wDay] movzx ecx,[lpSystemTime.wMonth] movzx edx,[lpSystemTime.wYear] cinvoke wsprintf, buf, "%u %u %u", eax, ecx, edx |
|||
![]() |
|
Overflowz 17 Sep 2011, 13:40
here's working example.
Code: format pe console include 'win32ax.inc' .code start: invoke CreateFile, "plik", GENERIC_READ or GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL mov [Handle], eax invoke GetSystemTime, lpSystemTime cinvoke wsprintf, buf, "%u %u %u",dword[lpSystemTime.wDay],dword[lpSystemTime.wMonth],dword[lpSystemTime.wYear] invoke WriteFile, [Handle], buf, eax, d, NULL ; crashes at the moment invoke CloseHandle, [Handle] invoke ExitProcess, NULL .data lpSystemTime SYSTEMTIME Handle dd 0 buf rb 256 d dd ? .end start For me, DWORD values are not causing any fault so, if something will went wrong, use revolution's method. ![]() P.S you have lost stack control when was pushing word values in stack. That was the problem. P.P.S %i = signed and %u = unsigned. Time value can't be signed right ? ![]() |
|||
![]() |
|
revolution 17 Sep 2011, 14:09
Code: dword[lpSystemTime.wDay],dword[lpSystemTime.wMonth],dword[lpSystemTime.wYear] |
|||
![]() |
|
Overflowz 17 Sep 2011, 15:02
revolution
You're right. I don't knew that they were WORD sizes following each other.. ![]() |
|||
![]() |
|
tutenhamon 23 Sep 2011, 09:47
Thanks
last question: about '\n' in 2st parameter of wsprintf function? "%u %u %u\n" gives '23 9 2011\n' \n eqe 10,13 |
|||
![]() |
|
Overflowz 23 Sep 2011, 10:23
tutenhamon
try: Code: frmt db "%u %u %u",0x0d,0x0a ;0x0d,0x0a = \r\n ... cinvoke wsprint,buf,frmt,... >eqe you mean EQU ? |
|||
![]() |
|
tutenhamon 23 Sep 2011, 10:51
<"%u %u %u",0x0d,0x0a> as parameter ?
it's works but is another way? Overflowz wrote:
yes |
|||
![]() |
|
Overflowz 23 Sep 2011, 11:15
You're welcome.
about "%u %u %u 0x0d,0x0a" will point you to false positive, because \r\n is defined as variable, not character. <"..",0x0d,0x0a> will work fine. |
|||
![]() |
|
tutenhamon 23 Sep 2011, 11:36
\r\n implement to FASM preprocesor or INCLUDE files ?
it's suggestion |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.