Signed-off-by: Zebediah Figura <zfigura(a)codeweavers.com>
---
dlls/kernel32/tests/volume.c | 94 +++++++++++++++++++++++++++++++++++-
include/ddk/mountmgr.h | 3 ++
2 files changed, 95 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c
index ed3897a6b94..444ae7ea795 100644
--- a/dlls/kernel32/tests/volume.c
+++ b/dlls/kernel32/tests/volume.c
@@ -18,14 +18,17 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
-#include "wine/test.h"
+#include <stdio.h>
+#include "ntstatus.h"
+#define WIN32_NO_STATUS
+#include "windef.h"
#include "winbase.h"
#include "winioctl.h"
#include "ntddstor.h"
#include "winternl.h"
-#include <stdio.h>
#include "ddk/ntddcdvd.h"
#include "ddk/mountmgr.h"
+#include "wine/test.h"
#include <pshpack1.h>
struct COMPLETE_DVD_LAYER_DESCRIPTOR
@@ -1619,6 +1622,92 @@ static void test_GetVolumeInformationByHandle(void)
CloseHandle( file );
}
+static void test_mountmgr_query_points(void)
+{
+ char input_buffer[64], output_buffer[2048];
+ MOUNTMGR_MOUNT_POINTS *output = (MOUNTMGR_MOUNT_POINTS *)output_buffer;
+ MOUNTMGR_MOUNT_POINT *input = (MOUNTMGR_MOUNT_POINT *)input_buffer;
+ IO_STATUS_BLOCK io;
+ NTSTATUS status;
+ unsigned int i;
+ HANDLE file;
+
+ file = CreateFileW( MOUNTMGR_DOS_DEVICE_NAME, 0, 0, NULL, OPEN_EXISTING, 0, NULL );
+ ok(file != INVALID_HANDLE_VALUE, "failed to open mountmgr, error %u\n", GetLastError());
+
+ io.Status = 0xdeadf00d;
+ io.Information = 0xdeadf00d;
+ status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
+ IOCTL_MOUNTMGR_QUERY_POINTS, NULL, 0, NULL, 0 );
+ ok(status == STATUS_INVALID_PARAMETER, "got %#x\n", status);
+ todo_wine ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
+ todo_wine ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
+
+ memset( input, 0, sizeof(*input) );
+
+ io.Status = 0xdeadf00d;
+ io.Information = 0xdeadf00d;
+ status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
+ IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input) - 1, NULL, 0 );
+ todo_wine ok(status == STATUS_INVALID_PARAMETER, "got %#x\n", status);
+ todo_wine ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
+ todo_wine ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
+
+ io.Status = 0xdeadf00d;
+ io.Information = 0xdeadf00d;
+ status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
+ IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input), NULL, 0 );
+ todo_wine ok(status == STATUS_INVALID_PARAMETER, "got %#x\n", status);
+ todo_wine ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
+ todo_wine ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
+
+ io.Status = 0xdeadf00d;
+ io.Information = 0xdeadf00d;
+ memset(output_buffer, 0xcc, sizeof(output_buffer));
+ status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
+ IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input), output, sizeof(*output) - 1 );
+ todo_wine ok(status == STATUS_INVALID_PARAMETER, "got %#x\n", status);
+ todo_wine ok(io.Status == 0xdeadf00d, "got status %#x\n", io.Status);
+ todo_wine ok(io.Information == 0xdeadf00d, "got information %#Ix\n", io.Information);
+ todo_wine ok(output->Size == 0xcccccccc, "got size %u\n", output->Size);
+ ok(output->NumberOfMountPoints == 0xcccccccc, "got count %u\n", output->NumberOfMountPoints);
+
+ io.Status = 0xdeadf00d;
+ io.Information = 0xdeadf00d;
+ memset(output_buffer, 0xcc, sizeof(output_buffer));
+ status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
+ IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input), output, sizeof(*output) );
+ todo_wine ok(status == STATUS_BUFFER_OVERFLOW, "got %#x\n", status);
+ todo_wine ok(io.Status == STATUS_BUFFER_OVERFLOW, "got status %#x\n", io.Status);
+ todo_wine ok(io.Information == offsetof(MOUNTMGR_MOUNT_POINTS, MountPoints[0]), "got information %#Ix\n", io.Information);
+ ok(output->Size > offsetof(MOUNTMGR_MOUNT_POINTS, MountPoints[0]), "got size %u\n", output->Size);
+ todo_wine ok(output->NumberOfMountPoints && output->NumberOfMountPoints != 0xcccccccc,
+ "got count %u\n", output->NumberOfMountPoints);
+
+ io.Status = 0xdeadf00d;
+ io.Information = 0xdeadf00d;
+ memset(output_buffer, 0xcc, sizeof(output_buffer));
+ status = NtDeviceIoControlFile( file, NULL, NULL, NULL, &io,
+ IOCTL_MOUNTMGR_QUERY_POINTS, input, sizeof(*input), output, sizeof(output_buffer) );
+ ok(!status, "got %#x\n", status);
+ ok(!io.Status, "got status %#x\n", io.Status);
+ ok(io.Information == output->Size, "got size %u, information %#Ix\n", output->Size, io.Information);
+ ok(output->Size > offsetof(MOUNTMGR_MOUNT_POINTS, MountPoints[0]), "got size %u\n", output->Size);
+ ok(output->NumberOfMountPoints && output->NumberOfMountPoints != 0xcccccccc,
+ "got count %u\n", output->NumberOfMountPoints);
+
+ for (i = 0; i < output->NumberOfMountPoints; ++i)
+ {
+ const MOUNTMGR_MOUNT_POINT *point = &output->MountPoints[i];
+
+ ok(!point->Reserved1, "got Reserved1 %#x\n", point->Reserved1);
+ ok(!point->Reserved2, "got Reserved2 %#x\n", point->Reserved2);
+ ok(!point->Reserved3, "got Reserved3 %#x\n", point->Reserved3);
+ }
+
+ CloseHandle( file );
+}
+
START_TEST(volume)
{
hdll = GetModuleHandleA("kernel32.dll");
@@ -1650,4 +1739,5 @@ START_TEST(volume)
test_cdrom_ioctl();
test_mounted_folder();
test_GetVolumeInformationByHandle();
+ test_mountmgr_query_points();
}
diff --git a/include/ddk/mountmgr.h b/include/ddk/mountmgr.h
index 6cf870f4f34..d4363f917b8 100644
--- a/include/ddk/mountmgr.h
+++ b/include/ddk/mountmgr.h
@@ -141,10 +141,13 @@ typedef struct _MOUNTMGR_MOUNT_POINT
{
ULONG SymbolicLinkNameOffset;
USHORT SymbolicLinkNameLength;
+ USHORT Reserved1;
ULONG UniqueIdOffset;
USHORT UniqueIdLength;
+ USHORT Reserved2;
ULONG DeviceNameOffset;
USHORT DeviceNameLength;
+ USHORT Reserved3;
} MOUNTMGR_MOUNT_POINT, *PMOUNTMGR_MOUNT_POINT;
typedef struct _MOUNTMGR_MOUNT_POINTS
--
2.33.0