[USRMGR]
authorEric Kohl <eric.kohl@reactos.org>
Sun, 15 Sep 2013 14:20:58 +0000 (14:20 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sun, 15 Sep 2013 14:20:58 +0000 (14:20 +0000)
Use NetLocalGroupGetMembers level 2 instead of level 1 in order to display the domain names of well-known groups in the group membership list. Skip the domain name for other account types.

svn path=/trunk/; revision=60134

reactos/dll/cpl/usrmgr/groupprops.c

index d34acd3..a455446 100644 (file)
@@ -389,7 +389,7 @@ GetGeneralGroupData(HWND hwndDlg,
                     PGENERAL_GROUP_DATA pGroupData)
 {
     PLOCALGROUP_INFO_1 groupInfo = NULL;
                     PGENERAL_GROUP_DATA pGroupData)
 {
     PLOCALGROUP_INFO_1 groupInfo = NULL;
-    PLOCALGROUP_MEMBERS_INFO_1 membersInfo = NULL;
+    PLOCALGROUP_MEMBERS_INFO_2 membersInfo = NULL;
     DWORD dwRead;
     DWORD dwTotal;
     DWORD_PTR resumeHandle = 0;
     DWORD dwRead;
     DWORD dwTotal;
     DWORD_PTR resumeHandle = 0;
@@ -435,7 +435,7 @@ GetGeneralGroupData(HWND hwndDlg,
     NetApiBufferFree(groupInfo);
 
     /* Set group members */
     NetApiBufferFree(groupInfo);
 
     /* Set group members */
-    NetLocalGroupGetMembers(NULL, pGroupData->szGroupName, 1, (LPBYTE*)&membersInfo,
+    NetLocalGroupGetMembers(NULL, pGroupData->szGroupName, 2, (LPBYTE*)&membersInfo,
                             MAX_PREFERRED_LENGTH, &dwRead, &dwTotal,
                             &resumeHandle);
 
                             MAX_PREFERRED_LENGTH, &dwRead, &dwTotal,
                             &resumeHandle);
 
@@ -443,32 +443,45 @@ GetGeneralGroupData(HWND hwndDlg,
     {
         ZeroMemory(&lvi, sizeof(lvi));
         lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
     {
         ZeroMemory(&lvi, sizeof(lvi));
         lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
-        lvi.pszText = membersInfo[i].lgrmi1_name;
         lvi.state = 0;
         lvi.state = 0;
-        if (membersInfo[i].lgrmi1_sidusage == SidTypeGroup ||
-            membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup)
+        if (membersInfo[i].lgrmi2_sidusage == SidTypeGroup ||
+            membersInfo[i].lgrmi2_sidusage == SidTypeWellKnownGroup)
         {
             lvi.iImage = 0;
         }
         {
             lvi.iImage = 0;
         }
-        else if (membersInfo[i].lgrmi1_sidusage == SidTypeUser)
+        else if (membersInfo[i].lgrmi2_sidusage == SidTypeUser)
         {
             /* FIXME: handle locked user properly! */
             lvi.iImage = 1;
         }
 
         {
             /* FIXME: handle locked user properly! */
             lvi.iImage = 1;
         }
 
-        if (membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup)
+        if (membersInfo[i].lgrmi2_sidusage == SidTypeWellKnownGroup)
         {
             TCHAR szSid[256];
 
         {
             TCHAR szSid[256];
 
-            GetTextSid(membersInfo[i].lgrmi1_sid, szSid);
+            GetTextSid(membersInfo[i].lgrmi2_sid, szSid);
 
             wsprintf(szGroupName,
                      TEXT("%s (%s)"),
 
             wsprintf(szGroupName,
                      TEXT("%s (%s)"),
-                     membersInfo[i].lgrmi1_name,
+                     membersInfo[i].lgrmi2_domainandname,
                      szSid);
 
             lvi.pszText = szGroupName;
         }
                      szSid);
 
             lvi.pszText = szGroupName;
         }
+        else
+        {
+            LPWSTR ptr;
+
+            ptr = wcschr(membersInfo[i].lgrmi2_domainandname, L'\\');
+            if (ptr != NULL)
+            {
+                lvi.pszText = ++ptr;
+            }
+            else
+            {
+                lvi.pszText = membersInfo[i].lgrmi2_domainandname;
+            }
+        }
 
         (void)ListView_InsertItem(hwndLV, &lvi);
     }
 
         (void)ListView_InsertItem(hwndLV, &lvi);
     }