mirror of
https://github.com/reactos/reactos.git
synced 2025-07-27 20:32:18 +00:00
- Remove a hack around sending FSCTL_ to an opened volume handle, it works good enough without the need to open another handle to the file system.
svn path=/trunk/; revision=35558
This commit is contained in:
parent
6156320103
commit
f460c4e31c
1 changed files with 5 additions and 39 deletions
|
@ -72,6 +72,8 @@ void fs_open(PUNICODE_STRING DriveRoot,int rw)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Query geometry and partition info, to have bytes per sector, etc
|
||||||
|
|
||||||
CurrentOffset.QuadPart = 0LL;
|
CurrentOffset.QuadPart = 0LL;
|
||||||
|
|
||||||
changes = last = NULL;
|
changes = last = NULL;
|
||||||
|
@ -80,43 +82,12 @@ void fs_open(PUNICODE_STRING DriveRoot,int rw)
|
||||||
|
|
||||||
BOOLEAN fs_isdirty(PUNICODE_STRING DriveRoot)
|
BOOLEAN fs_isdirty(PUNICODE_STRING DriveRoot)
|
||||||
{
|
{
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
|
||||||
ULONG DirtyMask = 0;
|
ULONG DirtyMask = 0;
|
||||||
WCHAR TempRootBuf[128];
|
|
||||||
UNICODE_STRING TempRoot;
|
|
||||||
HANDLE FileSystem;
|
|
||||||
IO_STATUS_BLOCK IoSb;
|
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
IO_STATUS_BLOCK IoSb;
|
||||||
/* Add backslash to the end, so FS will be opened */
|
|
||||||
TempRoot.Length = 0;
|
|
||||||
TempRoot.MaximumLength = sizeof(TempRootBuf);
|
|
||||||
TempRoot.Buffer = TempRootBuf;
|
|
||||||
RtlCopyUnicodeString(&TempRoot, DriveRoot);
|
|
||||||
if (TempRoot.Length == (TempRoot.MaximumLength-1)) return FALSE;
|
|
||||||
wcscat(TempRoot.Buffer, L"\\");
|
|
||||||
TempRoot.Length += sizeof(WCHAR);
|
|
||||||
|
|
||||||
InitializeObjectAttributes(&ObjectAttributes,
|
|
||||||
&TempRoot,
|
|
||||||
0,
|
|
||||||
NULL,
|
|
||||||
NULL);
|
|
||||||
|
|
||||||
Status = NtOpenFile(&FileSystem,
|
|
||||||
FILE_GENERIC_READ,
|
|
||||||
&ObjectAttributes,
|
|
||||||
&IoSb,
|
|
||||||
0,
|
|
||||||
0);
|
|
||||||
if (!NT_SUCCESS(Status))
|
|
||||||
{
|
|
||||||
DPRINT1("NtOpenFile() failed with status 0x%.08x\n", Status);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if volume is dirty */
|
/* Check if volume is dirty */
|
||||||
Status = NtFsControlFile(FileSystem,
|
Status = NtFsControlFile(fd/*FileSystem*/,
|
||||||
NULL, NULL, NULL, &IoSb,
|
NULL, NULL, NULL, &IoSb,
|
||||||
FSCTL_IS_VOLUME_DIRTY,
|
FSCTL_IS_VOLUME_DIRTY,
|
||||||
NULL, 0, &DirtyMask, sizeof(DirtyMask));
|
NULL, 0, &DirtyMask, sizeof(DirtyMask));
|
||||||
|
@ -124,18 +95,13 @@ BOOLEAN fs_isdirty(PUNICODE_STRING DriveRoot)
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("NtFsControlFile() failed with Status 0x%08x\n", Status);
|
DPRINT1("NtFsControlFile() failed with Status 0x%08x\n", Status);
|
||||||
/* Close FS handle */
|
|
||||||
NtClose(FileSystem);
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close FS handle */
|
/* Convert Dirty mask to a boolean value */
|
||||||
NtClose(FileSystem);
|
|
||||||
|
|
||||||
return (DirtyMask & 1);
|
return (DirtyMask & 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void fs_read(loff_t pos,int size,void *data)
|
void fs_read(loff_t pos,int size,void *data)
|
||||||
{
|
{
|
||||||
CHANGE *walk;
|
CHANGE *walk;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue