ReactOS  0.4.13-dev-544-gede3fdd
hardprof.c File Reference
#include "precomp.h"
#include <debug.h>
Include dependency graph for hardprof.c:

Go to the source code of this file.

Classes

struct  _PROFILE
 
struct  _PROFILEDATA
 
struct  _PROFILENAMES
 

Macros

#define PROFILE_NAME_LENGTH   80
 

Typedefs

typedef struct _PROFILE PROFILE
 
typedef struct _PROFILEPPROFILE
 
typedef struct _PROFILEDATA PROFILEDATA
 
typedef struct _PROFILEDATAPPROFILEDATA
 
typedef struct _PROFILENAMES PROFILENAMES
 
typedef struct _PROFILENAMESPPROFILENAMES
 

Functions

static VOID UpdateButtons (HWND hwndDlg, PPROFILEDATA pProfileData)
 
static BOOL IsProfileNameInUse (PPROFILENAMES pProfileNames, BOOL bIgnoreCurrent)
 
static INT_PTR CALLBACK CopyProfileDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID CopyHardwareProfile (HWND hwndDlg, PPROFILEDATA pProfileData)
 
static INT_PTR CALLBACK RenameProfileDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static VOID RenameHardwareProfile (HWND hwndDlg, PPROFILEDATA pProfileData)
 
static VOID DeleteHardwareProfile (HWND hwndDlg, PPROFILEDATA pProfileData)
 
static VOID MoveHardwareProfile (HWND hwndDlg, PPROFILEDATA pProfileData, BOOL bMoveUp)
 
static INT_PTR CALLBACK HardwareProfilePropertiesDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 
static int CALLBACK PropSheetProc (HWND hwndDlg, UINT uMsg, LPARAM lParam)
 
static VOID HardwareProfileProperties (HWND hwndDlg, PPROFILEDATA pProfileData)
 
static DWORD GetUserWaitInterval (VOID)
 
static VOID SetUserWaitInterval (DWORD dwWaitInterval)
 
static BOOL GetProfileCount (LPDWORD lpProfileCount)
 
static VOID GetProfile (HWND hwndDlg, HKEY hKey, LPWSTR lpName, DWORD dwProfileNumber, PPROFILE pProfile)
 
static BOOL GetProfiles (HWND hwndDlg)
 
static BOOL OnInitHardProfDialog (HWND hwndDlg)
 
static VOID OnOk (HWND hwndDlg)
 
