ReactOS  0.4.13-dev-563-g0561610
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 
14 #include <debug.h>
15 
16 typedef struct _PROFILEDATA
17 {
22 
23 
24 static
25 BOOL
27  HWND hwndDlg,
28  PPROFILEDATA pProfileData)
29 {
30  PWSTR pszRawBuffer = NULL, pszCookedBuffer = NULL;
31  INT nLength;
32 
34  pszRawBuffer = NULL;
35  if (nLength == 0)
36  return FALSE;
37 
38  pszRawBuffer = HeapAlloc(GetProcessHeap(), 0, (nLength + 1) * sizeof(WCHAR));
39  if (pszRawBuffer == NULL)
40  return FALSE;
41 
43 
44  pszCookedBuffer = HeapAlloc(GetProcessHeap(), 0, (nLength + wcslen(pProfileData->pszFullName) + 1) * sizeof(WCHAR));
45  if (pszCookedBuffer == NULL)
46  goto done;
47 
48  swprintf(pszCookedBuffer, pszRawBuffer, pProfileData->pszFullName);
49 
50  /* Set the full text */
51  SetDlgItemText(hwndDlg, IDC_USERPROFILE_TYPE_TEXT, pszCookedBuffer);
52 
53  /* FIXME: Right now, we support local user profiles only! */
56  EnableWindow(GetDlgItem(hwndDlg, IDOK), FALSE);
57 
58 done:
59  if (pszCookedBuffer != NULL)
60  HeapFree(GetProcessHeap(), 0, pszCookedBuffer);
61 
62  if (pszRawBuffer != NULL)
63  HeapFree(GetProcessHeap(), 0, pszRawBuffer);
64 
65  return TRUE;
66 }
67 
68 
69 static
70 INT_PTR
73  _In_ HWND hwndDlg,
74  _In_ UINT uMsg,
77 {
78  switch (uMsg)
79  {
80  case WM_INITDIALOG:
82  return TRUE;
83 
84  case WM_DESTROY:
85  break;
86 
87  case WM_COMMAND:
88  switch (LOWORD(wParam))
89  {
90  case IDOK:
91  case IDCANCEL:
92  EndDialog(hwndDlg,
93  LOWORD(wParam));
94  return TRUE;
95  }
96  break;
97  }
98 
99  return FALSE;
100 }
101 
102 
103 static
104 BOOL
106  _In_ HWND hwndDlg)
107 {
109  LVITEM Item;
110  INT iSelected;
111 
112  DPRINT("ChangeUserProfileType(%p)\n", hwndDlg);
113 
115  if (hwndListView == NULL)
116  return FALSE;
117 
119  if (iSelected == -1)
120  return FALSE;
121 
122  ZeroMemory(&Item, sizeof(LVITEM));
123  Item.mask = LVIF_PARAM;
124  Item.iItem = iSelected;
125  Item.iSubItem = 0;
126  if (!ListView_GetItem(hwndListView, &Item))
127  return FALSE;
128 
129  if (Item.lParam == 0)
130  return FALSE;
131 
134  hwndDlg,
136  (LPARAM)Item.lParam) == IDOK)
137  {
138  /* FIXME: Update the profile list view */
139  return TRUE;
140  }
141 
142  return FALSE;
143 }
144 
145 
146 static
147 BOOL
149  _In_ HWND hwndDlg)
150 {
151  WCHAR szTitle[64], szRawText[128], szCookedText[256];
153  LVITEM Item;
154  INT iSelected;
155  PPROFILEDATA pProfileData;
156 
157  DPRINT("DeleteUserProfile()\n");
158 
160  if (hwndListView == NULL)
161  return FALSE;
162 
164  if (iSelected == -1)
165  return FALSE;
166 
167  ZeroMemory(&Item, sizeof(LVITEM));
168  Item.mask = LVIF_PARAM;
169  Item.iItem = iSelected;
170  Item.iSubItem = 0;
171  if (!ListView_GetItem(hwndListView, &Item))
172  return FALSE;
173 
174  if (Item.lParam == 0)
175  return FALSE;
176 
177  pProfileData = (PPROFILEDATA)Item.lParam;
178  if (pProfileData->bMyProfile)
179  return FALSE;
180 
183  swprintf(szCookedText, szRawText, pProfileData->pszFullName);
184 
185  if (MessageBoxW(hwndDlg,
186  szCookedText,
187  szTitle,
189  {
190  /* FIXME: Delete the profile here! */
191  return TRUE;
192  }
193 
194  return FALSE;
195 }
196 
197 
198 static
199 INT_PTR
200 CALLBACK
202  _In_ HWND hwndDlg,
203  _In_ UINT uMsg,
206 {
207  switch (uMsg)
208  {
209  case WM_INITDIALOG:
210  return TRUE;
211 
212  case WM_DESTROY:
213  break;
214 
215  case WM_COMMAND:
216  switch (LOWORD(wParam))
217  {
218  case IDOK:
219  case IDCANCEL:
220  EndDialog(hwndDlg,
221  LOWORD(wParam));
222  return TRUE;
223  }
224  break;
225  }
226 
227  return FALSE;
228 }
229 
230 
231 static
232 BOOL
234  _In_ HWND hwndDlg)
235 {
237  LVITEM Item;
238  INT iSelected;
239 
240  DPRINT("CopyUserProfile()\n");
241 
243  if (hwndListView == NULL)
244  return FALSE;
245 
247  if (iSelected == -1)
248  return FALSE;
249 
250  ZeroMemory(&Item, sizeof(LVITEM));
251  Item.mask = LVIF_PARAM;
252  Item.iItem = iSelected;
253  Item.iSubItem = 0;
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 VOID
328  _In_ LPTSTR lpProfileSid,
329  _In_ PSID pMySid,
330  _In_ HKEY hProfileKey)
331 {
332  PPROFILEDATA pProfileData = NULL;
333  WCHAR szAccountName[128], szDomainName[128];
334  WCHAR szNameBuffer[256];
335  SID_NAME_USE Use;
336  DWORD dwAccountNameSize, dwDomainNameSize;
337  DWORD dwProfileData, dwSize, dwType, dwState = 0;
338  PWSTR ptr;
339  PSID pSid = NULL;
340  INT nId, iItem;
341  LV_ITEM lvi;
342 
343  if (!ConvertStringSidToSid(lpProfileSid,
344  &pSid))
345  return;
346 
347  dwAccountNameSize = ARRAYSIZE(szAccountName);
348  dwDomainNameSize = ARRAYSIZE(szDomainName);
349  if (!LookupAccountSidW(NULL,
350  pSid,
351  szAccountName,
352  &dwAccountNameSize,
353  szDomainName,
354  &dwDomainNameSize,
355  &Use))
356  {
357  /* Unknown account */
358  LoadStringW(hApplet, IDS_USERPROFILE_ACCOUNT_UNKNOWN, szNameBuffer, ARRAYSIZE(szNameBuffer));
359  }
360  else
361  {
362  /* Show only the user accounts */
363  if (Use != SidTypeUser)
364  goto done;
365 
366  if (szAccountName[0] == UNICODE_NULL)
367  {
368  /* Deleted account */
369  LoadStringW(hApplet, IDS_USERPROFILE_ACCOUNT_DELETED, szNameBuffer, ARRAYSIZE(szNameBuffer));
370  }
371  else
372  {
373  /* Normal account */
374  wsprintf(szNameBuffer, L"%s\\%s", szDomainName, szAccountName);
375  }
376  }
377 
378  /* Get the profile state value */
379  dwSize = sizeof(dwState);
380  if (RegQueryValueExW(hProfileKey,
381  L"State",
382  NULL,
383  &dwType,
384  (LPBYTE)&dwState,
385  &dwSize) != ERROR_SUCCESS)
386  {
387  dwState = 0;
388  }
389 
390  /* Create and fill the profile data entry */
391  dwProfileData = sizeof(PROFILEDATA) +
392  ((wcslen(szNameBuffer) + 1) * sizeof(WCHAR));
393  pProfileData = HeapAlloc(GetProcessHeap(),
394  0,
395  dwProfileData);
396  if (pProfileData == NULL)
397  goto done;
398 
399  pProfileData->bMyProfile = EqualSid(pMySid, pSid);
400  pProfileData->dwState = dwState;
401 
402  ptr = (PWSTR)((ULONG_PTR)pProfileData + sizeof(PROFILEDATA));
403  pProfileData->pszFullName = ptr;
404 
405  wcscpy(pProfileData->pszFullName, szNameBuffer);
406 
407  /* Add the profile and set its name */
408  memset(&lvi, 0x00, sizeof(lvi));
409  lvi.mask = LVIF_TEXT | LVIF_STATE | LVIF_PARAM;
410  lvi.pszText = pProfileData->pszFullName;
411  lvi.state = 0;
412  lvi.lParam = (LPARAM)pProfileData;
413  iItem = ListView_InsertItem(hwndListView, &lvi);
414 
415  /* Set the profile type */
416  if (dwState & 0x0001) // PROFILE_MANDATORY
418  else if (dwState & 0x0010) // PROFILE_UPDATE_CENTRAL
420  else
421  nId = IDS_USERPROFILE_LOCAL;
422 
423  LoadStringW(hApplet, nId, szAccountName, ARRAYSIZE(szAccountName));
424 
425  ListView_SetItemText(hwndListView, iItem, 2, szAccountName);
426 
427 done:
428  if (pSid != NULL)
429  LocalFree(pSid);
430 }
431 
432 
433 static VOID
435  _In_ HWND hwndDlg,
437 {
438  LVITEM Item;
439  INT iSelected;
440  BOOL bMyProfile;
441 
443  if (iSelected != -1)
444  {
445  Item.mask = LVIF_PARAM;
446  Item.iItem = iSelected;
447  Item.iSubItem = 0;
448  if (ListView_GetItem(hwndListView, &Item))
449  {
450  if (Item.lParam != 0)
451  {
452  bMyProfile = ((PPROFILEDATA)Item.lParam)->bMyProfile;
453  if (/*IsUserAnAdmin() &&*/ !bMyProfile)
454  {
457  }
458  }
459  }
461  }
462  else
463  {
467  }
468 }
469 
470 
471 static VOID
473  _In_ HWND hwndDlg,
475 {
476  HKEY hKeyUserProfiles = INVALID_HANDLE_VALUE;
477  HKEY hProfileKey;
478  DWORD dwIndex;
479  WCHAR szProfileSid[64];
480  DWORD dwSidLength;
481  FILETIME ftLastWrite;
482  DWORD dwSize;
483  HANDLE hToken = NULL;
484  PTOKEN_USER pTokenUser = NULL;
485 
487  return;
488 
489  GetTokenInformation(hToken, TokenUser, NULL, 0, &dwSize);
490  if (dwSize == 0)
491  goto done;
492 
493  pTokenUser = HeapAlloc(GetProcessHeap(), 0, dwSize);
494  if (pTokenUser == NULL)
495  goto done;
496 
497  if (!GetTokenInformation(hToken, TokenUser, pTokenUser, dwSize, &dwSize))
498  goto done;
499 
501  L"Software\\Microsoft\\Windows NT\\CurrentVersion\\ProfileList",
502  0,
503  KEY_READ,
504  &hKeyUserProfiles))
505  goto done;
506 
507  for (dwIndex = 0; ; dwIndex++)
508  {
509  dwSidLength = ARRAYSIZE(szProfileSid);
510  if (RegEnumKeyExW(hKeyUserProfiles,
511  dwIndex,
512  szProfileSid,
513  &dwSidLength,
514  NULL,
515  NULL,
516  NULL,
517  &ftLastWrite))
518  break;
519 
520  if (RegOpenKeyExW(hKeyUserProfiles,
521  szProfileSid,
522  0,
523  KEY_READ,
524  &hProfileKey) == ERROR_SUCCESS)
525  {
526  AddUserProfile(hwndListView, szProfileSid, pTokenUser->User.Sid, hProfileKey);
527  RegCloseKey(hProfileKey);
528  }
529  }
530 
533 
535 
536 done:
537  if (hKeyUserProfiles != INVALID_HANDLE_VALUE)
538  RegCloseKey(hKeyUserProfiles);
539 
540  if (pTokenUser != NULL)
541  HeapFree(GetProcessHeap(), 0, pTokenUser);
542 
543  if (hToken != NULL)
544  CloseHandle(hToken);
545 }
546 
547 
548 static VOID
550 {
551  /* Initialize the list view control */
553 
554  AddUserProfiles(hwndDlg, GetDlgItem(hwndDlg, IDC_USERPROFILE_LIST));
555 }
556 
557 
558 static
559 VOID
561  _In_ HWND hwndDlg)
562 {
563  HWND hwndList;
564  INT nItems, i;
565  LVITEM Item;
566 
567  hwndList = GetDlgItem(hwndDlg, IDC_USERPROFILE_LIST);
568 
569  nItems = ListView_GetItemCount(hwndList);
570  for (i = 0; i < nItems; i++)
571  {
572  Item.iItem = i;
573  Item.iSubItem = 0;
574  if (ListView_GetItem(hwndList, &Item))
575  {
576  if (Item.lParam != 0)
577  HeapFree(GetProcessHeap(), 0, (PVOID)Item.lParam);
578  }
579  }
580 }
581 
582 
583 static
584 VOID
586  _In_ HWND hwndDlg,
587  _In_ NMHDR *nmhdr)
588 {
589  if (nmhdr->idFrom == IDC_USERACCOUNT_LINK && nmhdr->code == NM_CLICK)
590  {
591  ShellExecuteW(hwndDlg, NULL, L"usrmgr.cpl", NULL, NULL, 0);
592  }
593  else if (nmhdr->idFrom == IDC_USERPROFILE_LIST && nmhdr->code == LVN_ITEMCHANGED)
594  {
595  UpdateButtonState(hwndDlg, nmhdr->hwndFrom);
596  }
597 }
598 
599 
600 /* Property page dialog callback */
603  UINT uMsg,
604  WPARAM wParam,
605  LPARAM lParam)
606 {
607  switch (uMsg)
608  {
609  case WM_INITDIALOG:
610  OnInitUserProfileDialog(hwndDlg);
611  return TRUE;
612 
613  case WM_DESTROY:
614  OnDestroy(hwndDlg);
615  break;
616 
617  case WM_COMMAND:
618  switch (LOWORD(wParam))
619  {
620  case IDOK:
621  case IDCANCEL:
622  EndDialog(hwndDlg,
623  LOWORD(wParam));
624  return TRUE;
625 
627  ChangeUserProfileType(hwndDlg);
628  break;
629 
631  DeleteUserProfile(hwndDlg);
632  break;
633 
635  CopyUserProfile(hwndDlg);
636  break;
637  }
638  break;
639 
640  case WM_NOTIFY:
641  OnNotify(hwndDlg, (NMHDR *)lParam);
642  break;
643  }
644 
645  return FALSE;
646 }
#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
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
#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:72
#define KEY_READ
Definition: nt_native.h:1023
uint16_t * PWSTR
Definition: typedefs.h:54
#define ConvertStringSidToSid
Definition: sddl.h:161
BOOL WINAPI EqualSid(PSID pSid1, PSID pSid2)
Definition: security.c:708
#define IDC_USERPROFILE_TYPE_TEXT
Definition: resource.h:109
#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
#define ZeroMemory
Definition: winbase.h:1635
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
int32_t INT_PTR
Definition: typedefs.h:62
static VOID OnInitUserProfileDialog(HWND hwndDlg)
Definition: userprofile.c:549
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
static BOOL OnProfileTypeInit(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: userprofile.c:26
#define IDS_USERPROFILE_MANDATORY
Definition: resource.h:38
CHAR * LPTSTR
Definition: xmlstorage.h:192
uint32_t ULONG_PTR
Definition: typedefs.h:63
#define LVIF_TEXT
Definition: commctrl.h:2281
#define LVCF_SUBITEM
Definition: commctrl.h:2561
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:233
#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:602
#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
static BOOL ChangeUserProfileType(_In_ HWND hwndDlg)
Definition: userprofile.c:105
LONG_PTR LPARAM
Definition: windef.h:208
void DPRINT(...)
Definition: polytest.cpp:61
#define ListView_GetItemCount(hwnd)
Definition: commctrl.h:2279
#define WM_DESTROY
Definition: winuser.h:1591
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
#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
HANDLE WINAPI GetCurrentProcess(VOID)
Definition: proc.c:1168
struct _PROFILEDATA * PPROFILEDATA
#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 SetDlgItemText
Definition: winuser.h:5715
TCHAR szTitle[MAX_LOADSTRING]
Definition: magnifier.c:35
#define DialogBoxParam
Definition: winuser.h:5630
_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:1716
static VOID OnDestroy(_In_ HWND hwndDlg)
Definition: userprofile.c:560
#define NM_CLICK
Definition: commctrl.h:130
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define _In_
Definition: no_sal2.h:204
BOOL bMyProfile
Definition: userprofile.c:18
BOOL WINAPI GetClientRect(_In_ HWND, _Out_ LPRECT)
#define LVCF_FMT
Definition: commctrl.h:2558
#define IDS_USERPROFILE_CONFIRM_DELETE_TITLE
Definition: resource.h:40
static VOID AddUserProfiles(_In_ HWND hwndDlg, _In_ HWND hwndListView)
Definition: userprofile.c:472
#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:20
static VOID AddUserProfile(_In_ HWND hwndListView, _In_ LPTSTR lpProfileSid, _In_ PSID pMySid, _In_ HKEY hProfileKey)
Definition: userprofile.c:326
static VOID OnNotify(_In_ HWND hwndDlg, _In_ NMHDR *nmhdr)
Definition: userprofile.c:585
unsigned int UINT
Definition: ndis.h:50
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
Definition: security.c:296
static PSID pSid
Definition: security.c:74
static BOOL DeleteUserProfile(_In_ HWND hwndDlg)
Definition: userprofile.c:148
#define BST_CHECKED
Definition: winuser.h:197
DWORD dwState
Definition: userprofile.c:19
#define Button_SetCheck(hwndCtl, check)
Definition: windowsx.h:10
#define ListView_GetItem(hwnd, pitem)
Definition: commctrl.h:2366
#define SendMessage
Definition: winuser.h:5709
#define LVIF_PARAM
Definition: commctrl.h:2283
HINSTANCE WINAPI ShellExecuteW(HWND hwnd, LPCWSTR lpVerb, LPCWSTR lpFile, LPCWSTR lpParameters, LPCWSTR lpDirectory, INT nShowCmd)
Definition: shlexec.cpp:2236
static VOID SetListViewColumns(_In_ HWND hwndListView)
Definition: userprofile.c:275
#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
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
#define IDCANCEL
Definition: winuser.h:825
#define LVIF_STATE
Definition: commctrl.h:2284
#define wsprintf
Definition: winuser.h:5731
#define memset(x, y, z)
Definition: compat.h:39
#define WM_INITDIALOG
Definition: winuser.h:1715
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:5685
#define IDS_USERPROFILE_NAME
Definition: resource.h:31
#define WM_NOTIFY
Definition: richedit.h:61
static VOID UpdateButtonState(_In_ HWND hwndDlg, _In_ HWND hwndListView)
Definition: userprofile.c:434
static INT_PTR CALLBACK CopyUserProfileDlgProc(_In_ HWND hwndDlg, _In_ UINT uMsg, _In_ WPARAM wParam, _In_ LPARAM lParam)
Definition: userprofile.c:201
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12