mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 08:53:01 -05:00
winfsp-tests: memfs: testing
This commit is contained in:
parent
8b1bcf3583
commit
58b16cdaae
@ -158,20 +158,17 @@ static NTSTATUS GetSecurity(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
if (0 != PFileAttributes)
|
if (0 != PFileAttributes)
|
||||||
*PFileAttributes = FileNode->FileAttributes;
|
*PFileAttributes = FileNode->FileAttributes;
|
||||||
|
|
||||||
if (0 == SecurityDescriptor)
|
|
||||||
{
|
|
||||||
if (0 != PSecurityDescriptorSize)
|
if (0 != PSecurityDescriptorSize)
|
||||||
|
{
|
||||||
|
if (FileNode->FileSecuritySize > *PSecurityDescriptorSize)
|
||||||
|
{
|
||||||
*PSecurityDescriptorSize = FileNode->FileSecuritySize;
|
*PSecurityDescriptorSize = FileNode->FileSecuritySize;
|
||||||
|
return STATUS_BUFFER_OVERFLOW;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
*PSecurityDescriptorSize = FileNode->FileSecuritySize;
|
||||||
if (0 != PSecurityDescriptorSize)
|
if (0 != SecurityDescriptor)
|
||||||
{
|
|
||||||
if (0 < FileNode->FileSecuritySize &&
|
|
||||||
FileNode->FileSecuritySize <= *PSecurityDescriptorSize)
|
|
||||||
memcpy(SecurityDescriptor, FileNode->FileSecurity, FileNode->FileSecuritySize);
|
memcpy(SecurityDescriptor, FileNode->FileSecurity, FileNode->FileSecuritySize);
|
||||||
*PSecurityDescriptorSize = FileNode->FileSecuritySize;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
@ -211,11 +208,12 @@ static NTSTATUS Create(FSP_FILE_SYSTEM *FileSystem,
|
|||||||
{
|
{
|
||||||
FileNode->FileSecuritySize = GetSecurityDescriptorLength(SecurityDescriptor);
|
FileNode->FileSecuritySize = GetSecurityDescriptorLength(SecurityDescriptor);
|
||||||
FileNode->FileSecurity = (PSECURITY_DESCRIPTOR)malloc(FileNode->FileSecuritySize);
|
FileNode->FileSecurity = (PSECURITY_DESCRIPTOR)malloc(FileNode->FileSecuritySize);
|
||||||
if (0 == FileNode->FileSecuritySize)
|
if (0 == FileNode->FileSecurity)
|
||||||
{
|
{
|
||||||
MemfsFileNodeDelete(FileNode);
|
MemfsFileNodeDelete(FileNode);
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
memcpy(FileNode->FileSecurity, SecurityDescriptor, FileNode->FileSecuritySize);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileNode->AllocationSize = FSP_FSCTL_ALIGN_UP((ULONG)AllocationSize, MEMFS_SECTOR_SIZE);
|
FileNode->AllocationSize = FSP_FSCTL_ALIGN_UP((ULONG)AllocationSize, MEMFS_SECTOR_SIZE);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user