mirror of
https://github.com/reactos/reactos.git
synced 2024-09-30 22:47:28 +00:00
[SETUPAPI] Don't let LZClose() reset error code
This commit is contained in:
parent
8236bb8f38
commit
497a9c8087
|
@ -1068,6 +1068,7 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
|
||||||
WCHAR TempPath[MAX_PATH];
|
WCHAR TempPath[MAX_PATH];
|
||||||
WCHAR TempFile[MAX_PATH];
|
WCHAR TempFile[MAX_PATH];
|
||||||
LONG lRes;
|
LONG lRes;
|
||||||
|
DWORD dwLastError;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TRACE("copy %s to %s style 0x%x\n",debugstr_w(source),debugstr_w(target),style);
|
TRACE("copy %s to %s style 0x%x\n",debugstr_w(source),debugstr_w(target),style);
|
||||||
|
@ -1090,11 +1091,16 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
|
||||||
|
|
||||||
if (!GetTempFileNameW(TempPath, L"", 0, TempFile))
|
if (!GetTempFileNameW(TempPath, L"", 0, TempFile))
|
||||||
{
|
{
|
||||||
|
dwLastError = GetLastError();
|
||||||
|
|
||||||
ERR("GetTempFileNameW(%s) error\n", debugstr_w(TempPath));
|
ERR("GetTempFileNameW(%s) error\n", debugstr_w(TempPath));
|
||||||
|
|
||||||
/* Close the source handle */
|
/* Close the source handle */
|
||||||
LZClose(hSource);
|
LZClose(hSource);
|
||||||
|
|
||||||
|
/* Restore error condition triggered by GetTempFileNameW */
|
||||||
|
SetLastError(dwLastError);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1102,6 +1108,8 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
|
||||||
hTemp = LZOpenFileW(TempFile, &OfStruct, OF_CREATE);
|
hTemp = LZOpenFileW(TempFile, &OfStruct, OF_CREATE);
|
||||||
if (hTemp < 0)
|
if (hTemp < 0)
|
||||||
{
|
{
|
||||||
|
dwLastError = GetLastError();
|
||||||
|
|
||||||
ERR("LZOpenFileW(2) error %d %s\n", (int)hTemp, debugstr_w(TempFile));
|
ERR("LZOpenFileW(2) error %d %s\n", (int)hTemp, debugstr_w(TempFile));
|
||||||
|
|
||||||
/* Close the source handle */
|
/* Close the source handle */
|
||||||
|
@ -1110,11 +1118,16 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
|
||||||
/* Delete temp file if an error is signaled */
|
/* Delete temp file if an error is signaled */
|
||||||
DeleteFileW(TempFile);
|
DeleteFileW(TempFile);
|
||||||
|
|
||||||
|
/* Restore error condition triggered by LZOpenFileW */
|
||||||
|
SetLastError(dwLastError);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
lRes = LZCopy(hSource, hTemp);
|
lRes = LZCopy(hSource, hTemp);
|
||||||
|
|
||||||
|
dwLastError = GetLastError();
|
||||||
|
|
||||||
LZClose(hSource);
|
LZClose(hSource);
|
||||||
LZClose(hTemp);
|
LZClose(hTemp);
|
||||||
|
|
||||||
|
@ -1125,6 +1138,9 @@ static BOOL do_file_copyW( LPCWSTR source, LPCWSTR target, DWORD style,
|
||||||
/* Delete temp file if copy was not successful */
|
/* Delete temp file if copy was not successful */
|
||||||
DeleteFileW(TempFile);
|
DeleteFileW(TempFile);
|
||||||
|
|
||||||
|
/* Restore error condition triggered by LZCopy */
|
||||||
|
SetLastError(dwLastError);
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue