[msconfig]

strsafe++

svn path=/trunk/; revision=61682
This commit is contained in:
Christoph von Wittich 2014-01-19 08:20:45 +00:00
parent 81b28a2a81
commit abe8b71bf5
3 changed files with 26 additions and 7 deletions

View file

@ -33,15 +33,27 @@ LoadBootIni(WCHAR *szDrive, HWND hDlg)
FILE * file;
UINT length;
LRESULT pos;
HRESULT hr;
wcscpy(szBuffer, szDrive);
wcscat(szBuffer, L"freeldr.ini");
hr = StringCbCopyW(szBuffer, sizeof(szBuffer), szDrive);
if (FAILED(hr))
return FALSE;
hr = StringCbCatW(szBuffer, sizeof(szBuffer), L"freeldr.ini");
if (FAILED(hr))
return FALSE;
file = _wfopen(szBuffer, L"rt");
if (!file)
{
wcscpy(szBuffer, szDrive);
wcscat(szBuffer, L"boot.ini");
hr = StringCbCopyW(szBuffer, sizeof(szBuffer), szDrive);
if (FAILED(hr))
return FALSE;
hr = StringCbCatW(szBuffer, sizeof(szBuffer), L"boot.ini");
if (FAILED(hr))
return FALSE;
file = _wfopen(szBuffer, L"rt");
if (!file)
return FALSE;
@ -137,7 +149,7 @@ FreeLdrPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
if (pos != LB_ERR)
{
LPARAM res = SendMessage((HWND)lParam, LB_GETITEMDATA, pos, 0);
if (!res) //line is not a default one
if (!res) /* line is not a default one */
SendMessage((HWND)lParam, LB_SETCURSEL, Settings.szDefaultPos, 0);
else
Settings.szDefaultPos = pos;

View file

@ -11,6 +11,7 @@
#include <tchar.h>
#include <stdio.h>
#include <shlobj.h>
#include <strsafe.h>
#include "msconfig.h"
#include "resource.h"

View file

@ -23,9 +23,15 @@ LoadSystemIni(WCHAR * szPath, HWND hDlg)
FILE* file;
UINT length;
TVINSERTSTRUCT insert;
HRESULT hr;
wcscpy(szBuffer, szPath);
wcscat(szBuffer, L"\\system.ini");
hr = StringCbCopyW(szBuffer, sizeof(szBuffer), szPath);
if (FAILED(hr))
return FALSE;
hr = StringCbCatW(szBuffer, sizeof(szBuffer), L"\\system.ini");
if (FAILED(hr))
return FALSE;
file = _wfopen(szBuffer, L"rt");
if (!file)