Sebastian Lackner : user32/tests: Add test to check ObjectNameInformation for desktop objects.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Dec 4 08:19:27 CST 2015


Module: wine
Branch: master
Commit: 8c4a785daf4b833561054e3556e094ab2ba6bf92
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=8c4a785daf4b833561054e3556e094ab2ba6bf92

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Fri Dec  4 01:18:51 2015 +0100

user32/tests: Add test to check ObjectNameInformation for desktop objects.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/user32/tests/winstation.c | 25 ++++++++++++++++++++-----
 1 file changed, 20 insertions(+), 5 deletions(-)

diff --git a/dlls/user32/tests/winstation.c b/dlls/user32/tests/winstation.c
index 30c56c3..db82026 100644
--- a/dlls/user32/tests/winstation.c
+++ b/dlls/user32/tests/winstation.c
@@ -23,6 +23,9 @@
 #include "wingdi.h"
 #include "winuser.h"
 #include "winnls.h"
+#include "winternl.h"
+
+static NTSTATUS (WINAPI *pNtQueryObject)(HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG, PULONG);
 
 #define DESKTOP_ALL_ACCESS 0x01ff
 
@@ -388,12 +391,14 @@ static void test_enumdesktops(void)
 
 static void test_getuserobjectinformation(void)
 {
-    HDESK desk;
-    WCHAR bufferW[20];
-    char buffer[20];
-    WCHAR foobarTestW[] = {'f','o','o','b','a','r','T','e','s','t',0};
+    WCHAR foobarTestW[] = {'\\','f','o','o','b','a','r','T','e','s','t',0};
     WCHAR DesktopW[] = {'D','e','s','k','t','o','p',0};
+    OBJECT_NAME_INFORMATION *name_info;
+    WCHAR bufferW[20];
+    char buffer[64];
+    NTSTATUS status;
     DWORD size;
+    HDESK desk;
     BOOL ret;
 
     desk = CreateDesktopA("foobarTest", NULL, NULL, 0, DESKTOP_ALL_ACCESS, NULL);
@@ -440,9 +445,16 @@ static void test_getuserobjectinformation(void)
     ok(ret, "GetUserObjectInformationW returned %x\n", ret);
     ok(GetLastError() == 0xdeadbeef, "LastError is set to %08x\n", GetLastError());
 
-    ok(lstrcmpW(bufferW, foobarTestW) == 0, "Buffer is not set to 'foobarTest'\n");
+    ok(lstrcmpW(bufferW, foobarTestW + 1) == 0, "Buffer is not set to 'foobarTest'\n");
     ok(size == 22, "size is set to %d\n", size);  /* 22 bytes in 'foobarTest\0' in Unicode */
 
+    /* ObjectNameInformation does not return the full desktop name */
+    name_info = (OBJECT_NAME_INFORMATION *)buffer;
+    status = pNtQueryObject(desk, ObjectNameInformation, name_info, sizeof(buffer), NULL);
+    ok(!status, "expected STATUS_SUCCESS, got %08x\n", status);
+    todo_wine ok(lstrcmpW(name_info->Name.Buffer, foobarTestW) == 0,
+                 "expected '\\foobarTest', got %s\n", wine_dbgstr_w(name_info->Name.Buffer));
+
     /** Tests for UOI_TYPE **/
 
     /* Get size, test size and return value/error code */
@@ -935,6 +947,9 @@ static void test_foregroundwindow(void)
 
 START_TEST(winstation)
 {
+    HMODULE hntdll = GetModuleHandleA("ntdll.dll");
+    pNtQueryObject = (void *)GetProcAddress(hntdll, "NtQueryObject");
+
     /* Check whether this platform supports WindowStation calls */
 
     SetLastError( 0xdeadbeef );




More information about the wine-cvs mailing list