ReactOS  0.4.15-dev-5618-g8866b9d
userprofile.c File Reference
#include "precomp.h"
#include <sddl.h>
#include <winnls.h>
#include <debug.h>
Include dependency graph for userprofile.c:

Go to the source code of this file.

Classes

struct  _PROFILEDATA
 

Typedefs

typedef struct _PROFILEDATA PROFILEDATA
 
typedef struct _PROFILEDATAPPROFILEDATA
 

Functions

static BOOL OnProfileTypeInit (_In_ HWND hwndDlg, _In_ PPROFILEDATA pProfileData)
 
static INT_PTR CALLBACK UserProfileTypeDlgProc (_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
 
static BOOL ChangeUserProfileType (_In_ HWND hwndDlg)
 
static BOOL DeleteUserProfile (_In_ HWND hwndDlg)
 
static INT_PTR CALLBACK CopyUserProfileDlgProc (_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
 
static BOOL CopyUserProfile (_In_ HWND hwndDlg)
 
static VOID SetListViewColumns (_In_ HWND hwndListView)
 
static BOOL GetProfileSize (_In_ PWSTR pszProfilePath, _Inout_ PULONGLONG pullProfileSize)
 
static BOOL GetProfileName (_In_ PSID pProfileSid, _In_ DWORD dwNameBufferSize, _Out_ PWSTR pszNameBuffer, _Out_ PBOOL pbUnknownProfile)
 
static VOID AddUserProfile (_In_ HWND hwndListView, _In_ PSID pProfileSid, _In_ HKEY hProfileKey)
 
static VOID UpdateButtonState (_In_ HWND hwndDlg, _In_ HWND hwndListView)
 
static VOID AddUserProfiles (_In_ HWND hwndDlg, _In_ HWND hwndListView, _In_ BOOL bAdmin)
 
static VOID OnInitUserProfileDialog (HWND hwndDlg)
 
static VOID OnNotify (_In_ HWND hwndDlg, _In_ NMHDR *nmhdr)
 
INT_PTR CALLBACK UserProfileDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Typedef Documentation

◆ PPROFILEDATA

◆ PROFILEDATA

Function Documentation

◆ AddUserProfile()

static VOID AddUserProfile ( _In_ HWND  hwndListView,
_In_ PSID  pProfileSid,
_In_ HKEY  hProfileKey 
)
static

Definition at line 434 of file userprofile.c.

438 {
439  WCHAR szTempProfilePath[MAX_PATH], szProfilePath[MAX_PATH];
440  WCHAR szNameBuffer[256];
441  PPROFILEDATA pProfileData = NULL;
442  DWORD dwProfileData, dwSize, dwType, dwState = 0, dwRefCount = 0;
443  DWORD dwProfilePathLength;
444  PWSTR ptr;
445  INT nId, iItem;
446  LV_ITEM lvi;
447  WIN32_FIND_DATA FindData;
448  HANDLE hFile;
449  SYSTEMTIME SystemTime;
450  ULONGLONG ullProfileSize;
451  BOOL bUnknownProfile;
452  DWORD dwError;
453 
454  /* Get the profile path */
455  dwSize = MAX_PATH * sizeof(WCHAR);
456  dwError = RegQueryValueExW(hProfileKey,
457  L"ProfileImagePath",
458  NULL,
459  &dwType,
460  (LPBYTE)szTempProfilePath,
461  &dwSize);
462  if (dwError != ERROR_SUCCESS)
463  return;
464 
465  /* Expand it */
466  ExpandEnvironmentStringsW(szTempProfilePath,
467  szProfilePath,
468  MAX_PATH);
469 
470  /* Check if the profile path exists */
471  hFile = FindFirstFileW(szProfilePath, &FindData);
473  return;
474 
475  FindClose(hFile);
476 
477  /* Get the length of the profile path */
478  dwProfilePathLength = wcslen(szProfilePath);
479 
480  /* Check for the ntuser.dat file */
481  wcscat(szProfilePath, L"\\ntuser.dat");
482  hFile = FindFirstFileW(szProfilePath, &FindData);
484  return;
485 
486  FindClose(hFile);
487  szProfilePath[dwProfilePathLength] = UNICODE_NULL;
488 
489  /* Get the profile size */
490  ullProfileSize = 0ULL;
491  GetProfileSize(szProfilePath, &ullProfileSize);
492 
493  /* Get the profile name */
494  if (!GetProfileName(pProfileSid,
495  ARRAYSIZE(szNameBuffer),
496  szNameBuffer,
497  &bUnknownProfile))
498  return;
499 
500  /* Get the profile state value */
501  dwSize = sizeof(dwState);
502  if (RegQueryValueExW(hProfileKey,
503  L"State",
504  NULL,
505  &dwType,
506  (LPBYTE)&dwState,
507  &dwSize) != ERROR_SUCCESS)
508  {
509  dwState = 0;
510  }
511 
512  /* Get the profile reference counter */
513  dwSize = sizeof(dwRefCount);
514  if (RegQueryValueExW(hProfileKey,
515  L"RefCount",
516  NULL,
517  &dwType,
518  (LPBYTE)&dwRefCount,
519  &dwSize) != ERROR_SUCCESS)
520  {
521  dwRefCount = 0;
522  }
523 
524  /* Create and fill the profile data entry */
525  dwProfileData = sizeof(PROFILEDATA) +
526  ((wcslen(szNameBuffer) + 1) * sizeof(WCHAR)) +
527  ((wcslen(szProfilePath) + 1) * sizeof(WCHAR));
528  pProfileData = HeapAlloc(GetProcessHeap(),
530  dwProfileData);
531  if (pProfileData == NULL)
532  return;
533 
534  pProfileData->dwRefCount = dwRefCount;
535  pProfileData->dwState = dwState;
536  pProfileData->bUnknownProfile = bUnknownProfile;
537 
538  ptr = (PWSTR)((ULONG_PTR)pProfileData + sizeof(PROFILEDATA));
539  pProfileData->pszFullName = ptr;
540 
541  wcscpy(pProfileData->pszFullName, szNameBuffer);
542 
543  ptr = (PWSTR)((ULONG_PTR)ptr + ((wcslen(pProfileData->pszFullName) + 1) * sizeof(WCHAR)));
544  pProfileData->pszProfilePath = ptr;
545  wcscpy(pProfileData->pszProfilePath, szProfilePath);
546 
547  /* Add the profile and set its name */
548  memset(&lvi, 0x00, sizeof(lvi));
549  lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
550  lvi.pszText = pProfileData->pszFullName;
551  lvi.state = 0;
552  lvi.lParam = (LPARAM)pProfileData;
553  iItem = ListView_InsertItem(hwndListView, &lvi);
554 
555  /* Set the profile size */
556  StrFormatByteSizeW(ullProfileSize, szNameBuffer, ARRAYSIZE(szNameBuffer) - 1);
557  ListView_SetItemText(hwndListView, iItem, 1, szNameBuffer);
558 
559  /* Set the profile type */
560  if (dwState & 0x0010) // PROFILE_UPDATE_CENTRAL
562  else
563  nId = IDS_USERPROFILE_LOCAL;
564 
565  LoadStringW(hApplet, nId, szNameBuffer, ARRAYSIZE(szNameBuffer));
566 
567  ListView_SetItemText(hwndListView, iItem, 2, szNameBuffer);
568 
569  /* FIXME: Set the profile status */
570  if (dwState & 0x0001) // PROFILE_MANDATORY
572  else if (dwState & 0x0010) // PROFILE_UPDATE_CENTRAL
574  else
575  nId = IDS_USERPROFILE_LOCAL;
576 
577  LoadStringW(hApplet, nId, szNameBuffer, ARRAYSIZE(szNameBuffer));
578 
579  ListView_SetItemText(hwndListView, iItem, 3, szNameBuffer);
580 
581  /* Set the profile modified time */
582  FileTimeToSystemTime(&FindData.ftLastWriteTime,
583  &SystemTime);
584 
587  &SystemTime,
588  NULL,
589  szNameBuffer,
590  ARRAYSIZE(szNameBuffer));
591 
592  ListView_SetItemText(hwndListView, iItem, 4, szNameBuffer);
593 }
#define LV_ITEM
Definition: commctrl.h:2337
LPWSTR WINAPI StrFormatByteSizeW(LONGLONG llBytes, LPWSTR lpszDest, UINT cchMax)
Definition: string.c:2380
#define ERROR_SUCCESS
Definition: deptool.c:10
uint16_t * PWSTR
Definition: typedefs.h:56
#define LOCALE_USER_DEFAULT
#define DATE_SHORTDATE
Definition: winnls.h:196
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
HINSTANCE hApplet
Definition: access.c:17
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2408
DWORD dwRefCount
Definition: userprofile.c:19
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
#define IDS_USERPROFILE_MANDATORY
Definition: resource.h:39
uint32_t ULONG_PTR
Definition: typedefs.h:65
#define LVIF_TEXT
Definition: commctrl.h:2309
BOOL bUnknownProfile
Definition: userprofile.c:21
#define L(x)
Definition: ntvdm.h:50
unsigned char * LPBYTE
Definition: typedefs.h:53
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_USERPROFILE_ROAMING
Definition: resource.h:38
static PVOID ptr
Definition: dispmode.c:27
HWND hwndListView
Definition: eventvwr.c:66
LONG_PTR LPARAM
Definition: windef.h:208
#define ULL(a, b)
Definition: format_msg.c:27
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2691
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:188
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
__wchar_t WCHAR
Definition: xmlstorage.h:180
uint64_t ULONGLONG
Definition: typedefs.h:67
#define MAX_PATH
Definition: compat.h:34
struct _PROFILEDATA PROFILEDATA
unsigned long DWORD
Definition: ntddk_ex.h:95
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_In_ HANDLE hFile
Definition: mswsock.h:90
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:979
PWSTR pszFullName
Definition: userprofile.c:22
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static BOOL GetProfileName(_In_ PSID pProfileSid, _In_ DWORD dwNameBufferSize, _Out_ PWSTR pszNameBuffer, _Out_ PBOOL pbUnknownProfile)
Definition: userprofile.c:386
#define NULL
Definition: types.h:112
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
DWORD dwState
Definition: userprofile.c:20
static BOOL GetProfileSize(_In_ PWSTR pszProfilePath, _Inout_ PULONGLONG pullProfileSize)
Definition: userprofile.c:324
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVIF_STATE
Definition: commctrl.h:2312
#define memset(x, y, z)
Definition: compat.h:39
#define IDS_USERPROFILE_LOCAL
Definition: resource.h:37
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
PWSTR pszProfilePath
Definition: userprofile.c:23
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by AddUserProfiles().

◆ AddUserProfiles()

static VOID AddUserProfiles ( _In_ HWND  hwndDlg,
_In_ HWND  hwndListView,
_In_ BOOL  bAdmin 
)
static

Definition at line 646 of file userprofile.c.

650 {
651  HKEY hKeyUserProfiles = INVALID_HANDLE_VALUE;
652  HKEY hProfileKey;
653  DWORD dwIndex;
654  WCHAR szProfileSid[64];
655  DWORD dwSidLength;
656  FILETIME ftLastWrite;
657  DWORD dwSize;
658  HANDLE hToken = NULL;
659  PTOKEN_USER pTokenUser = NULL;
660  PSID pProfileSid;
661  PWSTR pszProfileSid;
662 
664  return;
665 
666  if (GetTokenInformation(hToken, TokenUser, NULL, 0, &dwSize) ||
668  {
669  goto done;
670  }
671 
672  pTokenUser = HeapAlloc(GetProcessHeap(), 0, dwSize);
673  if (pTokenUser == NULL)
674  goto done;
675 
676  if (!GetTokenInformation(hToken, TokenUser, pTokenUser, dwSize, &dwSize))
677  goto done;
678 
680  L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
681  0,
682  KEY_READ,
683  &hKeyUserProfiles))
684  goto done;
685 
686  if (bAdmin)
687  {
688  for (dwIndex = 0; ; dwIndex++)
689  {
690  dwSidLength = ARRAYSIZE(szProfileSid);
691  if (RegEnumKeyExW(hKeyUserProfiles,
692  dwIndex,
693  szProfileSid,
694  &dwSidLength,
695  NULL,
696  NULL,
697  NULL,
698  &ftLastWrite))
699  break;
700 
701  if (RegOpenKeyExW(hKeyUserProfiles,
702  szProfileSid,
703  0,
704  KEY_READ,
705  &hProfileKey) == ERROR_SUCCESS)
706  {
707  if (ConvertStringSidToSid(szProfileSid, &pProfileSid))
708  {
710  pProfileSid,
711  hProfileKey);
712  LocalFree(pProfileSid);
713  }
714 
715  RegCloseKey(hProfileKey);
716  }
717  }
718  }
719  else
720  {
721  if (ConvertSidToStringSidW(pTokenUser->User.Sid, &pszProfileSid))
722  {
723  if (RegOpenKeyExW(hKeyUserProfiles,
724  pszProfileSid,
725  0,
726  KEY_READ,
727  &hProfileKey) == ERROR_SUCCESS)
728  {
730  pTokenUser->User.Sid,
731  hProfileKey);
732  RegCloseKey(hProfileKey);
733  }
734 
735  LocalFree(pszProfileSid);
736  }
737  }
738 
741 
743 
744 done:
745  if (hKeyUserProfiles != INVALID_HANDLE_VALUE)
746  RegCloseKey(hKeyUserProfiles);
747 
748  if (pTokenUser != NULL)
749  HeapFree(GetProcessHeap(), 0, pTokenUser);
750 
751  if (hToken != NULL)
752  CloseHandle(hToken);
753 }
#define CloseHandle
Definition: compat.h:739
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWSTR
Definition: typedefs.h:56
#define ConvertStringSidToSid
Definition: sddl.h:161
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
static VOID AddUserProfile(_In_ HWND hwndListView, _In_ PSID pProfileSid, _In_ HKEY hProfileKey)
Definition: userprofile.c:434
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3382
#define L(x)
Definition: ntvdm.h:50
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2673
HWND hwndListView
Definition: eventvwr.c:66
#define LVIS_SELECTED
Definition: commctrl.h:2319
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2307
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define TOKEN_QUERY
Definition: setypes.h:924
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define GetCurrentProcess()
Definition: compat.h:759
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define NULL
Definition: types.h:112
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
Definition: security.c:413
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
SID_AND_ATTRIBUTES User
Definition: setypes.h:1006
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2527
#define HeapFree(x, y, z)
Definition: compat.h:735
#define RegCloseKey(hKey)
Definition: registry.h:47
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define LVIS_FOCUSED
Definition: commctrl.h:2318
static VOID UpdateButtonState(_In_ HWND hwndDlg, _In_ HWND hwndListView)
Definition: userprofile.c:597
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10

