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>
14 SetListViewColumns(HWND hwndListView
)
20 GetClientRect(hwndListView
, &rect
);
22 SendMessage(hwndListView
, LVM_SETEXTENDEDLISTVIEWSTYLE
, 0, LVS_EX_FULLROWSELECT
);
24 memset(&column
, 0x00, sizeof(column
));
25 column
.mask
= LVCF_FMT
| LVCF_WIDTH
| LVCF_SUBITEM
| LVCF_TEXT
;
26 column
.fmt
= LVCFMT_LEFT
;
27 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.40);
29 LoadString(hApplet
, IDS_USERPROFILE_NAME
, szStr
, 32);
30 column
.pszText
= szStr
;
31 (void)ListView_InsertColumn(hwndListView
, 0, &column
);
33 column
.fmt
= LVCFMT_RIGHT
;
34 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.15);
36 LoadString(hApplet
, IDS_USERPROFILE_SIZE
, szStr
, 32);
37 column
.pszText
= szStr
;
38 (void)ListView_InsertColumn(hwndListView
, 1, &column
);
40 column
.fmt
= LVCFMT_LEFT
;
41 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.15);
43 LoadString(hApplet
, IDS_USERPROFILE_TYPE
, szStr
, 32);
44 column
.pszText
= szStr
;
45 (void)ListView_InsertColumn(hwndListView
, 2, &column
);
47 column
.fmt
= LVCFMT_LEFT
;
48 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.15);
50 LoadString(hApplet
, IDS_USERPROFILE_STATUS
, szStr
, 32);
51 column
.pszText
= szStr
;
52 (void)ListView_InsertColumn(hwndListView
, 3, &column
);
54 column
.fmt
= LVCFMT_LEFT
;
55 column
.cx
= (INT
)((rect
.right
- rect
.left
) * 0.15) - GetSystemMetrics(SM_CYHSCROLL
);
57 LoadString(hApplet
, IDS_USERPROFILE_MODIFIED
, szStr
, 32);
58 column
.pszText
= szStr
;
59 (void)ListView_InsertColumn(hwndListView
, 4, &column
);
64 AddUserProfile(HWND hwndListView
,
69 memset(&lvi
, 0x00, sizeof(lvi
));
70 lvi
.mask
= LVIF_TEXT
| LVIF_STATE
;
71 lvi
.pszText
= lpProfileSid
;
73 ListView_InsertItem(hwndListView
, &lvi
);
78 AddUserProfiles(HWND hwndListView
)
80 HKEY hKeyUserProfiles
;
82 TCHAR szProfileSid
[64];
86 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
87 _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList"),
93 for (dwIndex
= 0; ; dwIndex
++)
96 if (RegEnumKeyEx(hKeyUserProfiles
,
106 AddUserProfile(hwndListView
, szProfileSid
);
109 RegCloseKey(hKeyUserProfiles
);
114 OnInitDialog(HWND hwndDlg
)
116 /* Initialize the list view control */
117 SetListViewColumns(GetDlgItem(hwndDlg
, IDC_USERPROFILE_LIST
));
119 AddUserProfiles(GetDlgItem(hwndDlg
, IDC_USERPROFILE_LIST
));
121 /* Disable the "Delete" and "Copy To" buttons if the user is not an admin */
122 if (!IsUserAnAdmin())
124 EnableWindow(GetDlgItem(hwndDlg
, IDC_USERPROFILE_DELETE
), FALSE
);
125 EnableWindow(GetDlgItem(hwndDlg
, IDC_USERPROFILE_COPY
), FALSE
);
130 /* Property page dialog callback */
132 UserProfileDlgProc(HWND hwndDlg
,
140 OnInitDialog(hwndDlg
);
144 if ((LOWORD(wParam
) == IDOK
) || (LOWORD(wParam
) == IDCANCEL
))
154 NMHDR
*nmhdr
= (NMHDR
*)lParam
;
156 if (nmhdr
->idFrom
== IDC_USERACCOUNT_LINK
&& nmhdr
->code
== NM_CLICK
)
158 ShellExecute(hwndDlg
,
160 TEXT("rundll32.exe"),
161 TEXT("shell32.dll, Control_RunDLL nusrmgr.cpl"),