diff --git a/core/Common/Image.cpp b/core/Common/Image.cpp index 6a5b60e4..81d335fb 100644 --- a/core/Common/Image.cpp +++ b/core/Common/Image.cpp @@ -283,7 +283,7 @@ bool e2d::Image::preload(int resNameId, const String& resType) if (SUCCEEDED(hr)) { // 计算大小 - imageFileSize = SizeofResource(HINST_THISCOMPONENT, imageResHandle); + imageFileSize = ::SizeofResource(HINST_THISCOMPONENT, imageResHandle); hr = imageFileSize ? S_OK : E_FAIL; } diff --git a/core/Tool/Path.cpp b/core/Tool/Path.cpp index b36bdc70..e6c2a706 100644 --- a/core/Tool/Path.cpp +++ b/core/Tool/Path.cpp @@ -136,11 +136,20 @@ e2d::String e2d::Path::extractResource(int resNameId, const String & resType, co HGLOBAL hMem = ::LoadResource(NULL, hRes); DWORD dwSize = ::SizeofResource(NULL, hRes); - // 写入文件 - DWORD dwWrite = 0; - ::WriteFile(hFile, hMem, dwSize, &dwWrite, NULL); - ::CloseHandle(hFile); - return destFilePath; + if (hRes && hMem && dwSize) + { + // 写入文件 + DWORD dwWrite = 0; + ::WriteFile(hFile, hMem, dwSize, &dwWrite, NULL); + ::CloseHandle(hFile); + return destFilePath; + } + else + { + ::CloseHandle(hFile); + ::DeleteFile((LPCWSTR)destFilePath); + return String(); + } } e2d::String e2d::Path::getDataSavePath()