- Add a property sheet for user groups. Settings are visible but cannot be changed...
authorEric Kohl <eric.kohl@reactos.org>
Sat, 31 May 2008 19:48:44 +0000 (19:48 +0000)
committerEric Kohl <eric.kohl@reactos.org>
Sat, 31 May 2008 19:48:44 +0000 (19:48 +0000)
- Add missing SVN properties.

svn path=/trunk/; revision=33790

reactos/dll/cpl/usrmgr/extra.c
reactos/dll/cpl/usrmgr/groupprops.c [new file with mode: 0644]
reactos/dll/cpl/usrmgr/groups.c
reactos/dll/cpl/usrmgr/lang/en-US.rc
reactos/dll/cpl/usrmgr/misc.c
reactos/dll/cpl/usrmgr/resource.h
reactos/dll/cpl/usrmgr/userprops.c
reactos/dll/cpl/usrmgr/usrmgr.c
reactos/dll/cpl/usrmgr/usrmgr.def
reactos/dll/cpl/usrmgr/usrmgr.h
reactos/dll/cpl/usrmgr/usrmgr.rbuild

index 048df17..c057b13 100644 (file)
@@ -1,33 +1,33 @@
-/* $Id$\r
- *\r
- * COPYRIGHT:       See COPYING in the top level directory\r
- * PROJECT:         ReactOS User Manager Control Panel\r
- * FILE:            dll/cpl/usrmgr/extra.c\r
- * PURPOSE:         Extra property page\r
- *\r
- * PROGRAMMERS:     Eric Kohl\r
- */\r
-\r
-#include "usrmgr.h"\r
-\r
-INT_PTR CALLBACK\r
-ExtraPageProc(HWND hwndDlg,\r
-              UINT uMsg,\r
-              WPARAM wParam,\r
-              LPARAM lParam)\r
-{\r
-    UNREFERENCED_PARAMETER(lParam);\r
-    UNREFERENCED_PARAMETER(wParam);\r
-    UNREFERENCED_PARAMETER(hwndDlg);\r
-\r
-    switch (uMsg)\r
-    {\r
-        case WM_INITDIALOG:\r
-            break;\r
-\r
-        case WM_COMMAND:\r
-            break;\r
-    }\r
-\r
-    return FALSE;\r
-}\r
+/* $Id$
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS User Manager Control Panel
+ * FILE:            dll/cpl/usrmgr/extra.c
+ * PURPOSE:         Extra property page
+ *
+ * PROGRAMMERS:     Eric Kohl
+ */
+
+#include "usrmgr.h"
+
+INT_PTR CALLBACK
+ExtraPageProc(HWND hwndDlg,
+              UINT uMsg,
+              WPARAM wParam,
+              LPARAM lParam)
+{
+    UNREFERENCED_PARAMETER(lParam);
+    UNREFERENCED_PARAMETER(wParam);
+    UNREFERENCED_PARAMETER(hwndDlg);
+
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            break;
+
+        case WM_COMMAND:
+            break;
+    }
+
+    return FALSE;
+}
diff --git a/reactos/dll/cpl/usrmgr/groupprops.c b/reactos/dll/cpl/usrmgr/groupprops.c
new file mode 100644 (file)
index 0000000..29d8612
--- /dev/null
@@ -0,0 +1,155 @@
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS User Manager Control Panel
+ * FILE:            dll/cpl/usrmgr/groupprops.c
+ * PURPOSE:         Group property sheet
+ *
+ * PROGRAMMERS:     Eric Kohl
+ */
+
+#include "usrmgr.h"
+
+
+static VOID
+GetGroupData(HWND hwndDlg, LPTSTR lpGroupName)
+{
+    PLOCALGROUP_INFO_1 groupInfo = NULL;
+    PLOCALGROUP_MEMBERS_INFO_1 membersInfo = NULL;
+    DWORD dwRead;
+    DWORD dwTotal;
+    DWORD_PTR resumeHandle = 0;
+    DWORD i;
+    LV_ITEM lvi;
+    HWND hwndLV;
+    LV_COLUMN column;
+    RECT rect;
+    HIMAGELIST hImgList;
+    HICON hIcon;
+
+    hwndLV = GetDlgItem(hwndDlg, IDC_GROUP_GENERAL_MEMBERS);
+
+    /* Create the image list */
+    hImgList = ImageList_Create(16, 16, ILC_COLOR8 | ILC_MASK, 5, 5);
+    hIcon = LoadImage(hApplet, MAKEINTRESOURCE(IDI_USER), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+    ImageList_AddIcon(hImgList, hIcon);
+    hIcon = LoadImage(hApplet, MAKEINTRESOURCE(IDI_GROUP), IMAGE_ICON, 16, 16, LR_DEFAULTCOLOR);
+    ImageList_AddIcon(hImgList, hIcon);
+    DestroyIcon(hIcon);
+
+    (void)ListView_SetImageList(hwndLV, hImgList, LVSIL_SMALL);
+
+    /* Set the list column */
+    GetClientRect(hwndLV, &rect);
+
+    memset(&column, 0x00, sizeof(column));
+    column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM;
+    column.fmt = LVCFMT_LEFT;
+    column.cx = (INT)(rect.right - rect.left);
+    column.iSubItem = 0;
+    (void)ListView_InsertColumn(hwndLV, 0, &column);
+
+    /* Set group name */
+    SetDlgItemText(hwndDlg, IDC_GROUP_GENERAL_NAME, lpGroupName);
+
+    /* Set group description */
+    NetLocalGroupGetInfo(NULL, lpGroupName, 1, (LPBYTE*)&groupInfo);
+    SetDlgItemText(hwndDlg, IDC_GROUP_GENERAL_DESCRIPTION, groupInfo->lgrpi1_comment);
+    NetApiBufferFree(groupInfo);
+
+    /* Set group members */
+    NetLocalGroupGetMembers(NULL, lpGroupName, 1, (LPBYTE*)&membersInfo,
+                            MAX_PREFERRED_LENGTH, &dwRead, &dwTotal,
+                            &resumeHandle);
+
+    for (i = 0; i < dwRead; i++)
+    {
+        ZeroMemory(&lvi, sizeof(lvi));
+        lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
+        lvi.pszText = membersInfo[i].lgrmi1_name;
+        lvi.state = 0;
+        lvi.iImage = (membersInfo[i].lgrmi1_sidusage == SidTypeGroup ||
+                      membersInfo[i].lgrmi1_sidusage == SidTypeWellKnownGroup) ? 1 : 0;
+
+        (void)ListView_InsertItem(hwndLV, &lvi);
+    }
+
+    NetApiBufferFree(membersInfo);
+}
+
+
+INT_PTR CALLBACK
+GroupGeneralPageProc(HWND hwndDlg,
+                     UINT uMsg,
+                     WPARAM wParam,
+                     LPARAM lParam)
+{
+    UNREFERENCED_PARAMETER(lParam);
+    UNREFERENCED_PARAMETER(wParam);
+    UNREFERENCED_PARAMETER(hwndDlg);
+
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            GetGroupData(hwndDlg,
+                         (LPTSTR)((PROPSHEETPAGE *)lParam)->lParam);
+            break;
+
+        case WM_COMMAND:
+            break;
+
+        case WM_DESTROY:
+            break;
+    }
+
+    return FALSE;
+}
+
+
+static VOID
+InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc, LPTSTR pszGroup)
+{
+    ZeroMemory(psp, sizeof(PROPSHEETPAGE));
+    psp->dwSize = sizeof(PROPSHEETPAGE);
+    psp->dwFlags = PSP_DEFAULT;
+    psp->hInstance = hApplet;
+    psp->pszTemplate = MAKEINTRESOURCE(idDlg);
+    psp->pfnDlgProc = DlgProc;
+    psp->lParam = (LPARAM)pszGroup;
+}
+
+
+VOID
+GroupProperties(HWND hwndDlg)
+{
+    PROPSHEETPAGE psp[1];
+    PROPSHEETHEADER psh;
+    TCHAR szGroupName[UNLEN];
+    INT nItem;
+    HWND hwndLV;
+
+    hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
+    nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
+    if (nItem == -1)
+        return;
+
+    /* Get the new user name */
+    ListView_GetItemText(hwndLV,
+                         nItem, 0,
+                         szGroupName,
+                         UNLEN);
+
+    ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
+    psh.dwSize = sizeof(PROPSHEETHEADER);
+    psh.dwFlags =  PSH_PROPSHEETPAGE | PSH_PROPTITLE;
+    psh.hwndParent = hwndDlg;
+    psh.hInstance = hApplet;
+    psh.hIcon = NULL;
+    psh.pszCaption = szGroupName;
+    psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
+    psh.nStartPage = 0;
+    psh.ppsp = psp;
+
+    InitPropSheetPage(&psp[0], IDD_GROUP_GENERAL, (DLGPROC)GroupGeneralPageProc, szGroupName);
+
+    PropertySheet(&psh);
+}
index d29cef4..0960332 100644 (file)
-/*\r
- * COPYRIGHT:       See COPYING in the top level directory\r
- * PROJECT:         ReactOS User Manager Control Panel\r
- * FILE:            dll/cpl/usrmgr/groups.c\r
- * PURPOSE:         Groups property page\r
- *\r
- * PROGRAMMERS:     Eric Kohl\r
- */\r
-\r
-#include "usrmgr.h"\r
-\r
-typedef struct _GROUP_DATA\r
-{\r
-    HMENU hPopupMenu;\r
-\r
-    INT iCurrentItem;\r
-\r
-} GROUP_DATA, *PGROUP_DATA;\r
-\r
-\r
-static VOID\r
-SetGroupsListColumns(HWND hwndListView)\r
-{\r
-    LV_COLUMN column;\r
-    RECT rect;\r
-    TCHAR szStr[32];\r
-\r
-    GetClientRect(hwndListView, &rect);\r
-\r
-    memset(&column, 0x00, sizeof(column));\r
-    column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;\r
-    column.fmt = LVCFMT_LEFT;\r
-    column.cx = (INT)((rect.right - rect.left) * 0.40);\r
-    column.iSubItem = 0;\r
-    LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0]));\r
-    column.pszText = szStr;\r
-    (void)ListView_InsertColumn(hwndListView, 0, &column);\r
-\r
-    column.cx = (INT)((rect.right - rect.left) * 0.60);\r
-    column.iSubItem = 1;\r
-    LoadString(hApplet, IDS_DESCRIPTION, szStr, sizeof(szStr) / sizeof(szStr[0]));\r
-    column.pszText = szStr;\r
-    (void)ListView_InsertColumn(hwndListView, 1, &column);\r
-}\r
-\r
-\r
-static VOID\r
-UpdateGroupsList(HWND hwndListView)\r
-{\r
-    NET_API_STATUS netStatus;\r
-    PLOCALGROUP_INFO_1 pBuffer;\r
-    DWORD entriesread;\r
-    DWORD totalentries;\r
-    DWORD resume_handle = 0;\r
-    DWORD i;\r
-\r
-    LV_ITEM lvi;\r
-    INT iItem;\r
-\r
-\r
-    for (;;)\r
-    {\r
-        netStatus = NetLocalGroupEnum(NULL, 1, (LPBYTE*)&pBuffer,\r
-                                      1024, &entriesread,\r
-                                      &totalentries, &resume_handle);\r
-        if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA)\r
-            break;\r
-\r
-        for (i = 0; i < entriesread; i++)\r
-        {\r
-           memset(&lvi, 0x00, sizeof(lvi));\r
-           lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;\r
-           lvi.pszText = pBuffer[i].lgrpi1_name;\r
-           lvi.state = 0;\r
-           lvi.iImage = 0;\r
-           iItem = ListView_InsertItem(hwndListView, &lvi);\r
-\r
-           ListView_SetItemText(hwndListView, iItem, 1,\r
-                                pBuffer[i].lgrpi1_comment);\r
-        }\r
-\r
-        NetApiBufferFree(&pBuffer);\r
-\r
-        /* No more data left */\r
-        if (netStatus != ERROR_MORE_DATA)\r
-            break;\r
-    }\r
-\r
-}\r
-\r
-\r
-INT_PTR CALLBACK\r
-NewGroupDlgProc(HWND hwndDlg,\r
-               UINT uMsg,\r
-               WPARAM wParam,\r
-               LPARAM lParam)\r
-{\r
-    PLOCALGROUP_INFO_1 groupInfo;\r
-    INT nLength;\r
-\r
-    UNREFERENCED_PARAMETER(wParam);\r
-\r
-    groupInfo = (PLOCALGROUP_INFO_1)GetWindowLongPtr(hwndDlg, DWLP_USER);\r
-\r
-    switch (uMsg)\r
-    {\r
-        case WM_INITDIALOG:\r
-            SetWindowLongPtr(hwndDlg, DWLP_USER, lParam);\r
-            groupInfo = (PLOCALGROUP_INFO_1)lParam;\r
-            SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, EM_SETLIMITTEXT, 20, 0);\r
-            break;\r
-\r
-        case WM_COMMAND:\r
-            switch (LOWORD(wParam))\r
-            {\r
-                case IDC_GROUP_NEW_NAME:\r
-                    if (HIWORD(wParam) == EN_CHANGE)\r
-                    {\r
-                        nLength = SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, WM_GETTEXTLENGTH, 0, 0);\r
-                        EnableWindow(GetDlgItem(hwndDlg, IDOK), (nLength > 0));\r
-                    }\r
-                    break;\r
-\r
-                case IDOK:\r
-                    if (!CheckAccountName(hwndDlg, IDC_GROUP_NEW_NAME, NULL))\r
-                    {\r
-                        SetFocus(GetDlgItem(hwndDlg, IDC_GROUP_NEW_NAME));\r
-                        SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, EM_SETSEL, 0, -1);\r
-                        break;\r
-                    }\r
-\r
-                    nLength = SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, WM_GETTEXTLENGTH, 0, 0);\r
-                    if (nLength > 0)\r
-                    {\r
-                        groupInfo->lgrpi1_name = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));\r
-                        GetDlgItemText(hwndDlg, IDC_GROUP_NEW_NAME, groupInfo->lgrpi1_name, nLength + 1);\r
-                    }\r
-\r
-                    nLength = SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_DESCRIPTION, WM_GETTEXTLENGTH, 0, 0);\r
-                    if (nLength > 0)\r
-                    {\r
-                        groupInfo->lgrpi1_comment = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));\r
-                        GetDlgItemText(hwndDlg, IDC_GROUP_NEW_DESCRIPTION, groupInfo->lgrpi1_comment, nLength + 1);\r
-                    }\r
-\r
-                    EndDialog(hwndDlg, IDOK);\r
-                    break;\r
-\r
-                case IDCANCEL:\r
-                    EndDialog(hwndDlg, IDCANCEL);\r
-                    break;\r
-            }\r
-            break;\r
-\r
-        default:\r
-            return FALSE;\r
-    }\r
-\r
-    return TRUE;\r
-}\r
-\r
-\r
-static VOID\r
-GroupNew(HWND hwndDlg)\r
-{\r
-    NET_API_STATUS status;\r
-    LOCALGROUP_INFO_1 group;\r
-    LV_ITEM lvi;\r
-    INT iItem;\r
-    HWND hwndLV;\r
-\r
-    ZeroMemory(&group, sizeof(LOCALGROUP_INFO_1));\r
-\r
-    if (DialogBoxParam(hApplet,\r
-                       MAKEINTRESOURCE(IDD_GROUP_NEW),\r
-                       hwndDlg,\r
-                       NewGroupDlgProc,\r
-                       (LPARAM)&group) == IDOK)\r
-    {\r
-#if 0\r
-        status = NetLocalGroupAdd(NULL,\r
-                                  1,\r
-                                  (LPBYTE)&group,\r
-                                  NULL);\r
-#else\r
-        status = NERR_Success;\r
-#endif\r
-        if (status != NERR_Success)\r
-        {\r
-            TCHAR szText[256];\r
-            wsprintf(szText, TEXT("Error: %u"), status);\r
-            MessageBox(NULL, szText, TEXT("NetUserAdd"), MB_ICONERROR | MB_OK);\r
-            return;\r
-        }\r
-\r
-        hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);\r
-\r
-        ZeroMemory(&lvi, sizeof(lvi));\r
-        lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;\r
-        lvi.pszText = group.lgrpi1_name;\r
-        lvi.state = 0;\r
-        lvi.iImage = 0;\r
-        iItem = ListView_InsertItem(hwndLV, &lvi);\r
-\r
-        ListView_SetItemText(hwndLV, iItem, 1,\r
-                             group.lgrpi1_comment);\r
-    }\r
-\r
-    if (group.lgrpi1_name)\r
-        HeapFree(GetProcessHeap, 0, group.lgrpi1_name);\r
-\r
-    if (group.lgrpi1_comment)\r
-        HeapFree(GetProcessHeap, 0, group.lgrpi1_comment);\r
-}\r
-\r
-\r
-static VOID\r
-GroupRename(HWND hwndDlg)\r
-{\r
-    INT nItem;\r
-    HWND hwndLV;\r
-\r
-    hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);\r
-    nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);\r
-    if (nItem != -1)\r
-    {\r
-        (void)ListView_EditLabel(hwndLV, nItem);\r
-    }\r
-}\r
-\r
-\r
-static BOOL\r
-GroupDelete(HWND hwndDlg)\r
-{\r
-    TCHAR szGroupName[UNLEN];\r
-    TCHAR szText[256];\r
-    INT nItem;\r
-    HWND hwndLV;\r
-    NET_API_STATUS status;\r
-\r
-    hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);\r
-    nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);\r
-    if (nItem == -1)\r
-        return FALSE;\r
-\r
-    /* Get the new group name */\r
-    ListView_GetItemText(hwndLV,\r
-                         nItem, 0,\r
-                         szGroupName,\r
-                         UNLEN);\r
-\r
-    /* Display a warning message because the delete operation cannot be reverted */\r
-    wsprintf(szText, TEXT("Dou you really want to delete the user group \"%s\"?"), szGroupName);\r
-    if (MessageBox(NULL, szText, TEXT("User Groups"), MB_ICONWARNING | MB_YESNO) == IDNO)\r
-        return FALSE;\r
-\r
-    /* Delete the group */\r
-#if 0\r
-    status = NetLocalGroupDel(NULL, szGroupName);\r
-#else\r
-    status = NERR_Success;\r
-#endif\r
-    if (status != NERR_Success)\r
-    {\r
-        TCHAR szText[256];\r
-        wsprintf(szText, TEXT("Error: %u"), status);\r
-        MessageBox(NULL, szText, TEXT("NetLocalGroupDel"), MB_ICONERROR | MB_OK);\r
-        return FALSE;\r
-    }\r
-\r
-    /* Delete the group from the list */\r
-    (void)ListView_DeleteItem(hwndLV, nItem);\r
-\r
-    return TRUE;\r
-}\r
-\r
-\r
-static VOID\r
-OnInitDialog(HWND hwndDlg)\r
-{\r
-    HWND hwndListView;\r
-    HIMAGELIST hImgList;\r
-    HICON hIcon;\r
-\r
-    /* Create the image list */\r
-    hImgList = ImageList_Create(16,16,ILC_COLOR8 | ILC_MASK,5,5);\r
-    hIcon = LoadImage(hApplet,MAKEINTRESOURCE(IDI_GROUP),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);\r
-    ImageList_AddIcon(hImgList,hIcon);\r
-    DestroyIcon(hIcon);\r
-\r
-    hwndListView = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);\r
-\r
-    (VOID)ListView_SetImageList(hwndListView, hImgList, LVSIL_SMALL);\r
-\r
-    (void)ListView_SetExtendedListViewStyle(hwndListView, LVS_EX_FULLROWSELECT);\r
-\r
-    SetGroupsListColumns(hwndListView);\r
-\r
-    UpdateGroupsList(hwndListView);\r
-}\r
-\r
-\r
-static BOOL\r
-OnBeginLabelEdit(LPNMLVDISPINFO pnmv)\r
-{\r
-    HWND hwndEdit;\r
-\r
-    hwndEdit = ListView_GetEditControl(pnmv->hdr.hwndFrom);\r
-    if (hwndEdit == NULL)\r
-        return TRUE;\r
-\r
-    SendMessage(hwndEdit, EM_SETLIMITTEXT, 20, 0);\r
-\r
-    return FALSE;\r
-}\r
-\r
-\r
-static BOOL\r
-OnEndLabelEdit(LPNMLVDISPINFO pnmv)\r
-{\r
-    TCHAR szOldGroupName[UNLEN];\r
-    TCHAR szNewGroupName[UNLEN];\r
-    LOCALGROUP_INFO_0 lgrpi0;\r
-    NET_API_STATUS status;\r
-\r
-    /* Leave, if there is no valid listview item */\r
-    if (pnmv->item.iItem == -1)\r
-        return FALSE;\r
-\r
-    /* Get the new user name */\r
-    ListView_GetItemText(pnmv->hdr.hwndFrom,\r
-                         pnmv->item.iItem, 0,\r
-                         szOldGroupName,\r
-                         UNLEN);\r
-\r
-    /* Leave, if the user canceled the edit action */\r
-    if (pnmv->item.pszText == NULL)\r
-        return FALSE;\r
-\r
-    /* Get the new user name */\r
-    lstrcpy(szNewGroupName, pnmv->item.pszText);\r
-\r
-    /* Leave, if the user name was not changed */\r
-    if (lstrcmp(szOldGroupName, szNewGroupName) == 0)\r
-        return FALSE;\r
-\r
-    /* Check the group name for illegal characters */\r
-    if (!CheckAccountName(NULL, 0, szNewGroupName))\r
-        return FALSE;\r
-\r
-    /* Change the user name */\r
-    lgrpi0.lgrpi0_name = szNewGroupName;\r
-\r
-#if 0\r
-    status = NetLocalGroupSetInfo(NULL, szOldGroupName, 0, (LPBYTE)&lgrpi0, NULL);\r
-#else\r
-    status = NERR_Success;\r
-#endif\r
-    if (status != NERR_Success)\r
-    {\r
-        TCHAR szText[256];\r
-        wsprintf(szText, TEXT("Error: %u"), status);\r
-        MessageBox(NULL, szText, TEXT("NetLocalGroupSetInfo"), MB_ICONERROR | MB_OK);\r
-        return FALSE;\r
-    }\r
-\r
-    /* Update the listview item */\r
-    ListView_SetItemText(pnmv->hdr.hwndFrom,\r
-                         pnmv->item.iItem, 0,\r
-                         szNewGroupName);\r
-\r
-    return TRUE;\r
-}\r
-\r
-\r
-static BOOL\r
-OnNotify(HWND hwndDlg, PGROUP_DATA pGroupData, NMHDR *phdr)\r
-{\r
-    LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr;\r
-\r
-    switch (phdr->idFrom)\r
-    {\r
-        case IDC_GROUPS_LIST:\r
-            switch(phdr->code)\r
-            {\r
-                case NM_CLICK:\r
-                    pGroupData->iCurrentItem = lpnmlv->iItem;\r
-                    if (lpnmlv->iItem == -1)\r
-                    {\r
-                    }\r
-                    else\r
-                    {\r
-                    }\r
-                    break;\r
-\r
-                case NM_DBLCLK:\r
-                    break;\r
-\r
-                case NM_RCLICK:\r
-                    ClientToScreen(GetDlgItem(hwndDlg, IDC_GROUPS_LIST), &lpnmlv->ptAction);\r
-                    TrackPopupMenu(GetSubMenu(pGroupData->hPopupMenu, (lpnmlv->iItem == -1) ? 0 : 1),\r
-                                   TPM_LEFTALIGN, lpnmlv->ptAction.x, lpnmlv->ptAction.y, 0, hwndDlg, NULL);\r
-                    break;\r
-\r
-                case LVN_BEGINLABELEDIT:\r
-                    return OnBeginLabelEdit((LPNMLVDISPINFO)phdr);\r
-\r
-                case LVN_ENDLABELEDIT:\r
-                    return OnEndLabelEdit((LPNMLVDISPINFO)phdr);\r
-            }\r
-            break;\r
-    }\r
-\r
-    return FALSE;\r
-}\r
-\r
-\r
-INT_PTR CALLBACK\r
-GroupsPageProc(HWND hwndDlg,\r
-               UINT uMsg,\r
-               WPARAM wParam,\r
-               LPARAM lParam)\r
-{\r
-    PGROUP_DATA pGroupData;\r
-\r
-    UNREFERENCED_PARAMETER(lParam);\r
-    UNREFERENCED_PARAMETER(wParam);\r
-    UNREFERENCED_PARAMETER(hwndDlg);\r
-\r
-\r
-    pGroupData = (PGROUP_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);\r
-\r
-    switch (uMsg)\r
-    {\r
-        case WM_INITDIALOG:\r
-            pGroupData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GROUP_DATA));\r
-            SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGroupData);\r
-\r
-            pGroupData->hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDM_POPUP_GROUP));\r
-\r
-            OnInitDialog(hwndDlg);\r
-            break;\r
-\r
-        case WM_COMMAND:\r
-            switch (LOWORD(wParam))\r
-            {\r
-                case IDM_GROUP_NEW:\r
-                    GroupNew(hwndDlg);\r
-                    break;\r
-\r
-                case IDM_GROUP_RENAME:\r
-                    GroupRename(hwndDlg);\r
-                    break;\r
-\r
-                case IDM_GROUP_DELETE:\r
-                    GroupDelete(hwndDlg);\r
-                    break;\r
-            }\r
-            break;\r
-\r
-        case WM_NOTIFY:\r
-            return OnNotify(hwndDlg, pGroupData, (NMHDR *)lParam);\r
-\r
-        case WM_DESTROY:\r
-            DestroyMenu(pGroupData->hPopupMenu);\r
-            HeapFree(GetProcessHeap(), 0, pGroupData);\r
-            break;\r
-    }\r
-\r
-    return FALSE;\r
-}\r
+/*
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS User Manager Control Panel
+ * FILE:            dll/cpl/usrmgr/groups.c
+ * PURPOSE:         Groups property page
+ *
+ * PROGRAMMERS:     Eric Kohl
+ */
+
+#include "usrmgr.h"
+
+typedef struct _GROUP_DATA
+{
+    HMENU hPopupMenu;
+
+    INT iCurrentItem;
+
+} GROUP_DATA, *PGROUP_DATA;
+
+
+static VOID
+SetGroupsListColumns(HWND hwndListView)
+{
+    LV_COLUMN column;
+    RECT rect;
+    TCHAR szStr[32];
+
+    GetClientRect(hwndListView, &rect);
+
+    memset(&column, 0x00, sizeof(column));
+    column.mask = LVCF_FMT | LVCF_WIDTH | LVCF_SUBITEM | LVCF_TEXT;
+    column.fmt = LVCFMT_LEFT;
+    column.cx = (INT)((rect.right - rect.left) * 0.40);
+    column.iSubItem = 0;
+    LoadString(hApplet, IDS_NAME, szStr, sizeof(szStr) / sizeof(szStr[0]));
+    column.pszText = szStr;
+    (void)ListView_InsertColumn(hwndListView, 0, &column);
+
+    column.cx = (INT)((rect.right - rect.left) * 0.60);
+    column.iSubItem = 1;
+    LoadString(hApplet, IDS_DESCRIPTION, szStr, sizeof(szStr) / sizeof(szStr[0]));
+    column.pszText = szStr;
+    (void)ListView_InsertColumn(hwndListView, 1, &column);
+}
+
+
+static VOID
+UpdateGroupsList(HWND hwndListView)
+{
+    NET_API_STATUS netStatus;
+    PLOCALGROUP_INFO_1 pBuffer;
+    DWORD entriesread;
+    DWORD totalentries;
+    DWORD resume_handle = 0;
+    DWORD i;
+    LV_ITEM lvi;
+    INT iItem;
+
+    for (;;)
+    {
+        netStatus = NetLocalGroupEnum(NULL, 1, (LPBYTE*)&pBuffer,
+                                      1024, &entriesread,
+                                      &totalentries, &resume_handle);
+        if (netStatus != NERR_Success && netStatus != ERROR_MORE_DATA)
+            break;
+
+        for (i = 0; i < entriesread; i++)
+        {
+           memset(&lvi, 0x00, sizeof(lvi));
+           lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
+           lvi.pszText = pBuffer[i].lgrpi1_name;
+           lvi.state = 0;
+           lvi.iImage = 0;
+           iItem = ListView_InsertItem(hwndListView, &lvi);
+
+           ListView_SetItemText(hwndListView, iItem, 1,
+                                pBuffer[i].lgrpi1_comment);
+        }
+
+        NetApiBufferFree(&pBuffer);
+
+        /* No more data left */
+        if (netStatus != ERROR_MORE_DATA)
+            break;
+    }
+
+}
+
+
+INT_PTR CALLBACK
+NewGroupDlgProc(HWND hwndDlg,
+               UINT uMsg,
+               WPARAM wParam,
+               LPARAM lParam)
+{
+    PLOCALGROUP_INFO_1 groupInfo;
+    INT nLength;
+
+    UNREFERENCED_PARAMETER(wParam);
+
+    groupInfo = (PLOCALGROUP_INFO_1)GetWindowLongPtr(hwndDlg, DWLP_USER);
+
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            SetWindowLongPtr(hwndDlg, DWLP_USER, lParam);
+            groupInfo = (PLOCALGROUP_INFO_1)lParam;
+            SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, EM_SETLIMITTEXT, 20, 0);
+            break;
+
+        case WM_COMMAND:
+            switch (LOWORD(wParam))
+            {
+                case IDC_GROUP_NEW_NAME:
+                    if (HIWORD(wParam) == EN_CHANGE)
+                    {
+                        nLength = SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, WM_GETTEXTLENGTH, 0, 0);
+                        EnableWindow(GetDlgItem(hwndDlg, IDOK), (nLength > 0));
+                    }
+                    break;
+
+                case IDOK:
+                    if (!CheckAccountName(hwndDlg, IDC_GROUP_NEW_NAME, NULL))
+                    {
+                        SetFocus(GetDlgItem(hwndDlg, IDC_GROUP_NEW_NAME));
+                        SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, EM_SETSEL, 0, -1);
+                        break;
+                    }
+
+                    nLength = SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_NAME, WM_GETTEXTLENGTH, 0, 0);
+                    if (nLength > 0)
+                    {
+                        groupInfo->lgrpi1_name = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));
+                        GetDlgItemText(hwndDlg, IDC_GROUP_NEW_NAME, groupInfo->lgrpi1_name, nLength + 1);
+                    }
+
+                    nLength = SendDlgItemMessage(hwndDlg, IDC_GROUP_NEW_DESCRIPTION, WM_GETTEXTLENGTH, 0, 0);
+                    if (nLength > 0)
+                    {
+                        groupInfo->lgrpi1_comment = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (nLength + 1) * sizeof(WCHAR));
+                        GetDlgItemText(hwndDlg, IDC_GROUP_NEW_DESCRIPTION, groupInfo->lgrpi1_comment, nLength + 1);
+                    }
+
+                    EndDialog(hwndDlg, IDOK);
+                    break;
+
+                case IDCANCEL:
+                    EndDialog(hwndDlg, IDCANCEL);
+                    break;
+            }
+            break;
+
+        default:
+            return FALSE;
+    }
+
+    return TRUE;
+}
+
+
+static VOID
+GroupNew(HWND hwndDlg)
+{
+    NET_API_STATUS status;
+    LOCALGROUP_INFO_1 group;
+    LV_ITEM lvi;
+    INT iItem;
+    HWND hwndLV;
+
+    ZeroMemory(&group, sizeof(LOCALGROUP_INFO_1));
+
+    if (DialogBoxParam(hApplet,
+                       MAKEINTRESOURCE(IDD_GROUP_NEW),
+                       hwndDlg,
+                       NewGroupDlgProc,
+                       (LPARAM)&group) == IDOK)
+    {
+#if 0
+        status = NetLocalGroupAdd(NULL,
+                                  1,
+                                  (LPBYTE)&group,
+                                  NULL);
+#else
+        status = NERR_Success;
+#endif
+        if (status != NERR_Success)
+        {
+            TCHAR szText[256];
+            wsprintf(szText, TEXT("Error: %u"), status);
+            MessageBox(NULL, szText, TEXT("NetUserAdd"), MB_ICONERROR | MB_OK);
+            return;
+        }
+
+        hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
+
+        ZeroMemory(&lvi, sizeof(lvi));
+        lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_IMAGE;
+        lvi.pszText = group.lgrpi1_name;
+        lvi.state = 0;
+        lvi.iImage = 0;
+        iItem = ListView_InsertItem(hwndLV, &lvi);
+
+        ListView_SetItemText(hwndLV, iItem, 1,
+                             group.lgrpi1_comment);
+    }
+
+    if (group.lgrpi1_name)
+        HeapFree(GetProcessHeap, 0, group.lgrpi1_name);
+
+    if (group.lgrpi1_comment)
+        HeapFree(GetProcessHeap, 0, group.lgrpi1_comment);
+}
+
+
+static VOID
+GroupRename(HWND hwndDlg)
+{
+    INT nItem;
+    HWND hwndLV;
+
+    hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
+    nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
+    if (nItem != -1)
+    {
+        (void)ListView_EditLabel(hwndLV, nItem);
+    }
+}
+
+
+static BOOL
+GroupDelete(HWND hwndDlg)
+{
+    TCHAR szGroupName[UNLEN];
+    TCHAR szText[256];
+    INT nItem;
+    HWND hwndLV;
+    NET_API_STATUS status;
+
+    hwndLV = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
+    nItem = ListView_GetNextItem(hwndLV, -1, LVNI_SELECTED);
+    if (nItem == -1)
+        return FALSE;
+
+    /* Get the new group name */
+    ListView_GetItemText(hwndLV,
+                         nItem, 0,
+                         szGroupName,
+                         UNLEN);
+
+    /* Display a warning message because the delete operation cannot be reverted */
+    wsprintf(szText, TEXT("Dou you really want to delete the user group \"%s\"?"), szGroupName);
+    if (MessageBox(NULL, szText, TEXT("User Groups"), MB_ICONWARNING | MB_YESNO) == IDNO)
+        return FALSE;
+
+    /* Delete the group */
+#if 0
+    status = NetLocalGroupDel(NULL, szGroupName);
+#else
+    status = NERR_Success;
+#endif
+    if (status != NERR_Success)
+    {
+        TCHAR szText[256];
+        wsprintf(szText, TEXT("Error: %u"), status);
+        MessageBox(NULL, szText, TEXT("NetLocalGroupDel"), MB_ICONERROR | MB_OK);
+        return FALSE;
+    }
+
+    /* Delete the group from the list */
+    (void)ListView_DeleteItem(hwndLV, nItem);
+
+    return TRUE;
+}
+
+
+static VOID
+OnInitDialog(HWND hwndDlg)
+{
+    HWND hwndListView;
+    HIMAGELIST hImgList;
+    HICON hIcon;
+
+    /* Create the image list */
+    hImgList = ImageList_Create(16,16,ILC_COLOR8 | ILC_MASK,5,5);
+    hIcon = LoadImage(hApplet,MAKEINTRESOURCE(IDI_GROUP),IMAGE_ICON,16,16,LR_DEFAULTCOLOR);
+    ImageList_AddIcon(hImgList,hIcon);
+    DestroyIcon(hIcon);
+
+    hwndListView = GetDlgItem(hwndDlg, IDC_GROUPS_LIST);
+
+    (VOID)ListView_SetImageList(hwndListView, hImgList, LVSIL_SMALL);
+
+    (void)ListView_SetExtendedListViewStyle(hwndListView, LVS_EX_FULLROWSELECT);
+
+    SetGroupsListColumns(hwndListView);
+
+    UpdateGroupsList(hwndListView);
+}
+
+
+static BOOL
+OnBeginLabelEdit(LPNMLVDISPINFO pnmv)
+{
+    HWND hwndEdit;
+
+    hwndEdit = ListView_GetEditControl(pnmv->hdr.hwndFrom);
+    if (hwndEdit == NULL)
+        return TRUE;
+
+    SendMessage(hwndEdit, EM_SETLIMITTEXT, 20, 0);
+
+    return FALSE;
+}
+
+
+static BOOL
+OnEndLabelEdit(LPNMLVDISPINFO pnmv)
+{
+    TCHAR szOldGroupName[UNLEN];
+    TCHAR szNewGroupName[UNLEN];
+    LOCALGROUP_INFO_0 lgrpi0;
+    NET_API_STATUS status;
+
+    /* Leave, if there is no valid listview item */
+    if (pnmv->item.iItem == -1)
+        return FALSE;
+
+    /* Get the new user name */
+    ListView_GetItemText(pnmv->hdr.hwndFrom,
+                         pnmv->item.iItem, 0,
+                         szOldGroupName,
+                         UNLEN);
+
+    /* Leave, if the user canceled the edit action */
+    if (pnmv->item.pszText == NULL)
+        return FALSE;
+
+    /* Get the new user name */
+    lstrcpy(szNewGroupName, pnmv->item.pszText);
+
+    /* Leave, if the user name was not changed */
+    if (lstrcmp(szOldGroupName, szNewGroupName) == 0)
+        return FALSE;
+
+    /* Check the group name for illegal characters */
+    if (!CheckAccountName(NULL, 0, szNewGroupName))
+        return FALSE;
+
+    /* Change the user name */
+    lgrpi0.lgrpi0_name = szNewGroupName;
+
+#if 0
+    status = NetLocalGroupSetInfo(NULL, szOldGroupName, 0, (LPBYTE)&lgrpi0, NULL);
+#else
+    status = NERR_Success;
+#endif
+    if (status != NERR_Success)
+    {
+        TCHAR szText[256];
+        wsprintf(szText, TEXT("Error: %u"), status);
+        MessageBox(NULL, szText, TEXT("NetLocalGroupSetInfo"), MB_ICONERROR | MB_OK);
+        return FALSE;
+    }
+
+    /* Update the listview item */
+    ListView_SetItemText(pnmv->hdr.hwndFrom,
+                         pnmv->item.iItem, 0,
+                         szNewGroupName);
+
+    return TRUE;
+}
+
+
+static BOOL
+OnNotify(HWND hwndDlg, PGROUP_DATA pGroupData, NMHDR *phdr)
+{
+    LPNMLISTVIEW lpnmlv = (LPNMLISTVIEW)phdr;
+
+    switch (phdr->idFrom)
+    {
+        case IDC_GROUPS_LIST:
+            switch(phdr->code)
+            {
+                case NM_CLICK:
+                    pGroupData->iCurrentItem = lpnmlv->iItem;
+                    break;
+
+                case NM_DBLCLK:
+                    if (lpnmlv->iItem != -1)
+                    {
+                        UINT uItem;
+
+                        uItem =  GetMenuDefaultItem(GetSubMenu(pGroupData->hPopupMenu, 1),
+                                                    FALSE, 0);
+                        if (uItem != (UINT)-1)
+                            SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(uItem, 0), 0);
+                    }
+                    break;
+
+                case NM_RCLICK:
+                    ClientToScreen(GetDlgItem(hwndDlg, IDC_GROUPS_LIST), &lpnmlv->ptAction);
+                    TrackPopupMenu(GetSubMenu(pGroupData->hPopupMenu, (lpnmlv->iItem == -1) ? 0 : 1),
+                                   TPM_LEFTALIGN, lpnmlv->ptAction.x, lpnmlv->ptAction.y, 0, hwndDlg, NULL);
+                    break;
+
+                case LVN_BEGINLABELEDIT:
+                    return OnBeginLabelEdit((LPNMLVDISPINFO)phdr);
+
+                case LVN_ENDLABELEDIT:
+                    return OnEndLabelEdit((LPNMLVDISPINFO)phdr);
+            }
+            break;
+    }
+
+    return FALSE;
+}
+
+
+INT_PTR CALLBACK
+GroupsPageProc(HWND hwndDlg,
+               UINT uMsg,
+               WPARAM wParam,
+               LPARAM lParam)
+{
+    PGROUP_DATA pGroupData;
+
+    UNREFERENCED_PARAMETER(lParam);
+    UNREFERENCED_PARAMETER(wParam);
+    UNREFERENCED_PARAMETER(hwndDlg);
+
+
+    pGroupData = (PGROUP_DATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
+
+    switch (uMsg)
+    {
+        case WM_INITDIALOG:
+            pGroupData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(GROUP_DATA));
+            SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pGroupData);
+
+            pGroupData->hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDM_POPUP_GROUP));
+
+            OnInitDialog(hwndDlg);
+            SetMenuDefaultItem(GetSubMenu(pGroupData->hPopupMenu, 1),
+                               IDM_GROUP_PROPERTIES,
+                               FALSE);
+            break;
+
+        case WM_COMMAND:
+            switch (LOWORD(wParam))
+            {
+                case IDM_GROUP_NEW:
+                    GroupNew(hwndDlg);
+                    break;
+
+                case IDM_GROUP_RENAME:
+                    GroupRename(hwndDlg);
+                    break;
+
+                case IDM_GROUP_DELETE:
+                    GroupDelete(hwndDlg);
+                    break;
+
+                case IDM_GROUP_PROPERTIES:
+                    GroupProperties(hwndDlg);
+                    break;
+            }
+            break;
+
+        case WM_NOTIFY:
+            return OnNotify(hwndDlg, pGroupData, (NMHDR *)lParam);
+
+        case WM_DESTROY:
+            DestroyMenu(pGroupData->hPopupMenu);
+            HeapFree(GetProcessHeap(), 0, pGroupData);
+            break;
+    }
+
+    return FALSE;
+}
index 95e87d2..576cb98 100644 (file)
@@ -41,7 +41,7 @@ STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
 CAPTION "General"
 FONT 8, "MS Shell Dlg"
 BEGIN
