hi
I'm new, this is my first post, hello to all
Sorry for my bad english, i do my best.
i have a problem with the linker.
With Fasm and format MS COFF, i use directive "extrn"
format MS COFF
extrn '_IoCreateDevice@28' as IoCreateDevice:dword
extrn '_ExFreePoolWithTag@8' as ExFreePoolWithTag:dword
extrn '_KeSetSystemAffinityThread@4' as KeSetSystemAffinityThread:dword
extrn '_KeRevertToUserAffinityThread@0' as KeRevertToUserAffinityThread:dword
.....
DriverEntry equ _DriverEntry@8
section '.main' code readable writeable executable notpageable
public DriverEntry
proc DriverEntry pDriverObject, usRegistryPath
.....
I create the file ".obj" with "FASM" and then, I link tis file ".obj" with a external "dll".
This, with the linker of PellesC.this is my file "make.bat"
@echo off
set PATH=c:\PellesC\bin;c:\TEST;c:\fasm\INCLUDE;c:\fasm\INCLUDE\API;c:\fasm\INCLUDE\DDK;
set LIB=C:\WinDDK\6001.18002\lib\wxp\i386;C:\PellesC\Lib\;C:\PellesC\Lib\Win\;..\..\LIBRARY\;
set name=complet_driver
if exist %name%.exe del %name%.exe
if exist %name%.obj del %name%.obj
echo ____________________________________
echo *
echo * COMPILATION WITH FASM.EXE (FASM 1.69.11)
echo *
echo ____________________________________
c:\fasm\fasm %name%.asm
echo ____________________________________
echo *
echo * LINK WITH POLINK (PellesC)
echo *
echo ____________________________________
\PellesC\bin\PoLink /SUBSYSTEM:NATIVE /DRIVER %name%.obj BeaEngine.lib ntoskrnl.lib hal.lib /OUT:toto.sys
rem if exist %name%.obj del %name%.obj
pause
This, to built a driver.
And there, I have a problem ! ... eg : the function "IoCompleteRequest". (but also other)
If I call this function in the function "DriverEntry", no problem.
The table of mapping address is present in memory, all is ok.
But if I use "IoCompleteRequest" in the function DispatchCreate (IRP_MJ_CREATE) ,
the address table is gone and I have a nice BSOD. (I checked this with Syser)
However, in my sections "code" and "data", I used the directive "notpageable".
I also use the function "MmLockPagableCode/DataSection. But no results.
Inside the function "DriverEntry", there is no problem.
But when I am inside the other functions of the driver, the table of addresses is gone
and I can't access any of my declared functions.
It seems that this table is in paged memory ... !
What should I do to make this table IAT stays locked permanently in memory, in non paged memory ?
How to declare it in the file "make.bat ?
I think it's the linker's job doing that.thank you.