Hi all,
I tried to write a filter driver to hook “LanmanRedirector” under WinNT
(service pack 6) with the attached code. The API
IoGetDeviceObjectPointer() always return 0xC0000034L
(STATUS_OBJECT_NAME_NOT_FOUND) error.
However, the driver with the same code can successfully hook to
“LanmanRedirector” when executed under Win2K.
I use OSR’s DeviceTree application (Version 1.0 for WinNT, Version 2.8 for
Win2K/XP) to view the attachment of the “LanmanRedirector”.
What are the possible causes of the problem ?
Thanks a lot.
– Philip
NTSTATUS DriverEntry(…)
{
…
WCHAR deviceRdrBuffer = L"\Device\LanmanRedirector";
UNICODE_STRING deviceRdrUnicodeString;
// Setup the device name
RtlInitUnicodeString(&deviceRdrUnicodeString, deviceRdrBuffer);
ntGlobalStatus = IoGetDeviceObjectPointer(&deviceRdrUnicodeString,
FILE_GENERIC_READ|FILE_GENERIC_WRITE,
&fileGlobalObject, &lanDeviceObject);
if ( ntGlobalStatus == STATUS_SUCCESS )
{
fileGlobalSysDevice = IoGetRelatedDeviceObject(fileGlobalObject);
if ( !fileGlobalSysDevice )
{
ntGlobalStatus = IoCreateDevice(DriverObject, sizeof(HOOK_EXTENSION),
NULL, fileGlobalSysDevice->DeviceType, 0, FALSE, &hookDevice);
if ( ntGlobalStatus == STATUS_SUCCESS )
{
topAttachDevice = IoAttachDeviceToDeviceStack(hookDevice,
fileGlobalSysDevice);
if ( !topAttachDevice )
ObDereferenceObject(fileGlobalObject);
}
}
else
ObDereferenceObject(fileGlobalObject);
}