mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-23 17:03:12 -05:00
tst: winfsp-tests: stream testing
This commit is contained in:
parent
fa6b621042
commit
8e1512c067
@ -708,7 +708,6 @@ static void stream_setsecurity_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoT
|
|||||||
{
|
{
|
||||||
void *memfs = memfs_start_ex(Flags, FileInfoTimeout);
|
void *memfs = memfs_start_ex(Flags, FileInfoTimeout);
|
||||||
|
|
||||||
#if 0
|
|
||||||
static PWSTR Sddl = L"D:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GA;;;WD)";
|
static PWSTR Sddl = L"D:P(A;;GA;;;SY)(A;;GA;;;BA)(A;;GA;;;WD)";
|
||||||
static PWSTR Sddl2 = L"D:P(A;;GA;;;SY)(A;;GA;;;BA)";
|
static PWSTR Sddl2 = L"D:P(A;;GA;;;SY)(A;;GA;;;BA)";
|
||||||
PWSTR ConvertedSddl;
|
PWSTR ConvertedSddl;
|
||||||
@ -718,9 +717,9 @@ static void stream_setsecurity_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoT
|
|||||||
PACL Dacl, Dacl2, Sacl, Sacl2;
|
PACL Dacl, Dacl2, Sacl, Sacl2;
|
||||||
BOOL OwnerDefaulted, GroupDefaulted, DaclDefaulted, DaclPresent, SaclDefaulted, SaclPresent;
|
BOOL OwnerDefaulted, GroupDefaulted, DaclDefaulted, DaclPresent, SaclDefaulted, SaclPresent;
|
||||||
DWORD Length;
|
DWORD Length;
|
||||||
HANDLE Handle;
|
HANDLE Handle, StreamHandle;
|
||||||
BOOLEAN Success;
|
BOOLEAN Success;
|
||||||
WCHAR FilePath[MAX_PATH];
|
WCHAR FilePath[MAX_PATH], StreamPath[MAX_PATH];
|
||||||
|
|
||||||
Success = ConvertStringSecurityDescriptorToSecurityDescriptorW(Sddl, SDDL_REVISION_1, &SecurityDescriptor, 0);
|
Success = ConvertStringSecurityDescriptorToSecurityDescriptorW(Sddl, SDDL_REVISION_1, &SecurityDescriptor, 0);
|
||||||
ASSERT(Success);
|
ASSERT(Success);
|
||||||
@ -728,17 +727,20 @@ static void stream_setsecurity_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoT
|
|||||||
SecurityAttributes.nLength = sizeof SecurityAttributes;
|
SecurityAttributes.nLength = sizeof SecurityAttributes;
|
||||||
SecurityAttributes.lpSecurityDescriptor = SecurityDescriptor;
|
SecurityAttributes.lpSecurityDescriptor = SecurityDescriptor;
|
||||||
|
|
||||||
|
StringCbPrintfW(StreamPath, sizeof StreamPath, L"%s%s\\file0:foo",
|
||||||
|
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||||
|
|
||||||
|
StreamHandle = CreateFileW(StreamPath,
|
||||||
|
GENERIC_READ | GENERIC_WRITE | WRITE_DAC, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, &SecurityAttributes,
|
||||||
|
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
|
||||||
|
ASSERT(INVALID_HANDLE_VALUE != StreamHandle);
|
||||||
|
|
||||||
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\file0",
|
StringCbPrintfW(FilePath, sizeof FilePath, L"%s%s\\file0",
|
||||||
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
Prefix ? L"" : L"\\\\?\\GLOBALROOT", Prefix ? Prefix : memfs_volumename(memfs));
|
||||||
|
|
||||||
Handle = CreateFileW(FilePath,
|
Handle = CreateFileW(FilePath,
|
||||||
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, &SecurityAttributes,
|
GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0,
|
||||||
CREATE_NEW, FILE_ATTRIBUTE_NORMAL, 0);
|
OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
|
||||||
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
|
||||||
CloseHandle(Handle);
|
|
||||||
|
|
||||||
Handle = CreateFileW(FilePath,
|
|
||||||
GENERIC_READ | GENERIC_WRITE | WRITE_DAC, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, 0);
|
|
||||||
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
ASSERT(INVALID_HANDLE_VALUE != Handle);
|
||||||
|
|
||||||
Success = GetKernelObjectSecurity(Handle,
|
Success = GetKernelObjectSecurity(Handle,
|
||||||
@ -769,7 +771,7 @@ static void stream_setsecurity_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoT
|
|||||||
Success = ConvertStringSecurityDescriptorToSecurityDescriptorW(Sddl2, SDDL_REVISION_1, &SecurityDescriptor, 0);
|
Success = ConvertStringSecurityDescriptorToSecurityDescriptorW(Sddl2, SDDL_REVISION_1, &SecurityDescriptor, 0);
|
||||||
ASSERT(Success);
|
ASSERT(Success);
|
||||||
|
|
||||||
Success = SetKernelObjectSecurity(Handle, DACL_SECURITY_INFORMATION, SecurityDescriptor);
|
Success = SetKernelObjectSecurity(StreamHandle, DACL_SECURITY_INFORMATION, SecurityDescriptor);
|
||||||
ASSERT(Success);
|
ASSERT(Success);
|
||||||
|
|
||||||
Success = GetKernelObjectSecurity(Handle,
|
Success = GetKernelObjectSecurity(Handle,
|
||||||
@ -806,10 +808,10 @@ static void stream_setsecurity_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoT
|
|||||||
free(FileSecurityDescriptor);
|
free(FileSecurityDescriptor);
|
||||||
free(FileSecurityDescriptor2);
|
free(FileSecurityDescriptor2);
|
||||||
|
|
||||||
|
CloseHandle(StreamHandle);
|
||||||
CloseHandle(Handle);
|
CloseHandle(Handle);
|
||||||
|
|
||||||
LocalFree(SecurityDescriptor);
|
LocalFree(SecurityDescriptor);
|
||||||
#endif
|
|
||||||
|
|
||||||
memfs_stop(memfs);
|
memfs_stop(memfs);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user