-    LTEXT "", IDC_USER_GENERAL_NAME, 7, 7, 112, 8
+    LTEXT "", IDC_USER_GENERAL_NAME, 7, 12, 112, 8
     LTEXT "Full name:", -1, 7, 46, 63, 8
     EDITTEXT IDC_USER_GENERAL_FULL_NAME,77,43,168,13,ES_AUTOHSCROLL
     LTEXT "Description:", -1, 7, 64, 63, 8
@@ -54,6 +54,20 @@ BEGIN
 END
 
 
+IDD_GROUP_GENERAL DIALOGEX DISCARDABLE  0, 0, 252, 223
+STYLE DS_SHELLFONT | WS_CHILD | WS_DISABLED | WS_CAPTION
+CAPTION "General"
+FONT 8, "MS Shell Dlg"
+BEGIN
+    LTEXT "", IDC_GROUP_GENERAL_NAME, 7, 12, 112, 8
+    LTEXT "Description:", -1, 7, 45, 46, 8
+    EDITTEXT IDC_GROUP_GENERAL_DESCRIPTION,65,42,180,13,ES_AUTOHSCROLL
+    LTEXT "Members:", -1, 7, 63, 45, 8
+    CONTROL "", IDC_GROUP_GENERAL_MEMBERS, "SysListView32", LVS_REPORT | LVS_NOCOLUMNHEADER | LVS_SORTASCENDING | WS_BORDER | WS_TABSTOP,
+            7, 74, 238, 117, WS_EX_CLIENTEDGE
+END
+
+
 IDD_CHANGE_PASSWORD DIALOGEX DISCARDABLE  0, 0, 267, 74
 STYLE  DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU | DS_SHELLFONT
 CAPTION "Change Password"
