I am experimenting with export drivers. I have set up my bus driver to
export a single dummy function, added DllInitialize and DllUnload
functions, exported them all in a .def file (DECLSPEC_EXPORT gave me a
compile error…) and then in the dependant driver declared the function
as DECLSPEC_IMPORT, and built the dependant driver against the .lib file
of the exporting driver. The compile works fine and the exporting driver
loads but the dependant driver never gets to its DriverEntry so I
suspect that Windows isn’t resolving the functions.
The exporting driver is a driver in its own right for a PCI device, but
according to the docs this shouldn’t present any problems.
Can anyone offer any hints as to what I might be missing?
Thanks
James
Link /dump /exports on the export driver
Link /dump /imports on the driver importing
And see if the names match
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of James Harper
Sent: Friday, March 11, 2011 5:41 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] driver depending on export driver won’t load
I am experimenting with export drivers. I have set up my bus driver to export a single dummy function, added DllInitialize and DllUnload functions, exported them all in a .def file (DECLSPEC_EXPORT gave me a compile error…) and then in the dependant driver declared the function as DECLSPEC_IMPORT, and built the dependant driver against the .lib file of the exporting driver. The compile works fine and the exporting driver loads but the dependant driver never gets to its DriverEntry so I suspect that Windows isn’t resolving the functions.
The exporting driver is a driver in its own right for a PCI device, but according to the docs this shouldn’t present any problems.
Can anyone offer any hints as to what I might be missing?
Thanks
James
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
Link /dump /exports on the export driver
Section contains the following exports for XENPCI.dll
00000000 characteristics
4D7AD6A5 time date stamp Sat Mar 12 13:12:53 2011
0.00 version
1 ordinal base
3 number of functions
3 number of names
ordinal hint RVA name
1 0 00003750 DllInitialize = _DllInitialize@0
2 1 00003780 DllUnload = _DllUnload@0
3 2 000037B0 XenTestExport = _XenTestExport@0
Link /dump /imports on the driver importing
XENPCI.dll
1E074 Import Address Table
204E4 Import Name Table
0 time date stamp
0 Index of first forwarder reference
2 XenTestExport
Does that look okay? Is the fact that it calls the file ‘XENPCI.dll’
when it is actually ‘xenpci.sys’ a problem?
Thanks
James
The .dll is probably the culprit. http://blogs.msdn.com/b/doronh/archive/2006/03/13/550844.aspx describes how to debug this at runtime. For instance for hidusb, the import resolution name is .sys
HIDCLASS.SYS
16000 Import Address Table
1B0D8 Import Name Table
0 time date stamp
0 Index of first forwarder reference
3 HidRegisterMinidriver
d
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of James Harper
Sent: Friday, March 11, 2011 6:19 PM
To: Windows System Software Devs Interest List
Subject: RE: [ntdev] driver depending on export driver won’t load
Link /dump /exports on the export driver
Section contains the following exports for XENPCI.dll
00000000 characteristics
4D7AD6A5 time date stamp Sat Mar 12 13:12:53 2011
0.00 version
1 ordinal base
3 number of functions
3 number of names
ordinal hint RVA name
1 0 00003750 DllInitialize = _DllInitialize@0
2 1 00003780 DllUnload = _DllUnload@0
3 2 000037B0 XenTestExport = _XenTestExport@0
Link /dump /imports on the driver importing
XENPCI.dll
1E074 Import Address Table
204E4 Import Name Table
0 time date stamp
0 Index of first forwarder reference
2 XenTestExport
Does that look okay? Is the fact that it calls the file ‘XENPCI.dll’
when it is actually ‘xenpci.sys’ a problem?
Thanks
James
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
>
Does that look okay? Is the fact that it calls the file ‘XENPCI.dll’
when it is actually ‘xenpci.sys’ a problem?
I think that was it afterall. My .def file was:
LIBRARY XENPCI
EXPORTS
DllInitialize PRIVATE
DllUnload PRIVATE
XenTestExport
And after changing it to :
LIBRARY XENPCI.SYS
EXPORTS
DllInitialize PRIVATE
DllUnload PRIVATE
XenTestExport
It is now working perfectly 
Thanks
James
James Harper wrote:
I am experimenting with export drivers. I have set up my bus driver to
export a single dummy function, added DllInitialize and DllUnload
functions, exported them all in a .def file (DECLSPEC_EXPORT gave me a
compile error…) and then in the dependant driver declared the function
as DECLSPEC_IMPORT, and built the dependant driver against the .lib file
of the exporting driver. The compile works fine and the exporting driver
loads but the dependant driver never gets to its DriverEntry so I
suspect that Windows isn’t resolving the functions.
How are you triggering the load of the importing driver?
Here’s an article I wrote on this topic:
http://www.wd-3.com/archive/KernelDlls.htm
Does that look okay? Is the fact that it calls the file ‘XENPCI.dll’
when it is actually ‘xenpci.sys’ a problem?
You can fix that using the NAME directive in your .def file.
–
Tim Roberts, xxxxx@probo.com
Providenza & Boekelheide, Inc.