Referenced by OnInitUserProfileDialog().

◆ ChangeUserProfileType()

static BOOL ChangeUserProfileType ( _In_ HWND  hwndDlg)
static

Definition at line 108 of file userprofile.c.

110 {
112  LVITEM Item;
113  INT iSelected;
114 
115  DPRINT("ChangeUserProfileType(%p)\n", hwndDlg);
116 
118  if (hwndListView == NULL)
119  return FALSE;
120 
122  if (iSelected == -1)
123  return FALSE;
124 
125  ZeroMemory(&Item, sizeof(LVITEM));
126  Item.mask = LVIF_PARAM;
127  Item.iItem = iSelected;
129  return FALSE;
130 
131  if (Item.lParam == 0)
132  return FALSE;
133 
136  hwndDlg,
138  (LPARAM)Item.lParam) == IDOK)
139  {
140  /* FIXME: Update the profile list view */
141  return TRUE;
142  }
143 
144  return FALSE;
145 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define IDOK
Definition: winuser.h:824
static INT_PTR CALLBACK UserProfileTypeDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: userprofile.c:75
#define TRUE
Definition: types.h:120
#define IDC_USERPROFILE_LIST
Definition: resource.h:107
#define ZeroMemory
Definition: winbase.h:1670
HINSTANCE hApplet
Definition: access.c:17
#define LVNI_SELECTED
Definition: commctrl.h:2424
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
HWND hwndListView
Definition: eventvwr.c:66
#define IDD_USERPROFILE_TYPE
Definition: resource.h:114
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DialogBoxParam
Definition: winuser.h:5754
#define NULL
Definition: types.h:112
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVITEM
Definition: commctrl.h:2375
#define DPRINT
Definition: sndvol32.h:71

