Author: gedmurphy
Date: Thu Apr 6 20:23:35 2006
New Revision: 21481
URL:
http://svn.reactos.ru/svn/reactos?rev=21481&view=rev
Log:
store license on heap and add some error checking
Modified:
trunk/reactos/base/applications/wordpad/dialogs.c
Modified: trunk/reactos/base/applications/wordpad/dialogs.c
URL:
http://svn.reactos.ru/svn/reactos/trunk/reactos/base/applications/wordpad/d…
==============================================================================
--- trunk/reactos/base/applications/wordpad/dialogs.c (original)
+++ trunk/reactos/base/applications/wordpad/dialogs.c Thu Apr 6 20:23:35 2006
@@ -84,7 +84,7 @@
{
HWND hLicenseEditWnd;
HICON hIcon = NULL;
- TCHAR strLicense[700];
+ static LPTSTR lpLicense = NULL;
switch (message)
{
@@ -96,27 +96,30 @@
16,
16,
0);
-
- SendMessage(hDlg,
- WM_SETICON,
- ICON_SMALL,
- (LPARAM)hIcon);
+ if (hIcon != NULL)
+ {
+ SendMessage(hDlg,
+ WM_SETICON,
+ ICON_SMALL,
+ (LPARAM)hIcon);
+ }
hLicenseEditWnd = GetDlgItem(hDlg,
IDC_LICENSE_EDIT);
- LoadString(hInstance,
- IDS_LICENSE,
- strLicense,
- sizeof(strLicense) / sizeof(TCHAR));
-
- SetWindowText(hLicenseEditWnd,
- strLicense);
+ if (AllocAndLoadString(&lpLicense,
+ hInstance,
+ IDS_LICENSE))
+ {
+ SetWindowText(hLicenseEditWnd,
+ lpLicense);
+ }
return TRUE;
case WM_COMMAND:
if ((LOWORD(wParam) == IDOK) || (LOWORD(wParam) == IDCANCEL))
{
+ LocalFree((HLOCAL)lpLicense);
DestroyIcon(hIcon);
EndDialog(hDlg,
LOWORD(wParam));