INT_PTR CALLBACK HardProfDlgProc (HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 

Macro Definition Documentation

◆ PROFILE_NAME_LENGTH

#define PROFILE_NAME_LENGTH   80

Definition at line 14 of file hardprof.c.

Typedef Documentation

◆ PPROFILE

◆ PPROFILEDATA

◆ PPROFILENAMES

◆ PROFILE

◆ PROFILEDATA

◆ PROFILENAMES

Function Documentation

◆ CopyHardwareProfile()

static VOID CopyHardwareProfile ( HWND  hwndDlg,
PPROFILEDATA  pProfileData 
)
static

Definition at line 146 of file hardprof.c.

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 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDOK
Definition: winuser.h:824
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
#define IDC_HRDPROFLSTBOX
Definition: resource.h:173
#define LB_ADDSTRING
Definition: winuser.h:1992
WCHAR szSourceName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:35
DWORD dwLastProfile
Definition: hardprof.c:27
static INT_PTR CALLBACK CopyProfileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:91
HINSTANCE hApplet
Definition: access.c:17
#define IDD_COPYPROFILE
Definition: resource.h:197
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
WCHAR szDestinationName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:36
WCHAR szFriendlyName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:18
WCHAR szName[5]
Definition: hardprof.c:19
#define IDS_HWPROFILE_PROFILE
Definition: resource.h:57
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
#define CopyMemory
Definition: winbase.h:1633
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#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)
DWORD dwProfileNumber
Definition: hardprof.c:20
static const WCHAR L[]
Definition: oid.c:1250
DWORD dwPreferenceOrder
Definition: hardprof.c:21
PPROFILE pProfiles
Definition: hardprof.c:30
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
#define HeapReAlloc
Definition: compat.h:393
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DPRINT1
Definition: precomp.h:8
DWORD dwProfileCount
Definition: hardprof.c:26
static VOID UpdateButtons(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:43
PPROFILEDATA pProfileData
Definition: hardprof.c:37

Referenced by HardProfDlgProc().

◆ CopyProfileDlgProc()

static INT_PTR CALLBACK CopyProfileDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 91 of file hardprof.c.

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 }
#define IDS_HWPROFILE_ALREADY_IN_USE
Definition: resource.h:56
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
WCHAR szSourceName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:35
#define EM_SETLIMITTEXT
Definition: winuser.h:1972
HINSTANCE hApplet
Definition: access.c:17
#define PROFILE_NAME_LENGTH
Definition: hardprof.c:14
#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
WCHAR szDestinationName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:36
smooth NULL
Definition: ftsmooth.c:416
#define GetDlgItemText
Definition: winuser.h:5651
VOID ResourceMessageBox(HINSTANCE hInstance, HWND hwnd, UINT uType, UINT uCaptionId, UINT uMessageId)
Definition: misc.c:283
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SetDlgItemText
Definition: winuser.h:5715
#define DWLP_USER
Definition: winuser.h:866
#define MB_ICONERROR
Definition: winuser.h:781
#define WM_COMMAND
Definition: winuser.h:1716
struct _PROFILENAMES * PPROFILENAMES
#define IDC_COPYPROFILEFROM
Definition: resource.h:198
#define MB_OK
Definition: winuser.h:784
static BOOL IsProfileNameInUse(PPROFILENAMES pProfileNames, BOOL bIgnoreCurrent)
Definition: hardprof.c:69
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDS_HWPROFILE_WARNING
Definition: resource.h:58

Referenced by CopyHardwareProfile().

◆ DeleteHardwareProfile()

static VOID DeleteHardwareProfile ( HWND  hwndDlg,
PPROFILEDATA  pProfileData 
)
static

Definition at line 302 of file hardprof.c.

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 }
#define LB_SETCURSEL
Definition: winuser.h:2024
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
#define IDC_HRDPROFLSTBOX
Definition: resource.h:173
#define IDS_HWPROFILE_CONFIRM_DELETE_TITLE
Definition: resource.h:54
#define IDYES
Definition: winuser.h:829
HINSTANCE hApplet
Definition: access.c:17
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define RtlMoveMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define MB_YESNO
Definition: winuser.h:811
WCHAR szFriendlyName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:18
smooth NULL
Definition: ftsmooth.c:416
#define MB_ICONQUESTION
Definition: winuser.h:783
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDS_HWPROFILE_CONFIRM_DELETE
Definition: resource.h:55
#define MessageBox
Definition: winuser.h:5688
PPROFILE pProfiles
Definition: hardprof.c:30
#define HeapReAlloc
Definition: compat.h:393
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
#define DPRINT1
Definition: precomp.h:8
DWORD dwProfileCount
Definition: hardprof.c:26
static VOID UpdateButtons(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:43
#define LB_DELETESTRING
Definition: winuser.h:1993

Referenced by HardProfDlgProc().

◆ GetProfile()

static VOID GetProfile ( HWND  hwndDlg,
HKEY  hKey,
LPWSTR  lpName,
DWORD  dwProfileNumber,
PPROFILE  pProfile 
)
static

Definition at line 550 of file hardprof.c.

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 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define IDC_HRDPROFLSTBOX
Definition: resource.h:173
#define LB_ADDSTRING
Definition: winuser.h:1992
#define KEY_READ
Definition: nt_native.h:1023
_In_ LPCSTR lpName
Definition: winbase.h:2729
#define PROFILE_NAME_LENGTH
Definition: hardprof.c:14
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
WCHAR szFriendlyName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:18
smooth NULL
Definition: ftsmooth.c:416
LONG_PTR LPARAM
Definition: windef.h:208
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
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
DWORD dwProfileNumber
Definition: hardprof.c:20
static const WCHAR L[]
Definition: oid.c:1250
DWORD dwPreferenceOrder
Definition: hardprof.c:21
#define DPRINT1
Definition: precomp.h:8
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

Referenced by GetProfiles().

◆ GetProfileCount()

static BOOL GetProfileCount ( LPDWORD  lpProfileCount)
static

Definition at line 521 of file hardprof.c.

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 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
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
static const WCHAR L[]
Definition: oid.c:1250
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by GetProfiles().

◆ GetProfiles()

static BOOL GetProfiles ( HWND  hwndDlg)
static

Definition at line 603 of file hardprof.c.

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 }
#define TRUE
Definition: types.h:120
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
DWORD dwLastProfile
Definition: hardprof.c:27
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
#define DWORD
Definition: nt_native.h:44
#define SetWindowLongPtr
Definition: treelist.c:70
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
void DPRINT(...)
Definition: polytest.cpp:61
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define DWLP_USER
Definition: winuser.h:866
static VOID GetProfile(HWND hwndDlg, HKEY hKey, LPWSTR lpName, DWORD dwProfileNumber, PPROFILE pProfile)
Definition: hardprof.c:550
PPROFILE pProfiles
Definition: hardprof.c:30
__int3264 LONG_PTR
Definition: mstsclib_h.h:276
#define HEAP_ZERO_MEMORY
Definition: compat.h:123
DWORD dwProfileCount
Definition: hardprof.c:26
static const WCHAR szName[]
Definition: msipriv.h:1194
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
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
static BOOL GetProfileCount(LPDWORD lpProfileCount)
Definition: hardprof.c:521
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by OnInitHardProfDialog().

