Fix #266: CloseHandle close an invalid handle

This commit is contained in:
yuanyuanxiang
2025-12-26 15:57:27 +01:00
parent 02d86f6ce7
commit 34e7cdb663
33 changed files with 171 additions and 161 deletions

View File

@@ -969,7 +969,7 @@ void CMachineDlg::ShowProcessList_menu()
memcpy(lpBuffer+1, p_InjectData, sizeof(InjectData));
DWORD wr = 0;
ReadFile(hFile, lpBuffer + sizeof(InjectData)+1, p_InjectData->datasize, &wr, NULL);
CloseHandle(hFile);
SAFE_CLOSE_HANDLE(hFile);
m_ContextObject->Send2Client(lpBuffer, allsize);
SAFE_DELETE_AR(lpBuffer);
}
@@ -1656,10 +1656,10 @@ void CMachineDlg::ShowHostsList_menu()
lpBuffer = (LPBYTE)LocalAlloc(LPTR, dwSize + 2);
if (!ReadFile(hFile, lpBuffer, dwSize, &dwRead, NULL)) {
LocalFree(lpBuffer);
CloseHandle(hFile);
SAFE_CLOSE_HANDLE(hFile);
return;
}
CloseHandle(hFile);
SAFE_CLOSE_HANDLE(hFile);
DeleteList();
int i = 0;