mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:52:56 +00:00
[SYSDM] Improve the user profile dialog
- Currently used profiles cannot be copied or deleted. - Unknown profiles cannot be copied. - A double click on a profile opens the change profile type dialog.
This commit is contained in:
parent
fbc14d52cd
commit
ba783adf1e
1 changed files with 42 additions and 22 deletions
|
@ -18,6 +18,7 @@ typedef struct _PROFILEDATA
|
||||||
{
|
{
|
||||||
DWORD dwRefCount;
|
DWORD dwRefCount;
|
||||||
DWORD dwState;
|
DWORD dwState;
|
||||||
|
BOOL bUnknownProfile;
|
||||||
PWSTR pszFullName;
|
PWSTR pszFullName;
|
||||||
PWSTR pszProfilePath;
|
PWSTR pszProfilePath;
|
||||||
} PROFILEDATA, *PPROFILEDATA;
|
} PROFILEDATA, *PPROFILEDATA;
|
||||||
|
@ -391,7 +392,8 @@ BOOL
|
||||||
GetProfileName(
|
GetProfileName(
|
||||||
_In_ PSID pProfileSid,
|
_In_ PSID pProfileSid,
|
||||||
_In_ DWORD dwNameBufferSize,
|
_In_ DWORD dwNameBufferSize,
|
||||||
_Out_ PWSTR pszNameBuffer)
|
_Out_ PWSTR pszNameBuffer,
|
||||||
|
_Out_ PBOOL pbUnknownProfile)
|
||||||
{
|
{
|
||||||
WCHAR szAccountName[128], szDomainName[128];
|
WCHAR szAccountName[128], szDomainName[128];
|
||||||
DWORD dwAccountNameSize, dwDomainNameSize;
|
DWORD dwAccountNameSize, dwDomainNameSize;
|
||||||
|
@ -409,6 +411,7 @@ GetProfileName(
|
||||||
{
|
{
|
||||||
/* Unknown account */
|
/* Unknown account */
|
||||||
LoadStringW(hApplet, IDS_USERPROFILE_ACCOUNT_UNKNOWN, pszNameBuffer, dwNameBufferSize);
|
LoadStringW(hApplet, IDS_USERPROFILE_ACCOUNT_UNKNOWN, pszNameBuffer, dwNameBufferSize);
|
||||||
|
*pbUnknownProfile = TRUE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -426,6 +429,7 @@ GetProfileName(
|
||||||
/* Normal account */
|
/* Normal account */
|
||||||
wsprintf(pszNameBuffer, L"%s\\%s", szDomainName, szAccountName);
|
wsprintf(pszNameBuffer, L"%s\\%s", szDomainName, szAccountName);
|
||||||
}
|
}
|
||||||
|
*pbUnknownProfile = FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
@ -479,6 +483,7 @@ AddUserProfile(
|
||||||
HANDLE hFile;
|
HANDLE hFile;
|
||||||
SYSTEMTIME SystemTime;
|
SYSTEMTIME SystemTime;
|
||||||
ULONGLONG ullProfileSize;
|
ULONGLONG ullProfileSize;
|
||||||
|
BOOL bUnknownProfile;
|
||||||
DWORD dwError;
|
DWORD dwError;
|
||||||
|
|
||||||
/* Get the profile path */
|
/* Get the profile path */
|
||||||
|
@ -521,7 +526,10 @@ AddUserProfile(
|
||||||
GetProfileSize(szProfilePath, &ullProfileSize);
|
GetProfileSize(szProfilePath, &ullProfileSize);
|
||||||
|
|
||||||
/* Get the profile name */
|
/* Get the profile name */
|
||||||
if (!GetProfileName(pProfileSid, ARRAYSIZE(szNameBuffer), szNameBuffer))
|
if (!GetProfileName(pProfileSid,
|
||||||
|
ARRAYSIZE(szNameBuffer),
|
||||||
|
szNameBuffer,
|
||||||
|
&bUnknownProfile))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/* Get the profile state value */
|
/* Get the profile state value */
|
||||||
|
@ -560,6 +568,7 @@ AddUserProfile(
|
||||||
|
|
||||||
pProfileData->dwRefCount = dwRefCount;
|
pProfileData->dwRefCount = dwRefCount;
|
||||||
pProfileData->dwState = dwState;
|
pProfileData->dwState = dwState;
|
||||||
|
pProfileData->bUnknownProfile = bUnknownProfile;
|
||||||
|
|
||||||
ptr = (PWSTR)((ULONG_PTR)pProfileData + sizeof(PROFILEDATA));
|
ptr = (PWSTR)((ULONG_PTR)pProfileData + sizeof(PROFILEDATA));
|
||||||
pProfileData->pszFullName = ptr;
|
pProfileData->pszFullName = ptr;
|
||||||
|
@ -629,29 +638,37 @@ UpdateButtonState(
|
||||||
BOOL bChange = FALSE;
|
BOOL bChange = FALSE;
|
||||||
BOOL bCopy = FALSE;
|
BOOL bCopy = FALSE;
|
||||||
BOOL bDelete = FALSE;
|
BOOL bDelete = FALSE;
|
||||||
|
PPROFILEDATA pProfileData;
|
||||||
|
|
||||||
iSelected = ListView_GetNextItem(hwndListView, -1, LVNI_SELECTED);
|
if (ListView_GetSelectedCount(hwndListView) != 0)
|
||||||
if (iSelected != -1)
|
|
||||||
{
|
{
|
||||||
Item.mask = LVIF_PARAM;
|
iSelected = ListView_GetNextItem(hwndListView, -1, LVNI_SELECTED);
|
||||||
Item.iItem = iSelected;
|
if (iSelected != -1)
|
||||||
Item.iSubItem = 0;
|
|
||||||
if (ListView_GetItem(hwndListView, &Item))
|
|
||||||
{
|
{
|
||||||
if (Item.lParam != 0)
|
Item.mask = LVIF_PARAM;
|
||||||
|
Item.iItem = iSelected;
|
||||||
|
Item.iSubItem = 0;
|
||||||
|
if (ListView_GetItem(hwndListView, &Item))
|
||||||
{
|
{
|
||||||
bCopy = (((PPROFILEDATA)Item.lParam)->dwRefCount == 0);
|
if (Item.lParam != 0)
|
||||||
bDelete = (((PPROFILEDATA)Item.lParam)->dwRefCount == 0);
|
{
|
||||||
}
|
pProfileData = (PPROFILEDATA)Item.lParam;
|
||||||
}
|
|
||||||
|
|
||||||
bChange = TRUE;
|
if (pProfileData->bUnknownProfile)
|
||||||
}
|
{
|
||||||
else
|
bDelete = TRUE;
|
||||||
{
|
bCopy = FALSE;
|
||||||
bChange = FALSE;
|
}
|
||||||
bCopy = FALSE;
|
else
|
||||||
bDelete = FALSE;
|
{
|
||||||
|
bDelete = (pProfileData->dwRefCount == 0);
|
||||||
|
bCopy = (pProfileData->dwRefCount == 0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bChange = TRUE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_CHANGE), bChange);
|
EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_CHANGE), bChange);
|
||||||
|
@ -823,9 +840,12 @@ OnNotify(
|
||||||
{
|
{
|
||||||
ShellExecuteW(hwndDlg, NULL, L"usrmgr.cpl", NULL, NULL, 0);
|
ShellExecuteW(hwndDlg, NULL, L"usrmgr.cpl", NULL, NULL, 0);
|
||||||
}
|
}
|
||||||
else if (nmhdr->idFrom == IDC_USERPROFILE_LIST && nmhdr->code == LVN_ITEMCHANGED)
|
else if (nmhdr->idFrom == IDC_USERPROFILE_LIST)
|
||||||
{
|
{
|
||||||
UpdateButtonState(hwndDlg, nmhdr->hwndFrom);
|
if (nmhdr->code == LVN_ITEMCHANGED)
|
||||||
|
UpdateButtonState(hwndDlg, nmhdr->hwndFrom);
|
||||||
|
else if (nmhdr->code == NM_DBLCLK)
|
||||||
|
ChangeUserProfileType(hwndDlg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue