[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.
This commit is contained in:
Hermès Bélusca-Maïto 2025-01-26 23:08:52 +01:00
parent 8d91d4c8e1
commit cf2cbe6ff6
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0
4 changed files with 7 additions and 5 deletions

View file

@ -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());

View file

@ -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());

View file

@ -23,7 +23,8 @@
LPCSTR wine_dbgstr_us(const UNICODE_STRING *us);
HANDLE
GetMountMgrHandle(VOID);
GetMountMgrHandle(
_In_ ACCESS_MASK DesiredAccess);
VOID
DumpBuffer(

View file

@ -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,