Referenced by OnNotify(), and UserProfileDlgProc().

◆ CopyUserProfile()

static BOOL CopyUserProfile ( _In_ HWND  hwndDlg)
static

Definition at line 231 of file userprofile.c.

233 {
235  LVITEM Item;
236  INT iSelected;
237 
238  DPRINT("CopyUserProfile()\n");
239 
241  if (hwndListView == NULL)
242  return FALSE;
243 
245  if (iSelected == -1)
246  return FALSE;
247 
248  ZeroMemory(&Item, sizeof(LVITEM));
249  Item.mask = LVIF_PARAM;
250  Item.iItem = iSelected;
252  return FALSE;
253 
254  if (Item.lParam == 0)
255  return FALSE;
256 
259  hwndDlg,
261  (LPARAM)Item.lParam) == IDOK)
262  {
263  /* FIXME: Update the profile list view */
264  return TRUE;
265  }
266 
267  return FALSE;
268 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
#define IDC_USERPROFILE_LIST
Definition: resource.h:107
#define ZeroMemory
Definition: winbase.h:1670
HINSTANCE hApplet
Definition: access.c:17
#define LVNI_SELECTED
Definition: commctrl.h:2424
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
#define IDD_USERPROFILE_COPY
Definition: resource.h:120
HWND hwndListView
Definition: eventvwr.c:66
LONG_PTR LPARAM
Definition: windef.h:208
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DialogBoxParam
Definition: winuser.h:5754
#define NULL
Definition: types.h:112
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVITEM
Definition: commctrl.h:2375
#define DPRINT
Definition: sndvol32.h:71
static INT_PTR CALLBACK CopyUserProfileDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: userprofile.c:199

