flat assembler
Message board for the users of flat assembler.
Index
> Windows > Funny thing about DLL code |
Author |
|
asmrox 06 Mar 2008, 00:04
i always use this in dll:
entry $ pushad code... popad retn 12 |
|||
06 Mar 2008, 00:04 |
|
AlexP 06 Mar 2008, 00:08
? pushad? i'll check...
|
|||
06 Mar 2008, 00:08 |
|
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: |
|||
06 Mar 2008, 01:23 |
|
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. |
|||
06 Mar 2008, 03:53 |
|
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. |
|||
06 Mar 2008, 04:22 |
|
AlexP 06 Mar 2008, 04:28
Which SDK are you referring to? The driver SDK? Or do you mean the online documentation?
|
|||
06 Mar 2008, 04:28 |
|
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.
|
|||
06 Mar 2008, 04:30 |
|
AlexP 06 Mar 2008, 04:31
I've been looking around microsft download, it's nowhere!!! I can't find it in FASM site.
|
|||
06 Mar 2008, 04:31 |
|
asmrox 06 Mar 2008, 15:18
adding
xor eax,eax inc eax will fix it? |
|||
06 Mar 2008, 15:18 |
|
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. |
|||
06 Mar 2008, 15:22 |
|
revolution 06 Mar 2008, 15:24
asmrox wrote: adding |
|||
06 Mar 2008, 15:24 |
|
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 |
|||
06 Mar 2008, 16:03 |
|
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".
|
|||
06 Mar 2008, 21:45 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.