I am currently having some difficulty in loading some config data from
file, and was hoping the newsgroup could help.
I have a fs filter boot driver (supporting W2K, XP & WS2K3) that needs to
load some config data from file (I cannot use the registry due to size
constraints). I can’t load this in DriverEntry since the file system
drivers would not have loaded yet, and decided I would hijack the first
IRP_MJ_CREATE and load the files then, since at this point the drive
should
be mounted and the fs loaded.
However, my ZwOpenFile() causes a hardware reset (not sure if thats the
right term for it… thats what VMWare calls it), so bad that I can’t even
trap it with SEH or even catch it with WinDbg. I thought perhaps it might
be because it would have a recursive call back into my create() function,
but its seems to die right away without re-entering, and I am not sure
why. The following is the code around the offending line:
RtlInitUnicodeString( &rules_file,
L\systemroot\system32\drivers\etc\app.cfg );
InitializeObjectAttributes( &oa, &rules_file, OBJ_CASE_INSENSITIVE, NULL,
NULL );
log_print( “Attempting to open: %wZ”, &rules_file );
try
{
status = ZwOpenFile( &hFile,
FILE_READ_DATA|SYNCHRONIZE,
&oa, &iosb,
FILE_SHARE_READ,
FILE_NON_DIRECTORY_FILE|FILE_SYNCHRONOUS_IO_NONALERT );
}
except( EXCEPTION_EXECUTE_HANDLER )
{
status = GetExceptionCode();
log_print( “Failed to open "%wZ". Status=%s\n”,
&rules_file,
NTSTATUSToString(status) );
return line;
}
log_print( “Opened %wZ successfully!”, &rules_file );
Does anyone have any suggestions on how I can track down what I am doing
wrong? Is this approach an acceptable way to load conf data from disk? I
was looking at doing it right after a mount but found the IRP_MJ_CREATE
entry to make more sense.
Would love some insight on what the heck I am doing wrong here.