Referenced by UserProfileDlgProc().

◆ CopyUserProfileDlgProc()

static INT_PTR CALLBACK CopyUserProfileDlgProc ( _In_ HWND  hwndDlg,
_In_ UINT  uMsg,
_In_ WPARAM  wParam,
_In_ LPARAM  lParam 
)
static

Definition at line 199 of file userprofile.c.

204 {
205  switch (uMsg)
206  {
207  case WM_INITDIALOG:
208  return TRUE;
209 
210  case WM_DESTROY:
211  break;
212 
213  case WM_COMMAND:
214  switch (LOWORD(wParam))
215  {
216  case IDOK:
217  case IDCANCEL:
218  EndDialog(hwndDlg,
219  LOWORD(wParam));
220  return TRUE;
221  }
222  break;
223  }
224 
225  return FALSE;
226 }
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define FALSE
Definition: types.h:117
#define WM_DESTROY
Definition: winuser.h:1599
#define WM_COMMAND
Definition: winuser.h:1730
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1729
#define LOWORD(l)
Definition: pedump.c:82

Referenced by CopyUserProfile().

◆ DeleteUserProfile()

static BOOL DeleteUserProfile ( _In_ HWND  hwndDlg)
static

Definition at line 150 of file userprofile.c.

152 {
154  LVITEM Item;
155  INT iSelected;
156  PPROFILEDATA pProfileData;
157 
158  DPRINT("DeleteUserProfile()\n");
159 
161  if (hwndListView == NULL)
162  return FALSE;
163 
165  if (iSelected == -1)
166  return FALSE;
167 
168  ZeroMemory(&Item, sizeof(LVITEM));
169  Item.mask = LVIF_PARAM;
170  Item.iItem = iSelected;
172  return FALSE;
173 
174  if (Item.lParam == 0)
175  return FALSE;
176 
177  pProfileData = (PPROFILEDATA)Item.lParam;
178  if (pProfileData->dwRefCount != 0)
179  return FALSE;
180 
182  hwndDlg,
186  pProfileData->pszFullName) == IDYES)
187  {
188  /* FIXME: Delete the profile here! */
189  return TRUE;
190  }
191 
192  return FALSE;
193 }
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define IDYES
Definition: winuser.h:829
#define TRUE
Definition: types.h:120
#define IDC_USERPROFILE_LIST
Definition: resource.h:107
#define ZeroMemory
Definition: winbase.h:1670
HINSTANCE hApplet
Definition: access.c:17
#define LVNI_SELECTED
Definition: commctrl.h:2424
DWORD dwRefCount
Definition: userprofile.c:19
if(dx==0 &&dy==0)
Definition: linetemp.h:174
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
#define MB_YESNO
Definition: winuser.h:811
#define IDS_USERPROFILE_CONFIRM_DELETE
Definition: resource.h:40
HWND hwndListView
Definition: eventvwr.c:66
#define MB_ICONQUESTION
Definition: winuser.h:783
VOID ResourceMessageBox(HINSTANCE hInstance, HWND hwnd, UINT uType, UINT uCaptionId, UINT uMessageId)
Definition: misc.c:282
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
struct _PROFILEDATA * PPROFILEDATA
#define IDS_USERPROFILE_CONFIRM_DELETE_TITLE
Definition: resource.h:41
PWSTR pszFullName
Definition: userprofile.c:22
#define NULL
Definition: types.h:112
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVITEM
Definition: commctrl.h:2375
#define DPRINT
Definition: sndvol32.h:71

