mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-25 01:42:24 -05:00
sys: IRP_MJ_CREATE
This commit is contained in:
parent
25457b916d
commit
44f34b9295
@ -73,7 +73,7 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
|
|
||||||
/* cannot open the volume object */
|
/* cannot open the volume object */
|
||||||
if (0 == RelatedFileObject && 0 == FileName.Length)
|
if (0 == RelatedFileObject && 0 == FileName.Length)
|
||||||
return STATUS_ACCESS_DENIED; /* need error code like UNIX EPERM (STATUS_NOT_SUPPORTED?) */
|
return STATUS_ACCESS_DENIED; /* need error code like POSIX EPERM (STATUS_NOT_SUPPORTED?) */
|
||||||
|
|
||||||
/* cannot open a paging file */
|
/* cannot open a paging file */
|
||||||
if (FlagOn(Flags, SL_OPEN_PAGING_FILE))
|
if (FlagOn(Flags, SL_OPEN_PAGING_FILE))
|
||||||
@ -101,7 +101,7 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* check for trailing backslash */
|
/* check for trailing backslash */
|
||||||
if (sizeof(WCHAR) * 2/* root can have trailing backslash */ <= FileName.Length &&
|
if (sizeof(WCHAR) * 2/* not empty or root */ <= FileName.Length &&
|
||||||
L'\\' == FileName.Buffer[FileName.Length / 2 - 1])
|
L'\\' == FileName.Buffer[FileName.Length / 2 - 1])
|
||||||
{
|
{
|
||||||
FileName.Length -= sizeof(WCHAR);
|
FileName.Length -= sizeof(WCHAR);
|
||||||
@ -127,35 +127,39 @@ static NTSTATUS FspFsvolCreate(
|
|||||||
* because RelatedFileObject->FsContext is guaranteed to exist while RelatedFileObject
|
* because RelatedFileObject->FsContext is guaranteed to exist while RelatedFileObject
|
||||||
* exists.
|
* exists.
|
||||||
*/
|
*/
|
||||||
|
BOOLEAN AppendBackslash =
|
||||||
|
sizeof(WCHAR) * 2/* not empty or root */ <= RelatedFsContext->FileName.Length &&
|
||||||
|
sizeof(WCHAR) <= FileName.Length && L':' != FileName.Buffer[0];
|
||||||
Result = FspFileContextCreate(
|
Result = FspFileContextCreate(
|
||||||
RelatedFsContext->FileName.Length + sizeof(WCHAR)/* backslash */ + FileName.Length,
|
RelatedFsContext->FileName.Length + AppendBackslash * sizeof(WCHAR) + FileName.Length,
|
||||||
&FsContext);
|
&FsContext);
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
Result = RtlAppendUnicodeStringToString(&FsContext->FileName, &RelatedFsContext->FileName);
|
Result = RtlAppendUnicodeStringToString(&FsContext->FileName, &RelatedFsContext->FileName);
|
||||||
ASSERT(NT_SUCCESS(Result));
|
ASSERT(NT_SUCCESS(Result));
|
||||||
if (HasTrailingBackslash)
|
if (AppendBackslash)
|
||||||
{
|
{
|
||||||
Result = RtlAppendUnicodeToString(&FsContext->FileName, L"\\");
|
Result = RtlAppendUnicodeToString(&FsContext->FileName, L"\\");
|
||||||
ASSERT(NT_SUCCESS(Result));
|
ASSERT(NT_SUCCESS(Result));
|
||||||
}
|
}
|
||||||
Result = RtlAppendUnicodeStringToString(&FsContext->FileName, &FileName);
|
|
||||||
ASSERT(NT_SUCCESS(Result));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* absolute open */
|
/* must be an absolute path */
|
||||||
|
if (sizeof(WCHAR) <= FileName.Length && L'\\' != FileName.Buffer[0])
|
||||||
|
return STATUS_OBJECT_NAME_INVALID;
|
||||||
|
|
||||||
Result = FspFileContextCreate(
|
Result = FspFileContextCreate(
|
||||||
FileName.Length,
|
FileName.Length,
|
||||||
&FsContext);
|
&FsContext);
|
||||||
if (!NT_SUCCESS(Result))
|
if (!NT_SUCCESS(Result))
|
||||||
return Result;
|
return Result;
|
||||||
|
|
||||||
Result = RtlAppendUnicodeStringToString(&FsContext->FileName, &FileName);
|
|
||||||
ASSERT(NT_SUCCESS(Result));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Result = RtlAppendUnicodeStringToString(&FsContext->FileName, &FileName);
|
||||||
|
ASSERT(NT_SUCCESS(Result));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* From this point forward we MUST remember to delete the FsContext on error.
|
* From this point forward we MUST remember to delete the FsContext on error.
|
||||||
*/
|
*/
|
||||||
|
@ -334,7 +334,6 @@ typedef struct
|
|||||||
{
|
{
|
||||||
FSRTL_ADVANCED_FCB_HEADER Header;
|
FSRTL_ADVANCED_FCB_HEADER Header;
|
||||||
FSP_FILE_CONTEXT_NONPAGED *NonPaged;
|
FSP_FILE_CONTEXT_NONPAGED *NonPaged;
|
||||||
BOOLEAN HasTrailingBackslash;
|
|
||||||
UNICODE_STRING FileName;
|
UNICODE_STRING FileName;
|
||||||
WCHAR FileNameBuf[];
|
WCHAR FileNameBuf[];
|
||||||
} FSP_FILE_CONTEXT;
|
} FSP_FILE_CONTEXT;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user