sys: IRP_MJ_CREATE

This commit is contained in:
Bill Zissimopoulos 2015-12-07 22:59:08 -08:00
parent 6ea86a5e8a
commit 106b3ab0c7
2 changed files with 9 additions and 8 deletions

View File

@ -49,7 +49,7 @@ enum
{ {
FspFsctlTransactUnknownKind = 0, FspFsctlTransactUnknownKind = 0,
FspFsctlTransactCreateKind = 'C', FspFsctlTransactCreateKind = 'C',
FspFsctlTransactCreateCloseKind = 'c', FspFsctlTransactCreateCleanupCloseKind = 'c',
FspFsctlTransactCloseKind = 'z', FspFsctlTransactCloseKind = 'z',
FspFsctlTransactReadKind = 'R', FspFsctlTransactReadKind = 'R',
FspFsctlTransactWriteKind = 'W', FspFsctlTransactWriteKind = 'W',

View File

@ -195,6 +195,9 @@ static NTSTATUS FspFsvolCreate(
goto exit; goto exit;
} }
FSP_FILE_CONTEXT *RelatedFsContext = RelatedFileObject->FsContext;
ASSERT(0 != RelatedFsContext);
/* cannot FILE_DELETE_ON_CLOSE on the root directory */ /* cannot FILE_DELETE_ON_CLOSE on the root directory */
if (sizeof(WCHAR) == RelatedFsContext->FileName.Length && if (sizeof(WCHAR) == RelatedFsContext->FileName.Length &&
0 == FileName.Length && 0 == FileName.Length &&
@ -204,9 +207,6 @@ static NTSTATUS FspFsvolCreate(
goto exit; goto exit;
} }
FSP_FILE_CONTEXT *RelatedFsContext = RelatedFileObject->FsContext;
ASSERT(0 != RelatedFsContext);
/* /*
* There is no need to lock our accesses of RelatedFileObject->FsContext->FileName, * There is no need to lock our accesses of RelatedFileObject->FsContext->FileName,
* because RelatedFileObject->FsContext->Filename is read-only (after creation) and * because RelatedFileObject->FsContext->Filename is read-only (after creation) and
@ -240,7 +240,7 @@ static NTSTATUS FspFsvolCreate(
} }
/* cannot FILE_DELETE_ON_CLOSE on the root directory */ /* cannot FILE_DELETE_ON_CLOSE on the root directory */
if (sizeof(WCHAR) == FileName.Length) && if (sizeof(WCHAR) == FileName.Length &&
FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE)) FlagOn(CreateOptions, FILE_DELETE_ON_CLOSE))
{ {
Result = STATUS_CANNOT_DELETE; Result = STATUS_CANNOT_DELETE;
@ -689,9 +689,10 @@ static VOID FspFsvolCreateClose(
goto leak_exit; goto leak_exit;
/* populate the CreateClose request */ /* populate the CreateClose request */
Request->Kind = FspFsctlTransactCreateCloseKind; Request->Kind = FspFsctlTransactCreateCleanupCloseKind;
Request->Req.Close.UserContext = FsContext->UserContext; Request->Req.Cleanup.UserContext = FsContext->UserContext;
Request->Req.Close.UserContext2 = (UINT_PTR)FileObject->FsContext2; Request->Req.Cleanup.UserContext2 = (UINT_PTR)FileObject->FsContext2;
Request->Req.Cleanup.Delete = FILE_CREATED == Response->IoStatus.Information;
/* post as a work request */ /* post as a work request */
if (!FspIopPostWorkRequest(DeviceObject, Request)) if (!FspIopPostWorkRequest(DeviceObject, Request))