Referenced by UserProfileDlgProc().

◆ GetProfileName()

static BOOL GetProfileName ( _In_ PSID  pProfileSid,
_In_ DWORD  dwNameBufferSize,
_Out_ PWSTR  pszNameBuffer,
_Out_ PBOOL  pbUnknownProfile 
)
static

Definition at line 386 of file userprofile.c.

391 {
392  WCHAR szAccountName[128], szDomainName[128];
393  DWORD dwAccountNameSize, dwDomainNameSize;
394  SID_NAME_USE Use;
395 
396  dwAccountNameSize = ARRAYSIZE(szAccountName);
397  dwDomainNameSize = ARRAYSIZE(szDomainName);
398  if (!LookupAccountSidW(NULL,
399  pProfileSid,
400  szAccountName,
401  &dwAccountNameSize,
402  szDomainName,
403  &dwDomainNameSize,
404  &Use))
405  {
406  /* Unknown account */
407  LoadStringW(hApplet, IDS_USERPROFILE_ACCOUNT_UNKNOWN, pszNameBuffer, dwNameBufferSize);
408  *pbUnknownProfile = TRUE;
409  }
410  else
411  {
412  /* Show only the user accounts */
413  if (Use != SidTypeUser)
414  return FALSE;
415 
416  if (szAccountName[0] == UNICODE_NULL)
417  {
418  /* Deleted account */
419  LoadStringW(hApplet, IDS_USERPROFILE_ACCOUNT_DELETED, pszNameBuffer, dwNameBufferSize);
420  }
421  else
422  {
423  /* Normal account */
424  wsprintf(pszNameBuffer, L"%s\\%s", szDomainName, szAccountName);
425  }
426  *pbUnknownProfile = FALSE;
427  }
428 
429  return TRUE;
430 }
enum _SID_NAME_USE SID_NAME_USE
#define TRUE
Definition: types.h:120
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HINSTANCE hApplet
Definition: access.c:17
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
BOOL WINAPI LookupAccountSidW(LPCWSTR pSystemName, PSID pSid, LPWSTR pAccountName, LPDWORD pdwAccountName, LPWSTR pDomainName, LPDWORD pdwDomainName, PSID_NAME_USE peUse)
Definition: misc.c:537
#define IDS_USERPROFILE_ACCOUNT_DELETED
Definition: resource.h:43
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_USERPROFILE_ACCOUNT_UNKNOWN
Definition: resource.h:42
unsigned long DWORD
Definition: ntddk_ex.h:95
#define NULL
Definition: types.h:112
#define wsprintf
Definition: winuser.h:5855

Referenced by AddUserProfile().

◆ GetProfileSize()

static BOOL GetProfileSize ( _In_ PWSTR  pszProfilePath,
_Inout_ PULONGLONG  pullProfileSize 
)
static

Definition at line 324 of file userprofile.c.

