Everhart, Glenn From: Edwards, Jonathan [Jonathan_Edwards@NAI.com] Sent: Tuesday, March 16, 1999 11:34 AM To: Rob Newberry; ntdev@atria.com; ntfsd@atria.com Subject: RE: [ntdev] example of using OPEN_BY_FILE_ID? // 1st you have to open a handle to the partition the file is on (must be NTFS) // it doesn't matter if the file is in a subdirectory. HANDLE hRoot; UNICODE_STRING sRoot; OBJECT_ATTRIBUTES oaRoot; sRoot.Buffer =L"\\Device\\Harddisk0\\Partition2\\"; // D: sRoot.Length =wcslen(sRoot.Buffer)*2; sRoot.MaximumLength =sRoot.Length+2; InitializeObjectAttributes(&oaRoot, &sRoot, OBJ_CASE_INSENSITIVE, NULL, NULL); status=ZwCreateFile(&hRoot, SYNCHRONIZE | FILE_READ_DATA, &oaRoot, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, FILE_OPEN, FILE_DIRECTORY_FILE, NULL, 0); // Then, in the InitialiseObjectAttributes you set the root to the handle to the partition. HANDLE hFile; UNICODE_STRING sFile; OBJECT_ATTRIBUTES oaFile; LARGE_INTEGER FileID; FileID.HighPart=0x00600000; FileID.LowPart=0x000006c9; sFile.Buffer =(WCHAR*)&FileID; sFile.Length =8; sFile.MaximumLength =8; InitializeObjectAttributes(&oaFile, &sFile, OBJ_CASE_INSENSITIVE, hRoot, NULL); status=ZwCreateFile(&hFile, SYNCHRONIZE | FILE_READ_DATA, &oaFile, &IoStatusBlock, NULL, FILE_ATTRIBUTE_NORMAL, FILE_SHARE_READ, FILE_OPEN, FILE_NON_DIRECTORY_FILE | FILE_OPEN_BY_FILE_ID, NULL, 0); --- Jonathan Edwards Network Associates. -----Original Message----- From: Rob Newberry [mailto:robnewberry@grouplogic.com] Sent: Monday, March 15, 1999 6:18 PM To: ntdev@atria.com; ntfsd@atria.com Subject: [ntdev] example of using OPEN_BY_FILE_ID? Does anyone have an example of using NtCreateFile or ZwCreateFile with the "FILE_OPEN_BY_FILE_ID" flag? Rajeev Nagar's book describes how it's done -- by passing the FileIndex returned from NtQueryInformationFile in the name parameter, but I can't seem to get it to work. I'm pretty sure I'm not coaxing the LARGE_INTEGER into a UNICODE_STRING correctly. Does anyone have any examples for doing this? Thanks a million! Rob --------------------------------------------------------------------- Rob Newberry Director of Fajita Technology Group Logic, Inc. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - [ To unsubscribe, send email to ntdev-request@atria.com with body UNSUBSCRIBE (the subject is ignored). ]