/******************************************************************************/
-void fs_open(PUNICODE_STRING DriveRoot, int read_write)
+NTSTATUS fs_open(PUNICODE_STRING DriveRoot, int read_write)
{
NTSTATUS Status;
OBJECT_ATTRIBUTES ObjectAttributes;
if (!NT_SUCCESS(Status))
{
DPRINT1("NtOpenFile() failed with status 0x%.08x\n", Status);
- return;
+ return Status;
}
// If read_write is specified, then the volume should be exclusively locked
- if (read_write) fs_lock(TRUE);
+ if (read_write)
+ {
+ Status = fs_lock(TRUE);
+ }
// Query geometry and partition info, to have bytes per sector, etc
changes = last = NULL;
did_change = 0;
+
+ return Status;
}
BOOLEAN fs_isdirty(void)
if (!NT_SUCCESS(Status))
{
DPRINT1("NtFsControlFile() failed with Status 0x%08x\n", Status);
+#if 1
+ /* FIXME: ReactOS HACK for 1stage due to IopParseDevice() hack */
+ if (Status == STATUS_INVALID_DEVICE_REQUEST)
+ {
+ Status = STATUS_ACCESS_DENIED;
+ }
+#endif
}
return Status;
//#include <sys/types.h> /* for loff_t */
// #include <fcntl.h> /* for off_t */
-void fs_open(PUNICODE_STRING DriveRoot, int read_write);
+NTSTATUS fs_open(PUNICODE_STRING DriveRoot, int read_write);
/* Opens the file system PATH. If RW is zero, the file system is opened
read-only, otherwise, it is opened read-write. */
BOOLEAN salvage_files;
ULONG free_clusters;
DOS_FS fs;
+ NTSTATUS Status;
RtlZeroMemory(&fs, sizeof(fs));
salvage_files = TRUE;
/* Open filesystem and lock it */
- fs_open(DriveRoot, FsCheckFlags & FSCHECK_READ_WRITE);
+ Status = fs_open(DriveRoot, FsCheckFlags & FSCHECK_READ_WRITE);
+ if (Status == STATUS_ACCESS_DENIED)
+ {
+ /* We failed to lock, ask the caller whether we should continue */
+ if (Callback(VOLUMEINUSE, 0, NULL))
+ {
+ Status = STATUS_SUCCESS;
+ }
+ }
+ if (!NT_SUCCESS(Status))
+ {
+ fs_close(FALSE);
+ return STATUS_DISK_CORRUPT_ERROR;
+ }
if (CheckOnlyIfDirty && !fs_isdirty())
{