https://git.reactos.org/?p=reactos.git;a=commitdiff;h=9a4676f19fdaff40cc235…
commit 9a4676f19fdaff40cc23532d6e53c531547fe8f2
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sun Mar 24 06:49:27 2019 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sun Mar 24 06:50:24 2019 +0100
[SYSDM] Get a profiles 'State' value and use it to display the profile type.
---
dll/cpl/sysdm/userprofile.c | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
diff --git a/dll/cpl/sysdm/userprofile.c b/dll/cpl/sysdm/userprofile.c
index 6bdcd04e2c..fa59e9e534 100644
--- a/dll/cpl/sysdm/userprofile.c
+++ b/dll/cpl/sysdm/userprofile.c
@@ -16,6 +16,7 @@
typedef struct _PROFILEDATA
{
BOOL bMyProfile;
+ DWORD dwState;
PWSTR pszFullName;
} PROFILEDATA, *PPROFILEDATA;
@@ -204,9 +205,10 @@ AddUserProfile(
WCHAR szNameBuffer[256];
SID_NAME_USE Use;
DWORD dwAccountNameSize, dwDomainNameSize;
- DWORD dwProfileData;
+ DWORD dwProfileData, dwSize, dwType, dwState = 0;
PWSTR ptr;
PSID pSid = NULL;
+ INT nId, iItem;
LV_ITEM lvi;
if (!ConvertStringSidToSid(lpProfileSid,
@@ -244,6 +246,18 @@ AddUserProfile(
}
}
+ /* Get the profile state value */
+ dwSize = sizeof(dwState);
+ if (RegQueryValueExW(hProfileKey,
+ L"State",
+ NULL,
+ &dwType,
+ (LPBYTE)&dwState,
+ &dwSize) != ERROR_SUCCESS)
+ {
+ dwState = 0;
+ }
+
dwProfileData = sizeof(PROFILEDATA) +
((wcslen(szNameBuffer) + 1) * sizeof(WCHAR));
pProfileData = HeapAlloc(GetProcessHeap(),
@@ -253,18 +267,32 @@ AddUserProfile(
goto done;
pProfileData->bMyProfile = EqualSid(pMySid, pSid);
+ pProfileData->dwState = dwState;
ptr = (PWSTR)((ULONG_PTR)pProfileData + sizeof(PROFILEDATA));
pProfileData->pszFullName = ptr;
wcscpy(pProfileData->pszFullName, szNameBuffer);
+ /* Add the profile and set its name */
memset(&lvi, 0x00, sizeof(lvi));
lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
lvi.pszText = pProfileData->pszFullName;
lvi.state = 0;
lvi.lParam = (LPARAM)pProfileData;
- ListView_InsertItem(hwndListView, &lvi);
+ iItem = ListView_InsertItem(hwndListView, &lvi);
+
+ /* Set the profile type */
+ if (dwState & 0x0001) // PROFILE_MANDATORY
+ nId = IDS_USERPROFILE_MANDATORY;
+ else if (dwState & 0x0010) // PROFILE_UPDATE_CENTRAL
+ nId = IDS_USERPROFILE_ROAMING;
+ else
+ nId = IDS_USERPROFILE_LOCAL;
+
+ LoadStringW(hApplet, nId, szAccountName, ARRAYSIZE(szAccountName));
+
+ ListView_SetItemText(hwndListView, iItem, 2, szAccountName);
done:
if (pSid != NULL)