Author: ekohl
Date: Mon May 18 20:29:14 2015
New Revision: 67825
URL:
http://svn.reactos.org/svn/reactos?rev=67825&view=rev
Log:
[SYSDM]
The maximum length of hardware profiles names is 79 characters. Use a matching string
length and set the length of the edit control accordingly.
Modified:
trunk/reactos/dll/cpl/sysdm/hardprof.c
Modified: trunk/reactos/dll/cpl/sysdm/hardprof.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/cpl/sysdm/hardprof.c?r…
==============================================================================
--- trunk/reactos/dll/cpl/sysdm/hardprof.c [iso-8859-1] (original)
+++ trunk/reactos/dll/cpl/sysdm/hardprof.c [iso-8859-1] Mon May 18 20:29:14 2015
@@ -11,9 +11,11 @@
#include <debug.h>
+#define PROFILE_NAME_LENGTH 80
+
typedef struct _PROFILE
{
- WCHAR szFriendlyName[256];
+ WCHAR szFriendlyName[PROFILE_NAME_LENGTH];
WCHAR szName[5];
DWORD dwProfileNumber;
DWORD dwPreferenceOrder;
@@ -37,11 +39,12 @@
UINT idFrom,
UINT idTo)
{
- WCHAR szNewProfileName[256];
+ WCHAR szNewProfileName[PROFILE_NAME_LENGTH];
SetDlgItemText(hwndDlg, idFrom,
pProfileData->pProfiles[pProfileData->dwSelectedProfileIndex].szFriendlyName);
swprintf(szNewProfileName, L"Profile %lu",
pProfileData->dwProfileCount);
+ SendDlgItemMessageW(hwndDlg, idTo, EM_SETLIMITTEXT, PROFILE_NAME_LENGTH - 1, 0);
SetDlgItemText(hwndDlg, idTo, szNewProfileName);
}
@@ -76,7 +79,7 @@
GetDlgItemText(hwndDlg,
IDC_COPYPROFILETO,
pDstProfile->szFriendlyName,
- 256);
+ PROFILE_NAME_LENGTH);
pDstProfile->dwProfileNumber = ++pProfileData->dwLastProfile;
swprintf(pDstProfile->szName, L"%04lu",
pDstProfile->dwProfileNumber);
@@ -138,7 +141,7 @@
GetDlgItemText(hwndDlg,
IDC_RENPROFEDITTO,
pProfile->szFriendlyName,
- 256);
+ PROFILE_NAME_LENGTH);
/* Replace the listbox string */
SendDlgItemMessageW(pProfileData->hwndProfileDlg, IDC_HRDPROFLSTBOX,
LB_DELETESTRING, pProfileData->dwSelectedProfileIndex, 0);
@@ -288,7 +291,7 @@
if (lError != ERROR_SUCCESS)
return;
- dwSize = 256 * sizeof(WCHAR);
+ dwSize = PROFILE_NAME_LENGTH * sizeof(WCHAR);
lError = RegQueryValueExW(hProfileKey,
L"FriendlyName",
NULL,