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

commit d788a52c79f5822cc8a21920de421b77519ebd94
Author: Pierre Schweitzer <pie...@reactos.org>
AuthorDate: Sun Oct 8 10:12:08 2017 +0200

    [KERNEL32_APITEST]: Add tests for IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME 
that show its usage is "one-shot". Once queried, it gets forgotten.
---
 .../rostests/apitests/kernel32/DeviceIoControl.c   | 37 ++++++++++++++++++++++
 1 file changed, 37 insertions(+)

diff --git a/modules/rostests/apitests/kernel32/DeviceIoControl.c 
b/modules/rostests/apitests/kernel32/DeviceIoControl.c
index faa10d5465..be3086edda 100644
--- a/modules/rostests/apitests/kernel32/DeviceIoControl.c
+++ b/modules/rostests/apitests/kernel32/DeviceIoControl.c
@@ -183,6 +183,42 @@ QueryUniqueId(VOID)
     HeapFree(GetProcessHeap(), 0, AllocatedMUI);
 }
 
+static
+VOID
+QuerySuggestedLinkName(VOID)
+{
+    UINT Ret;
+    DWORD Size, Error;
+    MOUNTDEV_SUGGESTED_LINK_NAME MSLN;
+
+    Size = 0;
+    Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME, 
NULL, 0, &MSLN, sizeof(MSLN) - 1, &Size, NULL);
+    ok_type(Ret == 0, "DeviceIoControl succeed\n");
+    Error = GetLastError();
+    if (DriveType == DRIVE_FIXED)
+    {
+        ok_type(Error == ERROR_INVALID_PARAMETER, "Expecting 
ERROR_INVALID_PARAMETER, got %ld\n", Error);
+    }
+    else
+    {
+        ok_type(Error == ERROR_INSUFFICIENT_BUFFER, "Expecting 
ERROR_INSUFFICIENT_BUFFER, got %ld\n", Error);
+    }
+    ok_type(Size == 0, "Invalid output size: %ld\n", Size);
+
+    Ret = DeviceIoControl(Device, IOCTL_MOUNTDEV_QUERY_SUGGESTED_LINK_NAME, 
NULL, 0, &MSLN, sizeof(MSLN), &Size, NULL);
+    ok_type(Ret == 0, "DeviceIoControl succeed\n");
+    Error = GetLastError();
+    if (DriveType == DRIVE_FIXED)
+    {
+        ok_type(Error == ERROR_NOT_FOUND, "Expecting ERROR_NOT_FOUND, got 
%ld\n", Error);
+    }
+    else
+    {
+        ok_type(Error == ERROR_FILE_NOT_FOUND, "Expecting 
ERROR_FILE_NOT_FOUND, got %ld\n", Error);
+    }
+    ok_type(Size == 0, "Invalid output size: %ld\n", Size);
+}
+
 START_TEST(DeviceIoControl)
 {
     UINT Ret;
@@ -221,6 +257,7 @@ START_TEST(DeviceIoControl)
                 {
                     QueryDeviceName();
                     QueryUniqueId();
+                    QuerySuggestedLinkName();
                 }
 
                 CloseHandle(Device);

Reply via email to