0

How can I explicitly link to a .sys file on windows? MSDN says you can use the LoadLibrary() and the GetProcAddress() functions to basically explicitly link and access members of a dll. I can successfully use this to at least get a handle for an associated dll however when I try them with a .lib or a .sys they do not work or they return null. I can understand that it would not work with .lib maybe (even though it says library in the name) but I had read that .sys files were usually dlls.

if (0 == LoadLibraryA("videoprt.sys"))
{
    printf("goodbye");
} 

This will compile but the address returned will be zero for the .sys file, if I use a more typical windows dll it does not return zero. How do I link a .sys file so that I can access exported functions?

Kevin
  • 16,696
  • 7
  • 51
  • 68
marshal craft
  • 439
  • 5
  • 18
  • Purpose of a sys file is to hold some pre-defined routines for controlling a Hardware device. It is intended to be loaded/unloaded by Windows OS and not by any user program. – MNS Dec 04 '14 at 04:56
  • Thank you. So basically the sys file is sealed even though msdn says it may export certain functions, this is a different use of the word export different from dll. Basically when a driver exports a function it would be by irp or something but not by simple dll's unless stated? Is this how it works or still am i off? I know drivers have to be able to communicate and export functions to each other so I need to use a driver or a user interface if available? I know plug n play and the os is I think responsible for initially starting the display miniport and video port pair, but I should be ... – marshal craft Dec 04 '14 at 05:21
  • able to interact with the hardware some how, no? Does Microsoft Windows remove all interaction with hardware? How do people develop additional hardware and software if all this is locked by the os? Could I in theory write a driver to interact with the respective drivers and take requests from user api's or drivers? – marshal craft Dec 04 '14 at 05:27
  • I think i need a Driver_Object which is a structure that contains pointers to the drivers functions with which are accessed by irp's managed by the os's i/o manager? – marshal craft Dec 05 '14 at 21:39
  • any idea how i get the driver's name or a pointer to it's driver object struct? – marshal craft Dec 05 '14 at 21:40
  • yeah after further reading, .sys files or kernal mode drivers have to interact sometimes in ways not controlled by the os with irp's. it is possible and normal to link to .sys files the same as dll's so how to do it? – marshal craft Jan 02 '15 at 05:26

0 Answers0