2 * PROJECT: ReactOS System Control Panel Applet
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: dll/cpl/sysdm/userprofile.c
5 * PURPOSE: Computer settings for networking
6 * COPYRIGHT: Copyright Thomas Weidenmueller <w3seek@reactos.org>
7 * Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
15 SetListViewColumns(HWND hwndListView
)
21 GetClientRect(hwndListView
, &rect
);
23 SendMessage(hwndListView
, LVM_SETEXTENDEDLISTVIEWSTYLE
, 0, LVS_EX_FULLROWSELECT
);
25 memset(&column
, 0x00, sizeof(column
));
26 column
.mask
= LVCF_FMT
| LVCF_WIDTH
| LVCF_SUBITEM
| LVCF_TEXT
;
27 column
.fmt
= LVCFMT_LEFT
;
28 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.40);
30 LoadString(hApplet
, IDS_USERPROFILE_NAME
, szStr
, 32);
31 column
.pszText
= szStr
;
32 (void)ListView_InsertColumn(hwndListView
, 0, &column
);
34 column
.fmt
= LVCFMT_RIGHT
;
35 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.15);
37 LoadString(hApplet
, IDS_USERPROFILE_SIZE
, szStr
, 32);
38 column
.pszText
= szStr
;
39 (void)ListView_InsertColumn(hwndListView
, 1, &column
);
41 column
.fmt
= LVCFMT_LEFT
;
42 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.15);
44 LoadString(hApplet
, IDS_USERPROFILE_TYPE
, szStr
, 32);
45 column
.pszText
= szStr
;
46 (void)ListView_InsertColumn(hwndListView
, 2, &column
);
48 column
.fmt
= LVCFMT_LEFT
;
49 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.15);
51 LoadString(hApplet
, IDS_USERPROFILE_STATUS
, szStr
, 32);
52 column
.pszText
= szStr
;
53 (void)ListView_InsertColumn(hwndListView
, 3, &column
);
55 column
.fmt
= LVCFMT_LEFT
;
56 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.15) - GetSystemMetrics(SM_CYHSCROLL
);
58 LoadString(hApplet
, IDS_USERPROFILE_MODIFIED
, szStr
, 32);
59 column
.pszText
= szStr
;
60 (void)ListView_InsertColumn(hwndListView
, 4, &column
);
65 AddUserProfile(HWND hwndListView
,
71 memset(&lvi
, 0x00, sizeof(lvi
));
72 lvi
.mask
= LVIF_TEXT
| LVIF_STATE
;
73 lvi
.pszText
= lpProfileSid
;
75 iItem
= ListView_InsertItem(hwndListView
, &lvi
);
80 AddUserProfiles(HWND hwndListView
)
82 HKEY hKeyUserProfiles
;
84 TCHAR szProfileSid
[64];
88 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
89 _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList"),
95 for (dwIndex
= 0; ; dwIndex
++)
98 if (RegEnumKeyEx(hKeyUserProfiles
,
108 AddUserProfile(hwndListView
, szProfileSid
);
111 RegCloseKey(hKeyUserProfiles
);
116 OnInitDialog(HWND hwndDlg
)
118 /* Initialize the list view control */
119 SetListViewColumns(GetDlgItem(hwndDlg
, IDC_USERPROFILE_LIST
));
121 AddUserProfiles(GetDlgItem(hwndDlg
, IDC_USERPROFILE_LIST
));
123 /* Disable the "Delete" and "Copy To" buttons if the user is not an admin */
124 if (!IsUserAnAdmin())
126 EnableWindow(GetDlgItem(hwndDlg
, IDC_USERPROFILE_DELETE
), FALSE
);
127 EnableWindow(GetDlgItem(hwndDlg
, IDC_USERPROFILE_COPY
), FALSE
);
132 /* Property page dialog callback */
134 UserProfileDlgProc(HWND hwndDlg
,
142 OnInitDialog(hwndDlg
);
146 if ((LOWORD(wParam
) == IDOK
) || (LOWORD(wParam
) == IDCANCEL
))
156 NMHDR
*nmhdr
= (NMHDR
*)lParam
;
158 if (nmhdr
->idFrom
== IDC_USERACCOUNT_LINK
&& nmhdr
->code
== NM_CLICK
)
160 ShellExecute(hwndDlg
,
162 TEXT("rundll32.exe"),
163 TEXT("shell32.dll, Control_RunDLL nusrmgr.cpl"),