L
lucy
Dear all,
I compiled the MSDDK mirror driver sample, and installed it and it all runs
ok.
Then I added just a few lines in the "enable.c", after update to this new
compiled driver, it failed to reboot and bluescreened when rebooting, saying
something like paged memory fault stuff...
Can anybody help me out and see what's wrong with my addition to the code?
---// Added type definition for pointer to old DrvEnablePDEV
function----------
typedef DHPDEV (*OLDDRVENABLEPDEV)(
DEVMODEW *pDevmode, // Pointer to DEVMODE
PWSTR pwszLogAddress, // Logical address
ULONG cPatterns, // number of patterns
HSURF *ahsurfPatterns, // return standard patterns
ULONG cjGdiInfo, // Length of memory pointed to by pGdiInfo
ULONG *pGdiInfo, // Pointer to GdiInfo structure
ULONG cjDevInfo, // Length of following PDEVINFO structure
DEVINFO *pDevInfo, // physical device information structure
HDEV hdev, // HDEV, used for callbacks
PWSTR pwszDeviceName, // DeviceName - not used
HANDLE hDriver); // Handle to base driver
---// The original DrvEnablePDEV in enable.c----------
DHPDEV DrvEnablePDEV(
DEVMODEW *pDevmode, // Pointer to DEVMODE
PWSTR pwszLogAddress, // Logical address
ULONG cPatterns, // number of patterns
HSURF *ahsurfPatterns, // return standard patterns
ULONG cjGdiInfo, // Length of memory pointed to by pGdiInfo
ULONG *pGdiInfo, // Pointer to GdiInfo structure
ULONG cjDevInfo, // Length of following PDEVINFO structure
DEVINFO *pDevInfo, // physical device information structure
HDEV hdev, // HDEV, used for callbacks
PWSTR pwszDeviceName, // DeviceName - not used
HANDLE hDriver) // Handle to base driver
{
// ... some other original enable.c code...
---// Added call to old DrvEnablePDEV function----START------
hh=EngLoadImage((LPWSTR)"atidrae.dll");
DISPDBG((0,"DISP Load old atidrae.dll %d\n", hh));
pOldDrvEnablePDEV=(OLDDRVENABLEPDEV)EngFindImageProcAddress(hh,
"DrvEnablePDEV");
DISPDBG((0,"DISP Load DrvEnablePDEV in old atidrae.dll %d\n",
pOldDrvEnablePDEV));
ppdev=(PPDEV)(pOldDrvEnablePDEV)(pDevmode, // Pointer to DEVMODE
pwszLogAddress, // Logical address
cPatterns, // number of patterns
ahsurfPatterns, // return standard patterns
cjGdiInfo, // Length of memory pointed to by pGdiInfo
pGdiInfo, // Pointer to GdiInfo structure
cjDevInfo, // Length of following PDEVINFO structure
pDevInfo, // physical device information structure
hdev, // HDEV, used for callbacks
pwszDeviceName, // DeviceName - not used
hDriver); // Handle to base driver
DISPDBG((0,"DISP DrvEnablePDEV GDIINFO %d\n", ((GDIINFO
*)pGdiInfo)->ulPhysicalPixelGamma));
EngUnloadImage(hh);
---// Added call to old DrvEnablePDEV function END--------
// ... some other original enable.c code...
}
I compiled the MSDDK mirror driver sample, and installed it and it all runs
ok.
Then I added just a few lines in the "enable.c", after update to this new
compiled driver, it failed to reboot and bluescreened when rebooting, saying
something like paged memory fault stuff...
Can anybody help me out and see what's wrong with my addition to the code?
---// Added type definition for pointer to old DrvEnablePDEV
function----------
typedef DHPDEV (*OLDDRVENABLEPDEV)(
DEVMODEW *pDevmode, // Pointer to DEVMODE
PWSTR pwszLogAddress, // Logical address
ULONG cPatterns, // number of patterns
HSURF *ahsurfPatterns, // return standard patterns
ULONG cjGdiInfo, // Length of memory pointed to by pGdiInfo
ULONG *pGdiInfo, // Pointer to GdiInfo structure
ULONG cjDevInfo, // Length of following PDEVINFO structure
DEVINFO *pDevInfo, // physical device information structure
HDEV hdev, // HDEV, used for callbacks
PWSTR pwszDeviceName, // DeviceName - not used
HANDLE hDriver); // Handle to base driver
---// The original DrvEnablePDEV in enable.c----------
DHPDEV DrvEnablePDEV(
DEVMODEW *pDevmode, // Pointer to DEVMODE
PWSTR pwszLogAddress, // Logical address
ULONG cPatterns, // number of patterns
HSURF *ahsurfPatterns, // return standard patterns
ULONG cjGdiInfo, // Length of memory pointed to by pGdiInfo
ULONG *pGdiInfo, // Pointer to GdiInfo structure
ULONG cjDevInfo, // Length of following PDEVINFO structure
DEVINFO *pDevInfo, // physical device information structure
HDEV hdev, // HDEV, used for callbacks
PWSTR pwszDeviceName, // DeviceName - not used
HANDLE hDriver) // Handle to base driver
{
// ... some other original enable.c code...
---// Added call to old DrvEnablePDEV function----START------
hh=EngLoadImage((LPWSTR)"atidrae.dll");
DISPDBG((0,"DISP Load old atidrae.dll %d\n", hh));
pOldDrvEnablePDEV=(OLDDRVENABLEPDEV)EngFindImageProcAddress(hh,
"DrvEnablePDEV");
DISPDBG((0,"DISP Load DrvEnablePDEV in old atidrae.dll %d\n",
pOldDrvEnablePDEV));
ppdev=(PPDEV)(pOldDrvEnablePDEV)(pDevmode, // Pointer to DEVMODE
pwszLogAddress, // Logical address
cPatterns, // number of patterns
ahsurfPatterns, // return standard patterns
cjGdiInfo, // Length of memory pointed to by pGdiInfo
pGdiInfo, // Pointer to GdiInfo structure
cjDevInfo, // Length of following PDEVINFO structure
pDevInfo, // physical device information structure
hdev, // HDEV, used for callbacks
pwszDeviceName, // DeviceName - not used
hDriver); // Handle to base driver
DISPDBG((0,"DISP DrvEnablePDEV GDIINFO %d\n", ((GDIINFO
*)pGdiInfo)->ulPhysicalPixelGamma));
EngUnloadImage(hh);
---// Added call to old DrvEnablePDEV function END--------
// ... some other original enable.c code...
}