◆ GetUserWaitInterval()

static DWORD GetUserWaitInterval ( VOID  )
static

Definition at line 468 of file hardprof.c.

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 }
#define DWORD
Definition: nt_native.h:44
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
smooth NULL
Definition: ftsmooth.c:416
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
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by OnInitHardProfDialog().

◆ HardProfDlgProc()

INT_PTR CALLBACK HardProfDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)

Definition at line 735 of file hardprof.c.

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 }
static BOOL OnInitHardProfDialog(HWND hwndDlg)
Definition: hardprof.c:678
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
#define IDC_HRDPROFLSTBOX
Definition: resource.h:173
#define IDC_HRDPROFCOPY
Definition: resource.h:177
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
#define SendDlgItemMessage
Definition: winuser.h:5708
#define LBN_SELCHANGE
Definition: winuser.h:2036
#define DWORD
Definition: nt_native.h:44
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
static VOID OnOk(HWND hwndDlg)
Definition: hardprof.c:715
#define IDC_HRDPROFDEL
Definition: resource.h:179
static VOID RenameHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:263
#define IDC_HRDPROFUP
Definition: resource.h:174
smooth NULL
Definition: ftsmooth.c:416
#define IDC_HRDPROFDWN
Definition: resource.h:175
#define WM_DESTROY
Definition: winuser.h:1591
struct _PROFILEDATA * PPROFILEDATA
#define IDC_HRDPROFSELECT
Definition: resource.h:181
#define GetProcessHeap()
Definition: compat.h:395
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
#define DWLP_USER
Definition: winuser.h:866
#define IDC_HRDPROFWAIT
Definition: resource.h:180
#define WM_COMMAND
Definition: winuser.h:1716
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
static VOID DeleteHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:302
PPROFILE pProfiles
Definition: hardprof.c:30
#define IDC_HRDPROFPROP
Definition: resource.h:176
static VOID CopyHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:146
static VOID HardwareProfileProperties(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:429
#define LB_GETCURSEL
Definition: winuser.h:2000
#define IDC_HRDPROFRENAME
Definition: resource.h:178
#define IDC_HRDPROFEDIT
Definition: resource.h:182
#define HIWORD(l)
Definition: typedefs.h:246
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
static VOID UpdateButtons(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:43
static VOID MoveHardwareProfile(HWND hwndDlg, PPROFILEDATA pProfileData, BOOL bMoveUp)
Definition: hardprof.c:358
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by HardwarePageProc().

◆ HardwareProfileProperties()

static VOID HardwareProfileProperties ( HWND  hwndDlg,
PPROFILEDATA  pProfileData 
)
static

Definition at line 429 of file hardprof.c.

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 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
static INT_PTR CALLBACK HardwareProfilePropertiesDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:390
#define ZeroMemory
Definition: winbase.h:1635
#define IDI_HARDPROF
Definition: resource.h:7
HINSTANCE hApplet
Definition: access.c:17
#define PSH_USECALLBACK
Definition: prsht.h:48
#define PSH_USEICONID
Definition: prsht.h:42
WCHAR szFriendlyName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:18
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
smooth NULL
Definition: ftsmooth.c:416
#define PROPSHEETHEADER
Definition: prsht.h:374
#define IDD_HARDWAREPROFILE
Definition: resource.h:186
#define CreatePropertySheetPage
Definition: prsht.h:381
static int CALLBACK PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
Definition: hardprof.c:411
#define PSP_DEFAULT
Definition: prsht.h:22
#define PSH_PROPTITLE
Definition: prsht.h:40
PPROFILE pProfiles
Definition: hardprof.c:30
#define PropertySheet
Definition: prsht.h:382
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define PROPSHEETPAGE
Definition: prsht.h:371

Referenced by HardProfDlgProc().

◆ HardwareProfilePropertiesDlgProc()

static INT_PTR CALLBACK HardwareProfilePropertiesDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 390 of file hardprof.c.

395 {
396  UNREFERENCED_PARAMETER(hwndDlg);
399 
400  switch (uMsg)
401  {
402  case WM_INITDIALOG:
403  return TRUE;
404 
405  }
406 
407  return FALSE;
408 }
#define TRUE
Definition: types.h:120
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:323
WPARAM wParam
Definition: combotst.c:138
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139

Referenced by HardwareProfileProperties().

◆ IsProfileNameInUse()

static BOOL IsProfileNameInUse ( PPROFILENAMES  pProfileNames,
BOOL  bIgnoreCurrent 
)
static

Definition at line 69 of file hardprof.c.

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 }
#define TRUE
Definition: types.h:120
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
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
WCHAR szFriendlyName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:18
unsigned long DWORD
Definition: ntddk_ex.h:95
PPROFILE pProfiles
Definition: hardprof.c:30
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
DWORD dwProfileCount
Definition: hardprof.c:26
PPROFILEDATA pProfileData
Definition: hardprof.c:37

Referenced by CopyProfileDlgProc(), and RenameProfileDlgProc().

◆ MoveHardwareProfile()

static VOID MoveHardwareProfile ( HWND  hwndDlg,
PPROFILEDATA  pProfileData,
BOOL  bMoveUp 
)
static

Definition at line 358 of file hardprof.c.

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 }
#define LB_SETCURSEL
Definition: winuser.h:2024
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
#define IDC_HRDPROFLSTBOX
Definition: resource.h:173
WCHAR szFriendlyName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:18
LONG_PTR LPARAM
Definition: windef.h:208
#define CopyMemory
Definition: winbase.h:1633
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
PPROFILE pProfiles
Definition: hardprof.c:30
static VOID UpdateButtons(HWND hwndDlg, PPROFILEDATA pProfileData)
Definition: hardprof.c:43
#define LB_DELETESTRING
Definition: winuser.h:1993
#define LB_INSERTSTRING
Definition: winuser.h:2014

