Hi,
In order to create winlogon sessions I’ve implemented an RDS Protocol
Provider, which in turn requires input and display driver handles. For
the display driver I’ve taken the mirror driver sample from the
7600.16385.1 WDK. I modified the sample to only set the Remote Display
Driver functions[1] for the display driver .dll. (Display driver
functions at [DD], miniport driver functions at [MP])
When I start my on-demand driver service (using ‘net start’) it says
“System error 31 has occurred”. Tracing in windbg I see
VideoPortInitialize() returns STATUS_UNSUCCESSFUL (0xC0000001) in my
DriverEntry. Further stepping inside VideoPortInitialize I see
VIDEOPRT.SYS!VpGetFlags() failing[3].
Can you give any clues or suggestions on how I can find what the problem is?
Additional Info
Driver running on Win2012r2 in a VirtualBox VM on Win7 x64 host.
Driver is installed by right-clicking the .inf and choosing Install.
Driver is signed with self-signed cert, cert CA is added to system.
Bcdedit says testsigning is enabled.
Driver built on Win7 x64 host with the 7600 WDK, calling nmake directly.
Signing/inf/cat creation is my own, but roughly mirror what VS2013 or
2015 do if you create a Driver project (signtool on drivers, stampinf,
inf2cat, signtool on cat).
I noticed that the DriverEntry docs[2] say that HwVidQueryInterface is
required but the VIDEO_HW_INITIALIZATION_DATA docs[3] say it is
optional. I tried with and without but get the same error.
I manually signed/installed the stock mirror driver sample but get the
same error.
This is the first NT driver I’ve worked with; don’t be shy to insult my
intelligence with “obvious” suggestions.
Really appreciate any insight you have.
-Nathan
[1] Remote Display Drivers
https://docs.microsoft.com/en-us/windows-hardware/drivers/display/remote-display-drivers
[2] Video Miniport DriverEntry
https://msdn.microsoft.com/en-us/library/windows/hardware/ff556159(v=vs.85).aspx
[3] VIDEO_HW_INITIALIZATION_DATA
https://msdn.microsoft.com/en-us/library/windows/hardware/ff570505(v=vs.85).aspx
[4] Windbg stepping:
VIDEOPRT!pMiniportInit+0x8a:
fffff800cd00a9ba e845dfffff call VIDEOPRT!VpGetFlags (fffff800
cd008904)
kd> p
VIDEOPRT!pMiniportInit+0x8f:
fffff800cd00a9bf 85c0 test eax,eax kd\> p VIDEOPRT!pMiniportInit+0x91: fffff800
cd00a9c1 790a jns VIDEOPRT!pMiniportInit+0x9d
(fffff800cd00a9cd) kd\> p VIDEOPRT!pMiniportInit+0x93: fffff800
cd00a9c3 b8010000c0 mov eax,0C0000001h
[DD] Display driver functions
static DRVFN gadrvfn =
{
// A Remote Display Driver requires these and only these
//
https://docs.microsoft.com/en-us/windows-hardware/drivers/display/remote-display-drivers
{ INDEX_DrvAssertMode, (PFN) DrvAssertMode },
{ INDEX_DrvBitBlt, (PFN) DrvBitBlt },
{ INDEX_DrvCompletePDEV, (PFN) DrvCompletePDEV },
{ INDEX_DrvCopyBits, (PFN) DrvCopyBits },
{ INDEX_DrvDisableDriver, (PFN) DrvDisableDriver },
{ INDEX_DrvDisablePDEV, (PFN) DrvDisablePDEV },
{ INDEX_DrvDisableSurface, (PFN) DrvDisableSurface },
{ INDEX_DrvEnablePDEV, (PFN) DrvEnablePDEV },
{ INDEX_DrvEnableSurface, (PFN) DrvEnableSurface },
{ INDEX_DrvEscape, (PFN) DrvEscape },
{ INDEX_DrvGetModes, (PFN) DrvGetModes },
{ INDEX_DrvMovePointer, (PFN) DrvMovePointer },
{ INDEX_DrvResetPDEV, (PFN) DrvResetPDEV },
{ INDEX_DrvSetPointerShape, (PFN) DrvSetPointerShape },
};
[MP] Miniport driver entry:
ULONG DriverEntry (PVOID Context1, PVOID Context2)
{
VIDEO_HW_INITIALIZATION_DATA hwInitData;
ULONG status;
VideoDebugPrint((0, “MYVIDEOMP: [Driver Entry]\n”));
VideoPortZeroMemory(&hwInitData, sizeof(VIDEO_HW_INITIALIZATION_DATA));
hwInitData.HwInitDataSize = sizeof(VIDEO_HW_INITIALIZATION_DATA);
hwInitData.HwFindAdapter = &MirrorFindAdapter;
hwInitData.HwInitialize = &MirrorInitialize;
hwInitData.HwStartIO = &MirrorStartIO;
hwInitData.HwResetHw = &MirrorResetHW;
hwInitData.HwInterrupt = &MirrorVidInterrupt;
hwInitData.HwGetPowerState = &MirrorGetPowerState;
hwInitData.HwSetPowerState = &MirrorSetPowerState;
hwInitData.HwGetVideoChildDescriptor = &MirrorGetChildDescriptor;
hwInitData.HwQueryInterface = &MirrorVidQueryInterface;
status = VideoPortInitialize(Context1, Context2, &hwInitData, NULL);
VideoDebugPrint((0, “MYVIDEOMP: VideoPortInitialize returns 0x%x\n”,
status));
return status;
}