ReactOS  0.4.14-dev-606-g14ebc0b
hardprof.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/hardprof.c
5  * PURPOSE: Modify hardware profiles
6  * COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
7  *
8  */
9 
10 #include "precomp.h"
11 
12 #include <debug.h>
13 
14 #define PROFILE_NAME_LENGTH 80
15 
16 typedef struct _PROFILE
17 {
22 } PROFILE, *PPROFILE;
23 
24 typedef struct _PROFILEDATA
25 {
32 
33 typedef struct _PROFILENAMES
34 {
39 
40 
41 static
42 VOID
44  HWND hwndDlg,
45  PPROFILEDATA pProfileData)
46 {
47  EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFPROP), (pProfileData->dwSelectedProfileIndex != (DWORD)-1) ? TRUE : FALSE);
48  EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFCOPY), (pProfileData->dwSelectedProfileIndex != (DWORD)-1) ? TRUE : FALSE);
49  EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFRENAME), (pProfileData->dwSelectedProfileIndex != (DWORD)-1) ? TRUE : FALSE);
50  EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFDEL), (pProfileData->dwSelectedProfileIndex != (DWORD)-1) ? TRUE : FALSE);
51 
52  if (pProfileData->dwProfileCount < 2)
53  {
56  }
57  else
58  {
60  (pProfileData->dwSelectedProfileIndex > 0) ? TRUE : FALSE);
62  (pProfileData->dwSelectedProfileIndex < pProfileData->dwProfileCount - 1) ? TRUE : FALSE);
63  }
64 }
65 
66 
67 static
68 BOOL
70  PPROFILENAMES pProfileNames,
71  BOOL bIgnoreCurrent)
72 {
73  DWORD i;
74 
75  for (i = 0; i < pProfileNames->pProfileData->dwProfileCount; i++)
76  {
77  if (bIgnoreCurrent == TRUE && i == pProfileNames->pProfileData->dwSelectedProfileIndex)
78  continue;
79 
80  if (wcscmp(pProfileNames->pProfileData->pProfiles[i].szFriendlyName, pProfileNames->szDestinationName) == 0)
81  return TRUE;
82  }
83 
84  return FALSE;
85 }
86 
87 
88 static
89 INT_PTR
92  HWND hwndDlg,
93  UINT uMsg,
94  WPARAM wParam,
95  LPARAM lParam)
96 {
97  PPROFILENAMES pProfileNames;
98 
99  pProfileNames = (PPROFILENAMES)GetWindowLongPtr(hwndDlg, DWLP_USER);
100 
101  switch (uMsg)
102  {
103  case WM_INITDIALOG:
104  SetWindowLongPtr(hwndDlg, DWLP_USER, lParam);
105  pProfileNames = (PPROFILENAMES)lParam;
106 
107  /* Set the old name */
108  SetDlgItemText(hwndDlg, IDC_COPYPROFILEFROM, pProfileNames->szSourceName);
109 
110  /* Set the new name */
112  SetDlgItemText(hwndDlg, IDC_COPYPROFILETO, pProfileNames->szDestinationName);
113  break;
114 
115  case WM_COMMAND:
116  switch (LOWORD(wParam))
117  {
118  case IDOK:
119  GetDlgItemText(hwndDlg,
121  pProfileNames->szDestinationName,
123  if (IsProfileNameInUse(pProfileNames, FALSE))
125  NULL,
129  else
130  EndDialog(hwndDlg, IDOK);
131  return TRUE;
132 
133  case IDCANCEL:
134  EndDialog(hwndDlg, IDCANCEL);
135  return TRUE;
136  }
137  break;
138  }
139 
140  return FALSE;
141 }
142 
143 
144 static
145 VOID
147  HWND hwndDlg,
148  PPROFILEDATA pProfileData)
149 {
150  PROFILENAMES ProfileNames;
151  PPROFILE pProfile, pNewProfiles, pNewProfile;
152  WCHAR szBuffer[80];
153 
154  pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
155 
156  LoadStringW(hApplet, IDS_HWPROFILE_PROFILE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
157 
158  wcscpy(ProfileNames.szSourceName, pProfile->szFriendlyName);
159  swprintf(ProfileNames.szDestinationName, L"%s %lu", szBuffer, pProfileData->dwProfileCount);
160 
161  ProfileNames.pProfileData = pProfileData;
162 
165  hwndDlg,
167  (LPARAM)&ProfileNames) != IDOK)
168  return;
169 
170  /* Apply new name only if it has been changed */
171  if (wcscmp(ProfileNames.szSourceName, ProfileNames.szDestinationName) == 0)
172  return;
173 
174  /* Allocate memory for the new profile */
175  pNewProfiles = HeapReAlloc(GetProcessHeap(),
177  pProfileData->pProfiles,
178  (pProfileData->dwProfileCount + 1) * sizeof(PROFILE));
179  if (pNewProfiles == NULL)
180  {
181  DPRINT1("HeapReAlloc() failed!\n");
182  return;
183  }
184 
185  pProfileData->dwProfileCount++;
186  pProfileData->pProfiles = pNewProfiles;
187 
188  pNewProfile = &pProfileData->pProfiles[pProfileData->dwProfileCount - 1];
189 
190  CopyMemory(pNewProfile, pProfile, sizeof(PROFILE));
191 
192  wcscpy(pNewProfile->szFriendlyName, ProfileNames.szDestinationName);
193 
194  pNewProfile->dwProfileNumber = ++pProfileData->dwLastProfile;
195  swprintf(pNewProfile->szName, L"%04lu", pNewProfile->dwProfileNumber);
196 
197  pNewProfile->dwPreferenceOrder = pNewProfile->dwProfileNumber;
198 
200 
201  UpdateButtons(hwndDlg, pProfileData);
202 }
203 
204 
205 static
206 INT_PTR
207 CALLBACK
209  HWND hwndDlg,
210  UINT uMsg,
211  WPARAM wParam,
212  LPARAM lParam)
213 {
214  PPROFILENAMES pProfileNames;
215 
216  pProfileNames = (PPROFILENAMES)GetWindowLongPtr(hwndDlg, DWLP_USER);
217 
218  switch (uMsg)
219  {
220  case WM_INITDIALOG:
221  SetWindowLongPtr(hwndDlg, DWLP_USER, lParam);
222  pProfileNames = (PPROFILENAMES)lParam;
223 
224  /* Set the old name */
225  SetDlgItemText(hwndDlg, IDC_RENPROFEDITFROM, pProfileNames->szSourceName);
226 
227  /* Set the new name */
229  SetDlgItemText(hwndDlg, IDC_RENPROFEDITTO, pProfileNames->szDestinationName);
230  break;
231 
232  case WM_COMMAND:
233  switch (LOWORD(wParam))
234  {
235  case IDOK:
236  GetDlgItemText(hwndDlg,
238  pProfileNames->szDestinationName,
240  if (IsProfileNameInUse(pProfileNames, TRUE))
242  NULL,
246  else
247  EndDialog(hwndDlg, IDOK);
248  return TRUE;
249 
250  case IDCANCEL:
251  EndDialog(hwndDlg, IDCANCEL);
252  return TRUE;
253  }
254  break;
255  }
256 
257  return FALSE;
258 }
259 
260 
261 static
262 VOID
264  HWND hwndDlg,
265  PPROFILEDATA pProfileData)
266 {
267  PROFILENAMES ProfileNames;
268  PPROFILE pProfile;
269  WCHAR szBuffer[80];
270 
271  pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
272 
273  LoadStringW(hApplet, IDS_HWPROFILE_PROFILE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
274 
275  wcscpy(ProfileNames.szSourceName, pProfile->szFriendlyName);
276  swprintf(ProfileNames.szDestinationName, L"%s %lu", szBuffer, pProfileData->dwProfileCount);
277 
278  ProfileNames.pProfileData = pProfileData;
279 
282  hwndDlg,
284  (LPARAM)&ProfileNames) != IDOK)
285  return;
286 
287  /* Apply new name only if it has been changed */
288  if (wcscmp(pProfile->szFriendlyName, ProfileNames.szDestinationName) == 0)
289  return;
290 
291  /* Replace the profile name in the profile list */
292  wcscpy(pProfile->szFriendlyName, ProfileNames.szDestinationName);
293 
294  /* Replace the profile name in the listbox */
297 }
298 
299 
300 static
301 VOID
303  HWND hwndDlg,
304  PPROFILEDATA pProfileData)
305 {
306  WCHAR szMessage[256];
307  WCHAR szBuffer[128];
308  WCHAR szCaption[80];
309  PPROFILE pProfiles;
310  PPROFILE pProfile;
311 
312  pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
313 
314  LoadStringW(hApplet, IDS_HWPROFILE_CONFIRM_DELETE_TITLE, szCaption, sizeof(szCaption) / sizeof(WCHAR));
315  LoadStringW(hApplet, IDS_HWPROFILE_CONFIRM_DELETE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
316  swprintf(szMessage, szBuffer, pProfile->szFriendlyName);
317 
318  if (MessageBox(NULL,
319  szMessage,
320  szCaption,
322  return;
323 
325 
326  if (pProfileData->dwSelectedProfileIndex != pProfileData->dwProfileCount - 1)
327  {
328  RtlMoveMemory(&pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex],
329  &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex + 1],
330  (pProfileData->dwProfileCount - pProfileData->dwSelectedProfileIndex - 1) * sizeof(PROFILE));
331  }
332  else
333  {
334  pProfileData->dwSelectedProfileIndex--;
335  }
336 
337  pProfiles = HeapReAlloc(GetProcessHeap(),
339  pProfileData->pProfiles,
340  (pProfileData->dwProfileCount - 1) * sizeof(PROFILE));
341  if (pProfiles == NULL)
342  {
343  DPRINT1("HeapReAlloc() failed!\n");
344  return;
345  }
346 
347  pProfileData->dwProfileCount--;
348  pProfileData->pProfiles = pProfiles;
349 
351 
352  UpdateButtons(hwndDlg, pProfileData);
353 }
354 
355 
356 static
357 VOID
359  HWND hwndDlg,
360  PPROFILEDATA pProfileData,
361  BOOL bMoveUp)
362 {
363  PROFILE TempProfile;
364  PPROFILE pSrcProfile, pDstProfile;
365  DWORD dwSrcIndex, dwDstIndex;
366 
367  dwSrcIndex = pProfileData->dwSelectedProfileIndex;
368  dwDstIndex = bMoveUp ? (dwSrcIndex - 1) : (dwSrcIndex + 1);
369 
370  pSrcProfile = &pProfileData->pProfiles[dwSrcIndex];
371  pDstProfile = &pProfileData->pProfiles[dwDstIndex];
372 
373  CopyMemory(&TempProfile, pDstProfile, sizeof(PROFILE));
374  CopyMemory(pDstProfile, pSrcProfile, sizeof(PROFILE));
375  CopyMemory(pSrcProfile, &TempProfile, sizeof(PROFILE));
376 
377  SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_DELETESTRING, dwSrcIndex, 0);
378  SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_INSERTSTRING, dwDstIndex, (LPARAM)pDstProfile->szFriendlyName);
379 
380  pProfileData->dwSelectedProfileIndex = dwDstIndex;
382 
383  UpdateButtons(hwndDlg, pProfileData);
384 }
385 
386 
387 static
388 INT_PTR
389 CALLBACK
391  HWND hwndDlg,
392  UINT uMsg,
393  WPARAM wParam,
394  LPARAM lParam)
395 {
396  UNREFERENCED_PARAMETER(hwndDlg);
399 
400  switch (uMsg)
401  {
402  case WM_INITDIALOG:
403  return TRUE;
404 
405  }
406 
407  return FALSE;
408 }
409 
410 static int CALLBACK
412 {
413  // NOTE: This callback is needed to set large icon correctly.
414  HICON hIcon;
415  switch (uMsg)
416  {
417  case PSCB_INITIALIZED:
418  {
420  SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
421  break;
422  }
423  }
424  return 0;
425 }
426 
427 static
428 VOID
430  HWND hwndDlg,
431  PPROFILEDATA pProfileData)
432 {
433  HPROPSHEETPAGE hpsp;
434  PROPSHEETHEADER psh;
435  PROPSHEETPAGE psp;
436 
437  ZeroMemory(&psp, sizeof(psp));
438  psp.dwSize = sizeof(psp);
439  psp.dwFlags = PSP_DEFAULT;
440  psp.hInstance = hApplet;
441  psp.pszTemplate = MAKEINTRESOURCE(IDD_HARDWAREPROFILE);
442  psp.pfnDlgProc = HardwareProfilePropertiesDlgProc;
443 
444  hpsp = CreatePropertySheetPage(&psp);
445  if (hpsp == NULL)
446  {
447  return;
448  }
449 
450  ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
451  psh.dwSize = sizeof(PROPSHEETHEADER);
452  psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
453  psh.hwndParent = hwndDlg;
454  psh.hInstance = hApplet;
455  psh.pszIcon = MAKEINTRESOURCEW(IDI_HARDPROF);
456  psh.pszCaption = pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex].szFriendlyName;
457  psh.nPages = 1;
458  psh.nStartPage = 0;
459  psh.phpage = &hpsp;
460  psh.pfnCallback = PropSheetProc;
461 
462  PropertySheet(&psh);
463 }
464 
465 
466 static
467 DWORD
469 {
470  DWORD dwWaitInterval = 30;
471  DWORD dwSize;
472  HKEY hKey;
473 
475  L"System\\CurrentControlSet\\Control\\IDConfigDB",
476  0,
478  &hKey))
479  return dwWaitInterval;
480 
481  dwSize = sizeof(DWORD);
482  RegQueryValueExW(hKey,
483  L"UserWaitInterval",
484  NULL,
485  NULL,
486  (LPBYTE)&dwWaitInterval,
487  &dwSize);
488 
489  RegCloseKey(hKey);
490 
491  return dwWaitInterval;
492 }
493 
494 
495 static
496 VOID
497 SetUserWaitInterval(DWORD dwWaitInterval)
498 {
499  HKEY hKey;
500 
502  L"System\\CurrentControlSet\\Control\\IDConfigDB",
503  0,
505  &hKey))
506  return;
507 
508  RegSetValueExW(hKey,
509  L"UserWaitInterval",
510  0,
511  REG_DWORD,
512  (LPBYTE)&dwWaitInterval,
513  sizeof(DWORD));
514 
515  RegCloseKey(hKey);
516 }
517 
518 
519 static
520 BOOL
521 GetProfileCount(LPDWORD lpProfileCount)
522 {
523  HKEY hKey;
524  LONG lError;
525 
526  *lpProfileCount = 0;
527 
529  L"System\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles",
530  0,
531  KEY_READ,
532  &hKey);
533  if (lError != ERROR_SUCCESS)
534  return FALSE;
535 
536  lError = RegQueryInfoKeyW(hKey, NULL, NULL, NULL, lpProfileCount,
537  NULL, NULL, NULL, NULL, NULL, NULL, NULL);
538 
539  RegCloseKey(hKey);
540 
541  if (lError != ERROR_SUCCESS)
542  return FALSE;
543 
544  return TRUE;
545 }
546 
547 
548 static
549 VOID
551  HWND hwndDlg,
552  HKEY hKey,
553  LPWSTR lpName,
554  DWORD dwProfileNumber,
555  PPROFILE pProfile)
556 {
557  HKEY hProfileKey;
558  DWORD dwSize;
559  LONG lError;
560 
561  lError = RegOpenKeyExW(hKey,
562  lpName,
563  0,
564  KEY_READ,
565  &hProfileKey);
566  if (lError != ERROR_SUCCESS)
567  return;
568 
569  dwSize = PROFILE_NAME_LENGTH * sizeof(WCHAR);
570  lError = RegQueryValueExW(hProfileKey,
571  L"FriendlyName",
572  NULL,
573  NULL,
574  (LPBYTE)pProfile->szFriendlyName,
575  &dwSize);
576  if (lError == ERROR_SUCCESS)
577  {
578  DPRINT1("Profile: %S\n", pProfile->szFriendlyName);
579  }
580 
581  dwSize = sizeof(DWORD);
582  lError = RegQueryValueExW(hProfileKey,
583  L"PreferenceOrder",
584  NULL,
585  NULL,
586  (LPBYTE)&pProfile->dwPreferenceOrder,
587  &dwSize);
588  if (lError == ERROR_SUCCESS)
589  {
590  DPRINT1("PreferenceOrder: %lu\n", pProfile->dwPreferenceOrder);
591  }
592 
593  pProfile->dwProfileNumber = dwProfileNumber;
594 
596 
597  RegCloseKey(hProfileKey);
598 }
599 
600 
601 static
602 BOOL
604 {
605  PPROFILEDATA pProfileData;
606  WCHAR szName[8];
607  DWORD dwNameLength;
608  DWORD dwProfileNumber;
609  DWORD dwIndex = 0;
610  HKEY hKey;
611  LONG lError;
612 
613  pProfileData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PROFILEDATA));
614  if (pProfileData == NULL)
615  return FALSE;
616 
617  pProfileData->dwLastProfile = (DWORD)-1;
618  pProfileData->dwSelectedProfileIndex = (DWORD)-1;
619 
620  if (!GetProfileCount(&pProfileData->dwProfileCount))
621  {
622  HeapFree(GetProcessHeap(), 0, pProfileData);
623  return FALSE;
624  }
625 
627  pProfileData->dwProfileCount * sizeof(PROFILE));
628  if (pProfileData->pProfiles == NULL)
629  {
630  HeapFree(GetProcessHeap(), 0, pProfileData);
631  return FALSE;
632  }
633 
634  SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pProfileData);
635 
637  L"System\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles",
638  0,
639  KEY_READ,
640  &hKey) != ERROR_SUCCESS)
641  return FALSE;
642 
643  for (dwIndex = 0; dwIndex < pProfileData->dwProfileCount; dwIndex++)
644  {
645  dwNameLength = 8;
646  lError = RegEnumKeyExW(hKey,
647  dwIndex,
648  szName,
649  &dwNameLength,
650  NULL,
651  NULL,
652  NULL,
653  NULL);
654  if (lError != ERROR_SUCCESS)
655  break;
656 
657  dwProfileNumber = wcstoul(szName, NULL, 10);
658  DPRINT("Profile name: %S\n", szName);
659  DPRINT("Profile number: %lu\n", dwProfileNumber);
660 
661  if ((pProfileData->dwLastProfile == (DWORD)-1) ||
662  (pProfileData->dwLastProfile < dwProfileNumber))
663  pProfileData->dwLastProfile = dwProfileNumber;
664 
665  DPRINT("Last Profile number: %lu\n", pProfileData->dwLastProfile);
666 
667  GetProfile(hwndDlg, hKey, szName, dwProfileNumber, &pProfileData->pProfiles[dwIndex]);
668  }
669 
670  RegCloseKey(hKey);
671 
672  return TRUE;
673 }
674 
675 
676 static
677 BOOL
679 {
680  DWORD dwWaitInterval;
681 
682  DPRINT("OnInitHardProfDialog()\n");
683 
690 
691  if (!GetProfiles(hwndDlg))
692  return FALSE;
693 
695 
696  dwWaitInterval = GetUserWaitInterval();
697  if (dwWaitInterval == (DWORD)-1)
698  {
702  }
703  else
704  {
706  SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETPOS, 0, dwWaitInterval);
707  }
708 
709  return TRUE;
710 }
711 
712 
713 static
714 VOID
715 OnOk(HWND hwndDlg)
716 {
717  DWORD dwWaitInterval;
718 
720  {
721  dwWaitInterval = (DWORD)-1;
722  }
723  else
724  {
725  dwWaitInterval = LOWORD(SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_GETPOS, 0, 0));
726  }
727 
728  SetUserWaitInterval(dwWaitInterval);
729 }
730 
731 
732 /* Property page dialog callback */
733 INT_PTR
734 CALLBACK
736  UINT uMsg,
737  WPARAM wParam,
738  LPARAM lParam)
739 {
740  PPROFILEDATA pProfileData;
741 
744  UNREFERENCED_PARAMETER(hwndDlg);
745 
746  pProfileData = (PPROFILEDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
747 
748  switch (uMsg)
749  {
750  case WM_INITDIALOG:
751  return OnInitHardProfDialog(hwndDlg);
752 
753  case WM_DESTROY:
754  if (pProfileData != NULL)
755  {
756  if (pProfileData->pProfiles != NULL)
757  HeapFree(GetProcessHeap(), 0, pProfileData->pProfiles);
758  HeapFree(GetProcessHeap(), 0, pProfileData);
759  }
760  break;
761 
762  case WM_COMMAND:
763  switch (LOWORD(wParam))
764  {
765  case IDC_HRDPROFPROP:
766  HardwareProfileProperties(hwndDlg, pProfileData);
767  break;
768 
769  case IDC_HRDPROFCOPY:
770  CopyHardwareProfile(hwndDlg, pProfileData);
771  break;
772 
773  case IDC_HRDPROFRENAME:
774  RenameHardwareProfile(hwndDlg, pProfileData);
775  break;
776 
777  case IDC_HRDPROFDEL:
778  DeleteHardwareProfile(hwndDlg, pProfileData);
779  break;
780 
781  case IDC_HRDPROFUP:
782  MoveHardwareProfile(hwndDlg, pProfileData, TRUE);
783  break;
784 
785  case IDC_HRDPROFDWN:
786  MoveHardwareProfile(hwndDlg, pProfileData, FALSE);
787  break;
788 
789  case IDC_HRDPROFWAIT:
791  return TRUE;
792 
793  case IDC_HRDPROFSELECT:
795  return TRUE;
796 
797  case IDC_HRDPROFLSTBOX:
798  if (HIWORD(wParam) == LBN_SELCHANGE)
799  {
801  UpdateButtons(hwndDlg, pProfileData);
802  }
803  return TRUE;
804 
805  case IDOK:
806  OnOk(hwndDlg);
807 
808  case IDCANCEL:
809  EndDialog(hwndDlg, LOWORD(wParam));
810  return TRUE;
811  }
812  break;
813  }
814 
815  return FALSE;
816 }
#define LB_SETCURSEL
Definition: winuser.h:2045
static BOOL OnInitHardProfDialog(HWND hwndDlg)
Definition: hardprof.c:678
#define IDS_HWPROFILE_ALREADY_IN_USE
Definition: resource.h:56
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
static HICON
Definition: imagelist.c:84
#define TRUE
Definition: types.h:120
#define UDM_GETPOS
Definition: commctrl.h:2140
#define IDOK
Definition: winuser.h:824
#define IMAGE_ICON
Definition: winuser.h:212
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
static DWORD GetUserWaitInterval(VOID)
Definition: hardprof.c:468
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_HRDPROFLSTBOX
Definition: resource.h:173
#define IDS_HWPROFILE_CONFIRM_DELETE_TITLE
Definition: resource.h:54
#define IDYES
Definition: winuser.h:829
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define IDC_HRDPROFCOPY
Definition: resource.h:177
#define LB_ADDSTRING
Definition: winuser.h:2013
WCHAR szSourceName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:35
struct _PROFILE PROFILE
#define KEY_READ
Definition: nt_native.h:1023
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define EM_SETLIMITTEXT
Definition: winuser.h:1993
DWORD dwLastProfile
Definition: hardprof.c:27
static INT_PTR CALLBACK HardwareProfilePropertiesDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:390
#define CALLBACK
Definition: compat.h:27
_In_ LPCSTR lpName
Definition: winbase.h:2746
struct _PROFILEDATA PROFILEDATA
#define ZeroMemory
Definition: winbase.h:1642
#define IDI_HARDPROF
Definition: resource.h:7
static INT_PTR CALLBACK CopyProfileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:91
HINSTANCE hApplet
Definition: access.c:17
UINT_PTR WPARAM
Definition: windef.h:207
#define IDD_COPYPROFILE
Definition: resource.h:197
#define SendDlgItemMessage
Definition: winuser.h:5817
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define PROFILE_NAME_LENGTH
Definition: hardprof.c:14
int32_t INT_PTR
Definition: typedefs.h:62
#define PSH_USECALLBACK
Definition: prsht.h:48
DWORD dwSelectedProfile
Definition: hardprof.c:28
#define LBN_SELCHANGE
Definition: winuser.h:2057
#define BM_SETIMAGE
Definition: winuser.h:1904
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define DWORD
Definition: nt_native.h:44
#define IDC_COPYPROFILETO
Definition: resource.h:199
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IDC_RENPROFEDITFROM
Definition: resource.h:203
static VOID OnOk(HWND hwndDlg)
Definition: hardprof.c:715
#define IDC_HRDPROFDEL
Definition: resource.h:179
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
WCHAR szDestinationName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:36
static VOID RenameHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:263
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
#define PSH_USEICONID
Definition: prsht.h:42
#define MB_YESNO
Definition: winuser.h:811
#define IDC_HRDPROFUP
Definition: resource.h:174
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
WCHAR szFriendlyName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:18
short SHORT
Definition: pedump.c:59
WCHAR szName[5]
Definition: hardprof.c:19
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define IDS_HWPROFILE_PROFILE
Definition: resource.h:57
#define MAKELONG(a, b)
Definition: typedefs.h:248
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:374
#define MB_ICONQUESTION
Definition: winuser.h:783
LONG_PTR LPARAM
Definition: windef.h:208
void DPRINT(...)
Definition: polytest.cpp:61
#define UDM_SETRANGE
Definition: commctrl.h:2137
#define IDD_RENAMEPROFILE
Definition: resource.h:202
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define IDD_HARDWAREPROFILE
Definition: resource.h:186
#define CreatePropertySheetPage
Definition: prsht.h:381
#define IDC_HRDPROFDWN
Definition: resource.h:175
#define WM_DESTROY
Definition: winuser.h:1591
struct _PROFILEDATA * PPROFILEDATA
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: hardprof.c:411
#define IDC_HRDPROFSELECT
Definition: resource.h:181
#define PSP_DEFAULT
Definition: prsht.h:22
#define GetDlgItemText
Definition: winuser.h:5760
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
VOID ResourceMessageBox(HINSTANCE hInstance, HWND hwnd, UINT uType, UINT uCaptionId, UINT uMessageId)
Definition: misc.c:283
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
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
__wchar_t WCHAR
Definition: xmlstorage.h:180
struct _PROFILE * PPROFILE
#define PSH_PROPTITLE
Definition: prsht.h:40
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define CopyMemory
Definition: winbase.h:1640
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SetDlgItemText
Definition: winuser.h:5824
#define IDI_UP
Definition: resource.h:9
LONG WINAPI RegQueryInfoKeyW(HKEY hKey, LPWSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3686
#define IDS_HWPROFILE_CONFIRM_DELETE
Definition: resource.h:55
#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)
DWORD dwProfileNumber
Definition: hardprof.c:20
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
#define IDC_HRDPROFWAIT
Definition: resource.h:180
#define MB_ICONERROR
Definition: winuser.h:781
#define IDC_HRDPROFUPDWN
Definition: resource.h:183
#define MessageBox
Definition: winuser.h:5797
#define WM_COMMAND
Definition: winuser.h:1722
DWORD dwPreferenceOrder
Definition: hardprof.c:21
static VOID GetProfile(HWND hwndDlg, HKEY hKey, LPWSTR lpName, DWORD dwProfileNumber, PPROFILE pProfile)
Definition: hardprof.c:550
INT_PTR CALLBACK HardProfDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:735
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
struct _PROFILENAMES * PPROFILENAMES
static VOID DeleteHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:302
PPROFILE pProfiles
Definition: hardprof.c:30
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
struct _PROFILENAMES PROFILENAMES
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define IDC_HRDPROFPROP
Definition: resource.h:176
HICON hIcon
Definition: msconfig.c:44
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_COPYPROFILEFROM
Definition: resource.h:198
#define HeapReAlloc
Definition: compat.h:401
static VOID CopyHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:146
static VOID HardwareProfileProperties(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:429
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define UDM_SETPOS
Definition: commctrl.h:2139
#define LB_GETCURSEL
Definition: winuser.h:2021
unsigned int UINT
Definition: ndis.h:50
#define MB_OK
Definition: winuser.h:784
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
static BOOL IsProfileNameInUse(PPROFILENAMES pProfileNames, BOOL bIgnoreCurrent)
Definition: hardprof.c:69
#define IDC_RENPROFEDITTO
Definition: resource.h:204
#define BST_CHECKED
Definition: winuser.h:197
#define DPRINT1
Definition: precomp.h:8
#define IDC_HRDPROFRENAME
Definition: resource.h:178
DWORD dwProfileCount
Definition: hardprof.c:26
static VOID SetUserWaitInterval(DWORD dwWaitInterval)
Definition: hardprof.c:497
static const WCHAR szName[]
Definition: msipriv.h:1194
#define SendMessage
Definition: winuser.h:5818
#define PropertySheet
Definition: prsht.h:382
uint32_t * LPDWORD
Definition: typedefs.h:57
#define IDI_DOWN
Definition: resource.h:10
static BOOL GetProfiles(HWND hwndDlg)
Definition: hardprof.c:603
#define IDC_HRDPROFEDIT
Definition: resource.h:182
#define HIWORD(l)
Definition: typedefs.h:246
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
static INT_PTR CALLBACK RenameProfileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:208
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
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 LoadIcon
Definition: winuser.h:5788
#define GetWindowLongPtr
Definition: treelist.c:73
static BOOL GetProfileCount(LPDWORD lpProfileCount)
Definition: hardprof.c:521
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDCANCEL
Definition: winuser.h:825
static VOID UpdateButtons(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:43
#define LB_DELETESTRING
Definition: winuser.h:2014
#define REG_DWORD
Definition: sdbapi.c:596
static VOID MoveHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData, BOOL bMoveUp)
Definition: hardprof.c:358
#define WM_INITDIALOG
Definition: winuser.h:1721
#define LB_INSERTSTRING
Definition: winuser.h:2035
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:402
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define PROPSHEETPAGE
Definition: prsht.h:371
#define IDS_HWPROFILE_WARNING
Definition: resource.h:58
PPROFILEDATA pProfileData
Definition: hardprof.c:37
#define ICON_BIG
Definition: tnclass.cpp:51
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12