Referenced by HardProfDlgProc().

◆ OnInitHardProfDialog()

static BOOL OnInitHardProfDialog ( HWND  hwndDlg)
static

Definition at line 678 of file hardprof.c.

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 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
BOOL WINAPI CheckDlgButton(_In_ HWND, _In_ int, _In_ UINT)
#define TRUE
Definition: types.h:120
#define IMAGE_ICON
Definition: winuser.h:212
static DWORD GetUserWaitInterval(VOID)
Definition: hardprof.c:468
HINSTANCE hApplet
Definition: access.c:17
UINT_PTR WPARAM
Definition: windef.h:207
#define BM_SETIMAGE
Definition: winuser.h:1883
#define IDC_HRDPROFUP
Definition: resource.h:174
short SHORT
Definition: pedump.c:59
#define MAKELONG(a, b)
Definition: typedefs.h:248
LONG_PTR LPARAM
Definition: windef.h:208
void DPRINT(...)
Definition: polytest.cpp:61
#define UDM_SETRANGE
Definition: commctrl.h:2113
#define IDC_HRDPROFDWN
Definition: resource.h:175
#define IDC_HRDPROFSELECT
Definition: resource.h:181
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDI_UP
Definition: resource.h:9
#define IDC_HRDPROFWAIT
Definition: resource.h:180
#define IDC_HRDPROFUPDWN
Definition: resource.h:183
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define UDM_SETPOS
Definition: commctrl.h:2115
#define BST_CHECKED
Definition: winuser.h:197
#define SendMessage
Definition: winuser.h:5709
#define IDI_DOWN
Definition: resource.h:10
static BOOL GetProfiles(HWND hwndDlg)
Definition: hardprof.c:603
#define IDC_HRDPROFEDIT
Definition: resource.h:182
#define LoadIcon
Definition: winuser.h:5679

