flat assembler
Message board for the users of flat assembler.
Index
> Windows > DLLs less than 3K |
Author |
|
decard 21 Mar 2004, 07:19
You have to imort at least one function (I'm not sure but proably it has to be a function from kernel32.dll) in DLL under Win9x.
|
|||
21 Mar 2004, 07:19 |
|
iklin 21 Mar 2004, 07:48
Thanx, decard!
I tried and... voila! It's not necessarily from kernel32.dll. It may be any other. It only need to use this function somewhere in code. But it strange for me. Why I can't write dll without any Win functions? |
|||
21 Mar 2004, 07:48 |
|
decard 21 Mar 2004, 08:01
You have to use this function somewhere in your code because if you wont, it wont be actually imported (import macro imports only symbols that are used in source).
I also find this a bit strange. You have to use some function to make sure that kernel32.dll is mapped into the address space. (see this topic). regards |
|||
21 Mar 2004, 08:01 |
|
f0dder 22 Mar 2004, 10:09
Quote:
The requirement is actually that kernel32.dll must be present in your process address space, to work on all win32 versions. This can happen by importing a dll that imports a dll that imports a dll [...] that imports kernel32.dll . However, just importing any DLL is not enough - try importing only from a "dummy.dll" that doesn't import anything - your app will fail to load on a bunch of windows versions, and it will fail silently (at least on win2k. You click the exe, and nothing happens - no error message, nothing. No instructions in the exe will be executed.) It should be possible to have DLLs without any imports, as long as your main app imports from kernel32. I would suggest not depending on "this DLL imports from kernel32 so I'll just import from this and skip kernel32", to avoid problems - you might as well import kernel32.ExitProcess anyway. Of course for 4k or 64k demos, it's sorta acceptable to import gdi32.Arc as your only import, it will get kernel32 imported on all current win32 (that I know of), and it's a very short import string. The reason for the kernel32 stuff is that the initial thread in your process enters somewhere in kernel32, and your process entrypoint is called from this kernel32 function. Why no-imports works on XP is a bit weird, since the NT family has private DLL mappings. Perhaps some DLLs are force-loaded on XP? Play it safe, import+call kernel32.ExitProcess in your main app. |
|||
22 Mar 2004, 10:09 |
|
iklin 24 Mar 2004, 18:45
Thanx, decard! Thanx, f0dder!
As I see Win internals isn't clear enough for me... |
|||
24 Mar 2004, 18:45 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.