ReactOS 0.4.15-dev-7788-g1ad9096
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
16typedef struct _PROFILE
17{
23
24typedef struct _PROFILEDATA
25{
32
33typedef struct _PROFILENAMES
34{
39
40
41static
42VOID
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
67static
68BOOL
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
88static
92 HWND hwndDlg,
93 UINT uMsg,
96{
97 PPROFILENAMES pProfileNames;
98
99 pProfileNames = (PPROFILENAMES)GetWindowLongPtr(hwndDlg, DWLP_USER);
100
101 switch (uMsg)
102 {
103 case WM_INITDIALOG:
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))
124 {
126 hwndDlg,
130 }
131 else
132 {
133 EndDialog(hwndDlg, IDOK);
134 }
135 return TRUE;
136
137 case IDCANCEL:
138 EndDialog(hwndDlg, IDCANCEL);
139 return TRUE;
140 }
141 break;
142 }
143
144 return FALSE;
145}
146
147
148static
149VOID
151 HWND hwndDlg,
152 PPROFILEDATA pProfileData)
153{
154 PROFILENAMES ProfileNames;
155 PPROFILE pProfile, pNewProfiles, pNewProfile;
156 WCHAR szBuffer[80];
157
158 pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
159
160 LoadStringW(hApplet, IDS_HWPROFILE_PROFILE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
161
162 wcscpy(ProfileNames.szSourceName, pProfile->szFriendlyName);
163 swprintf(ProfileNames.szDestinationName, L"%s %lu", szBuffer, pProfileData->dwProfileCount);
164
165 ProfileNames.pProfileData = pProfileData;
166
169 hwndDlg,
171 (LPARAM)&ProfileNames) != IDOK)
172 return;
173
174 /* Apply new name only if it has been changed */
175 if (wcscmp(ProfileNames.szSourceName, ProfileNames.szDestinationName) == 0)
176 return;
177
178 /* Allocate memory for the new profile */
179 pNewProfiles = HeapReAlloc(GetProcessHeap(),
181 pProfileData->pProfiles,
182 (pProfileData->dwProfileCount + 1) * sizeof(PROFILE));
183 if (pNewProfiles == NULL)
184 {
185 DPRINT1("HeapReAlloc() failed!\n");
186 return;
187 }
188
189 pProfileData->dwProfileCount++;
190 pProfileData->pProfiles = pNewProfiles;
191
192 pNewProfile = &pProfileData->pProfiles[pProfileData->dwProfileCount - 1];
193
194 CopyMemory(pNewProfile, pProfile, sizeof(PROFILE));
195
196 wcscpy(pNewProfile->szFriendlyName, ProfileNames.szDestinationName);
197
198 pNewProfile->dwProfileNumber = ++pProfileData->dwLastProfile;
199 swprintf(pNewProfile->szName, L"%04lu", pNewProfile->dwProfileNumber);
200
201 pNewProfile->dwPreferenceOrder = pNewProfile->dwProfileNumber;
202
204
205 UpdateButtons(hwndDlg, pProfileData);
206}
207
208
209static
213 HWND hwndDlg,
214 UINT uMsg,
217{
218 PPROFILENAMES pProfileNames;
219
220 pProfileNames = (PPROFILENAMES)GetWindowLongPtr(hwndDlg, DWLP_USER);
221
222 switch (uMsg)
223 {
224 case WM_INITDIALOG:
226 pProfileNames = (PPROFILENAMES)lParam;
227
228 /* Set the old name */
229 SetDlgItemText(hwndDlg, IDC_RENPROFEDITFROM, pProfileNames->szSourceName);
230
231 /* Set the new name */
233 SetDlgItemText(hwndDlg, IDC_RENPROFEDITTO, pProfileNames->szDestinationName);
234 break;
235
236 case WM_COMMAND:
237 switch (LOWORD(wParam))
238 {
239 case IDOK:
240 GetDlgItemText(hwndDlg,
242 pProfileNames->szDestinationName,
244 if (IsProfileNameInUse(pProfileNames, TRUE))
245 {
247 hwndDlg,
251 }
252 else
253 {
254 EndDialog(hwndDlg, IDOK);
255 }
256 return TRUE;
257
258 case IDCANCEL:
259 EndDialog(hwndDlg, IDCANCEL);
260 return TRUE;
261 }
262 break;
263 }
264
265 return FALSE;
266}
267
268
269static
270VOID
272 HWND hwndDlg,
273 PPROFILEDATA pProfileData)
274{
275 PROFILENAMES ProfileNames;
276 PPROFILE pProfile;
277 WCHAR szBuffer[80];
278
279 pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
280
281 LoadStringW(hApplet, IDS_HWPROFILE_PROFILE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
282
283 wcscpy(ProfileNames.szSourceName, pProfile->szFriendlyName);
284 swprintf(ProfileNames.szDestinationName, L"%s %lu", szBuffer, pProfileData->dwProfileCount);
285
286 ProfileNames.pProfileData = pProfileData;
287
290 hwndDlg,
292 (LPARAM)&ProfileNames) != IDOK)
293 return;
294
295 /* Apply new name only if it has been changed */
296 if (wcscmp(pProfile->szFriendlyName, ProfileNames.szDestinationName) == 0)
297 return;
298
299 /* Replace the profile name in the profile list */
300 wcscpy(pProfile->szFriendlyName, ProfileNames.szDestinationName);
301
302 /* Replace the profile name in the listbox */
305}
306
307
308static
309VOID
311 HWND hwndDlg,
312 PPROFILEDATA pProfileData)
313{
314 PPROFILE pProfiles;
315 PPROFILE pProfile;
316
317 pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
318
320 hwndDlg,
324 pProfile->szFriendlyName) != IDYES)
325 {
326 return;
327 }
328
330
331 if (pProfileData->dwSelectedProfileIndex != pProfileData->dwProfileCount - 1)
332 {
333 RtlMoveMemory(&pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex],
334 &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex + 1],
335 (pProfileData->dwProfileCount - pProfileData->dwSelectedProfileIndex - 1) * sizeof(PROFILE));
336 }
337 else
338 {
339 pProfileData->dwSelectedProfileIndex--;
340 }
341
342 pProfiles = HeapReAlloc(GetProcessHeap(),
344 pProfileData->pProfiles,
345 (pProfileData->dwProfileCount - 1) * sizeof(PROFILE));
346 if (pProfiles == NULL)
347 {
348 DPRINT1("HeapReAlloc() failed!\n");
349 return;
350 }
351
352 pProfileData->dwProfileCount--;
353 pProfileData->pProfiles = pProfiles;
354
356
357 UpdateButtons(hwndDlg, pProfileData);
358}
359
360
361static
362VOID
364 HWND hwndDlg,
365 PPROFILEDATA pProfileData,
366 BOOL bMoveUp)
367{
368 PROFILE TempProfile;
369 PPROFILE pSrcProfile, pDstProfile;
370 DWORD dwSrcIndex, dwDstIndex;
371
372 dwSrcIndex = pProfileData->dwSelectedProfileIndex;
373 dwDstIndex = bMoveUp ? (dwSrcIndex - 1) : (dwSrcIndex + 1);
374
375 pSrcProfile = &pProfileData->pProfiles[dwSrcIndex];
376 pDstProfile = &pProfileData->pProfiles[dwDstIndex];
377
378 CopyMemory(&TempProfile, pDstProfile, sizeof(PROFILE));
379 CopyMemory(pDstProfile, pSrcProfile, sizeof(PROFILE));
380 CopyMemory(pSrcProfile, &TempProfile, sizeof(PROFILE));
381
382 SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_DELETESTRING, dwSrcIndex, 0);
383 SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_INSERTSTRING, dwDstIndex, (LPARAM)pDstProfile->szFriendlyName);
384
385 pProfileData->dwSelectedProfileIndex = dwDstIndex;
387
388 UpdateButtons(hwndDlg, pProfileData);
389}
390
391
392static
396 HWND hwndDlg,
397 UINT uMsg,
400{
401 UNREFERENCED_PARAMETER(hwndDlg);
404
405 switch (uMsg)
406 {
407 case WM_INITDIALOG:
408 return TRUE;
409
410 }
411
412 return FALSE;
413}
414
415static int CALLBACK
417{
418 // NOTE: This callback is needed to set large icon correctly.
419 HICON hIcon;
420 switch (uMsg)
421 {
422 case PSCB_INITIALIZED:
423 {
425 SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
426 break;
427 }
428 }
429 return 0;
430}
431
432static
433VOID
435 HWND hwndDlg,
436 PPROFILEDATA pProfileData)
437{
438 HPROPSHEETPAGE hpsp;
439 PROPSHEETHEADER psh;
440 PROPSHEETPAGE psp;
441
442 ZeroMemory(&psp, sizeof(psp));
443 psp.dwSize = sizeof(psp);
444 psp.dwFlags = PSP_DEFAULT;
445 psp.hInstance = hApplet;
446 psp.pszTemplate = MAKEINTRESOURCE(IDD_HARDWAREPROFILE);
447 psp.pfnDlgProc = HardwareProfilePropertiesDlgProc;
448
449 hpsp = CreatePropertySheetPage(&psp);
450 if (hpsp == NULL)
451 {
452 return;
453 }
454
455 ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
456 psh.dwSize = sizeof(PROPSHEETHEADER);
458 psh.hwndParent = hwndDlg;
459 psh.hInstance = hApplet;
460 psh.pszIcon = MAKEINTRESOURCEW(IDI_HARDPROF);
461 psh.pszCaption = pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex].szFriendlyName;
462 psh.nPages = 1;
463 psh.nStartPage = 0;
464 psh.phpage = &hpsp;
465 psh.pfnCallback = PropSheetProc;
466
467 PropertySheet(&psh);
468}
469
470
471static
472DWORD
474{
475 DWORD dwWaitInterval = 30;
477 HKEY hKey;
478
480 L"System\\CurrentControlSet\\Control\\IDConfigDB",
481 0,
483 &hKey))
484 return dwWaitInterval;
485
486 dwSize = sizeof(DWORD);
488 L"UserWaitInterval",
489 NULL,
490 NULL,
491 (LPBYTE)&dwWaitInterval,
492 &dwSize);
493
495
496 return dwWaitInterval;
497}
498
499
500static
501VOID
503{
504 HKEY hKey;
505
507 L"System\\CurrentControlSet\\Control\\IDConfigDB",
508 0,
510 &hKey))
511 return;
512
514 L"UserWaitInterval",
515 0,
516 REG_DWORD,
517 (LPBYTE)&dwWaitInterval,
518 sizeof(DWORD));
519
521}
522
523
524static
525BOOL
527{
528 HKEY hKey;
529 LONG lError;
530
531 *lpProfileCount = 0;
532
534 L"System\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles",
535 0,
536 KEY_READ,
537 &hKey);
538 if (lError != ERROR_SUCCESS)
539 return FALSE;
540
541 lError = RegQueryInfoKeyW(hKey, NULL, NULL, NULL, lpProfileCount,
542 NULL, NULL, NULL, NULL, NULL, NULL, NULL);
543
545
546 if (lError != ERROR_SUCCESS)
547 return FALSE;
548
549 return TRUE;
550}
551
552
553static
554VOID
556 HWND hwndDlg,
557 HKEY hKey,
559 DWORD dwProfileNumber,
560 PPROFILE pProfile)
561{
562 HKEY hProfileKey;
564 LONG lError;
565
566 lError = RegOpenKeyExW(hKey,
567 lpName,
568 0,
569 KEY_READ,
570 &hProfileKey);
571 if (lError != ERROR_SUCCESS)
572 return;
573
574 dwSize = PROFILE_NAME_LENGTH * sizeof(WCHAR);
575 lError = RegQueryValueExW(hProfileKey,
576 L"FriendlyName",
577 NULL,
578 NULL,
579 (LPBYTE)pProfile->szFriendlyName,
580 &dwSize);
581 if (lError == ERROR_SUCCESS)
582 {
583 DPRINT1("Profile: %S\n", pProfile->szFriendlyName);
584 }
585
586 dwSize = sizeof(DWORD);
587 lError = RegQueryValueExW(hProfileKey,
588 L"PreferenceOrder",
589 NULL,
590 NULL,
591 (LPBYTE)&pProfile->dwPreferenceOrder,
592 &dwSize);
593 if (lError == ERROR_SUCCESS)
594 {
595 DPRINT1("PreferenceOrder: %lu\n", pProfile->dwPreferenceOrder);
596 }
597
598 pProfile->dwProfileNumber = dwProfileNumber;
599
601
602 RegCloseKey(hProfileKey);
603}
604
605
606static
607BOOL
609{
610 PPROFILEDATA pProfileData;
611 WCHAR szName[8];
612 DWORD dwNameLength;
613 DWORD dwProfileNumber;
614 DWORD dwIndex = 0;
615 HKEY hKey;
616 LONG lError;
617
618 pProfileData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PROFILEDATA));
619 if (pProfileData == NULL)
620 return FALSE;
621
622 pProfileData->dwLastProfile = (DWORD)-1;
623 pProfileData->dwSelectedProfileIndex = (DWORD)-1;
624
625 if (!GetProfileCount(&pProfileData->dwProfileCount))
626 {
627 HeapFree(GetProcessHeap(), 0, pProfileData);
628 return FALSE;
629 }
630
632 pProfileData->dwProfileCount * sizeof(PROFILE));
633 if (pProfileData->pProfiles == NULL)
634 {
635 HeapFree(GetProcessHeap(), 0, pProfileData);
636 return FALSE;
637 }
638
639 SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pProfileData);
640
642 L"System\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles",
643 0,
644 KEY_READ,
645 &hKey) != ERROR_SUCCESS)
646 return FALSE;
647
648 for (dwIndex = 0; dwIndex < pProfileData->dwProfileCount; dwIndex++)
649 {
650 dwNameLength = 8;
651 lError = RegEnumKeyExW(hKey,
652 dwIndex,
653 szName,
654 &dwNameLength,
655 NULL,
656 NULL,
657 NULL,
658 NULL);
659 if (lError != ERROR_SUCCESS)
660 break;
661
662 dwProfileNumber = wcstoul(szName, NULL, 10);
663 DPRINT("Profile name: %S\n", szName);
664 DPRINT("Profile number: %lu\n", dwProfileNumber);
665
666 if ((pProfileData->dwLastProfile == (DWORD)-1) ||
667 (pProfileData->dwLastProfile < dwProfileNumber))
668 pProfileData->dwLastProfile = dwProfileNumber;
669
670 DPRINT("Last Profile number: %lu\n", pProfileData->dwLastProfile);
671
672 GetProfile(hwndDlg, hKey, szName, dwProfileNumber, &pProfileData->pProfiles[dwIndex]);
673 }
674
676
677 return TRUE;
678}
679
680
681static
682BOOL
684{
685 DWORD dwWaitInterval;
686
687 DPRINT("OnInitHardProfDialog()\n");
688
695
696 if (!GetProfiles(hwndDlg))
697 return FALSE;
698
700
701 dwWaitInterval = GetUserWaitInterval();
702 if (dwWaitInterval == (DWORD)-1)
703 {
707 }
708 else
709 {
711 SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETPOS, 0, dwWaitInterval);
712 }
713
714 return TRUE;
715}
716
717
718static
719VOID
720OnOk(HWND hwndDlg)
721{
722 DWORD dwWaitInterval;
723
725 {
726 dwWaitInterval = (DWORD)-1;
727 }
728 else
729 {
730 dwWaitInterval = LOWORD(SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_GETPOS, 0, 0));
731 }
732
733 SetUserWaitInterval(dwWaitInterval);
734}
735
736
737/* Property page dialog callback */
741 UINT uMsg,
744{
745 PPROFILEDATA pProfileData;
746
749 UNREFERENCED_PARAMETER(hwndDlg);
750
751 pProfileData = (PPROFILEDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
752
753 switch (uMsg)
754 {
755 case WM_INITDIALOG:
756 return OnInitHardProfDialog(hwndDlg);
757
758 case WM_DESTROY:
759 if (pProfileData != NULL)
760 {
761 if (pProfileData->pProfiles != NULL)
762 HeapFree(GetProcessHeap(), 0, pProfileData->pProfiles);
763 HeapFree(GetProcessHeap(), 0, pProfileData);
764 }
765 break;
766
767 case WM_COMMAND:
768 switch (LOWORD(wParam))
769 {
770 case IDC_HRDPROFPROP:
771 HardwareProfileProperties(hwndDlg, pProfileData);
772 break;
773
774 case IDC_HRDPROFCOPY:
775 CopyHardwareProfile(hwndDlg, pProfileData);
776 break;
777
779 RenameHardwareProfile(hwndDlg, pProfileData);
780 break;
781
782 case IDC_HRDPROFDEL:
783 DeleteHardwareProfile(hwndDlg, pProfileData);
784 break;
785
786 case IDC_HRDPROFUP:
787 MoveHardwareProfile(hwndDlg, pProfileData, TRUE);
788 break;
789
790 case IDC_HRDPROFDWN:
791 MoveHardwareProfile(hwndDlg, pProfileData, FALSE);
792 break;
793
794 case IDC_HRDPROFWAIT:
796 return TRUE;
797
800 return TRUE;
801
804 {
806 UpdateButtons(hwndDlg, pProfileData);
807 }
808 return TRUE;
809
810 case IDOK:
811 OnOk(hwndDlg);
812
813 case IDCANCEL:
814 EndDialog(hwndDlg, LOWORD(wParam));
815 return TRUE;
816 }
817 break;
818 }
819
820 return FALSE;
821}
VOID ResourceMessageBox(HINSTANCE hInstance, HWND hwnd, UINT uType, UINT uCaptionId, UINT uMessageId)
Definition: misc.c:282
#define DPRINT1
Definition: precomp.h:8
#define RegCloseKey(hKey)
Definition: registry.h:49
WPARAM wParam
Definition: combotst.c:138
LPARAM lParam
Definition: combotst.c:139
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
HINSTANCE hApplet
Definition: access.c:17
#define IDD_HARDWAREPROFILE
Definition: resource.h:204
#define IDC_RENPROFEDITTO
Definition: resource.h:222
#define IDI_HARDPROF
Definition: resource.h:7
#define IDC_HRDPROFDWN
Definition: resource.h:193
#define IDS_HWPROFILE_CONFIRM_DELETE_TITLE
Definition: resource.h:56
#define IDC_HRDPROFCOPY
Definition: resource.h:195
#define IDC_RENPROFEDITFROM
Definition: resource.h:221
#define IDC_HRDPROFRENAME
Definition: resource.h:196
#define IDS_HWPROFILE_WARNING
Definition: resource.h:60
#define IDC_HRDPROFUP
Definition: resource.h:192
#define IDD_RENAMEPROFILE
Definition: resource.h:220
#define IDC_HRDPROFEDIT
Definition: resource.h:200
#define IDD_COPYPROFILE
Definition: resource.h:215
#define IDC_COPYPROFILEFROM
Definition: resource.h:216
#define IDC_COPYPROFILETO
Definition: resource.h:217
#define IDI_DOWN
Definition: resource.h:11
#define IDI_UP
Definition: resource.h:10
#define IDC_HRDPROFSELECT
Definition: resource.h:199
#define IDS_HWPROFILE_ALREADY_IN_USE
Definition: resource.h:58
#define IDC_HRDPROFUPDWN
Definition: resource.h:201
#define IDS_HWPROFILE_PROFILE
Definition: resource.h:59
#define IDC_HRDPROFDEL
Definition: resource.h:197
#define IDC_HRDPROFLSTBOX
Definition: resource.h:191
#define IDC_HRDPROFWAIT
Definition: resource.h:198
#define IDS_HWPROFILE_CONFIRM_DELETE
Definition: resource.h:57
#define IDC_HRDPROFPROP
Definition: resource.h:194
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3362
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:2533
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:4911
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:3691
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4132
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapReAlloc
Definition: compat.h:734
#define HeapFree(x, y, z)
Definition: compat.h:735
#define CALLBACK
Definition: compat.h:35
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define swprintf
Definition: precomp.h:40
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
FxAutoRegKey hKey
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
static BOOL GetProfiles(HWND hwndDlg)
Definition: hardprof.c:608
struct _PROFILENAMES * PPROFILENAMES
static BOOL GetProfileCount(LPDWORD lpProfileCount)
Definition: hardprof.c:526
static VOID HardwareProfileProperties(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:434
static VOID CopyHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:150
static BOOL OnInitHardProfDialog(HWND hwndDlg)
Definition: hardprof.c:683
struct _PROFILENAMES PROFILENAMES
struct _PROFILEDATA * PPROFILEDATA
static VOID OnOk(HWND hwndDlg)
Definition: hardprof.c:720
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: hardprof.c:416
static INT_PTR CALLBACK CopyProfileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:91
static DWORD GetUserWaitInterval(VOID)
Definition: hardprof.c:473
static VOID SetUserWaitInterval(DWORD dwWaitInterval)
Definition: hardprof.c:502
static VOID GetProfile(HWND hwndDlg, HKEY hKey, LPWSTR lpName, DWORD dwProfileNumber, PPROFILE pProfile)
Definition: hardprof.c:555
static VOID MoveHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData, BOOL bMoveUp)
Definition: hardprof.c:363
static VOID DeleteHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:310
struct _PROFILE PROFILE
static INT_PTR CALLBACK RenameProfileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:212
#define PROFILE_NAME_LENGTH
Definition: hardprof.c:14
static INT_PTR CALLBACK HardwareProfilePropertiesDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:395
struct _PROFILE * PPROFILE
INT_PTR CALLBACK HardProfDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:740
static VOID UpdateButtons(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:43
static VOID RenameHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:271
struct _PROFILEDATA PROFILEDATA
static BOOL IsProfileNameInUse(PPROFILENAMES pProfileNames, BOOL bIgnoreCurrent)
Definition: hardprof.c:69
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
static HICON
Definition: imagelist.c:84
HICON hIcon
Definition: msconfig.c:44
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define DWORD
Definition: nt_native.h:44
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:317
#define L(x)
Definition: ntvdm.h:50
#define LOWORD(l)
Definition: pedump.c:82
short SHORT
Definition: pedump.c:59
long LONG
Definition: pedump.c:60
static const WCHAR szName[]
Definition: powrprof.c:45
#define PROPSHEETHEADER
Definition: prsht.h:392
#define PSH_PROPTITLE
Definition: prsht.h:40
#define CreatePropertySheetPage
Definition: prsht.h:399
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSP_DEFAULT
Definition: prsht.h:22
#define PropertySheet
Definition: prsht.h:400
#define PSH_USEICONID
Definition: prsht.h:42
#define PSCB_INITIALIZED
Definition: prsht.h:75
#define PROPSHEETPAGE
Definition: prsht.h:389
#define UDM_SETPOS
Definition: commctrl.h:2143
#define UDM_SETRANGE
Definition: commctrl.h:2141
#define UDM_GETPOS
Definition: commctrl.h:2144
#define REG_DWORD
Definition: sdbapi.c:596
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define DPRINT
Definition: sndvol32.h:71
PPROFILE pProfiles
Definition: hardprof.c:30
DWORD dwLastProfile
Definition: hardprof.c:27
DWORD dwProfileCount
Definition: hardprof.c:26
DWORD dwSelectedProfile
Definition: hardprof.c:28
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
WCHAR szDestinationName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:36
PPROFILEDATA pProfileData
Definition: hardprof.c:37
WCHAR szSourceName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:35
WCHAR szName[5]
Definition: hardprof.c:19
DWORD dwProfileNumber
Definition: hardprof.c:20
DWORD dwPreferenceOrder
Definition: hardprof.c:21
WCHAR szFriendlyName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:18
#define ICON_BIG
Definition: tnclass.cpp:51
#define GetWindowLongPtr
Definition: treelist.c:73
#define SetWindowLongPtr
Definition: treelist.c:70
int32_t INT_PTR
Definition: typedefs.h:64
unsigned char * LPBYTE
Definition: typedefs.h:53
uint32_t * LPDWORD
Definition: typedefs.h:59
#define MAKELONG(a, b)
Definition: typedefs.h:249
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:264
#define HIWORD(l)
Definition: typedefs.h:247
#define ZeroMemory
Definition: winbase.h:1712
_In_ LPCSTR lpName
Definition: winbase.h:2789
#define CopyMemory
Definition: winbase.h:1710
LONG_PTR LPARAM
Definition: windef.h:208
UINT_PTR WPARAM
Definition: windef.h:207
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define DWLP_USER
Definition: winuser.h:872
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define IDCANCEL
Definition: winuser.h:831
#define IMAGE_ICON
Definition: winuser.h:212
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define GetDlgItemText
Definition: winuser.h:5785
#define WM_COMMAND
Definition: winuser.h:1740
#define DialogBoxParam
Definition: winuser.h:5764
#define WM_INITDIALOG
Definition: winuser.h:1739
#define MB_YESNO
Definition: winuser.h:817
#define LB_ADDSTRING
Definition: winuser.h:2031
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define IDOK
Definition: winuser.h:830
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define MB_ICONERROR
Definition: winuser.h:787
#define BM_SETIMAGE
Definition: winuser.h:1922
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
#define LB_DELETESTRING
Definition: winuser.h:2032
#define EM_SETLIMITTEXT
Definition: winuser.h:2011
#define LB_INSERTSTRING
Definition: winuser.h:2053
#define LoadIcon
Definition: winuser.h:5813
#define SendMessage
Definition: winuser.h:5843
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define MB_OK
Definition: winuser.h:790
#define LBN_SELCHANGE
Definition: winuser.h:2075
#define MB_ICONQUESTION
Definition: winuser.h:789
#define WM_DESTROY
Definition: winuser.h:1609
#define LB_SETCURSEL
Definition: winuser.h:2063
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define IDYES
Definition: winuser.h:835
#define LB_GETCURSEL
Definition: winuser.h:2039
#define SendDlgItemMessage
Definition: winuser.h:5842
#define MAKEINTRESOURCE
Definition: winuser.h:591
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
Definition: cursoricon.c:2075
#define SetDlgItemText
Definition: winuser.h:5849
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define BST_CHECKED
Definition: winuser.h:197
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184