-
January 28th, 2008, 12:59 PM
#1
File_open_by_file_id
Can anyone tell me how I use this? I don't get what the value of ObjectName should be:
The file name specified in the ObjectAttributes parameter includes the 8-byte file reference number for the file.
So is the File ID a string or a long? And do we pass its value, or a pointer to its value? Thanks!
-
January 29th, 2008, 08:30 AM
#2
Re: File_open_by_file_id
something like this:
(where frn = filereferencenumber = FileID and fctNtCreateFile is a pointer to NtCreateFile)
/*static*/ NTSTATUS MiscUtil::HandleFromFrn(DWORDLONG frn, HANDLE hVolume, HANDLE* phFile)
{
UNICODE_STRING file;
OBJECT_ATTRIBUTES fileAttributes;
IO_STATUS_BLOCK ioStatusBlock;
// set frn
LARGE_INTEGER fileID;
fileID.QuadPart = frn;
// set frn
file.Buffer = (WCHAR*)&fileID;
file.Length = 8;
file.MaximumLength = 8;
InitializeObjectAttributes(&fileAttributes, &file, OBJ_CASE_INSENSITIVE, hVolume, NULL);
return fctNtCreateFile
(
phFile,
0, //SYNCHRONIZE | FILE_READ_DATA,
&fileAttributes,
&ioStatusBlock,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ | FILE_SHARE_WRITE,
FILE_OPEN,
FILE_OPEN_BY_FILE_ID,
NULL,
0
);
}
-
January 29th, 2008, 12:32 PM
#3
Re: File_open_by_file_id
Thanks a lot! I'll try it!
Just for future reference, could you please tell me where you got the documentation?
Or did you just try different things until it worked? Or was it just me who wasn't getting it?!
-
January 29th, 2008, 08:13 PM
#4
Status_object_path_syntax_bad
I get STATUS_OBJECT_PATH_SYNTAX_BAD if I don't give it a volume handle. If I do (whether the actual volume or the root directory), I get STATUS_INVALID_PARAMETER.
HELP!!!
-
October 12th, 2010, 10:05 AM
#5
Re: File_open_by_file_id
The bit you need is the access rights required to the file - they are commented out and replaced by 0 in the snippet. Just drop in the needed rights, and you will be away again. Apparently any open handle to a parent of the object ID you pass in will get you STATUS_SUCCESS.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|