btw, is there any reference of how to dynamically loading a function, is it the same method
used via MmGetSystemRoutineAddress() something like below ?
MmGetSystemRoutineAddress works only for ntos+hal library.
See FltGetRoutineAddress in MSDN (see WDK samples).
If you need find an exported function from other libraries (ndis.sys,
netio.sys, fwpkclnt.sys, …) you need to write your own implementation.
>If you need find an exported function from other libraries (ndis.sys,
netio.sys, fwpkclnt.sys, …) you need to write your own implementation.
Take a look the AuxKlib stuff for that.
mm
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Petr Kurtin
Sent: Monday, June 17, 2013 2:05 AM
To: Windows File Systems Devs Interest List
Subject: RE: [ntfsd] FltCreateFileEx() not in WXP FltMgr.lib ?
MmGetSystemRoutineAddress works only for ntos+hal library.
See FltGetRoutineAddress in MSDN (see WDK samples).
If you need find an exported function from other libraries (ndis.sys,
netio.sys, fwpkclnt.sys, …) you need to write your own implementation.
I have tried to compile at NTDDI_VERSION=0x05010300 and 0x05010400 under XP x86 compiler options and found out the FltGetRoutineAddress( “FltCreateFileEx” ) returned SUCCESS at DriverEntry:
.
.
. #if( NTDDI_VERSION <= NTDDI_WINXPSP4 )
g_ScannerData.FltCreateFileEx = (PFltCreateFileEx)FltGetRoutineAddress( “FltCreateFileEx” ); #endif // ( NTDDI_VERSION <= NTDDI_WINXPSP4 )
.
.
.
Its returned pointer is saved under g_ScannerData.FltCreateFileEx for later use in PreCreate() later such as:
.
.
.
if( g_ScannerData.FltCreateFileEx )
{
ntStatus = (*g_ScannerData.FltCreateFileEx)(FltObjects->Filter,
Data->Iopb->TargetInstance,
&h,
&pfo,
FILE_READ_ATTRIBUTES,
&oa,
&iob,
0,
FILE_ATTRIBUTE_NORMAL,
0,
FILE_OPEN,
FILE_DIRECTORY_FILE|FILE_COMPLETE_IF_OPLOCKED,
0,
0,
IO_IGNORE_SHARE_ACCESS_CHECK);
if( !NT_SUCCESS( ntStatus ) )
{
DbgPrint( “K> [PreCreate]…%ls”, L"ERROR" );
}
else
DbgPrint( “K> [PreCreate]…%ls”, L"OK" );
}
.
.
.
However, ntStatus above always returned ERROR.
Btw, I have referred to the WDK minispy source, above is the same method used according to
the WDK minispy.
…after some testing, I noticed is my fault that g_ScannerData.FltCreateFileEx() returned success only if the g_ScannerData.FltCreateFileEx() opening a directory, ERROR if it is a file.
I am not sure if this assumption is correct, but from the traced debug information, seems correct.
Please advise, if there is other reasons or suggestions.