Referenced by HardProfDlgProc().

◆ OnOk()

static VOID OnOk ( HWND  hwndDlg)
static

Definition at line 715 of file hardprof.c.

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 }
#define UDM_GETPOS
Definition: commctrl.h:2116
#define DWORD
Definition: nt_native.h:44
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define IDC_HRDPROFWAIT
Definition: resource.h:180
#define IDC_HRDPROFUPDWN
Definition: resource.h:183
#define BST_CHECKED
Definition: winuser.h:197
static VOID SetUserWaitInterval(DWORD dwWaitInterval)
Definition: hardprof.c:497
#define LOWORD(l)
Definition: pedump.c:82

Referenced by HardProfDlgProc().

◆ PropSheetProc()

static int CALLBACK PropSheetProc ( HWND  hwndDlg,
UINT  uMsg,
LPARAM  lParam 
)
static

Definition at line 411 of file hardprof.c.

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 }
static HICON
Definition: imagelist.c:84
#define IDI_HARDPROF
Definition: resource.h:7
HINSTANCE hApplet
Definition: access.c:17
LONG_PTR LPARAM
Definition: windef.h:208
#define PSCB_INITIALIZED
Definition: prsht.h:75
HICON hIcon
Definition: msconfig.c:44
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE, _In_ LPCWSTR)
Definition: cursoricon.c:2044
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
#define ICON_BIG
Definition: tnclass.cpp:51

Referenced by HardwareProfileProperties().

◆ RenameHardwareProfile()

static VOID RenameHardwareProfile ( HWND  hwndDlg,
PPROFILEDATA  pProfileData 
)
static

Definition at line 263 of file hardprof.c.

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 }
#define MAKEINTRESOURCE
Definition: winuser.h:591
#define IDOK
Definition: winuser.h:824
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
#define IDC_HRDPROFLSTBOX
Definition: resource.h:173
WCHAR szSourceName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:35
HINSTANCE hApplet
Definition: access.c:17
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
WCHAR szDestinationName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:36
WCHAR szFriendlyName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:18
#define IDS_HWPROFILE_PROFILE
Definition: resource.h:57
LONG_PTR LPARAM
Definition: windef.h:208
#define IDD_RENAMEPROFILE
Definition: resource.h:202
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define swprintf(buf, format,...)
Definition: sprintf.c:56
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#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
PPROFILE pProfiles
Definition: hardprof.c:30
_Check_return_ _CRTIMP int __cdecl wcscmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
DWORD dwProfileCount
Definition: hardprof.c:26
static INT_PTR CALLBACK RenameProfileDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
Definition: hardprof.c:208
#define LB_DELETESTRING
Definition: winuser.h:1993
#define LB_INSERTSTRING
Definition: winuser.h:2014
PPROFILEDATA pProfileData
Definition: hardprof.c:37

