https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cf2cbe6ff6c11d4c9527a212b3d2953ca7e5c988

commit cf2cbe6ff6c11d4c9527a212b3d2953ca7e5c988
Author:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
AuthorDate: Sun Jan 26 23:08:52 2025 +0100
Commit:     Hermès Bélusca-Maïto <hermes.belusca-ma...@reactos.org>
CommitDate: Tue Jan 28 15:29:41 2025 +0100

    [MOUNTMGR_APITEST] Add custom DesiredAccess to GetMountMgrHandle()
    
    This will allow any future tests, employing IOCTL_MOUNTMGR_*
    that require read or write accesses, to also use this helper.
---
 modules/rostests/apitests/mountmgr/QueryDosVolumePaths.c | 2 +-
 modules/rostests/apitests/mountmgr/QueryPoints.c         | 2 +-
 modules/rostests/apitests/mountmgr/precomp.h             | 3 ++-
 modules/rostests/apitests/mountmgr/utils.c               | 5 +++--
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/modules/rostests/apitests/mountmgr/QueryDosVolumePaths.c 
b/modules/rostests/apitests/mountmgr/QueryDosVolumePaths.c
index 138e45bd56e..e7103b121e7 100644
--- a/modules/rostests/apitests/mountmgr/QueryDosVolumePaths.c
+++ b/modules/rostests/apitests/mountmgr/QueryDosVolumePaths.c
@@ -571,7 +571,7 @@ START_TEST(QueryDosVolumePaths)
     HANDLE hFindVolume;
     WCHAR szVolumeName[MAX_PATH];
 
-    MountMgrHandle = GetMountMgrHandle();
+    MountMgrHandle = GetMountMgrHandle(FILE_READ_ATTRIBUTES);
     if (!MountMgrHandle)
     {
         win_skip("MountMgr unavailable: %lu\n", GetLastError());
diff --git a/modules/rostests/apitests/mountmgr/QueryPoints.c 
b/modules/rostests/apitests/mountmgr/QueryPoints.c
index ad6b433878d..a34e27f8ca4 100644
--- a/modules/rostests/apitests/mountmgr/QueryPoints.c
+++ b/modules/rostests/apitests/mountmgr/QueryPoints.c
@@ -36,7 +36,7 @@ START_TEST(QueryPoints)
     MOUNTMGR_MOUNT_POINTS MountPoints;
     PMOUNTMGR_MOUNT_POINTS AllocatedPoints;
 
-    MountMgrHandle = GetMountMgrHandle();
+    MountMgrHandle = GetMountMgrHandle(FILE_READ_ATTRIBUTES);
     if (!MountMgrHandle)
     {
         win_skip("MountMgr unavailable: %lu\n", GetLastError());
diff --git a/modules/rostests/apitests/mountmgr/precomp.h 
b/modules/rostests/apitests/mountmgr/precomp.h
index 8031f379b24..8414c0d9ce1 100644
--- a/modules/rostests/apitests/mountmgr/precomp.h
+++ b/modules/rostests/apitests/mountmgr/precomp.h
@@ -23,7 +23,8 @@
 LPCSTR wine_dbgstr_us(const UNICODE_STRING *us);
 
 HANDLE
-GetMountMgrHandle(VOID);
+GetMountMgrHandle(
+    _In_ ACCESS_MASK DesiredAccess);
 
 VOID
 DumpBuffer(
diff --git a/modules/rostests/apitests/mountmgr/utils.c 
b/modules/rostests/apitests/mountmgr/utils.c
index 7fa0794d2aa..10f4b527f16 100644
--- a/modules/rostests/apitests/mountmgr/utils.c
+++ b/modules/rostests/apitests/mountmgr/utils.c
@@ -19,7 +19,8 @@ LPCSTR wine_dbgstr_us(const UNICODE_STRING *us)
  * The handle should be closed with NtClose() once it is no longer in use.
  **/
 HANDLE
-GetMountMgrHandle(VOID)
+GetMountMgrHandle(
+    _In_ ACCESS_MASK DesiredAccess)
 {
     NTSTATUS Status;
     UNICODE_STRING MountMgrDevice;
@@ -34,7 +35,7 @@ GetMountMgrHandle(VOID)
                                NULL,
                                NULL);
     Status = NtOpenFile(&MountMgrHandle,
-                        FILE_READ_ATTRIBUTES | SYNCHRONIZE,
+                        DesiredAccess | SYNCHRONIZE,
                         &ObjectAttributes,
                         &IoStatusBlock,
                         FILE_SHARE_READ | FILE_SHARE_WRITE,

Reply via email to