mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 14:37:45 +00:00
[MOUNTMGR_APITEST] Add an extra test for query failure
This commit is contained in:
parent
80c0b083d8
commit
8b0086e465
|
@ -10,9 +10,12 @@
|
||||||
START_TEST(QueryPoints)
|
START_TEST(QueryPoints)
|
||||||
{
|
{
|
||||||
BOOL Ret;
|
BOOL Ret;
|
||||||
DWORD BytesReturned;
|
|
||||||
HANDLE MountMgrHandle;
|
HANDLE MountMgrHandle;
|
||||||
MOUNTMGR_MOUNT_POINT SinglePoint;
|
DWORD BytesReturned, Drives, i;
|
||||||
|
struct {
|
||||||
|
MOUNTMGR_MOUNT_POINT;
|
||||||
|
WCHAR Buffer[sizeof(L"\\DosDevice\\A:")];
|
||||||
|
} SinglePoint;
|
||||||
MOUNTMGR_MOUNT_POINTS MountPoints;
|
MOUNTMGR_MOUNT_POINTS MountPoints;
|
||||||
PMOUNTMGR_MOUNT_POINTS AllocatedPoints;
|
PMOUNTMGR_MOUNT_POINTS AllocatedPoints;
|
||||||
|
|
||||||
|
@ -26,7 +29,7 @@ START_TEST(QueryPoints)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ZeroMemory(&SinglePoint, sizeof(MOUNTMGR_MOUNT_POINT));
|
ZeroMemory(&SinglePoint, sizeof(SinglePoint));
|
||||||
|
|
||||||
Ret = DeviceIoControl(MountMgrHandle, IOCTL_MOUNTMGR_QUERY_POINTS,
|
Ret = DeviceIoControl(MountMgrHandle, IOCTL_MOUNTMGR_QUERY_POINTS,
|
||||||
&SinglePoint, sizeof(MOUNTMGR_MOUNT_POINT),
|
&SinglePoint, sizeof(MOUNTMGR_MOUNT_POINT),
|
||||||
|
@ -39,9 +42,9 @@ START_TEST(QueryPoints)
|
||||||
if (AllocatedPoints == NULL)
|
if (AllocatedPoints == NULL)
|
||||||
{
|
{
|
||||||
win_skip("Insufficiant memory\n");
|
win_skip("Insufficiant memory\n");
|
||||||
goto Done;
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
Ret = DeviceIoControl(MountMgrHandle, IOCTL_MOUNTMGR_QUERY_POINTS,
|
Ret = DeviceIoControl(MountMgrHandle, IOCTL_MOUNTMGR_QUERY_POINTS,
|
||||||
&SinglePoint, sizeof(MOUNTMGR_MOUNT_POINT),
|
&SinglePoint, sizeof(MOUNTMGR_MOUNT_POINT),
|
||||||
AllocatedPoints, MountPoints.Size,
|
AllocatedPoints, MountPoints.Size,
|
||||||
|
@ -49,6 +52,42 @@ START_TEST(QueryPoints)
|
||||||
ok(Ret == TRUE, "IOCTL unexpectedly failed %lx\n", GetLastError());
|
ok(Ret == TRUE, "IOCTL unexpectedly failed %lx\n", GetLastError());
|
||||||
|
|
||||||
RtlFreeHeap(RtlGetProcessHeap(), 0, AllocatedPoints);
|
RtlFreeHeap(RtlGetProcessHeap(), 0, AllocatedPoints);
|
||||||
|
}
|
||||||
|
|
||||||
|
Drives = GetLogicalDrives();
|
||||||
|
if (Drives == 0)
|
||||||
|
{
|
||||||
|
win_skip("Drives map unavailable: %lx\n", GetLastError());
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (i = 0; i < 26; i++)
|
||||||
|
{
|
||||||
|
if (!(Drives & (1 << i)))
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 26)
|
||||||
|
{
|
||||||
|
win_skip("All the drive letters are in use, skipping\n");
|
||||||
|
goto Done;
|
||||||
|
}
|
||||||
|
|
||||||
|
SinglePoint.SymbolicLinkNameOffset = sizeof(MOUNTMGR_MOUNT_POINT);
|
||||||
|
SinglePoint.SymbolicLinkNameLength = sizeof(L"\\DosDevice\\A:") - sizeof(UNICODE_NULL);
|
||||||
|
StringCbPrintfW((PWSTR)((ULONG_PTR)&SinglePoint + sizeof(MOUNTMGR_MOUNT_POINT)),
|
||||||
|
sizeof(L"\\DosDevice\\A:"),
|
||||||
|
L"\\DosDevice\\%C:",
|
||||||
|
i + L'A');
|
||||||
|
|
||||||
|
Ret = DeviceIoControl(MountMgrHandle, IOCTL_MOUNTMGR_QUERY_POINTS,
|
||||||
|
&SinglePoint, sizeof(SinglePoint),
|
||||||
|
&MountPoints, sizeof(MOUNTMGR_MOUNT_POINTS),
|
||||||
|
&BytesReturned, NULL);
|
||||||
|
ok(Ret == FALSE, "IOCTL unexpectedly succeed\n");
|
||||||
|
ok(GetLastError() == ERROR_FILE_NOT_FOUND, "Unexcepted failure: %lx\n", GetLastError());
|
||||||
|
|
||||||
Done:
|
Done:
|
||||||
CloseHandle(MountMgrHandle);
|
CloseHandle(MountMgrHandle);
|
||||||
|
|
Loading…
Reference in a new issue