Question

Recently I was trying to use W32pServiceTable in my driver. I did imported wink32.lib in SOURCES:

TARGETNAME=exp
TARGETTYPE=DRIVER
TARGETLIB=$(DDK_LIB_PATH)\win32k.lib
SOURCES=Experimental.cpp
MSC_WARNING_LEVEL=/W3

And I declare in source file:

extern PDWORD W32pServiceTable;

But I am getting symbol unresolved. I read, that only GDI drivers can use wink32.lib. But I am pretty sure that other drivers can also link to that library(but I dont know how). I would be very grateful if You could help.

Was it helpful?

Solution

This is true. Only GDI drivers can use win32k.sys, and vice versa - GDI drivers can be statically be linked only to win32k.sys.

The reason for this is that most of the Windows internals are loaded into the global memory space, whereas win32k.sys is loaded into the so-called "session space". Some info is here:

http://www.tar.hu/wininternals/ch07lev1sec4.html

In simple words - most of the windows components and drivers are loaded once for the whole system, whereas things like UI management, GDI and etc. - are loaded per session.

There's a tricky possibility during the runtime for GDI drivers to obtain pointers to ntoskrnl functions and use them, and vice versa - WDM drivers with some effort may use win32k functions (that will work for the 'current' session).

Anyway, why would you want to link to win32k? What functionality do you need?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top