N
Nadav
Hi,
I am trying to access the miniport driver from user mode, when trying to
access the display driver all works fine, BUT when trying to get the
miniport handle ( at user mode ) I keep getting an invalid handle with a
file not found last error code... Why can this happen? The driver name I am
using is found under
'HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\%DriverName%' and the same
name found in the .inf file used to install the driver... What am I doing
wrong here? following is a snap-shot of the code used to create the driver
and the .inf file used to install the driver...
THE CODE USED TO GET THE DRIVERS HANDLE
=======================================
// Returns an invalid handle, GetLastError returns file not found...
HANDLE hDevice = CreateFile("\\\\.\\MirrorTest", GENERIC_READ |
GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
....
....
THE ".INF" FILE
============
; MirrorTest.inf
;
; Installation inf for the Mirror graphics adapter.
;
; Copyright (x) 1995-1999 Microsoft Corporation. All rights reserved
;
[Version]
Signature="$CHICAGO$"
Provider=%Microsoft%
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
Class=Display
DriverVer=06/01/1999,1.0
[DestinationDirs]
DefaultDestDir = 11
MirrorTest.Miniport = 12 ; drivers
MirrorTest.Display = 11 ; system32
;
; Driver information
;
[Manufacturer]
%Microsoft% = MirrorTest.Mfg
[MirrorTest.Mfg]
%Mirror% = MirrorTest, Microsoft_Mirror_Sample1
;
; General installation section
;
[MirrorTest]
CopyFiles=MirrorTest.Miniport, MirrorTest.Display
;
; File sections
;
[MirrorTest.Miniport]
MirrorTest.sys
[MirrorTest.Display]
MirrorTest.dll
;
; Service Installation
;
[MirrorTest.Services]
AddService = MirrorTest, 0x00000002, mirror_Service_Inst,
mirror_EventLog_Inst
[mirror_Service_Inst]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 1 ; SERVICE_SYSTEM_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup = Video
ServiceBinary = %12%\MirrorTest.sys
[mirror_EventLog_Inst]
AddReg = mirror_EventLog_AddReg
[mirror_EventLog_AddReg]
HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLogMsg.dll;%System
Root%\System32\drivers\MirrorTest.sys"
HKR,,TypesSupported,0x00010001,7
;
; Software Installation
;
[MirrorTest.SoftwareSettings]
AddReg = mirror_SoftwareDeviceSettings
[mirror_SoftwareDeviceSettings]
HKR,, MirrorDriver, %REG_DWORD%, 1
HKR,, InstalledDisplayDrivers, %REG_MULTI_SZ%, MirrorTest
HKR,, VgaCompatible, %REG_DWORD%, 0
HKR,, Attach.ToDesktop, %REG_DWORD%, 1
[MirrorTest.OpenGLSoftwareSettings]
AddReg = mirror_OpenGLSoftwareSettings
[mirror_OpenGLSoftwareSettings]
;
; Not currently used:
;
[MirrorTest.GeneralConfigData]
MaximumNumberOfDevices = 1
KeepExistingDriverEnabled = 1
;
; Source file information
;
[SourceDisksNames.x86]
1 = %DiskId%,,,""
[SourceDisksFiles]
MirrorTest.sys = 1
MirrorTest.dll = 1
[Strings]
;
; Non-Localizable Strings
;
REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = "System\CurrentControlSet\Services"
;
; Localizable Strings
;
DiskId = "Mirror Installation DISK (VIDEO)"
GraphAdap = "Graphics Adapter"
Microsoft = "Microsoft"
Mirror = "Microsoft Mirror Driver"
Thanks,
Nadav.
I am trying to access the miniport driver from user mode, when trying to
access the display driver all works fine, BUT when trying to get the
miniport handle ( at user mode ) I keep getting an invalid handle with a
file not found last error code... Why can this happen? The driver name I am
using is found under
'HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Services\%DriverName%' and the same
name found in the .inf file used to install the driver... What am I doing
wrong here? following is a snap-shot of the code used to create the driver
and the .inf file used to install the driver...
THE CODE USED TO GET THE DRIVERS HANDLE
=======================================
// Returns an invalid handle, GetLastError returns file not found...
HANDLE hDevice = CreateFile("\\\\.\\MirrorTest", GENERIC_READ |
GENERIC_WRITE, 0, NULL, OPEN_EXISTING, 0, NULL);
....
....
THE ".INF" FILE
============
; MirrorTest.inf
;
; Installation inf for the Mirror graphics adapter.
;
; Copyright (x) 1995-1999 Microsoft Corporation. All rights reserved
;
[Version]
Signature="$CHICAGO$"
Provider=%Microsoft%
ClassGUID={4D36E968-E325-11CE-BFC1-08002BE10318}
Class=Display
DriverVer=06/01/1999,1.0
[DestinationDirs]
DefaultDestDir = 11
MirrorTest.Miniport = 12 ; drivers
MirrorTest.Display = 11 ; system32
;
; Driver information
;
[Manufacturer]
%Microsoft% = MirrorTest.Mfg
[MirrorTest.Mfg]
%Mirror% = MirrorTest, Microsoft_Mirror_Sample1
;
; General installation section
;
[MirrorTest]
CopyFiles=MirrorTest.Miniport, MirrorTest.Display
;
; File sections
;
[MirrorTest.Miniport]
MirrorTest.sys
[MirrorTest.Display]
MirrorTest.dll
;
; Service Installation
;
[MirrorTest.Services]
AddService = MirrorTest, 0x00000002, mirror_Service_Inst,
mirror_EventLog_Inst
[mirror_Service_Inst]
ServiceType = 1 ; SERVICE_KERNEL_DRIVER
StartType = 1 ; SERVICE_SYSTEM_START
ErrorControl = 0 ; SERVICE_ERROR_IGNORE
LoadOrderGroup = Video
ServiceBinary = %12%\MirrorTest.sys
[mirror_EventLog_Inst]
AddReg = mirror_EventLog_AddReg
[mirror_EventLog_AddReg]
HKR,,EventMessageFile,0x00020000,"%SystemRoot%\System32\IoLogMsg.dll;%System
Root%\System32\drivers\MirrorTest.sys"
HKR,,TypesSupported,0x00010001,7
;
; Software Installation
;
[MirrorTest.SoftwareSettings]
AddReg = mirror_SoftwareDeviceSettings
[mirror_SoftwareDeviceSettings]
HKR,, MirrorDriver, %REG_DWORD%, 1
HKR,, InstalledDisplayDrivers, %REG_MULTI_SZ%, MirrorTest
HKR,, VgaCompatible, %REG_DWORD%, 0
HKR,, Attach.ToDesktop, %REG_DWORD%, 1
[MirrorTest.OpenGLSoftwareSettings]
AddReg = mirror_OpenGLSoftwareSettings
[mirror_OpenGLSoftwareSettings]
;
; Not currently used:
;
[MirrorTest.GeneralConfigData]
MaximumNumberOfDevices = 1
KeepExistingDriverEnabled = 1
;
; Source file information
;
[SourceDisksNames.x86]
1 = %DiskId%,,,""
[SourceDisksFiles]
MirrorTest.sys = 1
MirrorTest.dll = 1
[Strings]
;
; Non-Localizable Strings
;
REG_SZ = 0x00000000
REG_MULTI_SZ = 0x00010000
REG_EXPAND_SZ = 0x00020000
REG_BINARY = 0x00000001
REG_DWORD = 0x00010001
SERVICEROOT = "System\CurrentControlSet\Services"
;
; Localizable Strings
;
DiskId = "Mirror Installation DISK (VIDEO)"
GraphAdap = "Graphics Adapter"
Microsoft = "Microsoft"
Mirror = "Microsoft Mirror Driver"
Thanks,
Nadav.