https://git.reactos.org/?p=reactos.git;a=commitdiff;h=cf6a5d6e7c6a1b69f6554…
commit cf6a5d6e7c6a1b69f6554d298a3e9848cccc603f
Author: Eric Kohl <eric.kohl(a)reactos.org>
AuthorDate: Sat Mar 16 19:12:25 2019 +0100
Commit: Eric Kohl <eric.kohl(a)reactos.org>
CommitDate: Sat Mar 16 19:13:15 2019 +0100
[USERENV] Store the profiles load time, flags and state in the profile list.
---
dll/win32/userenv/profile.c | 107 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 107 insertions(+)
diff --git a/dll/win32/userenv/profile.c b/dll/win32/userenv/profile.c
index 1c18a67ab6..bd859cc21c 100644
--- a/dll/win32/userenv/profile.c
+++ b/dll/win32/userenv/profile.c
@@ -348,6 +348,109 @@ done:
}
+static
+DWORD
+SetProfileData(
+ _In_ PWSTR pszSidString,
+ _In_ DWORD dwFlags,
+ _In_ HANDLE hToken)
+{
+ HKEY hProfilesKey = NULL, hProfileKey = NULL;
+ FILETIME LoadTime;
+ DWORD dwLength, dwState = 0;
+ DWORD dwError;
+
+ DPRINT("SetProfileData(%S %p)\n",
+ pszSidString, hToken);
+
+ dwError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
+ L"SOFTWARE\\Microsoft\\Windows
NT\\CurrentVersion\\ProfileList",
+ 0,
+ KEY_QUERY_VALUE,
+ &hProfilesKey);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("Error: %lu\n", dwError);
+ goto done;
+ }
+
+ dwError = RegOpenKeyExW(hProfilesKey,
+ pszSidString,
+ 0,
+ KEY_QUERY_VALUE | KEY_SET_VALUE,
+ &hProfileKey);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("Error: %lu\n", dwError);
+ goto done;
+ }
+
+ /* Set the profile load time */
+ GetSystemTimeAsFileTime(&LoadTime);
+
+ dwLength = sizeof(LoadTime.dwLowDateTime);
+ dwError = RegSetValueExW(hProfileKey,
+ L"ProfileLoadTimeLow",
+ 0,
+ REG_DWORD,
+ (PBYTE)&LoadTime.dwLowDateTime,
+ dwLength);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("Error: %lu\n", dwError);
+ goto done;
+ }
+
+ dwLength = sizeof(LoadTime.dwHighDateTime);
+ dwError = RegSetValueExW(hProfileKey,
+ L"ProfileLoadTimeHigh",
+ 0,
+ REG_DWORD,
+ (PBYTE)&LoadTime.dwHighDateTime,
+ dwLength);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("Error: %lu\n", dwError);
+ goto done;
+ }
+
+ dwLength = sizeof(dwFlags);
+ dwError = RegSetValueExW(hProfileKey,
+ L"Flags",
+ 0,
+ REG_DWORD,
+ (PBYTE)&dwFlags,
+ dwLength);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("Error: %lu\n", dwError);
+ goto done;
+ }
+
+ dwLength = sizeof(dwState);
+ dwError = RegSetValueExW(hProfileKey,
+ L"State",
+ 0,
+ REG_DWORD,
+ (PBYTE)&dwState,
+ dwLength);
+ if (dwError != ERROR_SUCCESS)
+ {
+ DPRINT1("Error: %lu\n", dwError);
+ goto done;
+ }
+
+done:
+ if (hProfileKey != NULL)
+ RegCloseKey(hProfileKey);
+
+ if (hProfilesKey != NULL)
+ RegCloseKey(hProfilesKey);
+
+ return dwError;
+}
+
+
/* PUBLIC FUNCTIONS ********************************************************/
BOOL
@@ -1749,6 +1852,10 @@ LoadUserProfileW(
SetLastError((DWORD)Error);
goto cleanup;
}
+
+ SetProfileData(SidString.Buffer,
+ lpProfileInfo->dwFlags,
+ hToken);
}
/* Open future HKEY_CURRENT_USER */