flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
asmrox 06 Mar 2008, 00:04
i always use this in dll:
entry $ pushad code... popad retn 12 |
|||
![]() |
|
AlexP 06 Mar 2008, 00:08
? pushad? i'll check...
|
|||
![]() |
|
Goplat 06 Mar 2008, 01:23
AlexP wrote: That was Windows Vista Kernel32 code that calls the entry point in a DLL, I had never seen it before... I studied why it faulted (esp contained value 0x100), and noticed that the person who coded this apparently stored the stack register in esi, then restored it when the code returned. Don't rely on this wrapper staying the same or even existing at all in the future; Microsoft doesn't care about backwards compatibility anywhere near as much as they used to (as you have surely seen if you're using Vista). To be safe, just follow the standard calling conventions. Quote: So in a DLL entry, you can modify and mess with the stack and esp register as much as you want, but if you modify esi the code will fault. asmrox wrote: i always use this in dll: |
|||
![]() |
|
AlexP 06 Mar 2008, 03:53
Quote: With this code, you're just returning whatever was already in EAX, which could possibly be 0. So the correct procedure is to place a value other than 0 into eax before returning. Very well written, I will be sure to remember that point in the future. |
|||
![]() |
|
revolution 06 Mar 2008, 04:22
It's in the doc's.
SDK - DllEntryPoint wrote: Return Values Do you have the SDK? If not it is available online at MSDN for anyone wishing to read it. |
|||
![]() |
|
AlexP 06 Mar 2008, 04:28
Which SDK are you referring to? The driver SDK? Or do you mean the online documentation?
|
|||
![]() |
|
revolution 06 Mar 2008, 04:30
Platform SDK. It is available online for free, it has also been posted for download on the flatassembler.net website.
|
|||
![]() |
|
AlexP 06 Mar 2008, 04:31
I've been looking around microsft download, it's nowhere!!! I can't find it in FASM site.
|
|||
![]() |
|
asmrox 06 Mar 2008, 15:18
adding
xor eax,eax inc eax will fix it? |
|||
![]() |
|
revolution 06 Mar 2008, 15:22
AlexP wrote: I've been looking around microsft download, it's nowhere!!! I can't find it in FASM site. ![]() But the MSDN online version is always the most up-to-date anyway. |
|||
![]() |
|
revolution 06 Mar 2008, 15:24
asmrox wrote: adding |
|||
![]() |
|
dap 06 Mar 2008, 16:03
Goplat wrote: This code is to compensate for the fact that some broken DLLs return from their entry function with plain "ret" instead of the required "ret 12". An interesting article BTW : http://blogs.msdn.com/oldnewthing/archive/2004/01/15/58973.aspx |
|||
![]() |
|
AlexP 06 Mar 2008, 21:45
hmm... I'll continue using the online MSDN, but I've found a new version of the SDK for "windows server 2008". I'll try it, just selected the options for only "Win32 examples" and "Win32 documentation".
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.