@@ -121,7 +135,7 @@ BEGIN
         MENUITEM "Delete", IDM_GROUP_DELETE
         MENUITEM "Rename", IDM_GROUP_RENAME
         MENUITEM SEPARATOR
-        MENUITEM "Properties", IDM_GROUP_PROPERTIES, GRAYED
+        MENUITEM "Properties", IDM_GROUP_PROPERTIES
     END
 END
 
index 86d6058..50f6457 100644 (file)
 #include "usrmgr.h"
 
 
+VOID
+DebugPrintf(LPTSTR szFormat, ...)
+{
+    TCHAR szOut[512];
+    va_list arg_ptr;
+
+
+    va_start (arg_ptr, szFormat);
+    _vstprintf (szOut, szFormat, arg_ptr);
+    va_end (arg_ptr);
+
+    MessageBox(NULL, szOut, _T("Debug"), MB_OK);
+}
+
 BOOL
 CheckAccountName(HWND hwndDlg,
                  INT nIdDlgItem,
index f0050c5..5c6ccc1 100644 (file)
 #define IDC_USER_GENERAL_DISABLED      317
 #define IDC_USER_GENERAL_LOCKED        318
 
+#define IDD_GROUP_GENERAL              340
+#define IDC_GROUP_GENERAL_NAME         341
+#define IDC_GROUP_GENERAL_DESCRIPTION  342
+#define IDC_GROUP_GENERAL_MEMBERS      343
+
 
 #define IDD_CHANGE_PASSWORD         350
 #define IDC_EDIT_PASSWORD1          351
index 736c83d..c535186 100644 (file)
@@ -2,7 +2,7 @@
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS User Manager Control Panel
  * FILE:            dll/cpl/usrmgr/users.c
- * PURPOSE:         Users property page
+ * PURPOSE:         User property sheet
  *
  * PROGRAMMERS:     Eric Kohl
  */
index 1258ffe..5bade2b 100644 (file)
-/* $Id$\r
- *\r
- * COPYRIGHT:       See COPYING in the top level directory\r
- * PROJECT:         ReactOS User Manager Control Panel\r
- * FILE:            dll/cpl/usrmgr/extra.c\r
- * PURPOSE:         Main functions\r
- *\r
- * PROGRAMMERS:     Eric Kohl\r
- */\r
-\r
-#include "usrmgr.h"\r
-\r
-#define NUM_APPLETS 1\r
-\r
-static LONG APIENTRY UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);\r
-\r
-HINSTANCE hApplet = 0;\r
-\r
-/* Applets */\r
-APPLET Applets[NUM_APPLETS] =\r
-{\r
-    {\r
-        IDI_USRMGR_ICON,\r
-        IDS_CPLNAME,\r
-        IDS_CPLDESCRIPTION,\r
-        UsrmgrApplet\r
-    }\r
-};\r
-\r
-\r
-static VOID\r
-InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)\r
-{\r
-    ZeroMemory(psp, sizeof(PROPSHEETPAGE));\r
-    psp->dwSize = sizeof(PROPSHEETPAGE);\r
-    psp->dwFlags = PSP_DEFAULT;\r
-    psp->hInstance = hApplet;\r
-    psp->pszTemplate = MAKEINTRESOURCE(idDlg);\r
-    psp->pfnDlgProc = DlgProc;\r
-}\r
-\r
-\r
-/* Display Applet */\r
-static LONG APIENTRY\r
-UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)\r
-{\r
-    PROPSHEETPAGE psp[3];\r
-    PROPSHEETHEADER psh;\r
-    TCHAR Caption[1024];\r
-\r
-    UNREFERENCED_PARAMETER(lParam);\r
-    UNREFERENCED_PARAMETER(wParam);\r
-    UNREFERENCED_PARAMETER(uMsg);\r
-\r
-    LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));\r
-\r
-    ZeroMemory(&psh, sizeof(PROPSHEETHEADER));\r
-    psh.dwSize = sizeof(PROPSHEETHEADER);\r
-    psh.dwFlags =  PSH_PROPSHEETPAGE;\r
-    psh.hwndParent = hwnd;\r
-    psh.hInstance = hApplet;\r
-    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_USRMGR_ICON));\r
-    psh.pszCaption = Caption;\r
-    psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);\r
-    psh.nStartPage = 0;\r
-    psh.ppsp = psp;\r
-\r
-    InitPropSheetPage(&psp[0], IDD_USERS, (DLGPROC)UsersPageProc);\r
-    InitPropSheetPage(&psp[1], IDD_GROUPS, (DLGPROC)GroupsPageProc);\r
-    InitPropSheetPage(&psp[2], IDD_EXTRA, (DLGPROC)ExtraPageProc);\r
-\r
-    return (LONG)(PropertySheet(&psh) != -1);\r
-}\r
-\r
-\r
-/* Control Panel Callback */\r
-LONG CALLBACK\r
-CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)\r
-{\r
-    int i = (int)lParam1;\r
-\r
-    switch (uMsg)\r
-    {\r
-        case CPL_INIT:\r
-            return TRUE;\r
-\r
-        case CPL_GETCOUNT:\r
-            return NUM_APPLETS;\r
-\r
-        case CPL_INQUIRE:\r
-            {\r
-                CPLINFO *CPlInfo = (CPLINFO*)lParam2;\r
-                CPlInfo->lData = 0;\r
-                CPlInfo->idIcon = Applets[i].idIcon;\r
-                CPlInfo->idName = Applets[i].idName;\r
-                CPlInfo->idInfo = Applets[i].idDescription;\r
-            }\r
-            break;\r
-\r
-        case CPL_DBLCLK:\r
-            Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);\r
-            break;\r
-    }\r
-\r
-    return FALSE;\r
-}\r
-\r
-\r
-BOOL WINAPI\r
-DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)\r
-{\r
-    UNREFERENCED_PARAMETER(lpvReserved);\r
-\r
-    switch (dwReason)\r
-    {\r
-        case DLL_PROCESS_ATTACH:\r
-            hApplet = hinstDLL;\r
-            break;\r
-    }\r
-\r
-    return TRUE;\r
-}\r
+/* $Id$
+ *
+ * COPYRIGHT:       See COPYING in the top level directory
+ * PROJECT:         ReactOS User Manager Control Panel
+ * FILE:            dll/cpl/usrmgr/extra.c
+ * PURPOSE:         Main functions
+ *
+ * PROGRAMMERS:     Eric Kohl
+ */
+
+#include "usrmgr.h"
+
+#define NUM_APPLETS 1
+
+static LONG APIENTRY UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam);
+
+HINSTANCE hApplet = 0;
+
+/* Applets */
+APPLET Applets[NUM_APPLETS] =
+{
+    {
+        IDI_USRMGR_ICON,
+        IDS_CPLNAME,
+        IDS_CPLDESCRIPTION,
+        UsrmgrApplet
+    }
+};
+
+
+static VOID
+InitPropSheetPage(PROPSHEETPAGE *psp, WORD idDlg, DLGPROC DlgProc)
+{
+    ZeroMemory(psp, sizeof(PROPSHEETPAGE));
+    psp->dwSize = sizeof(PROPSHEETPAGE);
+    psp->dwFlags = PSP_DEFAULT;
+    psp->hInstance = hApplet;
+    psp->pszTemplate = MAKEINTRESOURCE(idDlg);
+    psp->pfnDlgProc = DlgProc;
+}
+
+
+/* Display Applet */
+static LONG APIENTRY
+UsrmgrApplet(HWND hwnd, UINT uMsg, LPARAM wParam, LPARAM lParam)
+{
+    PROPSHEETPAGE psp[3];
+    PROPSHEETHEADER psh;
+    TCHAR Caption[1024];
+
+    UNREFERENCED_PARAMETER(lParam);
+    UNREFERENCED_PARAMETER(wParam);
+    UNREFERENCED_PARAMETER(uMsg);
+
+    LoadString(hApplet, IDS_CPLNAME, Caption, sizeof(Caption) / sizeof(TCHAR));
+
+    ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
+    psh.dwSize = sizeof(PROPSHEETHEADER);
+    psh.dwFlags =  PSH_PROPSHEETPAGE;
+    psh.hwndParent = hwnd;
+    psh.hInstance = hApplet;
+    psh.hIcon = LoadIcon(hApplet, MAKEINTRESOURCE(IDI_USRMGR_ICON));
+    psh.pszCaption = Caption;
+    psh.nPages = sizeof(psp) / sizeof(PROPSHEETPAGE);
+    psh.nStartPage = 0;
+    psh.ppsp = psp;
+
+    InitPropSheetPage(&psp[0], IDD_USERS, (DLGPROC)UsersPageProc);
+    InitPropSheetPage(&psp[1], IDD_GROUPS, (DLGPROC)GroupsPageProc);
+    InitPropSheetPage(&psp[2], IDD_EXTRA, (DLGPROC)ExtraPageProc);
+
+    return (LONG)(PropertySheet(&psh) != -1);
+}
+
+
+/* Control Panel Callback */
+LONG CALLBACK
+CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
+{
+    int i = (int)lParam1;
+
+    switch (uMsg)
+    {
+        case CPL_INIT:
+            return TRUE;
+
+        case CPL_GETCOUNT:
+            return NUM_APPLETS;
+
+        case CPL_INQUIRE:
+            {
+                CPLINFO *CPlInfo = (CPLINFO*)lParam2;
+                CPlInfo->lData = 0;
+                CPlInfo->idIcon = Applets[i].idIcon;
+                CPlInfo->idName = Applets[i].idName;
+                CPlInfo->idInfo = Applets[i].idDescription;
+            }
+            break;
+
+        case CPL_DBLCLK:
+            Applets[i].AppletProc(hwndCPl, uMsg, lParam1, lParam2);
+            break;
+    }
+
+    return FALSE;
+}
+
+
+BOOL WINAPI
+DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
+{
+    UNREFERENCED_PARAMETER(lpvReserved);
+
+    switch (dwReason)
+    {
+        case DLL_PROCESS_ATTACH:
+            hApplet = hinstDLL;
+            break;
+    }
+
+    return TRUE;
+}
index 35fc55f..bf450f1 100644 (file)
@@ -1,6 +1,6 @@
-LIBRARY usrmgr.cpl\r
-\r
-EXPORTS\r
-CPlApplet@16\r
-\r
-; EOF\r
+LIBRARY usrmgr.cpl
+
+EXPORTS
+CPlApplet@16
+
+; EOF
index 91c39d5..abe7374 100644 (file)
@@ -29,7 +29,14 @@ INT_PTR CALLBACK UsersPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lP
 INT_PTR CALLBACK GroupsPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
 INT_PTR CALLBACK ExtraPageProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
 
+/* groupprops.c */
+VOID
+GroupProperties(HWND hwndDlg);
+
 /* misc.c */
+VOID
+DebugPrintf(LPTSTR szFormat, ...);
+
 BOOL
 CheckAccountName(HWND hwndDlg,
                  INT nIdDlgItem,
index 1f0ce25..30d487a 100644 (file)
@@ -14,6 +14,7 @@
        <library>netapi32</library>
        <library>msvcrt</library>
        <file>extra.c</file>
+       <file>groupprops.c</file>
        <file>groups.c</file>
        <file>misc.c</file>
        <file>userprops.c</file>