WCHAR TempPath[MAX_PATH];
WCHAR TempFile[MAX_PATH];
LONG lRes;
+ DWORD dwLastError;
#endif
TRACE("copy %s to %s style 0x%x\n",debugstr_w(source),debugstr_w(target),style);
if (!GetTempFileNameW(TempPath, L"", 0, TempFile))
{
+ dwLastError = GetLastError();
+
ERR("GetTempFileNameW(%s) error\n", debugstr_w(TempPath));
/* Close the source handle */
LZClose(hSource);
+ /* Restore error condition triggered by GetTempFileNameW */
+ SetLastError(dwLastError);
+
return FALSE;
}
hTemp = LZOpenFileW(TempFile, &OfStruct, OF_CREATE);
if (hTemp < 0)
{
+ dwLastError = GetLastError();
+
ERR("LZOpenFileW(2) error %d %s\n", (int)hTemp, debugstr_w(TempFile));
/* Close the source handle */
/* Delete temp file if an error is signaled */
DeleteFileW(TempFile);
+ /* Restore error condition triggered by LZOpenFileW */
+ SetLastError(dwLastError);
+
return FALSE;
}
lRes = LZCopy(hSource, hTemp);
+ dwLastError = GetLastError();
+
LZClose(hSource);
LZClose(hTemp);
/* Delete temp file if copy was not successful */
DeleteFileW(TempFile);
+ /* Restore error condition triggered by LZCopy */
+ SetLastError(dwLastError);
+
return FALSE;
}
#endif