News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

Segments and import/export tables in a DLL

Started by duebel13, March 23, 2006, 09:46:18 AM

Previous topic - Next topic

duebel13

Hi,

I've searched the forum but found nothing so bear with me if the following questions have already been answered.

Looking at the PE Header in Windows 2000 SP4 sfcfiles.dll, I noticed that there is no .rdata section. Both the import and the export table are located in the .text segement. Also there are no imports from kernel32.dll, just from ntdll.dll.

How do I have to modify the DLL template and/or makeit.bat file which masm32 editor generates, so that the above behavior is enforced (wether it makes sense or not). To be more precise, how do I force export and import table to the code segment? How do I prevent a DLL from importing from kernel32.dll?

Thanks.

Regards,
Martin

asmfan

try to use /SECTION option in Link.exe to merge 2/more sections with the specified attributes in one.
Russia is a weird place

duebel13

Quote from: asmfan on March 23, 2006, 09:58:14 AM
try to use /SECTION option in Link.exe to merge 2/more sections with the specified attributes in one.

Thank you for pointing me to link.exe options. /merge:.rdata=.text is the answer to the first question.
I'd be happy to hear that the answer to the second question regarding kernel32 imports is simple as this one.

asmfan

of course it was /merge option (i not often use it)
the answer on the second question can be one of the follows
1. dont use APIs from others DLL
2. use runtime linking (you only import 2 functions - LoadLibrary, GetProcAddress from kernel32)
3. not allowed here unusual/uncommon ways not needed for programmers
P.S. if you use API funcs why dont you want just to import them?
Russia is a weird place