Hi All,
I have a couple of code questions. In the first case the system becomes slow
an unusable. In the second I eventually get a page fault. I want to make
sure I am not doing something blatantly wrong.
1.) Detectting Volume mounts:
PDEVICE_OBJECT devObj = NULL;
status = FltGetDiskDeviceObject( FltObjects->Volume, &devObj );
if (NT_SUCCESS(status)) {
status = IoVolumeDeviceToDosName( devObj, &dosName );
}
This worked for 3 different USB flash drives I used but not a fourth one (it
did work w/o my filter driver).
I used SoftICE to debug. It fails in the call to IoVolumeDeviceToDosName. I
have never seen SoftICE behave that way, but it just prints a lot of Debug
statements that are in various parts of the driver (basiucally SoftICE is
crashing) It just becomes unusable and I need to reboot.
2.) I am trying to get the dos name in kernel space. Trying to get the drive
letter, than replace the harddisk name with drive letter to get the full
path. It fails even with only one RtlInitUnicode in it. It doesn’t fail
right away, just after a few seconds, complaining about RtlInitUnicode
string. Just wondering if there is something fundamentally wrong with these
calls. This is in post create:
UNICODE_STRING completeDosName;
UNICODE_STRING auxBuf;
status = FltGetDiskDeviceObject( FltObjects->Volume, &devObj );
status = IoVolumeDeviceToDosName( devObj, &dosName );
if (devObj) {
ObDereferenceObject( devObj );
}
RtlInitUnicodeString( &completeDosName, (PCWSTR)dosName.Buffer);
completeDosName.MaximumLength = 520;
RtlInitUnicodeString( &auxBuf, (PCWSTR)
((nameInfo->Name).Buffer+(volNameLength/2) ));
auxBuf.MaximumLength = (USHORT) (nameInfo->Name).Length;
completeDosName.MaximumLength = completeDosName.MaximumLength +
auxBuf.MaximumLength;
status = RtlAppendUnicodeStringToString( &completeDosName, &auxBuf);
Thanks, bjorn