327 {
329  WIN32_FIND_DATA FindData;
330  DWORD dwProfilePathLength;
332  BOOL bResult = TRUE;
333 
334  dwProfilePathLength = wcslen(pszProfilePath);
335 
336  wcscat(pszProfilePath, L"\\*.*");
337 
338  hFile = FindFirstFileW(pszProfilePath, &FindData);
340  {
341  if ((GetLastError() != ERROR_FILE_NOT_FOUND) &&
343  bResult = FALSE;
344 
345  goto done;
346  }
347 
348  do
349  {
350  if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
351  {
352  if ((_wcsicmp(FindData.cFileName, L".") == 0) ||
353  (_wcsicmp(FindData.cFileName, L"..") == 0))
354  continue;
355 
356  pszProfilePath[dwProfilePathLength + 1] = UNICODE_NULL;
357  wcscat(pszProfilePath, FindData.cFileName);
358 
359  if (!GetProfileSize(pszProfilePath, pullProfileSize))
360  {
361  bResult = FALSE;
362  goto done;
363  }
364  }
365  else
366  {
367  Size.u.LowPart = FindData.nFileSizeLow;
368  Size.u.HighPart = FindData.nFileSizeHigh;
369  *pullProfileSize += Size.QuadPart;
370  }
371  }
372  while (FindNextFile(hFile, &FindData));
373 
374 done:
375  pszProfilePath[dwProfilePathLength] = UNICODE_NULL;
376 
378  FindClose(hFile);
379 
380  return bResult;
381 }
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:361
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1040
#define L(x)
Definition: ntvdm.h:50
#define FALSE
Definition: types.h:117
#define UNICODE_NULL
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
#define FindNextFile
Definition: winbase.h:3659
unsigned long DWORD
Definition: ntddk_ex.h:95
_In_ HANDLE hFile
Definition: mswsock.h:90
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
static BOOL GetProfileSize(_In_ PWSTR pszProfilePath, _Inout_ PULONGLONG pullProfileSize)
Definition: userprofile.c:324
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502

Referenced by AddUserProfile().

◆ OnInitUserProfileDialog()

static VOID OnInitUserProfileDialog ( HWND  hwndDlg)
static

Definition at line 757 of file userprofile.c.

758 {
759  BOOL bAdmin;
760 
761  bAdmin = IsUserAdmin();
762 
763  /* Initialize the list view control */
765 
766  /* Hide the delete and copy buttons for non-admins */
769 
770  /* Add the profiles to the list view */
771  AddUserProfiles(hwndDlg, GetDlgItem(hwndDlg, IDC_USERPROFILE_LIST), bAdmin);
772 }
#define SW_HIDE
Definition: winuser.h:762
#define IDC_USERPROFILE_LIST
Definition: resource.h:107
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
unsigned int BOOL
Definition: ntddk_ex.h:94
static BOOL IsUserAdmin(VOID)
Definition: netid.c:163
#define IDC_USERPROFILE_DELETE
Definition: resource.h:109
#define SW_SHOW
Definition: winuser.h:769
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
static VOID AddUserProfiles(_In_ HWND hwndDlg, _In_ HWND hwndListView, _In_ BOOL bAdmin)
Definition: userprofile.c:646
#define IDC_USERPROFILE_COPY
Definition: resource.h:110
static VOID SetListViewColumns(_In_ HWND hwndListView)
Definition: userprofile.c:272

Referenced by UserProfileDlgProc().

◆ OnNotify()

static VOID OnNotify ( _In_ HWND  hwndDlg,
_In_ NMHDR nmhdr 
)
static

Definition at line 776 of file userprofile.c.

779 {
780  LPNMLISTVIEW pNMLV;
781 
782  if (nmhdr->idFrom == IDC_USERACCOUNT_LINK && nmhdr->code == NM_CLICK)
783  {
784  ShellExecuteW(hwndDlg, NULL, L"usrmgr.cpl", NULL, NULL, 0);
785  }
786  else if (nmhdr->idFrom == IDC_USERPROFILE_LIST)
787  {
788  switch(nmhdr->code)
789  {
790  case LVN_ITEMCHANGED:
791  UpdateButtonState(hwndDlg, nmhdr->hwndFrom);
792  break;
793 
794  case NM_DBLCLK:
795  ChangeUserProfileType(hwndDlg);
796  break;
797 
798  case LVN_DELETEITEM:
799  pNMLV = (LPNMLISTVIEW)nmhdr;
800  if (pNMLV->lParam != 0)
801  HeapFree(GetProcessHeap(), 0, (LPVOID)pNMLV->lParam);
802  break;
803  }
804  }
805 }
#define LVN_ITEMCHANGED
Definition: commctrl.h:3131
#define IDC_USERPROFILE_LIST
Definition: resource.h:107
#define L(x)
Definition: ntvdm.h:50
static BOOL ChangeUserProfileType(_In_ HWND hwndDlg)
Definition: userprofile.c:108
#define GetProcessHeap()
Definition: compat.h:736
#define LVN_DELETEITEM
Definition: commctrl.h:3133
#define IDC_USERACCOUNT_LINK
Definition: resource.h:111
#define NM_CLICK
Definition: commctrl.h:130
#define NM_DBLCLK
Definition: commctrl.h:131
struct tagNMLISTVIEW * LPNMLISTVIEW
#define NULL
Definition: types.h:112
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2346
LPARAM lParam
Definition: commctrl.h:3040
#define HeapFree(x, y, z)
Definition: compat.h:735
static VOID UpdateButtonState(_In_ HWND hwndDlg, _In_ HWND hwndListView)
Definition: userprofile.c:597

Referenced by UserProfileDlgProc().

◆ OnProfileTypeInit()

static BOOL OnProfileTypeInit ( _In_ HWND  hwndDlg,
_In_ PPROFILEDATA  pProfileData 
)
static

Definition at line 29 of file userprofile.c.

32 {
33  PWSTR pszRawBuffer = NULL, pszCookedBuffer = NULL;
34  INT nLength;
35 
37  pszRawBuffer = NULL;
38  if (nLength == 0)
39  return FALSE;
40 
41  pszRawBuffer = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(WCHAR));
42  if (pszRawBuffer == NULL)
43  return FALSE;
44 
46 
47  pszCookedBuffer = HeapAlloc(GetProcessHeap(), 0, (nLength + wcslen(pProfileData->pszFullName) + 1) * sizeof(WCHAR));
48  if (pszCookedBuffer == NULL)
49  goto done;
50 
51  swprintf(pszCookedBuffer, pszRawBuffer, pProfileData->pszFullName);
52 
53  /* Set the full text */
54  SetDlgItemText(hwndDlg, IDC_USERPROFILE_TYPE_TEXT, pszCookedBuffer);
55 
56  /* FIXME: Right now, we support local user profiles only! */
59  EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
60 
61 done:
62  if (pszCookedBuffer != NULL)
63  HeapFree(GetProcessHeap(), 0, pszCookedBuffer);
64 
65  if (pszRawBuffer != NULL)
66  HeapFree(GetProcessHeap(), 0, pszRawBuffer);
67 
68  return TRUE;
69 }
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
uint16_t * PWSTR
Definition: typedefs.h:56
#define IDC_USERPROFILE_TYPE_TEXT
Definition: resource.h:115
#define IDC_USERPROFILE_TYPE_LOCAL
Definition: resource.h:117
_In_ DWORD nLength
Definition: wincon.h:473
#define IDS_USERPROFILE_TYPE_TEXT
Definition: resource.h:44
HINSTANCE hApplet
Definition: access.c:17
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
int32_t INT
Definition: typedefs.h:58
#define FALSE
Definition: types.h:117
#define IDC_USERPROFILE_TYPE_ROAMING
Definition: resource.h:116
#define GetProcessHeap()
Definition: compat.h:736
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define SetDlgItemText
Definition: winuser.h:5839
int _cdecl swprintf(const WCHAR *,...)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define NULL
Definition: types.h:112
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define BST_CHECKED
Definition: winuser.h:197
#define Button_SetCheck(hwndCtl, check)
Definition: windowsx.h:35
#define HeapFree(x, y, z)
Definition: compat.h:735