Referenced by HardProfDlgProc().

◆ RenameProfileDlgProc()

static INT_PTR CALLBACK RenameProfileDlgProc ( HWND  hwndDlg,
UINT  uMsg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 208 of file hardprof.c.

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 }
#define IDS_HWPROFILE_ALREADY_IN_USE
Definition: resource.h:56
#define TRUE
Definition: types.h:120
#define IDOK
Definition: winuser.h:824
WCHAR szSourceName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:35
#define EM_SETLIMITTEXT
Definition: winuser.h:1972
HINSTANCE hApplet
Definition: access.c:17
#define PROFILE_NAME_LENGTH
Definition: hardprof.c:14
#define SetWindowLongPtr
Definition: treelist.c:70
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
WPARAM wParam
Definition: combotst.c:138
#define IDC_RENPROFEDITFROM
Definition: resource.h:203
WCHAR szDestinationName[PROFILE_NAME_LENGTH]
Definition: hardprof.c:36
smooth NULL
Definition: ftsmooth.c:416
#define GetDlgItemText
Definition: winuser.h:5651
VOID ResourceMessageBox(HINSTANCE hInstance, HWND hwnd, UINT uType, UINT uCaptionId, UINT uMessageId)
Definition: misc.c:283
LRESULT WINAPI SendDlgItemMessageW(_In_ HWND, _In_ int, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
#define SetDlgItemText
Definition: winuser.h:5715
#define DWLP_USER
Definition: winuser.h:866
#define MB_ICONERROR
Definition: winuser.h:781
#define WM_COMMAND
Definition: winuser.h:1716
struct _PROFILENAMES * PPROFILENAMES
#define MB_OK
Definition: winuser.h:784
static BOOL IsProfileNameInUse(PPROFILENAMES pProfileNames, BOOL bIgnoreCurrent)
Definition: hardprof.c:69
#define IDC_RENPROFEDITTO
Definition: resource.h:204
#define GetWindowLongPtr
Definition: treelist.c:73
#define IDCANCEL
Definition: winuser.h:825
#define WM_INITDIALOG
Definition: winuser.h:1715
LPARAM lParam
Definition: combotst.c:139
#define LOWORD(l)
Definition: pedump.c:82
#define IDS_HWPROFILE_WARNING
Definition: resource.h:58

Referenced by RenameHardwareProfile().

◆ SetUserWaitInterval()

static VOID SetUserWaitInterval ( DWORD  dwWaitInterval)
static

Definition at line 497 of file hardprof.c.

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 }
#define KEY_SET_VALUE
Definition: nt_native.h:1017
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
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
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define REG_DWORD
Definition: sdbapi.c:596
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by OnOk().

◆ UpdateButtons()

static VOID UpdateButtons ( HWND  hwndDlg,
PPROFILEDATA  pProfileData 
)
static

Definition at line 43 of file hardprof.c.

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 }
#define TRUE
Definition: types.h:120
DWORD dwSelectedProfileIndex
Definition: hardprof.c:29
#define IDC_HRDPROFCOPY
Definition: resource.h:177
#define IDC_HRDPROFDEL
Definition: resource.h:179
#define IDC_HRDPROFUP
Definition: resource.h:174
#define IDC_HRDPROFDWN
Definition: resource.h:175
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define IDC_HRDPROFPROP
Definition: resource.h:176
#define IDC_HRDPROFRENAME
Definition: resource.h:178
DWORD dwProfileCount
Definition: hardprof.c:26

Referenced by CopyHardwareProfile(), DeleteHardwareProfile(), HardProfDlgProc(), and MoveHardwareProfile().