Hello out there!
I’m in the process of creating a “HelloWorld” file system driver (to
practice it a bit before I start the real project).
I have not yet implemented the fast io-stuff and I do not use caching. And
I still do not use any ERESOURCE’s to synchronize access, well, since only
one process can access the HelloWorld-file, and I am the only person who
can issue read requests, and since it’s all read-only I figured that I
won’t face any problems without synchronizing. It’s a “hello world” thingy
after all.
Ok, here comes my question: I can execute “more M:HelloWorld” (contents of
file are displayed), but "more <m:helloworld does not display anything. as>far as I can tell from the debug output, every IRP_MJ_*-request has been
successfully completed.
Both commands produce quite a different debug output. But I have not the
slightest idea where to look for the problem. If anybody has encountered
this problem already I’d greatly appreciate any hints about a possible
location of that bug.
(Additional note: I’m trying “type M:HelloWorld” and “openread
M:HelloWorld” (openread.exe is a simple program that just does CreateFile()
and ReadFile()). When trying those two commands and both ‘more’ commands
above, I got quite different results when I changed the type of the base
device (FILE_DEVICE_FILE_SYSTEM, FILE_DEVICE_NETWORK_FILE_SYSTEM) and the
stuff that FileFsDeviceInformation returns. In the worst case, only
“openread” works, in the best case all works except for "more
<m:helloworld oh. i forgot to mention that for some settings>remember now, I have changed those values so often] I even get a blue
screen.)
Here are the IRP-packets that are processed:
“more M:HelloWorld”
IRP_MJ_CREATE - Root directory ""
IRP_MJ_CLEANUP - Root directory
IRP_MJ_CLOSE - Root directory
IRP_MJ_CREATE - Root directory ""
IRP_MJ_DIRECTORY_CONTROL IRP_MN_QUERY_DIRECTORY, search for file
“HelloWorld”
IRP_MJ_CLEANUP - Root directory
IRP_MJ_CLOSE - Root directory
IRP_MJ_CREATE - File “HelloWorld”
IRP_MJ_READ
IRP_MJ_CLEANUP - HelloWorld
IRP_MJ_CLOSE - HelloWorld
–> contents are displayed.
"more <m:helloworld>IRP_MJ_CREATE - Root directory ""
IRP_MJ_CLEANUP - Root directory
IRP_MJ_CLOSE - Root directory
IRP_MJ_CREATE - File “HelloWorld”
IRP_MJ_QUERY_VOLUME_INFORMATION, FileFsDeviceInformation
IRP_MJ_QUERY_VOLUME_INFORMATION, FileFsDeviceInformation
IRP_MJ_QUERY_VOLUME_INFORMATION, FileFsDeviceInformation
IRP_MJ_QUERY_INFORMATION, FileStandardInformation
IRP_MJ_CLEANUP - HelloWorld
IRP_MJ_CLOSE - HelloWorld
-> Nothing is displayed, no error message, just plain nothing.
Since create, cleanup and close seem to work, here my
FileFsDeviceInformation and FileStandardInformation-return values:
FileFsDeviceInformation:
p=pIrp->AssociatedIrp.SystemBuffer;
p->DeviceType=FILE_DEVICE_VIRTUAL_DISK;
p->Characteristics=FILE_READ_ONLY_DEVICE;
status=STATUS_SUCCESS;
info=sizeof(FILE_FS_DEVICE_INFORMATION);
FileStandardInformation: (if invoked on file HelloWorld)
if( pIrp->MdlAddress ) {
p=MmGetSystemAddressForMdl(pIrp->MdlAddress );
} else {
p=pIrp->AssociatedIrp.SystemBuffer; // Allocated by I/O Manager for
query/set functionality
}
RtlZeroMemory( p, sizeof(FILE_STANDARD_INFORMATION) );
p->AllocationSize.QuadPart=1;
p->EndOfFile.QuadPart=5;
p->NumberOfLinks=1;
p->DeletePending=FALSE;
p->Directory=FALSE;
status=STATUS_SUCCESS;
info=sizeof(FILE_STANDARD_INFORMATION);
The device object itself is FILE_DEVICE_NETWORK_FILE_SYSTEM. Not really
true, but it seems to give the best results. FCB and CCB-objects are
allocated with ExAllocatePool(NonPagedPool , …size…
+paranoia-added-value ).
Currently I am in the process of gnawing through my desk since I just have
no idea what the real problem is. I must be overlooking something
important…
I hope that somebody out there can point me in the right direction?
Cheers,
Desperate Soul
erm… I mean…
Michael</m:helloworld></m:helloworld></m:helloworld>