ReactOS  0.4.15-dev-488-gc7a1924
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 {
25 
26 
27 static
28 BOOL
30  _In_ HWND hwndDlg,
31  _In_ PPROFILEDATA pProfileData)
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 }
70 
71 
72 static
73 INT_PTR
76  _In_ HWND hwndDlg,
77  _In_ UINT uMsg,
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 }
104 
105 
106 static
107 BOOL
109  _In_ HWND hwndDlg)
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;
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  if (!ListView_GetItem(hwndListView, &Item))
173  return FALSE;
174 
175  if (Item.lParam == 0)
176  return FALSE;
177 
178  pProfileData = (PPROFILEDATA)Item.lParam;
179  if (pProfileData->dwRefCount != 0)
180  return FALSE;
181 
184  swprintf(szCookedText, szRawText, pProfileData->pszFullName);
185 
186  if (MessageBoxW(hwndDlg,
187  szCookedText,
188  szTitle,
190  {
191  /* FIXME: Delete the profile here! */
192  return TRUE;
193  }
194 
195  return FALSE;
196 }
197 
198 
199 static
200 INT_PTR
201 CALLBACK
203  _In_ HWND hwndDlg,
204  _In_ UINT uMsg,
207 {
208  switch (uMsg)
209  {
210  case WM_INITDIALOG:
211  return TRUE;
212 
213  case WM_DESTROY:
214  break;
215 
216  case WM_COMMAND:
217  switch (LOWORD(wParam))
218  {
219  case IDOK:
220  case IDCANCEL:
221  EndDialog(hwndDlg,
222  LOWORD(wParam));
223  return TRUE;
224  }
225  break;
226  }
227 
228  return FALSE;
229 }
230 
231 
232 static
233 BOOL
235  _In_ HWND hwndDlg)
236 {
238  LVITEM Item;
239  INT iSelected;
240 
241  DPRINT("CopyUserProfile()\n");
242 
244  if (hwndListView == NULL)
245  return FALSE;
246 
248  if (iSelected == -1)
249  return FALSE;
250 
251  ZeroMemory(&Item, sizeof(LVITEM));
252  Item.mask = LVIF_PARAM;
253  Item.iItem = iSelected;
254  if (!ListView_GetItem(hwndListView, &Item))
255  return FALSE;
256 
257  if (Item.lParam == 0)
258  return FALSE;
259 
262  hwndDlg,
264  (LPARAM)Item.lParam) == IDOK)
265  {
266  /* FIXME: Update the profile list view */
267  return TRUE;
268  }
269 
270  return FALSE;
271 }
272 
273 
274 static VOID
277 {
279  RECT rect;
280  TCHAR szStr[32];
281 
283 
285 
286  memset(&column, 0x00, sizeof(column));
288  column.fmt = LVCFMT_LEFT;
289  column.cx = (INT)((rect.right - rect.left) * 0.40);
290  column.iSubItem = 0;
292  column.pszText = szStr;
294 
295  column.fmt = LVCFMT_RIGHT;
296  column.cx = (INT)((rect.right - rect.left) * 0.15);
297  column.iSubItem = 1;
299  column.pszText = szStr;
301 
302  column.fmt = LVCFMT_LEFT;
303  column.cx = (INT)((rect.right - rect.left) * 0.15);
304  column.iSubItem = 2;
306  column.pszText = szStr;
308 
309  column.fmt = LVCFMT_LEFT;
310  column.cx = (INT)((rect.right - rect.left) * 0.15);
311  column.iSubItem = 3;
313  column.pszText = szStr;
315 
316  column.fmt = LVCFMT_LEFT;
317  column.cx = (INT)((rect.right - rect.left) * 0.15) - GetSystemMetrics(SM_CYHSCROLL);
318  column.iSubItem = 4;
320  column.pszText = szStr;
322 }
323 
324 
325 static
326 BOOL
328  _In_ PWSTR pszProfilePath,
329  _Inout_ PULONGLONG pullProfileSize)
330 {
332  WIN32_FIND_DATA FindData;
333  DWORD dwProfilePathLength;
335  BOOL bResult = TRUE;
336 
337  dwProfilePathLength = wcslen(pszProfilePath);
338 
339  wcscat(pszProfilePath, L"\\*.*");
340 
341  hFile = FindFirstFileW(pszProfilePath, &FindData);
343  {
344  if ((GetLastError() != ERROR_FILE_NOT_FOUND) &&
346  bResult = FALSE;
347 
348  goto done;
349  }
350 
351  do
352  {
353  if (FindData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
354  {
355  if ((_wcsicmp(FindData.cFileName, L".") == 0) ||
356  (_wcsicmp(FindData.cFileName, L"..") == 0))
357  continue;
358 
359  pszProfilePath[dwProfilePathLength + 1] = UNICODE_NULL;
360  wcscat(pszProfilePath, FindData.cFileName);
361 
362  if (!GetProfileSize(pszProfilePath, pullProfileSize))
363  {
364  bResult = FALSE;
365  goto done;
366  }
367  }
368  else
369  {
370  Size.u.LowPart = FindData.nFileSizeLow;
371  Size.u.HighPart = FindData.nFileSizeHigh;
372  *pullProfileSize += Size.QuadPart;
373  }
374  }
375  while (FindNextFile(hFile, &FindData));
376 
377 done:
378  pszProfilePath[dwProfilePathLength] = UNICODE_NULL;
379 
381  FindClose(hFile);
382 
383  return bResult;
384 }
385 
386 
387 static
388 BOOL
390  _In_ PSID pProfileSid,
391  _In_ DWORD dwNameBufferSize,
392  _Out_ PWSTR pszNameBuffer,
393  _Out_ PBOOL pbUnknownProfile)
394 {
395  WCHAR szAccountName[128], szDomainName[128];
396  DWORD dwAccountNameSize, dwDomainNameSize;
397  SID_NAME_USE Use;
398 
399  dwAccountNameSize = ARRAYSIZE(szAccountName);
400  dwDomainNameSize = ARRAYSIZE(szDomainName);
401  if (!LookupAccountSidW(NULL,
402  pProfileSid,
403  szAccountName,
404  &dwAccountNameSize,
405  szDomainName,
406  &dwDomainNameSize,
407  &Use))
408  {
409  /* Unknown account */
410  LoadStringW(hApplet, IDS_USERPROFILE_ACCOUNT_UNKNOWN, pszNameBuffer, dwNameBufferSize);
411  *pbUnknownProfile = TRUE;
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  *pbUnknownProfile = FALSE;
430  }
431 
432  return TRUE;
433 }
434 
435 
436 static
437 VOID
440  _In_ double size)
441 {
442  const LPWSTR units[] = {L"MB", L"GB", L"TB"};
443  int i = 0, j;
444 
445  size /= 1024;
446  size /= 1024;
447 
448  while (size >= 1024 && i < 3)
449  {
450  size /= 1024;
451  i++;
452  }
453 
454  if (size < 10)
455  j = 2;
456  else if (size < 100)
457  j = 1;
458  else
459  j = 0;
460 
461  swprintf(Buffer, L"%.*f %s", j, size, units[i]);
462 }
463 
464 
465 static VOID
468  _In_ PSID pProfileSid,
469  _In_ HKEY hProfileKey)
470 {
471  WCHAR szTempProfilePath[MAX_PATH], szProfilePath[MAX_PATH];
472  WCHAR szNameBuffer[256];
473  PPROFILEDATA pProfileData = NULL;
474  DWORD dwProfileData, dwSize, dwType, dwState = 0, dwRefCount = 0;
475  DWORD dwProfilePathLength;
476  PWSTR ptr;
477  INT nId, iItem;
478  LV_ITEM lvi;
479  WIN32_FIND_DATA FindData;
480  HANDLE hFile;
481  SYSTEMTIME SystemTime;
482  ULONGLONG ullProfileSize;
483  BOOL bUnknownProfile;
484  DWORD dwError;
485 
486  /* Get the profile path */
487  dwSize = MAX_PATH * sizeof(WCHAR);
488  dwError = RegQueryValueExW(hProfileKey,
489  L"ProfileImagePath",
490  NULL,
491  &dwType,
492  (LPBYTE)szTempProfilePath,
493  &dwSize);
494  if (dwError != ERROR_SUCCESS)
495  return;
496 
497  /* Expand it */
498  ExpandEnvironmentStringsW(szTempProfilePath,
499  szProfilePath,
500  MAX_PATH);
501 
502  /* Check if the profile path exists */
503  hFile = FindFirstFileW(szProfilePath, &FindData);
505  return;
506 
507  FindClose(hFile);
508 
509  /* Get the length of the profile path */
510  dwProfilePathLength = wcslen(szProfilePath);
511 
512  /* Check for the ntuser.dat file */
513  wcscat(szProfilePath, L"\\ntuser.dat");
514  hFile = FindFirstFileW(szProfilePath, &FindData);
516  return;
517 
518  FindClose(hFile);
519  szProfilePath[dwProfilePathLength] = UNICODE_NULL;
520 
521  /* Get the profile size */
522  ullProfileSize = 0ULL;
523  GetProfileSize(szProfilePath, &ullProfileSize);
524 
525  /* Get the profile name */
526  if (!GetProfileName(pProfileSid,
527  ARRAYSIZE(szNameBuffer),
528  szNameBuffer,
529  &bUnknownProfile))
530  return;
531 
532  /* Get the profile state value */
533  dwSize = sizeof(dwState);
534  if (RegQueryValueExW(hProfileKey,
535  L"State",
536  NULL,
537  &dwType,
538  (LPBYTE)&dwState,
539  &dwSize) != ERROR_SUCCESS)
540  {
541  dwState = 0;
542  }
543 
544  /* Get the profile reference counter */
545  dwSize = sizeof(dwRefCount);
546  if (RegQueryValueExW(hProfileKey,
547  L"RefCount",
548  NULL,
549  &dwType,
550  (LPBYTE)&dwRefCount,
551  &dwSize) != ERROR_SUCCESS)
552  {
553  dwRefCount = 0;
554  }
555 
556  /* Create and fill the profile data entry */
557  dwProfileData = sizeof(PROFILEDATA) +
558  ((wcslen(szNameBuffer) + 1) * sizeof(WCHAR)) +
559  ((wcslen(szProfilePath) + 1) * sizeof(WCHAR));
560  pProfileData = HeapAlloc(GetProcessHeap(),
562  dwProfileData);
563  if (pProfileData == NULL)
564  return;
565 
566  pProfileData->dwRefCount = dwRefCount;
567  pProfileData->dwState = dwState;
568  pProfileData->bUnknownProfile = bUnknownProfile;
569 
570  ptr = (PWSTR)((ULONG_PTR)pProfileData + sizeof(PROFILEDATA));
571  pProfileData->pszFullName = ptr;
572 
573  wcscpy(pProfileData->pszFullName, szNameBuffer);
574 
575  ptr = (PWSTR)((ULONG_PTR)ptr + ((wcslen(pProfileData->pszFullName) + 1) * sizeof(WCHAR)));
576  pProfileData->pszProfilePath = ptr;
577  wcscpy(pProfileData->pszProfilePath, szProfilePath);
578 
579  /* Add the profile and set its name */
580  memset(&lvi, 0x00, sizeof(lvi));
581  lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
582  lvi.pszText = pProfileData->pszFullName;
583  lvi.state = 0;
584  lvi.lParam = (LPARAM)pProfileData;
585  iItem = ListView_InsertItem(hwndListView, &lvi);
586 
587  /* Set the profile size */
588  FormatProfileSize(szNameBuffer, (double)ullProfileSize);
589  ListView_SetItemText(hwndListView, iItem, 1, szNameBuffer);
590 
591  /* Set the profile type */
592  if (dwState & 0x0010) // PROFILE_UPDATE_CENTRAL
594  else
595  nId = IDS_USERPROFILE_LOCAL;
596 
597  LoadStringW(hApplet, nId, szNameBuffer, ARRAYSIZE(szNameBuffer));
598 
599  ListView_SetItemText(hwndListView, iItem, 2, szNameBuffer);
600 
601  /* FIXME: Set the profile status */
602  if (dwState & 0x0001) // PROFILE_MANDATORY
604  else if (dwState & 0x0010) // PROFILE_UPDATE_CENTRAL
606  else
607  nId = IDS_USERPROFILE_LOCAL;
608 
609  LoadStringW(hApplet, nId, szNameBuffer, ARRAYSIZE(szNameBuffer));
610 
611  ListView_SetItemText(hwndListView, iItem, 3, szNameBuffer);
612 
613  /* Set the profile modified time */
614  FileTimeToSystemTime(&FindData.ftLastWriteTime,
615  &SystemTime);
616 
619  &SystemTime,
620  NULL,
621  szNameBuffer,
622  ARRAYSIZE(szNameBuffer));
623 
624  ListView_SetItemText(hwndListView, iItem, 4, szNameBuffer);
625 }
626 
627 
628 static VOID
630  _In_ HWND hwndDlg,
632 {
633  LVITEM Item;
634  INT iSelected;
635  BOOL bChange = FALSE;
636  BOOL bCopy = FALSE;
637  BOOL bDelete = FALSE;
638  PPROFILEDATA pProfileData;
639 
641  {
643  if (iSelected != -1)
644  {
645  ZeroMemory(&Item, sizeof(LVITEM));
646  Item.mask = LVIF_PARAM;
647  Item.iItem = iSelected;
648  if (ListView_GetItem(hwndListView, &Item))
649  {
650  if (Item.lParam != 0)
651  {
652  pProfileData = (PPROFILEDATA)Item.lParam;
653 
654  if (pProfileData->bUnknownProfile)
655  {
656  bDelete = TRUE;
657  bCopy = FALSE;
658  }
659  else
660  {
661  bDelete = (pProfileData->dwRefCount == 0);
662  bCopy = (pProfileData->dwRefCount == 0);
663  }
664  }
665  }
666 
667  bChange = TRUE;
668  }
669  }
670 
671  EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_CHANGE), bChange);
672  EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_DELETE), bDelete);
673  EnableWindow(GetDlgItem(hwndDlg, IDC_USERPROFILE_COPY), bCopy);
674 }
675 
676 
677 static VOID
679  _In_ HWND hwndDlg,
681  _In_ BOOL bAdmin)
682 {
683  HKEY hKeyUserProfiles = INVALID_HANDLE_VALUE;
684  HKEY hProfileKey;
685  DWORD dwIndex;
686  WCHAR szProfileSid[64];
687  DWORD dwSidLength;
688  FILETIME ftLastWrite;
689  DWORD dwSize;
690  HANDLE hToken = NULL;
691  PTOKEN_USER pTokenUser = NULL;
692  PSID pProfileSid;
693  PWSTR pszProfileSid;
694 
696  return;
697 
698  if (GetTokenInformation(hToken, TokenUser, NULL, 0, &dwSize) ||
700  {
701  goto done;
702  }
703 
704  pTokenUser = HeapAlloc(GetProcessHeap(), 0, dwSize);
705  if (pTokenUser == NULL)
706  goto done;
707 
708  if (!GetTokenInformation(hToken, TokenUser, pTokenUser, dwSize, &dwSize))
709  goto done;
710 
712  L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
713  0,
714  KEY_READ,
715  &hKeyUserProfiles))
716  goto done;
717 
718  if (bAdmin)
719  {
720  for (dwIndex = 0; ; dwIndex++)
721  {
722  dwSidLength = ARRAYSIZE(szProfileSid);
723  if (RegEnumKeyExW(hKeyUserProfiles,
724  dwIndex,
725  szProfileSid,
726  &dwSidLength,
727  NULL,
728  NULL,
729  NULL,
730  &ftLastWrite))
731  break;
732 
733  if (RegOpenKeyExW(hKeyUserProfiles,
734  szProfileSid,
735  0,
736  KEY_READ,
737  &hProfileKey) == ERROR_SUCCESS)
738  {
739  if (ConvertStringSidToSid(szProfileSid, &pProfileSid))
740  {
742  pProfileSid,
743  hProfileKey);
744  LocalFree(pProfileSid);
745  }
746 
747  RegCloseKey(hProfileKey);
748  }
749  }
750  }
751  else
752  {
753  if (ConvertSidToStringSidW(pTokenUser->User.Sid, &pszProfileSid))
754  {
755  if (RegOpenKeyExW(hKeyUserProfiles,
756  pszProfileSid,
757  0,
758  KEY_READ,
759  &hProfileKey) == ERROR_SUCCESS)
760  {
762  pTokenUser->User.Sid,
763  hProfileKey);
764  RegCloseKey(hProfileKey);
765  }
766 
767  LocalFree(pszProfileSid);
768  }
769  }
770 
773 
775 
776 done:
777  if (hKeyUserProfiles != INVALID_HANDLE_VALUE)
778  RegCloseKey(hKeyUserProfiles);
779 
780  if (pTokenUser != NULL)
781  HeapFree(GetProcessHeap(), 0, pTokenUser);
782 
783  if (hToken != NULL)
784  CloseHandle(hToken);
785 }
786 
787 
788 static VOID
790 {
791  BOOL bAdmin;
792 
793  bAdmin = IsUserAdmin();
794 
795  /* Initialize the list view control */
797 
798  /* Hide the delete and copy buttons for non-admins */
801 
802  /* Add the profiles to the list view */
803  AddUserProfiles(hwndDlg, GetDlgItem(hwndDlg, IDC_USERPROFILE_LIST), bAdmin);
804 }
805 
806 static
807 VOID
809  _In_ HWND hwndDlg,
810  _In_ NMHDR *nmhdr)
811 {
812  LPNMLISTVIEW pNMLV;
813 
814  if (nmhdr->idFrom == IDC_USERACCOUNT_LINK && nmhdr->code == NM_CLICK)
815  {
816  ShellExecuteW(hwndDlg, NULL, L"usrmgr.cpl", NULL, NULL, 0);
817  }
818  else if (nmhdr->idFrom == IDC_USERPROFILE_LIST)
819  {
820  switch(nmhdr->code)
821  {
822  case LVN_ITEMCHANGED:
823  UpdateButtonState(hwndDlg, nmhdr->hwndFrom);
824  break;
825 
826  case NM_DBLCLK:
827  ChangeUserProfileType(hwndDlg);
828  break;
829 
830  case LVN_DELETEITEM:
831  pNMLV = (LPNMLISTVIEW)nmhdr;
832  if (pNMLV->lParam != 0)
833  HeapFree(GetProcessHeap(), 0, (LPVOID)pNMLV->lParam);
834  break;
835  }
836  }
837 }
838 
839 
840 /* Property page dialog callback */
843  UINT uMsg,
844  WPARAM wParam,
845  LPARAM lParam)
846 {
847  switch (uMsg)
848  {
849  case WM_INITDIALOG:
850  OnInitUserProfileDialog(hwndDlg);
851  return TRUE;
852 
853  case WM_COMMAND:
854  switch (LOWORD(wParam))
855  {
856  case IDOK:
857  case IDCANCEL:
858  EndDialog(hwndDlg,
859  LOWORD(wParam));
860  return TRUE;
861 
863  ChangeUserProfileType(hwndDlg);
864  break;
865 
867  DeleteUserProfile(hwndDlg);
868  break;
869 
871  CopyUserProfile(hwndDlg);
872  break;
873  }
874  break;
875 
876  case WM_NOTIFY:
877  OnNotify(hwndDlg, (NMHDR *)lParam);
878  break;
879  }
880 
881  return FALSE;
882 }
#define IDS_USERPROFILE_MODIFIED
Definition: resource.h:35
#define LV_ITEM
Definition: commctrl.h:2333
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define ListView_GetNextItem(hwnd, i, flags)
Definition: commctrl.h:2430
#define SM_CYHSCROLL
Definition: winuser.h:952
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
#define CloseHandle
Definition: compat.h:407
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:2583
enum _SID_NAME_USE SID_NAME_USE
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDYES
Definition: winuser.h:829
#define LVCF_TEXT
Definition: commctrl.h:2584
static INT_PTR CALLBACK UserProfileTypeDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: userprofile.c:75
#define KEY_READ
Definition: nt_native.h:1023
#define SW_HIDE
Definition: winuser.h:762
uint16_t * PWSTR
Definition: typedefs.h:55
#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:2543
#define LVN_ITEMCHANGED
Definition: commctrl.h:3127
#define INT
Definition: polytest.cpp:20
#define LVCFMT_RIGHT
Definition: commctrl.h:2595
#define CALLBACK
Definition: compat.h:27
_In_ DWORD nLength
Definition: wincon.h:476
#define LVS_EX_FULLROWSELECT
Definition: commctrl.h:2730
#define IDS_USERPROFILE_TYPE_TEXT
Definition: resource.h:43
#define IDC_USERPROFILE_LIST
Definition: resource.h:101
#define LVCFMT_LEFT
Definition: commctrl.h:2594
#define ARRAYSIZE(array)
Definition: filtermapper.c:47
#define INVALID_HANDLE_VALUE
Definition: compat.h:400
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define ZeroMemory
Definition: winbase.h:1648
HINSTANCE hApplet
Definition: access.c:17
#define LVNI_SELECTED
Definition: commctrl.h:2420
UINT_PTR WPARAM
Definition: windef.h:207
#define ListView_InsertItem(hwnd, pitem)
Definition: commctrl.h:2404
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int32_t INT_PTR
Definition: typedefs.h:63
static VOID AddUserProfile(_In_ HWND hwndListView, _In_ PSID pProfileSid, _In_ HKEY hProfileKey)
Definition: userprofile.c:466
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:789
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:57
#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:29
uint32_t ULONG_PTR
Definition: typedefs.h:64
#define LVIF_TEXT
Definition: commctrl.h:2305
#define LVCF_SUBITEM
Definition: commctrl.h:2585
BOOL bUnknownProfile
Definition: userprofile.c:21
static VOID FormatProfileSize(_Out_ LPWSTR Buffer, _In_ double size)
Definition: userprofile.c:438
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:2632
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:53
static BOOL CopyUserProfile(_In_ HWND hwndDlg)
Definition: userprofile.c:234
#define ListView_GetSelectedCount(hwndLV)
Definition: commctrl.h:2705
#define MB_YESNO
Definition: winuser.h:811
#define UNICODE_NULL
#define ListView_SetItemState(hwndLV, i, data, mask)
Definition: commctrl.h:2669
unsigned int BOOL
Definition: ntddk_ex.h:94
#define IDS_USERPROFILE_ROAMING
Definition: resource.h:37
#define IDD_USERPROFILE_COPY
Definition: resource.h:114
static BOOL IsUserAdmin(VOID)
Definition: netid.c:163
INT_PTR CALLBACK UserProfileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: userprofile.c:842
#define IDS_USERPROFILE_CONFIRM_DELETE
Definition: resource.h:39
static PVOID ptr
Definition: dispmode.c:27
HWND hwndListView
Definition: eventvwr.c:83
smooth NULL
Definition: ftsmooth.c:416
#define LVIS_SELECTED
Definition: commctrl.h:2315
#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:108
LONG_PTR LPARAM
Definition: windef.h:208
void DPRINT(...)
Definition: polytest.cpp:61
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2303
Definition: bufpool.h:45
#define SW_SHOW
Definition: winuser.h:769
BOOL * PBOOL
Definition: windef.h:161
#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:2687
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:188
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:404
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:3628
uint64_t ULONGLONG
Definition: typedefs.h:66
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)
#define LVN_DELETEITEM
Definition: commctrl.h:3129
unsigned long DWORD
Definition: ntddk_ex.h:95
#define LVM_SETEXTENDEDLISTVIEWSTYLE
Definition: commctrl.h:2720
#define IDC_USERACCOUNT_LINK
Definition: resource.h:105
#define _Inout_
Definition: no_sal2.h:244
#define SetDlgItemText
Definition: winuser.h:5824
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define DialogBoxParam
Definition: winuser.h:5739
_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:361
_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:2582
static VOID AddUserProfiles(_In_ HWND hwndDlg, _In_ HWND hwndListView, _In_ BOOL bAdmin)
Definition: userprofile.c:678
#define IDS_USERPROFILE_CONFIRM_DELETE_TITLE
Definition: resource.h:40
#define NM_DBLCLK
Definition: commctrl.h:131
#define IDC_USERPROFILE_COPY
Definition: resource.h:104
struct tagNMLISTVIEW * LPNMLISTVIEW
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577
#define IDS_USERPROFILE_STATUS
Definition: resource.h:34
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 VOID OnNotify(_In_ HWND hwndDlg, _In_ NMHDR *nmhdr)
Definition: userprofile.c:808
static BOOL GetProfileName(_In_ PSID pProfileSid, _In_ DWORD dwNameBufferSize, _Out_ PWSTR pszNameBuffer, _Out_ PBOOL pbUnknownProfile)
Definition: userprofile.c:389
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:327
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2390
#define SendMessage
Definition: winuser.h:5818
#define LVIF_PARAM
Definition: commctrl.h:2307
__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:2274
static VOID SetListViewColumns(_In_ HWND hwndListView)
Definition: userprofile.c:275
#define LVITEM
Definition: commctrl.h:2371
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
LPARAM lParam
Definition: commctrl.h:3036
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
#define LVIF_STATE
Definition: commctrl.h:2308
#define wsprintf
Definition: winuser.h:5840
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:403
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define LoadString
Definition: winuser.h:5794
#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:2314
#define WM_NOTIFY
Definition: richedit.h:61
static VOID UpdateButtonState(_In_ HWND hwndDlg, _In_ HWND hwndListView)
Definition: userprofile.c:629
PWSTR pszProfilePath
Definition: userprofile.c:23
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:202
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define ERROR_INSUFFICIENT_BUFFER
Definition: dderror.h:10
BOOL WINAPI FindClose(HANDLE hFindFile)
Definition: find.c:502