2006-11-08 11:47:44 +00:00
|
|
|
/*
|
|
|
|
* PROJECT: ReactOS System Control Panel Applet
|
|
|
|
* LICENSE: GPL - See COPYING in the top level directory
|
|
|
|
* FILE: dll/cpl/sysdm/hardprof.c
|
|
|
|
* PURPOSE: Modify hardware profiles
|
|
|
|
* COPYRIGHT: Copyright 2006 Ged Murphy <gedmurphy@gmail.com>
|
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "precomp.h"
|
2014-01-19 10:39:14 +00:00
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
#include <debug.h>
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2015-05-18 20:29:14 +00:00
|
|
|
#define PROFILE_NAME_LENGTH 80
|
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
typedef struct _PROFILE
|
|
|
|
{
|
2015-05-18 20:29:14 +00:00
|
|
|
WCHAR szFriendlyName[PROFILE_NAME_LENGTH];
|
2015-05-17 16:11:15 +00:00
|
|
|
WCHAR szName[5];
|
|
|
|
DWORD dwProfileNumber;
|
|
|
|
DWORD dwPreferenceOrder;
|
2011-11-19 19:10:18 +00:00
|
|
|
} PROFILE, *PPROFILE;
|
|
|
|
|
|
|
|
typedef struct _PROFILEDATA
|
|
|
|
{
|
|
|
|
DWORD dwProfileCount;
|
2015-05-17 16:11:15 +00:00
|
|
|
DWORD dwLastProfile;
|
|
|
|
DWORD dwSelectedProfile;
|
|
|
|
DWORD dwSelectedProfileIndex;
|
2011-11-19 19:10:18 +00:00
|
|
|
PPROFILE pProfiles;
|
|
|
|
} PROFILEDATA, *PPROFILEDATA;
|
|
|
|
|
2015-05-24 20:20:04 +00:00
|
|
|
typedef struct _PROFILENAMES
|
2015-05-17 16:11:15 +00:00
|
|
|
{
|
2015-05-24 20:20:04 +00:00
|
|
|
WCHAR szSourceName[PROFILE_NAME_LENGTH];
|
|
|
|
WCHAR szDestinationName[PROFILE_NAME_LENGTH];
|
2015-05-24 22:51:12 +00:00
|
|
|
PPROFILEDATA pProfileData;
|
2015-05-24 20:20:04 +00:00
|
|
|
} PROFILENAMES, *PPROFILENAMES;
|
2015-05-17 16:11:15 +00:00
|
|
|
|
|
|
|
|
2015-05-25 12:23:12 +00:00
|
|
|
static
|
|
|
|
VOID
|
|
|
|
UpdateButtons(
|
|
|
|
HWND hwndDlg,
|
|
|
|
PPROFILEDATA pProfileData)
|
|
|
|
{
|
2015-05-25 22:02:05 +00:00
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFPROP), (pProfileData->dwSelectedProfileIndex != (DWORD)-1) ? TRUE : FALSE);
|
2015-05-25 12:23:12 +00:00
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFCOPY), (pProfileData->dwSelectedProfileIndex != (DWORD)-1) ? TRUE : FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFRENAME), (pProfileData->dwSelectedProfileIndex != (DWORD)-1) ? TRUE : FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFDEL), (pProfileData->dwSelectedProfileIndex != (DWORD)-1) ? TRUE : FALSE);
|
|
|
|
|
|
|
|
if (pProfileData->dwProfileCount < 2)
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFUP), FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFDWN), FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFUP),
|
|
|
|
(pProfileData->dwSelectedProfileIndex > 0) ? TRUE : FALSE);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFDWN),
|
|
|
|
(pProfileData->dwSelectedProfileIndex < pProfileData->dwProfileCount - 1) ? TRUE : FALSE);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-24 22:51:12 +00:00
|
|
|
static
|
|
|
|
BOOL
|
|
|
|
IsProfileNameInUse(
|
|
|
|
PPROFILENAMES pProfileNames,
|
|
|
|
BOOL bIgnoreCurrent)
|
|
|
|
{
|
|
|
|
DWORD i;
|
|
|
|
|
|
|
|
for (i = 0; i < pProfileNames->pProfileData->dwProfileCount; i++)
|
|
|
|
{
|
|
|
|
if (bIgnoreCurrent == TRUE && i == pProfileNames->pProfileData->dwSelectedProfileIndex)
|
|
|
|
continue;
|
|
|
|
|
|
|
|
if (wcscmp(pProfileNames->pProfileData->pProfiles[i].szFriendlyName, pProfileNames->szDestinationName) == 0)
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
static
|
|
|
|
INT_PTR
|
|
|
|
CALLBACK
|
2015-05-24 22:51:12 +00:00
|
|
|
CopyProfileDlgProc(
|
|
|
|
HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
2011-11-19 19:10:18 +00:00
|
|
|
{
|
2015-05-24 20:20:04 +00:00
|
|
|
PPROFILENAMES pProfileNames;
|
2015-05-17 16:11:15 +00:00
|
|
|
|
2015-05-24 20:20:04 +00:00
|
|
|
pProfileNames = (PPROFILENAMES)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
2011-11-19 19:10:18 +00:00
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
2015-05-17 16:11:15 +00:00
|
|
|
case WM_INITDIALOG:
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, lParam);
|
2015-05-24 20:20:04 +00:00
|
|
|
pProfileNames = (PPROFILENAMES)lParam;
|
|
|
|
|
|
|
|
/* Set the old name */
|
|
|
|
SetDlgItemText(hwndDlg, IDC_COPYPROFILEFROM, pProfileNames->szSourceName);
|
|
|
|
|
|
|
|
/* Set the new name */
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_COPYPROFILETO, EM_SETLIMITTEXT, PROFILE_NAME_LENGTH - 1, 0);
|
|
|
|
SetDlgItemText(hwndDlg, IDC_COPYPROFILETO, pProfileNames->szDestinationName);
|
2015-05-17 16:11:15 +00:00
|
|
|
break;
|
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
case WM_COMMAND:
|
2015-05-17 16:11:15 +00:00
|
|
|
switch (LOWORD(wParam))
|
2011-11-19 19:10:18 +00:00
|
|
|
{
|
2015-05-17 16:11:15 +00:00
|
|
|
case IDOK:
|
2015-05-24 20:20:04 +00:00
|
|
|
GetDlgItemText(hwndDlg,
|
|
|
|
IDC_COPYPROFILETO,
|
|
|
|
pProfileNames->szDestinationName,
|
|
|
|
PROFILE_NAME_LENGTH);
|
2015-05-24 22:51:12 +00:00
|
|
|
if (IsProfileNameInUse(pProfileNames, FALSE))
|
2022-11-03 00:00:32 +00:00
|
|
|
{
|
2015-05-24 22:51:12 +00:00
|
|
|
ResourceMessageBox(hApplet,
|
2022-11-03 00:00:32 +00:00
|
|
|
hwndDlg,
|
2015-05-24 22:51:12 +00:00
|
|
|
MB_OK | MB_ICONERROR,
|
|
|
|
IDS_HWPROFILE_WARNING,
|
|
|
|
IDS_HWPROFILE_ALREADY_IN_USE);
|
2022-11-03 00:00:32 +00:00
|
|
|
}
|
2015-05-24 22:51:12 +00:00
|
|
|
else
|
2022-11-03 00:00:32 +00:00
|
|
|
{
|
2015-05-24 22:51:12 +00:00
|
|
|
EndDialog(hwndDlg, IDOK);
|
2022-11-03 00:00:32 +00:00
|
|
|
}
|
2015-05-17 16:11:15 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hwndDlg, IDCANCEL);
|
2015-05-24 20:20:04 +00:00
|
|
|
return TRUE;
|
2011-11-19 19:10:18 +00:00
|
|
|
}
|
|
|
|
break;
|
|
|
|
}
|
2015-05-24 20:20:04 +00:00
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-17 16:11:15 +00:00
|
|
|
static
|
|
|
|
VOID
|
2015-05-24 20:20:04 +00:00
|
|
|
CopyHardwareProfile(
|
2015-05-17 16:11:15 +00:00
|
|
|
HWND hwndDlg,
|
|
|
|
PPROFILEDATA pProfileData)
|
|
|
|
{
|
2015-05-24 20:20:04 +00:00
|
|
|
PROFILENAMES ProfileNames;
|
|
|
|
PPROFILE pProfile, pNewProfiles, pNewProfile;
|
|
|
|
WCHAR szBuffer[80];
|
2015-05-17 16:11:15 +00:00
|
|
|
|
|
|
|
pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
|
|
|
|
|
2015-05-24 20:20:04 +00:00
|
|
|
LoadStringW(hApplet, IDS_HWPROFILE_PROFILE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
|
|
|
|
|
|
|
|
wcscpy(ProfileNames.szSourceName, pProfile->szFriendlyName);
|
|
|
|
swprintf(ProfileNames.szDestinationName, L"%s %lu", szBuffer, pProfileData->dwProfileCount);
|
|
|
|
|
2015-05-24 22:51:12 +00:00
|
|
|
ProfileNames.pProfileData = pProfileData;
|
|
|
|
|
2015-05-24 20:20:04 +00:00
|
|
|
if (DialogBoxParam(hApplet,
|
|
|
|
MAKEINTRESOURCE(IDD_COPYPROFILE),
|
|
|
|
hwndDlg,
|
2017-10-30 23:37:37 +00:00
|
|
|
CopyProfileDlgProc,
|
2015-05-24 20:20:04 +00:00
|
|
|
(LPARAM)&ProfileNames) != IDOK)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Apply new name only if it has been changed */
|
|
|
|
if (wcscmp(ProfileNames.szSourceName, ProfileNames.szDestinationName) == 0)
|
|
|
|
return;
|
2015-05-17 16:11:15 +00:00
|
|
|
|
2015-05-24 20:20:04 +00:00
|
|
|
/* Allocate memory for the new profile */
|
|
|
|
pNewProfiles = HeapReAlloc(GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
pProfileData->pProfiles,
|
|
|
|
(pProfileData->dwProfileCount + 1) * sizeof(PROFILE));
|
|
|
|
if (pNewProfiles == NULL)
|
|
|
|
{
|
|
|
|
DPRINT1("HeapReAlloc() failed!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pProfileData->dwProfileCount++;
|
|
|
|
pProfileData->pProfiles = pNewProfiles;
|
|
|
|
|
|
|
|
pNewProfile = &pProfileData->pProfiles[pProfileData->dwProfileCount - 1];
|
|
|
|
|
|
|
|
CopyMemory(pNewProfile, pProfile, sizeof(PROFILE));
|
|
|
|
|
|
|
|
wcscpy(pNewProfile->szFriendlyName, ProfileNames.szDestinationName);
|
|
|
|
|
|
|
|
pNewProfile->dwProfileNumber = ++pProfileData->dwLastProfile;
|
|
|
|
swprintf(pNewProfile->szName, L"%04lu", pNewProfile->dwProfileNumber);
|
|
|
|
|
|
|
|
pNewProfile->dwPreferenceOrder = pNewProfile->dwProfileNumber;
|
|
|
|
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_ADDSTRING, 0, (LPARAM)pNewProfile->szFriendlyName);
|
2015-05-25 12:23:12 +00:00
|
|
|
|
|
|
|
UpdateButtons(hwndDlg, pProfileData);
|
2015-05-17 16:11:15 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
static
|
|
|
|
INT_PTR
|
|
|
|
CALLBACK
|
2015-05-24 22:51:12 +00:00
|
|
|
RenameProfileDlgProc(
|
|
|
|
HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
2006-11-08 11:47:44 +00:00
|
|
|
{
|
2015-05-24 20:20:04 +00:00
|
|
|
PPROFILENAMES pProfileNames;
|
2015-05-17 16:11:15 +00:00
|
|
|
|
2015-05-24 20:20:04 +00:00
|
|
|
pProfileNames = (PPROFILENAMES)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
2007-11-03 14:39:08 +00:00
|
|
|
|
|
|
|
switch (uMsg)
|
2007-07-23 16:32:04 +00:00
|
|
|
{
|
2015-05-17 16:11:15 +00:00
|
|
|
case WM_INITDIALOG:
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, lParam);
|
2015-05-24 20:20:04 +00:00
|
|
|
pProfileNames = (PPROFILENAMES)lParam;
|
|
|
|
|
|
|
|
/* Set the old name */
|
|
|
|
SetDlgItemText(hwndDlg, IDC_RENPROFEDITFROM, pProfileNames->szSourceName);
|
|
|
|
|
|
|
|
/* Set the new name */
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_RENPROFEDITTO, EM_SETLIMITTEXT, PROFILE_NAME_LENGTH - 1, 0);
|
|
|
|
SetDlgItemText(hwndDlg, IDC_RENPROFEDITTO, pProfileNames->szDestinationName);
|
2015-05-17 16:11:15 +00:00
|
|
|
break;
|
|
|
|
|
2007-07-23 16:32:04 +00:00
|
|
|
case WM_COMMAND:
|
2015-05-17 16:11:15 +00:00
|
|
|
switch (LOWORD(wParam))
|
2007-07-23 16:32:04 +00:00
|
|
|
{
|
2015-05-17 16:11:15 +00:00
|
|
|
case IDOK:
|
2015-05-24 20:20:04 +00:00
|
|
|
GetDlgItemText(hwndDlg,
|
|
|
|
IDC_RENPROFEDITTO,
|
|
|
|
pProfileNames->szDestinationName,
|
|
|
|
PROFILE_NAME_LENGTH);
|
2015-05-24 22:51:12 +00:00
|
|
|
if (IsProfileNameInUse(pProfileNames, TRUE))
|
2022-11-03 00:00:32 +00:00
|
|
|
{
|
2015-05-24 22:51:12 +00:00
|
|
|
ResourceMessageBox(hApplet,
|
2022-11-03 00:00:32 +00:00
|
|
|
hwndDlg,
|
2015-05-24 22:51:12 +00:00
|
|
|
MB_OK | MB_ICONERROR,
|
|
|
|
IDS_HWPROFILE_WARNING,
|
|
|
|
IDS_HWPROFILE_ALREADY_IN_USE);
|
2022-11-03 00:00:32 +00:00
|
|
|
}
|
2015-05-24 22:51:12 +00:00
|
|
|
else
|
2022-11-03 00:00:32 +00:00
|
|
|
{
|
2015-05-24 22:51:12 +00:00
|
|
|
EndDialog(hwndDlg, IDOK);
|
2022-11-03 00:00:32 +00:00
|
|
|
}
|
2015-05-17 16:11:15 +00:00
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case IDCANCEL:
|
|
|
|
EndDialog(hwndDlg, IDCANCEL);
|
2015-05-24 20:20:04 +00:00
|
|
|
return TRUE;
|
2007-07-23 16:32:04 +00:00
|
|
|
}
|
2007-11-03 14:39:08 +00:00
|
|
|
break;
|
2007-07-23 16:32:04 +00:00
|
|
|
}
|
2015-05-17 16:11:15 +00:00
|
|
|
|
2007-07-23 16:32:04 +00:00
|
|
|
return FALSE;
|
2006-11-08 11:47:44 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-21 21:47:57 +00:00
|
|
|
static
|
|
|
|
VOID
|
2015-05-24 20:20:04 +00:00
|
|
|
RenameHardwareProfile(
|
|
|
|
HWND hwndDlg,
|
|
|
|
PPROFILEDATA pProfileData)
|
|
|
|
{
|
|
|
|
PROFILENAMES ProfileNames;
|
|
|
|
PPROFILE pProfile;
|
|
|
|
WCHAR szBuffer[80];
|
|
|
|
|
|
|
|
pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
|
|
|
|
|
|
|
|
LoadStringW(hApplet, IDS_HWPROFILE_PROFILE, szBuffer, sizeof(szBuffer) / sizeof(WCHAR));
|
|
|
|
|
|
|
|
wcscpy(ProfileNames.szSourceName, pProfile->szFriendlyName);
|
|
|
|
swprintf(ProfileNames.szDestinationName, L"%s %lu", szBuffer, pProfileData->dwProfileCount);
|
|
|
|
|
2015-05-24 22:51:12 +00:00
|
|
|
ProfileNames.pProfileData = pProfileData;
|
|
|
|
|
2015-05-24 20:20:04 +00:00
|
|
|
if (DialogBoxParam(hApplet,
|
|
|
|
MAKEINTRESOURCE(IDD_RENAMEPROFILE),
|
|
|
|
hwndDlg,
|
2017-10-30 23:37:37 +00:00
|
|
|
RenameProfileDlgProc,
|
2015-05-24 20:20:04 +00:00
|
|
|
(LPARAM)&ProfileNames) != IDOK)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Apply new name only if it has been changed */
|
|
|
|
if (wcscmp(pProfile->szFriendlyName, ProfileNames.szDestinationName) == 0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Replace the profile name in the profile list */
|
|
|
|
wcscpy(pProfile->szFriendlyName, ProfileNames.szDestinationName);
|
|
|
|
|
|
|
|
/* Replace the profile name in the listbox */
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_DELETESTRING, pProfileData->dwSelectedProfileIndex, 0);
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_INSERTSTRING, pProfileData->dwSelectedProfileIndex, (LPARAM)pProfile->szFriendlyName);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
VOID
|
|
|
|
DeleteHardwareProfile(
|
|
|
|
HWND hwndDlg,
|
|
|
|
PPROFILEDATA pProfileData)
|
2015-05-21 21:47:57 +00:00
|
|
|
{
|
|
|
|
PPROFILE pProfiles;
|
|
|
|
PPROFILE pProfile;
|
|
|
|
|
|
|
|
pProfile = &pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex];
|
|
|
|
|
2022-11-03 00:00:32 +00:00
|
|
|
if (ResourceMessageBox(hApplet,
|
|
|
|
hwndDlg,
|
|
|
|
MB_YESNO | MB_ICONQUESTION,
|
|
|
|
IDS_HWPROFILE_CONFIRM_DELETE_TITLE,
|
|
|
|
IDS_HWPROFILE_CONFIRM_DELETE,
|
|
|
|
pProfile->szFriendlyName) != IDYES)
|
|
|
|
{
|
2015-05-24 22:51:12 +00:00
|
|
|
return;
|
2022-11-03 00:00:32 +00:00
|
|
|
}
|
2015-05-24 22:51:12 +00:00
|
|
|
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_DELETESTRING, pProfileData->dwSelectedProfileIndex, 0);
|
|
|
|
|
|
|
|
if (pProfileData->dwSelectedProfileIndex != pProfileData->dwProfileCount - 1)
|
|
|
|
{
|
|
|
|
RtlMoveMemory(&pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex],
|
|
|
|
&pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex + 1],
|
2017-02-04 17:27:49 +00:00
|
|
|
(pProfileData->dwProfileCount - pProfileData->dwSelectedProfileIndex - 1) * sizeof(PROFILE));
|
2015-05-24 22:51:12 +00:00
|
|
|
}
|
|
|
|
else
|
2015-05-21 21:47:57 +00:00
|
|
|
{
|
2015-05-24 22:51:12 +00:00
|
|
|
pProfileData->dwSelectedProfileIndex--;
|
2015-05-21 21:47:57 +00:00
|
|
|
}
|
2015-05-24 22:51:12 +00:00
|
|
|
|
|
|
|
pProfiles = HeapReAlloc(GetProcessHeap(),
|
|
|
|
HEAP_ZERO_MEMORY,
|
|
|
|
pProfileData->pProfiles,
|
|
|
|
(pProfileData->dwProfileCount - 1) * sizeof(PROFILE));
|
|
|
|
if (pProfiles == NULL)
|
|
|
|
{
|
|
|
|
DPRINT1("HeapReAlloc() failed!\n");
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
pProfileData->dwProfileCount--;
|
|
|
|
pProfileData->pProfiles = pProfiles;
|
|
|
|
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_SETCURSEL, pProfileData->dwSelectedProfileIndex, 0);
|
2015-05-25 12:23:12 +00:00
|
|
|
|
|
|
|
UpdateButtons(hwndDlg, pProfileData);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
VOID
|
|
|
|
MoveHardwareProfile(
|
|
|
|
HWND hwndDlg,
|
|
|
|
PPROFILEDATA pProfileData,
|
|
|
|
BOOL bMoveUp)
|
|
|
|
{
|
|
|
|
PROFILE TempProfile;
|
|
|
|
PPROFILE pSrcProfile, pDstProfile;
|
|
|
|
DWORD dwSrcIndex, dwDstIndex;
|
|
|
|
|
|
|
|
dwSrcIndex = pProfileData->dwSelectedProfileIndex;
|
|
|
|
dwDstIndex = bMoveUp ? (dwSrcIndex - 1) : (dwSrcIndex + 1);
|
|
|
|
|
|
|
|
pSrcProfile = &pProfileData->pProfiles[dwSrcIndex];
|
|
|
|
pDstProfile = &pProfileData->pProfiles[dwDstIndex];
|
|
|
|
|
|
|
|
CopyMemory(&TempProfile, pDstProfile, sizeof(PROFILE));
|
|
|
|
CopyMemory(pDstProfile, pSrcProfile, sizeof(PROFILE));
|
|
|
|
CopyMemory(pSrcProfile, &TempProfile, sizeof(PROFILE));
|
|
|
|
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_DELETESTRING, dwSrcIndex, 0);
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_INSERTSTRING, dwDstIndex, (LPARAM)pDstProfile->szFriendlyName);
|
|
|
|
|
|
|
|
pProfileData->dwSelectedProfileIndex = dwDstIndex;
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_SETCURSEL, pProfileData->dwSelectedProfileIndex, 0);
|
|
|
|
|
|
|
|
UpdateButtons(hwndDlg, pProfileData);
|
2015-05-21 21:47:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2015-05-25 22:02:05 +00:00
|
|
|
static
|
|
|
|
INT_PTR
|
|
|
|
CALLBACK
|
|
|
|
HardwareProfilePropertiesDlgProc(
|
|
|
|
HWND hwndDlg,
|
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
|
|
|
{
|
|
|
|
UNREFERENCED_PARAMETER(hwndDlg);
|
|
|
|
UNREFERENCED_PARAMETER(lParam);
|
|
|
|
UNREFERENCED_PARAMETER(wParam);
|
|
|
|
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
2018-12-15 23:40:47 +00:00
|
|
|
static int CALLBACK
|
|
|
|
PropSheetProc(HWND hwndDlg, UINT uMsg, LPARAM lParam)
|
|
|
|
{
|
|
|
|
// NOTE: This callback is needed to set large icon correctly.
|
|
|
|
HICON hIcon;
|
|
|
|
switch (uMsg)
|
|
|
|
{
|
|
|
|
case PSCB_INITIALIZED:
|
|
|
|
{
|
|
|
|
hIcon = LoadIconW(hApplet, MAKEINTRESOURCEW(IDI_HARDPROF));
|
|
|
|
SendMessageW(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)hIcon);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
2015-05-25 22:02:05 +00:00
|
|
|
|
|
|
|
static
|
|
|
|
VOID
|
|
|
|
HardwareProfileProperties(
|
|
|
|
HWND hwndDlg,
|
|
|
|
PPROFILEDATA pProfileData)
|
|
|
|
{
|
|
|
|
HPROPSHEETPAGE hpsp;
|
|
|
|
PROPSHEETHEADER psh;
|
|
|
|
PROPSHEETPAGE psp;
|
|
|
|
|
|
|
|
ZeroMemory(&psp, sizeof(psp));
|
|
|
|
psp.dwSize = sizeof(psp);
|
|
|
|
psp.dwFlags = PSP_DEFAULT;
|
|
|
|
psp.hInstance = hApplet;
|
|
|
|
psp.pszTemplate = MAKEINTRESOURCE(IDD_HARDWAREPROFILE);
|
|
|
|
psp.pfnDlgProc = HardwareProfilePropertiesDlgProc;
|
|
|
|
|
|
|
|
hpsp = CreatePropertySheetPage(&psp);
|
|
|
|
if (hpsp == NULL)
|
|
|
|
{
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
ZeroMemory(&psh, sizeof(PROPSHEETHEADER));
|
|
|
|
psh.dwSize = sizeof(PROPSHEETHEADER);
|
2018-12-15 23:40:47 +00:00
|
|
|
psh.dwFlags = PSH_PROPTITLE | PSH_USEICONID | PSH_USECALLBACK;
|
2015-05-25 22:02:05 +00:00
|
|
|
psh.hwndParent = hwndDlg;
|
|
|
|
psh.hInstance = hApplet;
|
2018-12-15 23:40:47 +00:00
|
|
|
psh.pszIcon = MAKEINTRESOURCEW(IDI_HARDPROF);
|
2015-09-16 20:56:14 +00:00
|
|
|
psh.pszCaption = pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex].szFriendlyName;
|
2015-05-25 22:02:05 +00:00
|
|
|
psh.nPages = 1;
|
|
|
|
psh.nStartPage = 0;
|
|
|
|
psh.phpage = &hpsp;
|
2018-12-15 23:40:47 +00:00
|
|
|
psh.pfnCallback = PropSheetProc;
|
2015-05-25 22:02:05 +00:00
|
|
|
|
|
|
|
PropertySheet(&psh);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-01 17:47:18 +00:00
|
|
|
static
|
|
|
|
DWORD
|
|
|
|
GetUserWaitInterval(VOID)
|
|
|
|
{
|
|
|
|
DWORD dwWaitInterval = 30;
|
|
|
|
DWORD dwSize;
|
|
|
|
HKEY hKey;
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"System\\CurrentControlSet\\Control\\IDConfigDB",
|
|
|
|
0,
|
|
|
|
KEY_QUERY_VALUE,
|
|
|
|
&hKey))
|
|
|
|
return dwWaitInterval;
|
|
|
|
|
|
|
|
dwSize = sizeof(DWORD);
|
|
|
|
RegQueryValueExW(hKey,
|
|
|
|
L"UserWaitInterval",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
(LPBYTE)&dwWaitInterval,
|
|
|
|
&dwSize);
|
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
|
|
|
return dwWaitInterval;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
VOID
|
|
|
|
SetUserWaitInterval(DWORD dwWaitInterval)
|
|
|
|
{
|
|
|
|
HKEY hKey;
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"System\\CurrentControlSet\\Control\\IDConfigDB",
|
|
|
|
0,
|
|
|
|
KEY_SET_VALUE,
|
|
|
|
&hKey))
|
|
|
|
return;
|
|
|
|
|
|
|
|
RegSetValueExW(hKey,
|
|
|
|
L"UserWaitInterval",
|
|
|
|
0,
|
|
|
|
REG_DWORD,
|
|
|
|
(LPBYTE)&dwWaitInterval,
|
|
|
|
sizeof(DWORD));
|
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
static
|
|
|
|
BOOL
|
|
|
|
GetProfileCount(LPDWORD lpProfileCount)
|
|
|
|
{
|
|
|
|
HKEY hKey;
|
|
|
|
LONG lError;
|
|
|
|
|
|
|
|
*lpProfileCount = 0;
|
|
|
|
|
|
|
|
lError = RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"System\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles",
|
|
|
|
0,
|
|
|
|
KEY_READ,
|
|
|
|
&hKey);
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
lError = RegQueryInfoKeyW(hKey, NULL, NULL, NULL, lpProfileCount,
|
|
|
|
NULL, NULL, NULL, NULL, NULL, NULL, NULL);
|
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2011-11-01 17:47:18 +00:00
|
|
|
static
|
|
|
|
VOID
|
2015-05-17 16:11:15 +00:00
|
|
|
GetProfile(
|
|
|
|
HWND hwndDlg,
|
|
|
|
HKEY hKey,
|
|
|
|
LPWSTR lpName,
|
|
|
|
DWORD dwProfileNumber,
|
|
|
|
PPROFILE pProfile)
|
2011-11-19 19:10:18 +00:00
|
|
|
{
|
|
|
|
HKEY hProfileKey;
|
|
|
|
DWORD dwSize;
|
|
|
|
LONG lError;
|
|
|
|
|
|
|
|
lError = RegOpenKeyExW(hKey,
|
|
|
|
lpName,
|
|
|
|
0,
|
|
|
|
KEY_READ,
|
|
|
|
&hProfileKey);
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
return;
|
|
|
|
|
2015-05-18 20:29:14 +00:00
|
|
|
dwSize = PROFILE_NAME_LENGTH * sizeof(WCHAR);
|
2011-11-19 19:10:18 +00:00
|
|
|
lError = RegQueryValueExW(hProfileKey,
|
|
|
|
L"FriendlyName",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
(LPBYTE)pProfile->szFriendlyName,
|
|
|
|
&dwSize);
|
|
|
|
if (lError == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("Profile: %S\n", pProfile->szFriendlyName);
|
|
|
|
}
|
|
|
|
|
2015-05-17 16:11:15 +00:00
|
|
|
dwSize = sizeof(DWORD);
|
|
|
|
lError = RegQueryValueExW(hProfileKey,
|
|
|
|
L"PreferenceOrder",
|
|
|
|
NULL,
|
|
|
|
NULL,
|
2018-04-23 09:42:32 +00:00
|
|
|
(LPBYTE)&pProfile->dwPreferenceOrder,
|
2015-05-17 16:11:15 +00:00
|
|
|
&dwSize);
|
|
|
|
if (lError == ERROR_SUCCESS)
|
|
|
|
{
|
|
|
|
DPRINT1("PreferenceOrder: %lu\n", pProfile->dwPreferenceOrder);
|
|
|
|
}
|
|
|
|
|
|
|
|
pProfile->dwProfileNumber = dwProfileNumber;
|
|
|
|
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFLSTBOX, LB_ADDSTRING, 0, (LPARAM)pProfile->szFriendlyName);
|
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
RegCloseKey(hProfileKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
BOOL
|
|
|
|
GetProfiles(HWND hwndDlg)
|
|
|
|
{
|
|
|
|
PPROFILEDATA pProfileData;
|
|
|
|
WCHAR szName[8];
|
|
|
|
DWORD dwNameLength;
|
2015-05-17 16:11:15 +00:00
|
|
|
DWORD dwProfileNumber;
|
2011-11-19 19:10:18 +00:00
|
|
|
DWORD dwIndex = 0;
|
|
|
|
HKEY hKey;
|
|
|
|
LONG lError;
|
|
|
|
|
|
|
|
pProfileData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(PROFILEDATA));
|
|
|
|
if (pProfileData == NULL)
|
|
|
|
return FALSE;
|
|
|
|
|
2015-05-17 16:11:15 +00:00
|
|
|
pProfileData->dwLastProfile = (DWORD)-1;
|
|
|
|
pProfileData->dwSelectedProfileIndex = (DWORD)-1;
|
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
if (!GetProfileCount(&pProfileData->dwProfileCount))
|
2011-12-29 13:20:18 +00:00
|
|
|
{
|
2011-12-29 13:25:08 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, pProfileData);
|
2011-11-19 19:10:18 +00:00
|
|
|
return FALSE;
|
2011-12-29 13:20:18 +00:00
|
|
|
}
|
2011-11-19 19:10:18 +00:00
|
|
|
|
|
|
|
pProfileData->pProfiles = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
|
|
|
|
pProfileData->dwProfileCount * sizeof(PROFILE));
|
|
|
|
if (pProfileData->pProfiles == NULL)
|
|
|
|
{
|
2011-12-29 13:25:08 +00:00
|
|
|
HeapFree(GetProcessHeap(), 0, pProfileData);
|
2011-11-19 19:10:18 +00:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
SetWindowLongPtr(hwndDlg, DWLP_USER, (LONG_PTR)pProfileData);
|
|
|
|
|
|
|
|
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE,
|
|
|
|
L"System\\CurrentControlSet\\Control\\IDConfigDB\\Hardware Profiles",
|
|
|
|
0,
|
|
|
|
KEY_READ,
|
|
|
|
&hKey) != ERROR_SUCCESS)
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
for (dwIndex = 0; dwIndex < pProfileData->dwProfileCount; dwIndex++)
|
|
|
|
{
|
|
|
|
dwNameLength = 8;
|
|
|
|
lError = RegEnumKeyExW(hKey,
|
|
|
|
dwIndex,
|
|
|
|
szName,
|
|
|
|
&dwNameLength,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL,
|
|
|
|
NULL);
|
|
|
|
if (lError != ERROR_SUCCESS)
|
|
|
|
break;
|
|
|
|
|
2015-05-17 16:11:15 +00:00
|
|
|
dwProfileNumber = wcstoul(szName, NULL, 10);
|
2011-11-19 19:10:18 +00:00
|
|
|
DPRINT("Profile name: %S\n", szName);
|
2015-05-17 16:11:15 +00:00
|
|
|
DPRINT("Profile number: %lu\n", dwProfileNumber);
|
|
|
|
|
|
|
|
if ((pProfileData->dwLastProfile == (DWORD)-1) ||
|
|
|
|
(pProfileData->dwLastProfile < dwProfileNumber))
|
|
|
|
pProfileData->dwLastProfile = dwProfileNumber;
|
2011-11-19 19:10:18 +00:00
|
|
|
|
2015-05-17 16:11:15 +00:00
|
|
|
DPRINT("Last Profile number: %lu\n", pProfileData->dwLastProfile);
|
|
|
|
|
|
|
|
GetProfile(hwndDlg, hKey, szName, dwProfileNumber, &pProfileData->pProfiles[dwIndex]);
|
2011-11-19 19:10:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
RegCloseKey(hKey);
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
BOOL
|
2017-12-23 13:05:07 +00:00
|
|
|
OnInitHardProfDialog(HWND hwndDlg)
|
2011-11-01 17:47:18 +00:00
|
|
|
{
|
|
|
|
DWORD dwWaitInterval;
|
|
|
|
|
2017-12-23 13:05:07 +00:00
|
|
|
DPRINT("OnInitHardProfDialog()\n");
|
2011-11-19 19:10:18 +00:00
|
|
|
|
2011-11-01 17:47:18 +00:00
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_HRDPROFUP),
|
|
|
|
BM_SETIMAGE,(WPARAM)IMAGE_ICON,
|
|
|
|
(LPARAM)(HANDLE)LoadIcon(hApplet, MAKEINTRESOURCE(IDI_UP)));
|
|
|
|
SendMessage(GetDlgItem(hwndDlg, IDC_HRDPROFDWN),
|
|
|
|
BM_SETIMAGE,(WPARAM)IMAGE_ICON,
|
|
|
|
(LPARAM)(HANDLE)LoadIcon(hApplet, MAKEINTRESOURCE(IDI_DOWN)));
|
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
if (!GetProfiles(hwndDlg))
|
|
|
|
return FALSE;
|
2011-11-01 17:47:18 +00:00
|
|
|
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETRANGE, (WPARAM)0, (LPARAM)MAKELONG((SHORT)500, 0));
|
|
|
|
|
|
|
|
dwWaitInterval = GetUserWaitInterval();
|
|
|
|
if (dwWaitInterval == (DWORD)-1)
|
|
|
|
{
|
|
|
|
CheckDlgButton(hwndDlg, IDC_HRDPROFWAIT, BST_CHECKED);
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETPOS, 0, 30);
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFEDIT), FALSE);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CheckDlgButton(hwndDlg, IDC_HRDPROFSELECT, BST_CHECKED);
|
|
|
|
SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_SETPOS, 0, dwWaitInterval);
|
|
|
|
}
|
2011-11-19 19:10:18 +00:00
|
|
|
|
|
|
|
return TRUE;
|
2011-11-01 17:47:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static
|
|
|
|
VOID
|
|
|
|
OnOk(HWND hwndDlg)
|
|
|
|
{
|
|
|
|
DWORD dwWaitInterval;
|
|
|
|
|
|
|
|
if (IsDlgButtonChecked(hwndDlg, IDC_HRDPROFWAIT) == BST_CHECKED)
|
|
|
|
{
|
|
|
|
dwWaitInterval = (DWORD)-1;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
dwWaitInterval = LOWORD(SendDlgItemMessageW(hwndDlg, IDC_HRDPROFUPDWN, UDM_GETPOS, 0, 0));
|
|
|
|
}
|
|
|
|
|
|
|
|
SetUserWaitInterval(dwWaitInterval);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-11-08 11:47:44 +00:00
|
|
|
/* Property page dialog callback */
|
2011-11-19 19:10:18 +00:00
|
|
|
INT_PTR
|
|
|
|
CALLBACK
|
2006-11-08 11:47:44 +00:00
|
|
|
HardProfDlgProc(HWND hwndDlg,
|
2007-07-23 16:32:04 +00:00
|
|
|
UINT uMsg,
|
|
|
|
WPARAM wParam,
|
|
|
|
LPARAM lParam)
|
2006-11-08 11:47:44 +00:00
|
|
|
{
|
2011-11-19 19:10:18 +00:00
|
|
|
PPROFILEDATA pProfileData;
|
|
|
|
|
2007-07-23 16:32:04 +00:00
|
|
|
UNREFERENCED_PARAMETER(lParam);
|
|
|
|
UNREFERENCED_PARAMETER(wParam);
|
|
|
|
UNREFERENCED_PARAMETER(hwndDlg);
|
2007-11-03 14:39:08 +00:00
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
pProfileData = (PPROFILEDATA)GetWindowLongPtr(hwndDlg, DWLP_USER);
|
|
|
|
|
2007-11-03 14:39:08 +00:00
|
|
|
switch (uMsg)
|
2007-07-23 16:32:04 +00:00
|
|
|
{
|
|
|
|
case WM_INITDIALOG:
|
2017-12-23 13:05:07 +00:00
|
|
|
return OnInitHardProfDialog(hwndDlg);
|
2011-11-19 19:10:18 +00:00
|
|
|
|
|
|
|
case WM_DESTROY:
|
|
|
|
if (pProfileData != NULL)
|
|
|
|
{
|
|
|
|
if (pProfileData->pProfiles != NULL)
|
|
|
|
HeapFree(GetProcessHeap(), 0, pProfileData->pProfiles);
|
|
|
|
HeapFree(GetProcessHeap(), 0, pProfileData);
|
|
|
|
}
|
2011-11-01 17:47:18 +00:00
|
|
|
break;
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2007-07-23 16:32:04 +00:00
|
|
|
case WM_COMMAND:
|
|
|
|
switch (LOWORD(wParam))
|
|
|
|
{
|
2015-05-25 22:02:05 +00:00
|
|
|
case IDC_HRDPROFPROP:
|
|
|
|
HardwareProfileProperties(hwndDlg, pProfileData);
|
|
|
|
break;
|
|
|
|
|
2011-11-19 19:10:18 +00:00
|
|
|
case IDC_HRDPROFCOPY:
|
2015-05-24 20:20:04 +00:00
|
|
|
CopyHardwareProfile(hwndDlg, pProfileData);
|
2011-11-19 19:10:18 +00:00
|
|
|
break;
|
|
|
|
|
2007-07-23 16:32:04 +00:00
|
|
|
case IDC_HRDPROFRENAME:
|
2015-05-24 20:20:04 +00:00
|
|
|
RenameHardwareProfile(hwndDlg, pProfileData);
|
2007-11-03 14:39:08 +00:00
|
|
|
break;
|
2006-11-08 11:47:44 +00:00
|
|
|
|
2015-05-21 21:47:57 +00:00
|
|
|
case IDC_HRDPROFDEL:
|
2015-05-24 20:20:04 +00:00
|
|
|
DeleteHardwareProfile(hwndDlg, pProfileData);
|
2015-05-21 21:47:57 +00:00
|
|
|
break;
|
|
|
|
|
2015-05-25 12:23:12 +00:00
|
|
|
case IDC_HRDPROFUP:
|
|
|
|
MoveHardwareProfile(hwndDlg, pProfileData, TRUE);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case IDC_HRDPROFDWN:
|
|
|
|
MoveHardwareProfile(hwndDlg, pProfileData, FALSE);
|
|
|
|
break;
|
|
|
|
|
2011-11-01 17:47:18 +00:00
|
|
|
case IDC_HRDPROFWAIT:
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFEDIT), FALSE);
|
|
|
|
return TRUE;
|
|
|
|
|
|
|
|
case IDC_HRDPROFSELECT:
|
|
|
|
EnableWindow(GetDlgItem(hwndDlg, IDC_HRDPROFEDIT), TRUE);
|
|
|
|
return TRUE;
|
|
|
|
|
2015-05-17 16:11:15 +00:00
|
|
|
case IDC_HRDPROFLSTBOX:
|
|
|
|
if (HIWORD(wParam) == LBN_SELCHANGE)
|
|
|
|
{
|
|
|
|
pProfileData->dwSelectedProfileIndex = (DWORD)SendDlgItemMessage(hwndDlg, IDC_HRDPROFLSTBOX, LB_GETCURSEL, 0, 0);
|
2015-05-25 12:23:12 +00:00
|
|
|
UpdateButtons(hwndDlg, pProfileData);
|
2015-05-17 16:11:15 +00:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
|
2007-07-23 16:32:04 +00:00
|
|
|
case IDOK:
|
2011-11-01 17:47:18 +00:00
|
|
|
OnOk(hwndDlg);
|
|
|
|
|
2007-07-23 16:32:04 +00:00
|
|
|
case IDCANCEL:
|
2015-05-17 16:11:15 +00:00
|
|
|
EndDialog(hwndDlg, LOWORD(wParam));
|
2007-07-23 16:32:04 +00:00
|
|
|
return TRUE;
|
|
|
|
}
|
2007-11-03 14:39:08 +00:00
|
|
|
break;
|
2007-07-23 16:32:04 +00:00
|
|
|
}
|
2007-11-03 14:39:08 +00:00
|
|
|
|
2007-07-23 16:32:04 +00:00
|
|
|
return FALSE;
|
2006-11-08 11:47:44 +00:00
|
|
|
}
|