Referenced by UserProfileTypeDlgProc().

◆ SetListViewColumns()

static VOID SetListViewColumns ( _In_ HWND  hwndListView)
static

Definition at line 272 of file userprofile.c.

274 {
276  RECT rect;
277  TCHAR szStr[32];
278 
280 
282 
283  memset(&column, 0x00, sizeof(column));
285  column.fmt = LVCFMT_LEFT;
286  column.cx = (INT)((rect.right - rect.left) * 0.40);
287  column.iSubItem = 0;
289  column.pszText = szStr;
291 
292  column.fmt = LVCFMT_RIGHT;
293  column.cx = (INT)((rect.right - rect.left) * 0.15);
294  column.iSubItem = 1;
296  column.pszText = szStr;
298 
299  column.fmt = LVCFMT_LEFT;
300  column.cx = (INT)((rect.right - rect.left) * 0.15);
301  column.iSubItem = 2;
303  column.pszText = szStr;
305 
306  column.fmt = LVCFMT_LEFT;
307  column.cx = (INT)((rect.right - rect.left) * 0.15);
308  column.iSubItem = 3;
310  column.pszText = szStr;
312 
313  column.fmt = LVCFMT_LEFT;
314  column.cx = (INT)((rect.right - rect.left) * 0.15) - GetSystemMetrics(SM_CYHSCROLL);
315  column.iSubItem = 4;
317  column.pszText = szStr;
319 }
#define IDS_USERPROFILE_MODIFIED
Definition: resource.h:36
#define SM_CYHSCROLL
Definition: winuser.h:956
struct png_info_def **typedef void(__cdecl typeof(png_destroy_read_struct))(struct png_struct_def **
Definition: typeof.h:49
#define LVCF_WIDTH
Definition: commctrl.h:2587
#define LVCF_TEXT
Definition: commctrl.h:2588
#define LV_COLUMN
Definition: commctrl.h:2547
#define INT
Definition: polytest.cpp:20
#define LVCFMT_RIGHT
Definition: commctrl.h:2599
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2734
#define LVCFMT_LEFT
Definition: commctrl.h:2598
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
HINSTANCE hApplet
Definition: access.c:17
& rect
Definition: startmenu.cpp:1413
#define LVCF_SUBITEM
Definition: commctrl.h:2589
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2636
HWND hwndListView
Definition: eventvwr.c:66
char TCHAR
Definition: xmlstorage.h:189
int WINAPI GetSystemMetrics(_In_ int)
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2724
#define IDS_USERPROFILE_SIZE
Definition: resource.h:33
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2586
#define IDS_USERPROFILE_STATUS
Definition: resource.h:35
#define SendMessage
Definition: winuser.h:5833
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664
#define memset(x, y, z)
Definition: compat.h:39
#define IDS_USERPROFILE_TYPE
Definition: resource.h:34
#define LoadString
Definition: winuser.h:5809
#define IDS_USERPROFILE_NAME
Definition: resource.h:32

Referenced by OnInitUserProfileDialog().

◆ UpdateButtonState()

static VOID UpdateButtonState ( _In_ HWND  hwndDlg,
_In_ HWND  hwndListView 
)
static

Definition at line 597 of file userprofile.c.

600 {
601  LVITEM Item;
602  INT iSelected;
603  BOOL bChange = FALSE;
604  BOOL bCopy = FALSE;
605  BOOL bDelete = FALSE;
606  PPROFILEDATA pProfileData;
607 
609  {
611  if (iSelected != -1)
612  {
613  ZeroMemory(&Item, sizeof(LVITEM));
614  Item.mask = LVIF_PARAM;
615  Item.iItem = iSelected;
617  {
618  if (Item.lParam != 0)
619  {
620  pProfileData = (PPROFILEDATA)Item.lParam;
621 
622  if (pProfileData->bUnknownProfile)
623  {
624  bDelete = TRUE;
625  bCopy = FALSE;
626  }
627  else
628  {
629  bDelete = (pProfileData->dwRefCount == 0);
630  bCopy = (pProfileData->dwRefCount == 0);
631  }
632  }
633  }
634 
635  bChange = TRUE;
636  }
637  }
638 
639  EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_CHANGE), bChange);
640  EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_DELETE), bDelete);
641  EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_COPY), bCopy);
642 }
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2434
#define TRUE
Definition: types.h:120
#define ZeroMemory
Definition: winbase.h:1670
#define LVNI_SELECTED
Definition: commctrl.h:2424
DWORD dwRefCount
Definition: userprofile.c:19
if(dx==0 &&dy==0)
Definition: linetemp.h:174
int32_t INT
Definition: typedefs.h:58
#define IDC_USERPROFILE_CHANGE
Definition: resource.h:108
BOOL bUnknownProfile
Definition: userprofile.c:21
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2709
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
HWND hwndListView
Definition: eventvwr.c:66
#define IDC_USERPROFILE_DELETE
Definition: resource.h:109
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
struct _PROFILEDATA * PPROFILEDATA
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_USERPROFILE_COPY
Definition: resource.h:110
_In_ WDFCOLLECTION _In_ WDFOBJECT Item
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2394
#define LVIF_PARAM
Definition: commctrl.h:2311
#define LVITEM
Definition: commctrl.h:2375

Referenced by AddUserProfiles(), and OnNotify().

◆ UserProfileDlgProc()

INT_PTR CALLBACK UserProfileDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 810 of file userprofile.c.

814 {
815  switch (uMsg)
816  {
817  case WM_INITDIALOG:
818  OnInitUserProfileDialog(hwndDlg);
819  return TRUE;
820 
821  case WM_COMMAND:
822  switch (LOWORD(wParam))
823  {
824  case IDOK:
825  case IDCANCEL:
826  EndDialog(hwndDlg,
827  LOWORD(wParam));
828  return TRUE;
829 
831  ChangeUserProfileType(hwndDlg);
832  break;
833 
835  DeleteUserProfile(hwndDlg);
836  break;
837 
839  CopyUserProfile(hwndDlg);
840  break;
841  }
842  break;
843 
844  case WM_NOTIFY:
845  OnNotify(hwndDlg, (NMHDR *)lParam);
846  break;
847  }
848 
849  return FALSE;
850 }
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
static VOID OnInitUserProfileDialog(HWND hwndDlg)
Definition: userprofile.c:757
#define IDC_USERPROFILE_CHANGE
Definition: resource.h:108
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static BOOL CopyUserProfile(_In_ HWND hwndDlg)
Definition: userprofile.c:231
#define FALSE
Definition: types.h:117
#define IDC_USERPROFILE_DELETE
Definition: resource.h:109
static BOOL ChangeUserProfileType(_In_ HWND hwndDlg)
Definition: userprofile.c:108
#define WM_COMMAND
Definition: winuser.h:1730
#define IDC_USERPROFILE_COPY
Definition: resource.h:110
static VOID OnNotify(_In_ HWND hwndDlg, _In_ NMHDR *nmhdr)
Definition: userprofile.c:776
static BOOL DeleteUserProfile(_In_ HWND hwndDlg)
Definition: userprofile.c:150
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define WM_NOTIFY
Definition: richedit.h:61

Referenced by AdvancedPageProc().

◆ UserProfileTypeDlgProc()

static INT_PTR CALLBACK UserProfileTypeDlgProc ( _In_ HWND  hwndDlg,
_In_ UINT  uMsg,
_In_ WPARAM  wParam,
_In_ LPARAM  lParam 
)
static

Definition at line 75 of file userprofile.c.

80 {
81  switch (uMsg)
82  {
83  case WM_INITDIALOG:
85  return TRUE;
86 
87  case WM_DESTROY:
88  break;
89 
90  case WM_COMMAND:
91  switch (LOWORD(wParam))
92  {
93  case IDOK:
94  case IDCANCEL:
95  EndDialog(hwndDlg,
96  LOWORD(wParam));
97  return TRUE;
98  }
99  break;
100  }
101 
102  return FALSE;
103 }
#define IDOK
Definition: winuser.h:824
#define TRUE
Definition: types.h:120
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static BOOL OnProfileTypeInit(_In_ HWND hwndDlg, _In_ PPROFILEDATA pProfileData)
Definition: userprofile.c:29
#define FALSE
Definition: types.h:117
#define WM_DESTROY
Definition: winuser.h:1599
#define WM_COMMAND
Definition: winuser.h:1730
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1729
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82

Referenced by ChangeUserProfileType().