ReactOS  0.4.14-dev-115-g4576127
userprofile.c
Go to the documentation of this file.
1 /*
2  * PROJECT: ReactOS System Control Panel Applet
3  * LICENSE: GPL - See COPYING in the top level directory
4  * FILE: dll/cpl/sysdm/userprofile.c
5  * PURPOSE: Computer settings for networking
6  * COPYRIGHT: Copyright Thomas Weidenmueller <w3seek@reactos.org>
7  * Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
8  *
9  */
10 
11 #include "precomp.h"
12 #include <sddl.h>
13 #include <winnls.h>
14 
15 #include <debug.h>
16 
17 typedef struct _PROFILEDATA
18 {
24 
25 
26 static
27 BOOL
29  _In_ HWND hwndDlg,
30  _In_ PPROFILEDATA pProfileData)
31 {
32  PWSTR pszRawBuffer = NULL, pszCookedBuffer = NULL;
33  INT nLength;
34 
36  pszRawBuffer = NULL;
37  if (nLength == 0)
38  return FALSE;
39 
40  pszRawBuffer = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(WCHAR));
41  if (pszRawBuffer == NULL)
42  return FALSE;
43 
45 
46  pszCookedBuffer = HeapAlloc(GetProcessHeap(), 0, (nLength + wcslen(pProfileData->pszFullName) + 1) * sizeof(WCHAR));
47  if (pszCookedBuffer == NULL)
48  goto done;
49 
50  swprintf(pszCookedBuffer, pszRawBuffer, pProfileData->pszFullName);
51 
52  /* Set the full text */
53  SetDlgItemText(hwndDlg, IDC_USERPROFILE_TYPE_TEXT, pszCookedBuffer);
54 
55  /* FIXME: Right now, we support local user profiles only! */
58  EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
59 
60 done:
61  if (pszCookedBuffer != NULL)
62  HeapFree(GetProcessHeap(), 0, pszCookedBuffer);
63 
64  if (pszRawBuffer != NULL)
65  HeapFree(GetProcessHeap(), 0, pszRawBuffer);
66 
67  return TRUE;
68 }
69 
70 
71 static
72 INT_PTR
75  _In_ HWND hwndDlg,
76  _In_ UINT uMsg,
79 {
80  switch (uMsg)
81  {
82  case WM_INITDIALOG:
84  return TRUE;
85 
86  case WM_DESTROY:
87  break;
88 
89  case WM_COMMAND:
90  switch (LOWORD(wParam))
91  {
92  case IDOK:
93  case IDCANCEL:
94  EndDialog(hwndDlg,
95  LOWORD(wParam));
96  return TRUE;
97  }
98  break;
99  }
100 
101  return FALSE;
102 }
103 
104 
105 static
106 BOOL
108  _In_ HWND hwndDlg)
109 {
111  LVITEM Item;
112  INT iSelected;
113 
114  DPRINT("ChangeUserProfileType(%p)\n", hwndDlg);
115 
117  if (hwndListView == NULL)
118  return FALSE;
119 
121  if (iSelected == -1)
122  return FALSE;
123 
124  ZeroMemory(&Item, sizeof(LVITEM));
125  Item.mask = LVIF_PARAM;
126  Item.iItem = iSelected;
127  Item.iSubItem = 0;
128  if (!ListView_GetItem(hwndListView, &Item))
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 }
146 
147 
148 static
149 BOOL
151  _In_ HWND hwndDlg)
152 {
153  WCHAR szTitle[64], szRawText[128], szCookedText[256];
155  LVITEM Item;
156  INT iSelected;
157  PPROFILEDATA pProfileData;
158 
159  DPRINT("DeleteUserProfile()\n");
160 
162  if (hwndListView == NULL)
163  return FALSE;
164 
166  if (iSelected == -1)
167  return FALSE;
168 
169  ZeroMemory(&Item, sizeof(LVITEM));
170  Item.mask = LVIF_PARAM;
171  Item.iItem = iSelected;
172  Item.iSubItem = 0;
173  if (!ListView_GetItem(hwndListView, &Item))
174  return FALSE;
175 
176  if (Item.lParam == 0)
177  return FALSE;
178 
179  pProfileData = (PPROFILEDATA)Item.lParam;
180  if (pProfileData->dwRefCount != 0)
181  return FALSE;
182 
185  swprintf(szCookedText, szRawText, pProfileData->pszFullName);
186 
187  if (MessageBoxW(hwndDlg,
188  szCookedText,
189  szTitle,
191  {
192  /* FIXME: Delete the profile here! */
193  return TRUE;
194  }
195 
196  return FALSE;
197 }
198 
199 
200 static
201 INT_PTR
202 CALLBACK
204  _In_ HWND hwndDlg,
205  _In_ UINT uMsg,
208 {
209  switch (uMsg)
210  {
211  case WM_INITDIALOG:
212  return TRUE;
213 
214  case WM_DESTROY:
215  break;
216 
217  case WM_COMMAND:
218  switch (LOWORD(wParam))
219  {
220  case IDOK:
221  case IDCANCEL:
222  EndDialog(hwndDlg,
223  LOWORD(wParam));
224  return TRUE;
225  }
226  break;
227  }
228 
229  return FALSE;
230 }
231 
232 
233 static
234 BOOL
236  _In_ HWND hwndDlg)
237 {
239  LVITEM Item;
240  INT iSelected;
241 
242  DPRINT("CopyUserProfile()\n");
243 
245  if (hwndListView == NULL)
246  return FALSE;
247 
249  if (iSelected == -1)
250  return FALSE;
251 
252  ZeroMemory(&Item, sizeof(LVITEM));
253  Item.mask = LVIF_PARAM;
254  Item.iItem = iSelected;
255  Item.iSubItem = 0;
256  if (!ListView_GetItem(hwndListView, &Item))
257  return FALSE;
258 
259  if (Item.lParam == 0)
260  return FALSE;
261 
264  hwndDlg,
266  (LPARAM)Item.lParam) == IDOK)
267  {
268  /* FIXME: Update the profile list view */
269  return TRUE;
270  }
271 
272  return FALSE;
273 }
274 
275 
276 static VOID
279 {
281  RECT rect;
282  TCHAR szStr[32];
283 
285 
287 
288  memset(&column, 0x00, sizeof(column));
290  column.fmt = LVCFMT_LEFT;
291  column.cx = (INT)((rect.right - rect.left) * 0.40);
292  column.iSubItem = 0;
294  column.pszText = szStr;
296 
297  column.fmt = LVCFMT_RIGHT;
298  column.cx = (INT)((rect.right - rect.left) * 0.15);
299  column.iSubItem = 1;
301  column.pszText = szStr;
303 
304  column.fmt = LVCFMT_LEFT;
305  column.cx = (INT)((rect.right - rect.left) * 0.15);
306  column.iSubItem = 2;
308  column.pszText = szStr;
310 
311  column.fmt = LVCFMT_LEFT;
312  column.cx = (INT)((rect.right - rect.left) * 0.15);
313  column.iSubItem = 3;
315  column.pszText = szStr;
317 
318  column.fmt = LVCFMT_LEFT;
319  column.cx = (INT)((rect.right - rect.left) * 0.15) - GetSystemMetrics(SM_CYHSCROLL);
320  column.iSubItem = 4;
322  column.pszText = szStr;
324 }
325 
326 
327 static
328 BOOL
330  _In_ PWSTR pszProfilePath,
331  _Inout_ PULONGLONG pullProfileSize)
332 {
334  WIN32_FIND_DATA FindData;
335  DWORD dwProfilePathLength;
337  BOOL bResult = TRUE;
338 
339  dwProfilePathLength = wcslen(pszProfilePath);
340 
341  wcscat(pszProfilePath, L"\\*.*");
342 
343  hFile = FindFirstFileW(pszProfilePath, &FindData);
345  {
346  if ((GetLastError() != ERROR_FILE_NOT_FOUND) &&
348  bResult = FALSE;
349 
350  goto done;
351  }
352 
353  do
354  {
355  if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
356  {
357  if ((_wcsicmp(FindData.cFileName, L".") == 0) ||
358  (_wcsicmp(FindData.cFileName, L"..") == 0))
359  continue;
360 
361  pszProfilePath[dwProfilePathLength + 1] = UNICODE_NULL;
362  wcscat(pszProfilePath, FindData.cFileName);
363 
364  if (!GetProfileSize(pszProfilePath, pullProfileSize))
365  {
366  bResult = FALSE;
367  goto done;
368  }
369  }
370  else
371  {
372  Size.u.LowPart = FindData.nFileSizeLow;
373  Size.u.HighPart = FindData.nFileSizeHigh;
374  *pullProfileSize += Size.QuadPart;
375  }
376  }
377  while (FindNextFile(hFile, &FindData));
378 
379 done:
380  pszProfilePath[dwProfilePathLength] = UNICODE_NULL;
381 
383  FindClose(hFile);
384 
385  return bResult;
386 }
387 
388 
389 static
390 BOOL
392  _In_ PSID pProfileSid,
393  _In_ DWORD dwNameBufferSize,
394  _Out_ PWSTR pszNameBuffer)
395 {
396  WCHAR szAccountName[128], szDomainName[128];
397  DWORD dwAccountNameSize, dwDomainNameSize;
398  SID_NAME_USE Use;
399 
400  dwAccountNameSize = ARRAYSIZE(szAccountName);
401  dwDomainNameSize = ARRAYSIZE(szDomainName);
402  if (!LookupAccountSidW(NULL,
403  pProfileSid,
404  szAccountName,
405  &dwAccountNameSize,
406  szDomainName,
407  &dwDomainNameSize,
408  &Use))
409  {
410  /* Unknown account */
411  LoadStringW(hApplet, IDS_USERPROFILE_ACCOUNT_UNKNOWN, pszNameBuffer, dwNameBufferSize);
412  }
413  else
414  {
415  /* Show only the user accounts */
416  if (Use != SidTypeUser)
417  return FALSE;
418 
419  if (szAccountName[0] == UNICODE_NULL)
420  {
421  /* Deleted account */
422  LoadStringW(hApplet, IDS_USERPROFILE_ACCOUNT_DELETED, pszNameBuffer, dwNameBufferSize);
423  }
424  else
425  {
426  /* Normal account */
427  wsprintf(pszNameBuffer, L"%s\\%s", szDomainName, szAccountName);
428  }
429  }
430 
431  return TRUE;
432 }
433 
434 
435 static
436 VOID
439  _In_ double size)
440 {
441  const LPWSTR units[] = {L"MB", L"GB", L"TB"};
442  int i = 0, j;
443 
444  size /= 1024;
445  size /= 1024;
446 
447  while (size >= 1024 && i < 3)
448  {
449  size /= 1024;
450  i++;
451  }
452 
453  if (size < 10)
454  j = 2;
455  else if (size < 100)
456  j = 1;
457  else
458  j = 0;
459 
460  swprintf(Buffer, L"%.*f %s", j, size, units[i]);
461 }
462 
463 
464 static VOID
467  _In_ PSID pProfileSid,
468  _In_ HKEY hProfileKey)
469 {
470  WCHAR szTempProfilePath[MAX_PATH], szProfilePath[MAX_PATH];
471  WCHAR szNameBuffer[256];
472  PPROFILEDATA pProfileData = NULL;
473  DWORD dwProfileData, dwSize, dwType, dwState = 0, dwRefCount = 0;
474  DWORD dwProfilePathLength;
475  PWSTR ptr;
476  INT nId, iItem;
477  LV_ITEM lvi;
478  WIN32_FIND_DATA FindData;
479  HANDLE hFile;
480  SYSTEMTIME SystemTime;
481  ULONGLONG ullProfileSize;
482  DWORD dwError;
483 
484  /* Get the profile path */
485  dwSize = MAX_PATH * sizeof(WCHAR);
486  dwError = RegQueryValueExW(hProfileKey,
487  L"ProfileImagePath",
488  NULL,
489  &dwType,
490  (LPBYTE)szTempProfilePath,
491  &dwSize);
492  if (dwError != ERROR_SUCCESS)
493  return;
494 
495  /* Expand it */
496  ExpandEnvironmentStringsW(szTempProfilePath,
497  szProfilePath,
498  MAX_PATH);
499 
500  /* Check if the profile path exists */
501  hFile = FindFirstFileW(szProfilePath, &FindData);
503  return;
504 
505  FindClose(hFile);
506 
507  /* Get the length of the profile path */
508  dwProfilePathLength = wcslen(szProfilePath);
509 
510  /* Check for the ntuser.dat file */
511  wcscat(szProfilePath, L"\\ntuser.dat");
512  hFile = FindFirstFileW(szProfilePath, &FindData);
514  return;
515 
516  FindClose(hFile);
517  szProfilePath[dwProfilePathLength] = UNICODE_NULL;
518 
519  /* Get the profile size */
520  ullProfileSize = 0ULL;
521  GetProfileSize(szProfilePath, &ullProfileSize);
522 
523  /* Get the profile name */
524  if (!GetProfileName(pProfileSid, ARRAYSIZE(szNameBuffer), szNameBuffer))
525  return;
526 
527  /* Get the profile state value */
528  dwSize = sizeof(dwState);
529  if (RegQueryValueExW(hProfileKey,
530  L"State",
531  NULL,
532  &dwType,
533  (LPBYTE)&dwState,
534  &dwSize) != ERROR_SUCCESS)
535  {
536  dwState = 0;
537  }
538 
539  /* Get the profile reference counter */
540  dwSize = sizeof(dwRefCount);
541  if (RegQueryValueExW(hProfileKey,
542  L"RefCount",
543  NULL,
544  &dwType,
545  (LPBYTE)&dwRefCount,
546  &dwSize) != ERROR_SUCCESS)
547  {
548  dwRefCount = 0;
549  }
550 
551  /* Create and fill the profile data entry */
552  dwProfileData = sizeof(PROFILEDATA) +
553  ((wcslen(szNameBuffer) + 1) * sizeof(WCHAR)) +
554  ((wcslen(szProfilePath) + 1) * sizeof(WCHAR));
555  pProfileData = HeapAlloc(GetProcessHeap(),
557  dwProfileData);
558  if (pProfileData == NULL)
559  return;
560 
561  pProfileData->dwRefCount = dwRefCount;
562  pProfileData->dwState = dwState;
563 
564  ptr = (PWSTR)((ULONG_PTR)pProfileData + sizeof(PROFILEDATA));
565  pProfileData->pszFullName = ptr;
566 
567  wcscpy(pProfileData->pszFullName, szNameBuffer);
568 
569  ptr = (PWSTR)((ULONG_PTR)ptr + ((wcslen(pProfileData->pszFullName) + 1) * sizeof(WCHAR)));
570  pProfileData->pszProfilePath = ptr;
571  wcscpy(pProfileData->pszProfilePath, szProfilePath);
572 
573  /* Add the profile and set its name */
574  memset(&lvi, 0x00, sizeof(lvi));
575  lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
576  lvi.pszText = pProfileData->pszFullName;
577  lvi.state = 0;
578  lvi.lParam = (LPARAM)pProfileData;
579  iItem = ListView_InsertItem(hwndListView, &lvi);
580 
581  /* Set the profile size */
582  FormatProfileSize(szNameBuffer, (double)ullProfileSize);
583  ListView_SetItemText(hwndListView, iItem, 1, szNameBuffer);
584 
585  /* Set the profile type */
586  if (dwState & 0x0010) // PROFILE_UPDATE_CENTRAL
588  else
589  nId = IDS_USERPROFILE_LOCAL;
590 
591  LoadStringW(hApplet, nId, szNameBuffer, ARRAYSIZE(szNameBuffer));
592 
593  ListView_SetItemText(hwndListView, iItem, 2, szNameBuffer);
594 
595  /* FIXME: Set the profile status */
596  if (dwState & 0x0001) // PROFILE_MANDATORY
598  else if (dwState & 0x0010) // PROFILE_UPDATE_CENTRAL
600  else
601  nId = IDS_USERPROFILE_LOCAL;
602 
603  LoadStringW(hApplet, nId, szNameBuffer, ARRAYSIZE(szNameBuffer));
604 
605  ListView_SetItemText(hwndListView, iItem, 3, szNameBuffer);
606 
607  /* Set the profile modified time */
608  FileTimeToSystemTime(&FindData.ftLastWriteTime,
609  &SystemTime);
610 
613  &SystemTime,
614  NULL,
615  szNameBuffer,
616  ARRAYSIZE(szNameBuffer));
617 
618  ListView_SetItemText(hwndListView, iItem, 4, szNameBuffer);
619 }
620 
621 
622 static VOID
624  _In_ HWND hwndDlg,
626 {
627  LVITEM Item;
628  INT iSelected;
629  BOOL bChange = FALSE;
630  BOOL bCopy = FALSE;
631  BOOL bDelete = FALSE;
632 
634  if (iSelected != -1)
635  {
636  Item.mask = LVIF_PARAM;
637  Item.iItem = iSelected;
638  Item.iSubItem = 0;
639  if (ListView_GetItem(hwndListView, &Item))
640  {
641  if (Item.lParam != 0)
642  {
643  bCopy = (((PPROFILEDATA)Item.lParam)->dwRefCount == 0);
644  bDelete = (((PPROFILEDATA)Item.lParam)->dwRefCount == 0);
645  }
646  }
647 
648  bChange = TRUE;
649  }
650  else
651  {
652  bChange = FALSE;
653  bCopy = FALSE;
654  bDelete = FALSE;
655  }
656 
657  EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_CHANGE), bChange);
658  EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_DELETE), bDelete);
659  EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_COPY), bCopy);
660 }
661 
662 
663 static VOID
665  _In_ HWND hwndDlg,
667  _In_ BOOL bAdmin)
668 {
669  HKEY hKeyUserProfiles = INVALID_HANDLE_VALUE;
670  HKEY hProfileKey;
671  DWORD dwIndex;
672  WCHAR szProfileSid[64];
673  DWORD dwSidLength;
674  FILETIME ftLastWrite;
675  DWORD dwSize;
676  HANDLE hToken = NULL;
677  PTOKEN_USER pTokenUser = NULL;
678  PSID pProfileSid;
679  PWSTR pszProfileSid;
680 
682  return;
683 
684  GetTokenInformation(hToken, TokenUser, NULL, 0, &dwSize);
685  if (dwSize == 0)
686  goto done;
687 
688  pTokenUser = HeapAlloc(GetProcessHeap(), 0, dwSize);
689  if (pTokenUser == NULL)
690  goto done;
691 
692  if (!GetTokenInformation(hToken, TokenUser, pTokenUser, dwSize, &dwSize))
693  goto done;
694 
696  L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
697  0,
698  KEY_READ,
699  &hKeyUserProfiles))
700  goto done;
701 
702  if (bAdmin)
703  {
704  for (dwIndex = 0; ; dwIndex++)
705  {
706  dwSidLength = ARRAYSIZE(szProfileSid);
707  if (RegEnumKeyExW(hKeyUserProfiles,
708  dwIndex,
709  szProfileSid,
710  &dwSidLength,
711  NULL,
712  NULL,
713  NULL,
714  &ftLastWrite))
715  break;
716 
717  if (RegOpenKeyExW(hKeyUserProfiles,
718  szProfileSid,
719  0,
720  KEY_READ,
721  &hProfileKey) == ERROR_SUCCESS)
722  {
723  if (ConvertStringSidToSid(szProfileSid, &pProfileSid))
724  {
726  pProfileSid,
727  hProfileKey);
728  LocalFree(pProfileSid);
729  }
730 
731  RegCloseKey(hProfileKey);
732  }
733  }
734  }
735  else
736  {
737  if (ConvertSidToStringSidW(pTokenUser->User.Sid, &pszProfileSid))
738  {
739  if (RegOpenKeyExW(hKeyUserProfiles,
740  pszProfileSid,
741  0,
742  KEY_READ,
743  &hProfileKey) == ERROR_SUCCESS)
744  {
746  pTokenUser->User.Sid,
747  hProfileKey);
748  RegCloseKey(hProfileKey);
749  }
750 
751  LocalFree(pszProfileSid);
752  }
753  }
754 
757 
759 
760 done:
761  if (hKeyUserProfiles != INVALID_HANDLE_VALUE)
762  RegCloseKey(hKeyUserProfiles);
763 
764  if (pTokenUser != NULL)
765  HeapFree(GetProcessHeap(), 0, pTokenUser);
766 
767  if (hToken != NULL)
768  CloseHandle(hToken);
769 }
770 
771 
772 static VOID
774 {
775  BOOL bAdmin;
776 
777  bAdmin = IsUserAdmin();
778 
779  /* Initialize the list view control */
781 
782  /* Hide the delete and copy buttons for non-admins */
785 
786  /* Add the profiles to the list view */
787  AddUserProfiles(hwndDlg, GetDlgItem(hwndDlg, IDC_USERPROFILE_LIST), bAdmin);
788 }
789 
790 
791 static
792 VOID
794  _In_ HWND hwndDlg)
795 {
796  HWND hwndList;
797  INT nItems, i;
798  LVITEM Item;
799 
800  hwndList = GetDlgItem(hwndDlg, IDC_USERPROFILE_LIST);
801 
802  nItems = ListView_GetItemCount(hwndList);
803  for (i = 0; i < nItems; i++)
804  {
805  Item.iItem = i;
806  Item.iSubItem = 0;
807  if (ListView_GetItem(hwndList, &Item))
808  {
809  if (Item.lParam != 0)
810  HeapFree(GetProcessHeap(), 0, (PVOID)Item.lParam);
811  }
812  }
813 }
814 
815 
816 static
817 VOID
819  _In_ HWND hwndDlg,
820  _In_ NMHDR *nmhdr)
821 {
822  if (nmhdr->idFrom == IDC_USERACCOUNT_LINK && nmhdr->code == NM_CLICK)
823  {
824  ShellExecuteW(hwndDlg, NULL, L"usrmgr.cpl", NULL, NULL, 0);
825  }
826  else if (nmhdr->idFrom == IDC_USERPROFILE_LIST && nmhdr->code == LVN_ITEMCHANGED)
827  {
828  UpdateButtonState(hwndDlg, nmhdr->hwndFrom);
829  }
830 }
831 
832 
833 /* Property page dialog callback */
836  UINT uMsg,
837  WPARAM wParam,
838  LPARAM lParam)
839 {
840  switch (uMsg)
841  {
842  case WM_INITDIALOG:
843  OnInitUserProfileDialog(hwndDlg);
844  return TRUE;
845 
846  case WM_DESTROY:
847  OnDestroy(hwndDlg);
848  break;
849 
850  case WM_COMMAND:
851  switch (LOWORD(wParam))
852  {
853  case IDOK:
854  case IDCANCEL:
855  EndDialog(hwndDlg,
856  LOWORD(wParam));
857  return TRUE;
858 
860  ChangeUserProfileType(hwndDlg);
861  break;
862 
864  DeleteUserProfile(hwndDlg);
865  break;
866 
868  CopyUserProfile(hwndDlg);
869  break;
870  }
871  break;
872 
873  case WM_NOTIFY:
874  OnNotify(hwndDlg, (NMHDR *)lParam);
875  break;
876  }
877 
878  return FALSE;
879 }
#define IDS_USERPROFILE_MODIFIED
Definition: resource.h:35
#define LV_ITEM
Definition: commctrl.h:2309
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2406
#define SM_CYHSCROLL
Definition: winuser.h:952
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:398
static BOOL GetProfileName(_In_ PSID pProfileSid, _In_ DWORD dwNameBufferSize, _Out_ PWSTR pszNameBuffer)
Definition: userprofile.c:391
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:2559
enum _SID_NAME_USE SID_NAME_USE
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDYES
Definition: winuser.h:829
BOOL WINAPI IsUserAdmin(VOID)
#define LVCF_TEXT
Definition: commctrl.h:2560
static INT_PTR CALLBACK UserProfileTypeDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: userprofile.c:74
#define KEY_READ
Definition: nt_native.h:1023
#define SW_HIDE
Definition: winuser.h:762
uint16_t * PWSTR
Definition: typedefs.h:54
#define ConvertStringSidToSid
Definition: sddl.h:161
#define LOCALE_USER_DEFAULT
#define IDC_USERPROFILE_TYPE_TEXT
Definition: resource.h:109
#define DATE_SHORTDATE
Definition: winnls.h:193
#define IDC_USERPROFILE_TYPE_LOCAL
Definition: resource.h:111
#define LV_COLUMN
Definition: commctrl.h:2519
#define LVN_ITEMCHANGED
Definition: commctrl.h:3103
#define INT
Definition: polytest.cpp:20
#define LVCFMT_RIGHT
Definition: commctrl.h:2571
#define CALLBACK
Definition: compat.h:27
_In_ DWORD nLength
Definition: wincon.h:461
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2706
#define IDS_USERPROFILE_TYPE_TEXT
Definition: resource.h:43
#define IDC_USERPROFILE_LIST
Definition: resource.h:101
#define LVCFMT_LEFT
Definition: commctrl.h:2570
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:391
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1642
HINSTANCE hApplet
Definition: access.c:17
#define LVNI_SELECTED
Definition: commctrl.h:2396
UINT_PTR WPARAM
Definition: windef.h:207
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2380
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:62
static VOID AddUserProfile(_In_ HWND hwndListView, _In_ PSID pProfileSid, _In_ HKEY hProfileKey)
Definition: userprofile.c:465
DWORD dwRefCount
Definition: userprofile.c:19
BOOL WINAPI ConvertSidToStringSidW(PSID Sid, LPWSTR *StringSid)
Definition: security.c:3259
static VOID OnInitUserProfileDialog(HWND hwndDlg)
Definition: userprofile.c:773
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:56
#define IDC_USERPROFILE_CHANGE
Definition: resource.h:102
& rect
Definition: startmenu.cpp:1413
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define IDS_USERPROFILE_MANDATORY
Definition: resource.h:38
static BOOL OnProfileTypeInit(_In_ HWND hwndDlg, _In_ PPROFILEDATA pProfileData)
Definition: userprofile.c:28
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define LVIF_TEXT
Definition: commctrl.h:2281
#define LVCF_SUBITEM
Definition: commctrl.h:2561
static VOID FormatProfileSize(_Out_ LPWSTR Buffer, _In_ double size)
Definition: userprofile.c:437
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ListView_InsertColumn(hwnd, iCol, pcol)
Definition: commctrl.h:2608
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
static BOOL CopyUserProfile(_In_ HWND hwndDlg)
Definition: userprofile.c:235
#define MB_YESNO
Definition: winuser.h:811
#define UNICODE_NULL
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2645
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_USERPROFILE_ROAMING
Definition: resource.h:37
#define IDD_USERPROFILE_COPY
Definition: resource.h:114
INT_PTR CALLBACK UserProfileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: userprofile.c:835
#define IDS_USERPROFILE_CONFIRM_DELETE
Definition: resource.h:39
static PVOID ptr
Definition: dispmode.c:27
int nItems
Definition: appswitch.c:56
HWND hwndListView
Definition: eventvwr.c:83
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2291
#define IDD_USERPROFILE_TYPE
Definition: resource.h:108
#define MB_ICONQUESTION
Definition: winuser.h:783
#define IDC_USERPROFILE_DELETE
Definition: resource.h:103
#define _Out_
Definition: no_sal2.h:323
static BOOL ChangeUserProfileType(_In_ HWND hwndDlg)
Definition: userprofile.c:107
LONG_PTR LPARAM
Definition: windef.h:208
void DPRINT(...)
Definition: polytest.cpp:61
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
Definition: bufpool.h:45
#define SW_SHOW
Definition: winuser.h:769
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define ULL(a, b)
Definition: format_msg.c:27
#define WM_DESTROY
Definition: winuser.h:1591
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250
#define FILE_ATTRIBUTE_DIRECTORY
Definition: nt_native.h:705
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:42
#define ListView_SetItemText(hwndLV, i, iSubItem_, pszText_)
Definition: commctrl.h:2663
char TCHAR
Definition: xmlstorage.h:189
#define IDC_USERPROFILE_TYPE_ROAMING
Definition: resource.h:110
BOOL WINAPI FileTimeToSystemTime(IN CONST FILETIME *lpFileTime, OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:178
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
#define TOKEN_QUERY
Definition: setypes.h:874
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4116
int WINAPI MessageBoxW(_In_opt_ HWND, _In_opt_ LPCWSTR, _In_opt_ LPCWSTR, _In_ UINT)
if(!(yy_init))
Definition: macro.lex.yy.c:714
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define IDS_USERPROFILE_ACCOUNT_UNKNOWN
Definition: resource.h:41
#define FindNextFile
Definition: winbase.h:3612
uint64_t ULONGLONG
Definition: typedefs.h:65
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1138
struct _PROFILEDATA * PPROFILEDATA
#define MAX_PATH
Definition: compat.h:26
#define swprintf(buf, format,...)
Definition: sprintf.c:56
struct _PROFILEDATA PROFILEDATA
int WINAPI GetSystemMetrics(_In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2696
#define IDC_USERACCOUNT_LINK
Definition: resource.h:105
#define _Inout_
Definition: no_sal2.h:244
#define SetDlgItemText
Definition: winuser.h:5750
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define DialogBoxParam
Definition: winuser.h:5665
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
static const WCHAR L[]
Definition: oid.c:1250
#define IDS_USERPROFILE_SIZE
Definition: resource.h:32
#define WM_COMMAND
Definition: winuser.h:1722
IN PVOID IN PVOID IN USHORT IN USHORT Size
Definition: pci.h:359
static VOID OnDestroy(_In_ HWND hwndDlg)
Definition: userprofile.c:793
_In_ HANDLE hFile
Definition: mswsock.h:90
#define NM_CLICK
Definition: commctrl.h:130
INT WINAPI GetDateFormatW(LCID lcid, DWORD dwFlags, const SYSTEMTIME *lpTime, LPCWSTR lpFormat, LPWSTR lpDateStr, INT cchOut)
Definition: lcformat.c:979
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define _In_
Definition: no_sal2.h:204
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2558
static VOID AddUserProfiles(_In_ HWND hwndDlg, _In_ HWND hwndListView, _In_ BOOL bAdmin)
Definition: userprofile.c:664
#define IDS_USERPROFILE_CONFIRM_DELETE_TITLE
Definition: resource.h:40
#define IDC_USERPROFILE_COPY
Definition: resource.h:104
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define IDS_USERPROFILE_STATUS
Definition: resource.h:34
PWSTR pszFullName
Definition: userprofile.c:21
_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 VOID OnNotify(_In_ HWND hwndDlg, _In_ NMHDR *nmhdr)
Definition: userprofile.c:818
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
DWORD WINAPI ExpandEnvironmentStringsW(IN LPCWSTR lpSrc, IN LPWSTR lpDst, IN DWORD nSize)
Definition: environ.c:519
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static BOOL DeleteUserProfile(_In_ HWND hwndDlg)
Definition: userprofile.c:150
#define BST_CHECKED
Definition: winuser.h:197
DWORD dwState
Definition: userprofile.c:20
#define Button_SetCheck(hwndCtl, check)
Definition: windowsx.h:10
static BOOL GetProfileSize(_In_ PWSTR pszProfilePath, _Inout_ PULONGLONG pullProfileSize)
Definition: userprofile.c:329
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2366
#define SendMessage
Definition: winuser.h:5744
#define LVIF_PARAM
Definition: commctrl.h:2283
__GNU_EXTENSION typedef unsigned __int64 * PULONGLONG
Definition: ntbasedef.h:390
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2208
static VOID SetListViewColumns(_In_ HWND hwndListView)
Definition: userprofile.c:277
#define LVITEM
Definition: commctrl.h:2347
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:3366
SID_AND_ATTRIBUTES User
Definition: setypes.h:956
#define ERROR_PATH_NOT_FOUND
Definition: winerror.h:106
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
GLenum GLenum GLvoid GLvoid * column
Definition: glext.h:5664
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define LVIF_STATE
Definition: commctrl.h:2284
#define wsprintf
Definition: winuser.h:5766
GLfloat units
Definition: glext.h:11727
#define memset(x, y, z)
Definition: compat.h:39
#define WM_INITDIALOG
Definition: winuser.h:1721
LPARAM lParam
Definition: combotst.c:139
#define IDS_USERPROFILE_LOCAL
Definition: resource.h:36
#define LOWORD(l)
Definition: pedump.c:82
#define IDS_USERPROFILE_TYPE
Definition: resource.h:33
size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define HeapFree(x, y, z)
Definition: compat.h:394
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define LoadString
Definition: winuser.h:5720
#define IDS_USERPROFILE_NAME
Definition: resource.h:31
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define LVIS_FOCUSED
Definition: commctrl.h:2290
#define WM_NOTIFY
Definition: richedit.h:61
static VOID UpdateButtonState(_In_ HWND hwndDlg, _In_ HWND hwndListView)
Definition: userprofile.c:623
PWSTR pszProfilePath
Definition: userprofile.c:22
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
Definition: find.c:320
static INT_PTR CALLBACK CopyUserProfileDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: userprofile.c:203
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502