GetUserObjectInformation UOI_USER_SID (try 2)

Wolfgang Schwotzer wolfgang.schwotzer at gmx.net
Sat Jul 24 10:12:05 CDT 2010


---
 dlls/user32/winstation.c |   42 ++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 40 insertions(+), 2 deletions(-)

diff --git a/dlls/user32/winstation.c b/dlls/user32/winstation.c
index c6c52b7..0748d74 100644
--- a/dlls/user32/winstation.c
+++ b/dlls/user32/winstation.c
@@ -32,6 +32,7 @@
 #include "wine/unicode.h"
 #include "wine/debug.h"
 #include "user_private.h"
+#include "lmcons.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(winstation);
 
@@ -577,8 +578,45 @@ BOOL WINAPI GetUserObjectInformationW( HANDLE handle, INT index, LPVOID info, DW
         return ret;
 
     case UOI_USER_SID:
-        FIXME( "not supported index %d\n", index );
-        /* fall through */
+        {
+            SID_NAME_USE use;
+            DWORD size = UNLEN+1;
+            WCHAR user_name[size];
+            DWORD dom_size;
+            LPWSTR dom_name = NULL;
+
+            if (!GetUserNameW( user_name, &size ))
+                return FALSE;
+
+            size = 0;
+            dom_size = 0;
+            if (!LookupAccountNameW( NULL, user_name, NULL, &size, NULL, &dom_size, &use ) &&
+                GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+            {
+                return FALSE;
+            }
+
+            *needed = size;
+            if (info == NULL)
+                return TRUE;
+
+            if (len < size)
+            {
+                SetLastError( ERROR_INSUFFICIENT_BUFFER );
+                return FALSE;
+            }
+
+            dom_name = HeapAlloc( GetProcessHeap(), 0, dom_size * sizeof(WCHAR) );
+            if (!dom_name)
+            {
+                SetLastError( ERROR_OUTOFMEMORY );
+                return FALSE;
+            }
+
+            ret = LookupAccountNameW( NULL, user_name, (PSID)info, &size, dom_name, &dom_size, &use );
+            HeapFree( GetProcessHeap(), 0, dom_name );
+            return ret;
+        }
     default:
         SetLastError( ERROR_INVALID_PARAMETER );
         return FALSE;
-- 
1.6.3.3


--------------000703080609030903020109--



More information about the wine-patches mailing list