mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +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 = (PFONT_OPEN_INFO) HeapAlloc( hProcessHeap, HEAP_ZERO_MEMORY, sizeof(FONT_OPEN_INFO) );
|
||||||
OpenInfo->pszFileName = HeapAlloc(hProcessHeap, 0, MAX_PATH);
|
OpenInfo->pszFileName = HeapAlloc(hProcessHeap, 0, MAX_PATH);
|
||||||
OpenInfo->pszFileName[0] = 0;
|
if (OpenInfo->pszFileName)
|
||||||
|
|
||||||
if( DoOpenFile(OpenInfo->pszFileName) )
|
|
||||||
{
|
{
|
||||||
OpenInfo->bCreateNew = FALSE;
|
OpenInfo->pszFileName[0] = 0;
|
||||||
CreateFontWindow(Info, OpenInfo);
|
|
||||||
|
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 = HeapAlloc(hProcessHeap, HEAP_ZERO_MEMORY, sizeof(FONT_OPEN_INFO));
|
||||||
OpenInfo->pszFileName = HeapAlloc(hProcessHeap, 0, MAX_PATH);
|
OpenInfo->pszFileName = HeapAlloc(hProcessHeap, 0, MAX_PATH);
|
||||||
lstrcpynW(OpenInfo->pszFileName, File, MAX_PATH);
|
if (OpenInfo->pszFileName)
|
||||||
|
{
|
||||||
OpenInfo->bCreateNew = FALSE;
|
if (StringCchCopyW(OpenInfo->pszFileName, MAX_PATH, File) == S_OK)
|
||||||
CreateFontWindow(Info, OpenInfo);
|
{
|
||||||
|
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
|
static VOID
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <windowsx.h>
|
#include <windowsx.h>
|
||||||
#include <commctrl.h>
|
#include <commctrl.h>
|
||||||
|
#include <strsafe.h>
|
||||||
#include "resource.h"
|
#include "resource.h"
|
||||||
#include "customwndclasses.h"
|
#include "customwndclasses.h"
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue