Hi,
This is the code sample i used.
swprintf( loggerPath, L"\Device\HarddiskVolume1\glDriver_logger.txt");
RtlInitUnicodeString( &fileName, loggerPath );
InitializeObjectAttributes(&ObjectAttributes, &fileName,
OBJ_CASE_INSENSITIVE,
NULL, NULL);
Status =
ZwCreateFile(&fileHandle,GENERIC_WRITE,&ObjectAttributes,
&IoStatusBlock,NULL,FILE_ATTRIBUTE_NORMAL,0,
FILE_CREATE,FILE_SYNCHRONOUS_IO_NONALERT,NULL,0);
if ( NT_SUCCESS( Status ) )
{
DbgPrint(“File Opened successfully”);
Status=ZwClose( fileHandle );
if(NT_SUCCESS(Status))
{
DbgPrint(“File Closed Successfully”);
}
}
else
{
if(IoStatusBlock.Information ==FILE_CREATED)
DbgPrint(“File Created”);
else if(IoStatusBlock.Information ==FILE_OPENED)
DbgPrint(“File opened”);
else if(IoStatusBlock.Information ==FILE_OVERWRITTEN)
DbgPrint(“File Written”);
else if(IoStatusBlock.Information ==FILE_SUPERSEDED)
DbgPrint(“File superseed”);
else if(IoStatusBlock.Information ==FILE_EXISTS)
DbgPrint(“File exist”);
else if(IoStatusBlock.Information ==FILE_DOES_NOT_EXIST)
DbgPrint(“File not exist”);
else
DbgPrint(“UNKNOWN return value”);
}
It works correctly when i try this with my IOCTL.
But when i try to do this in IRP_MJ_CREATE it blue screens.
I get unexcepted_kernel_mode_trap.
The trap number is sometimes 0x00000005 or 0x00000008.
With Thanks,
A.Ilamparithi.
Hi,
Can you put ur code snnipet of opening file in IRP_MJ_CREATE?
yatindra