mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[ROSAPPS][VGAFONTEDIT] String/Memory check
This commit is contained in:
parent
fb8fe4a08c
commit
56297438a5
2 changed files with 29 additions and 9 deletions
|
@ -213,12 +213,19 @@ DoFileOpen(IN PMAIN_WND_INFO Info)
|
|||
|
||||
OpenInfo = (PFONT_OPEN_INFO) HeapAlloc( hProcessHeap, HEAP_ZERO_MEMORY, sizeof(FONT_OPEN_INFO) );
|
||||
OpenInfo->pszFileName = HeapAlloc(hProcessHeap, 0, MAX_PATH);
|
||||
OpenInfo->pszFileName[0] = 0;
|
||||
|
||||
if( DoOpenFile(OpenInfo->pszFileName) )
|
||||
if (OpenInfo->pszFileName)
|
||||
{
|
||||
OpenInfo->bCreateNew = FALSE;
|
||||
CreateFontWindow(Info, OpenInfo);
|
||||
OpenInfo->pszFileName[0] = 0;
|
||||
|
||||
if (DoOpenFile(OpenInfo->pszFileName))
|
||||
{
|
||||
OpenInfo->bCreateNew = FALSE;
|
||||
CreateFontWindow(Info, OpenInfo);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxW(Info->hMainWnd, L"Out of memory!", NULL, MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -229,10 +236,22 @@ MainWndOpenFile(IN PMAIN_WND_INFO Info, LPCWSTR File)
|
|||
|
||||
OpenInfo = HeapAlloc(hProcessHeap, HEAP_ZERO_MEMORY, sizeof(FONT_OPEN_INFO));
|
||||
OpenInfo->pszFileName = HeapAlloc(hProcessHeap, 0, MAX_PATH);
|
||||
lstrcpynW(OpenInfo->pszFileName, File, MAX_PATH);
|
||||
|
||||
OpenInfo->bCreateNew = FALSE;
|
||||
CreateFontWindow(Info, OpenInfo);
|
||||
if (OpenInfo->pszFileName)
|
||||
{
|
||||
if (StringCchCopyW(OpenInfo->pszFileName, MAX_PATH, File) == S_OK)
|
||||
{
|
||||
OpenInfo->bCreateNew = FALSE;
|
||||
CreateFontWindow(Info, OpenInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxW(Info->hMainWnd, L"Pathname is too long!", NULL, MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
MessageBoxW(Info->hMainWnd, L"Out of memory!", NULL, MB_ICONERROR);
|
||||
}
|
||||
}
|
||||
|
||||
static VOID
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <windows.h>
|
||||
#include <windowsx.h>
|
||||
#include <commctrl.h>
|
||||
#include <strsafe.h>
|
||||
#include "resource.h"
|
||||
#include "customwndclasses.h"
|
||||
|
||||
|
|
Loading…
Reference in a new issue