What is the status code returned?
Instead of FILE_ALL_ACCESS, use (FILE_LIST_DIRECTORY | SYNCHRONIZE). You may
also want to set OBJ_CASE_INSENSITIVE in the call to
IntiializeObjectAttributes.
/ted
-----Original Message-----
From: Rohit [mailto:xxxxx@divassoftware.com]
Sent: Wednesday, September 17, 2003 5:46 AM
To: Windows File Systems Devs Interest List
Subject: [ntfsd] Open handle of directory for ZwQueryDirectoryFile…Help
experts
Dear All,
I am working on the filespy code. I want to query the files present in a
directory . For that I am doing following steps:
1)first of all i need to Open the directory using ZwOpenFile followed by
Initialize Object attribute to get the handle and then pass it to
ZwQueryDirectoryFile.
I have coded following under spycreate routine to open the drectory , but it
not opening the specified directory.and prints
“ERROR Opening file”
Can any please tell me the problem in the code.
Or any alternate solution to open a file
And so i am not able to proceed further.
//A global variable:
int chkflag = 0;
////MyDeclarations
UNICODE_STRING ObjectName;
OBJECT_ATTRIBUTES objectAttributes;
HANDLE ntFileHandle;
IO_STATUS_BLOCK ioStatus;
////////////////
Code
if(!chkflag)
{
RtlInitUnicodeString(&ObjectName,
L"\??\D:\WINNT\system32\config");
InitializeObjectAttributes(&objectAttributes,&ObjectName,OBJ_KERNEL_HANDLE
, NULL, NULL );
status = ZwOpenFile(&ntFileHandle,FILE_ALL_ACCESS,&objectAttributes,
&ioStatus,FILE_SHARE_VALID_FLAGS,FILE_SYNCHRONOUS_IO_NONALERT);
if( !NT_SUCCESS( status ) )
{
DbgPrint(“ERROR Opening file”);
}
else
{
DbgPrint(“File Opened”);
}
ZwClose(ntFileHandle);
chkflag = 1;
}
////////////////////////////////////////////
Thanks in advance
Rohit
You are currently subscribed to ntfsd as: xxxxx@livevault.com To unsubscribe
send a blank email to xxxxx@lists.osr.com