Use ReadFile helper function in exehead

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@6395 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
anders_k 2013-07-25 19:18:34 +00:00
parent a5f0809ee9
commit 19b9a3e65a
4 changed files with 15 additions and 9 deletions

View file

@ -449,6 +449,13 @@ TCHAR * NSISCALL my_GetTempFileName(TCHAR *buf, const TCHAR *dir)
return 0;
}
BOOL NSISCALL myReadFile(HANDLE h, LPVOID buf, DWORD cb)
{
DWORD cbio;
BOOL r = ReadFile(h, buf, cb, &cbio, NULL);
return r && cb == cbio;
}
#ifdef NSIS_SUPPORT_MOVEONREBOOT
/** Modifies the wininit.ini file to rename / delete a file.
*
@ -503,7 +510,7 @@ void RenameViaWininit(const TCHAR* prevName, const TCHAR* newName)
if (pszWinInit != NULL)
{
if (ReadFile(hfile, pszWinInit, dwFileSize, &dwBytes, NULL) && dwFileSize == dwBytes)
if (myReadFile(hfile, pszWinInit, dwFileSize))
{
// Look for the rename section in the current file.
LPSTR pszRenameSecInFile = mystrstriA(pszWinInit, szRenameSec);