From: Eric Kohl Date: Mon, 16 Sep 2019 06:51:08 +0000 (+0200) Subject: [SYSDM] Store the profile path in the PROFILEDATA struct for deleting and copying... X-Git-Tag: 0.4.14-dev~77 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=95dd1c6705a604c5031aa062d2e24c091a93f8c7 [SYSDM] Store the profile path in the PROFILEDATA struct for deleting and copying the profiles --- diff --git a/dll/cpl/sysdm/userprofile.c b/dll/cpl/sysdm/userprofile.c index 0c9e1f9d399..bd2ac0fe80d 100644 --- a/dll/cpl/sysdm/userprofile.c +++ b/dll/cpl/sysdm/userprofile.c @@ -19,14 +19,15 @@ typedef struct _PROFILEDATA DWORD dwRefCount; DWORD dwState; PWSTR pszFullName; + PWSTR pszProfilePath; } PROFILEDATA, *PPROFILEDATA; static BOOL OnProfileTypeInit( - HWND hwndDlg, - PPROFILEDATA pProfileData) + _In_ HWND hwndDlg, + _In_ PPROFILEDATA pProfileData) { PWSTR pszRawBuffer = NULL, pszCookedBuffer = NULL; INT nLength; @@ -326,8 +327,8 @@ SetListViewColumns( static BOOL GetProfileSize( - PWSTR pszProfilePath, - PULONGLONG pullProfileSize) + _In_ PWSTR pszProfilePath, + _Inout_ PULONGLONG pullProfileSize) { HANDLE hFile = INVALID_HANDLE_VALUE; WIN32_FIND_DATA FindData; @@ -433,7 +434,9 @@ GetProfileName( static VOID -FormatProfileSize(LPWSTR Buffer, double size) +FormatProfileSize( + _Out_ LPWSTR Buffer, + _In_ double size) { const LPWSTR units[] = {L"MB", L"GB", L"TB"}; int i = 0, j; @@ -547,7 +550,8 @@ AddUserProfile( /* Create and fill the profile data entry */ dwProfileData = sizeof(PROFILEDATA) + - ((wcslen(szNameBuffer) + 1) * sizeof(WCHAR)); + ((wcslen(szNameBuffer) + 1) * sizeof(WCHAR)) + + ((wcslen(szProfilePath) + 1) * sizeof(WCHAR)); pProfileData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, dwProfileData); @@ -562,6 +566,10 @@ AddUserProfile( wcscpy(pProfileData->pszFullName, szNameBuffer); + ptr = (PWSTR)((ULONG_PTR)ptr + ((wcslen(pProfileData->pszFullName) + 1) * sizeof(WCHAR))); + pProfileData->pszProfilePath = ptr; + wcscpy(pProfileData->pszProfilePath, szProfilePath); + /* Add the profile and set its name */ memset(&lvi, 0x00, sizeof(lvi)); lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;