(1) Note that you don’t check for a failure from ExAllocatePoolWithTag;
(2) You never set renameFileName.Length
(3) You use a fixed-size buffer, even though you don’t know the size of
the input string.
(2) is why it doesn’t print. (1) will explain when at some point this
code blue screens (either when running low resource simulation or out in
the field on a machine with low memory.) (3) is going to cause it to
blue screen the moment we test with a 256 character file name.
Also, unless there’s some very strong reason, I’d suggest using paged
pool for strings.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Rohit Dhamija
Sent: Thursday, April 29, 2004 2:10 AM
To: ntfsd redirect
Subject: [ntfsd] UNICODE_STRING Copy problem…
Dear All,
In my filter driver application , i am getting problem in following
piece of code , its written in irp_mj_set_information routine
//////////////////////////////////////////
PFILE_RENAME_INFORMATION fileRename;
UNICODE_STRING renameFileName;
renameFileName.MaximumLength = 200;
renameFileName.Buffer = ExAllocatePoolWithTag(NonPagedPool,
renameFileName.MaximumLength,‘2leM’);
// I am getting Renamed file by:-
fileRename = (PFILE_RENAME_INFORMATION)Irp->AssociatedIrp.SystemBuffer;
*renameFileName.Buffer = L’\0’;
//After that I copy character by chacter into my unicode string
for(i=0; i < fileRename->FileNameLength/2; i++) {
renameFileName.Buffer[i] = fileRename->FileName[i]; } // and then i
append the string with null character
renameFileName.Buffer[i] = L’Q’;
renameFileName.Buffer[i] = L’\0’;
//When i print this string it shows nothing??? Can any body please tell
where is the flaw in the program
DbgPrint(“\nRENAME renameFileName %wZ!\n”, &renameFileName);
////////////////////////////////
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@osr.com To unsubscribe
send a blank email to xxxxx@lists.osr.com