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
,
70 memset(&lvi
, 0x00, sizeof(lvi
));
71 lvi
.mask
= LVIF_TEXT
| LVIF_STATE
;
72 lvi
.pszText
= lpProfileSid
;
74 ListView_InsertItem(hwndListView
, &lvi
);
79 AddUserProfiles(HWND hwndListView
)
81 HKEY hKeyUserProfiles
;
83 TCHAR szProfileSid
[64];
87 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE
,
88 _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList"),
94 for (dwIndex
= 0; ; dwIndex
++)
97 if (RegEnumKeyEx(hKeyUserProfiles
,
107 AddUserProfile(hwndListView
, szProfileSid
);
110 RegCloseKey(hKeyUserProfiles
);
115 OnInitDialog(HWND hwndDlg
)
117 /* Initialize the list view control */
118 SetListViewColumns(GetDlgItem(hwndDlg
, IDC_USERPROFILE_LIST
));
120 AddUserProfiles(GetDlgItem(hwndDlg
, IDC_USERPROFILE_LIST
));
122 /* Disable the "Delete" and "Copy To" buttons if the user is not an admin */
123 if (!IsUserAnAdmin())
125 EnableWindow(GetDlgItem(hwndDlg
, IDC_USERPROFILE_DELETE
), FALSE
);
126 EnableWindow(GetDlgItem(hwndDlg
, IDC_USERPROFILE_COPY
), FALSE
);
131 /* Property page dialog callback */
133 UserProfileDlgProc(HWND hwndDlg
,
141 OnInitDialog(hwndDlg
);
145 if ((LOWORD(wParam
) == IDOK
) || (LOWORD(wParam
) == IDCANCEL
))
155 NMHDR
*nmhdr
= (NMHDR
*)lParam
;
157 if (nmhdr
->idFrom
== IDC_USERACCOUNT_LINK
&& nmhdr
->code
== NM_CLICK
)
159 ShellExecute(hwndDlg
,
161 TEXT("rundll32.exe"),
162 TEXT("shell32.dll, Control_RunDLL nusrmgr.cpl"),