Dear All,
I am developing a filter driver and filtering the request coming from user
mode for Windows 2000 operating system
I am encountering an unusual behaviour in my driver . I am getting file name
from the fileobject and then I make two similiar unicode strings having full
path names from this filename. But at some times one unicode strings get
fullpath name but the other one gets only some part of it. Although the code
for both is the same.Below is detailed explaination:
Step 1) I am getting file name from fileobject using following code"
///////
irpStack = IoGetCurrentIrpStackLocation( Irp );
fileObject = irpStack->FileObject;
fileName = &fileObject->FileName;
devExt = DeviceObject->DeviceExtension;
///////
Step2) The I am making two unicode strings having complete filepath from the
given file name using, the fullFileNameWrt and tempA.
The tempA unicode string path contains fullpath name in CAPITAL Letters.
/////////////////////////////
fullFileNameWrt.MaximumLength = fileName->MaximumLength +
devExt->DeviceName.MaximumLength + 2;
fullFileNameWrt.Buffer = ExAllocatePoolWithTag(NonPagedPool,
fullFileNameWrt.MaximumLength,‘2leM’);
if(NULL == fullFileNameWrt.Buffer) {
DbgPrint(“\xxxxx@LACK OF RESOURCES…”);
status = STATUS_INSUFFICIENT_RESOURCES;
Irp->IoStatus.Status = status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return status;
}
RtlCopyUnicodeString(&fullFileNameWrt,&devExt->DeviceName);
RtlAppendUnicodeStringToString(&fullFileNameWrt, fileName);
tempA.MaximumLength = fileName->MaximumLength +
devExt->DeviceName.MaximumLength + 2;
tempA.Buffer = ExAllocatePoolWithTag(NonPagedPool,
tempA.MaximumLength,‘2leD’);
if(NULL == tempA.Buffer) {
DbgPrint(“\xxxxx@LACK OF RESOURCES…”);
if(fullFileNameWrt.Buffer) {
ExFreePoolWithTag(fullFileNameWrt.Buffer,‘pmoC’);
}
status = STATUS_INSUFFICIENT_RESOURCES;
Irp->IoStatus.Status = status;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return status;
}
RtlCopyUnicodeString(&tempA,&devExt->DeviceName);
RtlAppendUnicodeStringToString(&tempA, fileName);
tempA.Buffer[tempA.Length] = L’\0’;
tempA.Length = wcslen(tempA.Buffer) * sizeof(WCHAR);
_wcsupr(tempA.Buffer);
DbgPrint(“\xxxxx@JAI fullFileNameWrt:%wZ!”,&fullFileNameWrt);
DbgPrint(“\xxxxx@JAI tempA:%wZ!”,&tempA);
////////////////////////
But at most of the times while filtering , I am not getting the complete
filepath in fullFileNameWrt although I am gettings fullfilepath in
tempA unicode string
JAI fullFileNameWrt: c:\Docum
JAI tempA: C:\DOCUMENTS AND SETTINGS\NEW11\APPLICATION
DATA\MACROMEDIA\FLASHPLAYER\
MACROMEDIA.COM\FLASHPLAYER\SYS\SETTIGS.SYX!
////////
To know more I have added ! mark to check the end of filepath in my
Dbgprints. But There is no ! mark found in fullFileNameWrt. (as shown in the
above output)
Can some body please tell what the problem exactly is ?? Is this happening
because the file name is tooo big ??? Please help.
Regards,
Rohit