GetUserObjectInformation UOI_USER_SID

Wolfgang Schwotzer wolfgang.schwotzer at gmx.net
Thu Jul 22 13:50:20 CDT 2010


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

diff --git a/dlls/user32/winstation.c b/dlls/user32/winstation.c
index c6c52b7..a599df8 100644
--- a/dlls/user32/winstation.c
+++ b/dlls/user32/winstation.c
@@ -577,8 +577,49 @@ 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;
+            LPWSTR user_name;
+            DWORD size, dom_size;
+
+            size = 0;
+            GetUserNameW( NULL, &size );
+
+            user_name = HeapAlloc( GetProcessHeap(), 0, (size + 1) * sizeof(WCHAR) );
+            if (!user_name) {
+                SetLastError(ERROR_OUTOFMEMORY);
+                return FALSE;
+            }
+
+            if (!GetUserNameW( user_name, &size ))
+            {
+                HeapFree( GetProcessHeap(), 0, user_name );
+                return FALSE;
+            }
+
+            size = 0;
+            dom_size = 0;
+            LookupAccountNameW( NULL, user_name, NULL, &size, NULL, &dom_size, &use );
+
+            *needed = size;
+            if (info == NULL)
+            {
+                HeapFree( GetProcessHeap(), 0, user_name );
+                return TRUE;
+            }
+
+            if (len < size)
+            {
+                SetLastError( ERROR_NOT_ENOUGH_MEMORY );
+                HeapFree( GetProcessHeap(), 0, user_name );
+                return FALSE;
+            }
+
+            dom_size = 0;
+            ret = LookupAccountNameW( NULL, user_name, (PSID)info, &size, NULL, &dom_size, &use );
+            HeapFree( GetProcessHeap(), 0, user_name );
+            return ret;
+        }
     default:
         SetLastError( ERROR_INVALID_PARAMETER );
         return FALSE;
-- 
1.6.3.3


--------------040502010005050104090107--



More information about the wine-patches mailing list