mirror of
https://github.com/reactos/reactos.git
synced 2025-05-11 13:27:47 +00:00
Fewer GetLastError() function calls.
This commit is contained in:
parent
9c8a86b4cc
commit
e1d0128ffc
1 changed files with 13 additions and 9 deletions
|
@ -86,14 +86,14 @@ ErrorMessage(
|
||||||
ConPrintf(StdOut, L"%s\n", szMsg);
|
ConPrintf(StdOut, L"%s\n", szMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Returns TRUE if anything found and listed, FALSE otherwise */
|
/* Returns TRUE if anything is printed, FALSE otherwise */
|
||||||
static
|
static
|
||||||
BOOL
|
BOOL
|
||||||
PrintAttribute(
|
PrintAttribute(
|
||||||
LPWSTR pszPath,
|
LPWSTR pszPath,
|
||||||
LPWSTR pszFile,
|
LPWSTR pszFile,
|
||||||
BOOL bRecurse,
|
BOOL bRecurse,
|
||||||
BOOL bDirectories)
|
BOOL bDirectories)
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATAW findData;
|
WIN32_FIND_DATAW findData;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
|
@ -102,6 +102,7 @@ PrintAttribute(
|
||||||
BOOL bFound = FALSE;
|
BOOL bFound = FALSE;
|
||||||
BOOL bIsDir;
|
BOOL bIsDir;
|
||||||
BOOL bExactMatch;
|
BOOL bExactMatch;
|
||||||
|
DWORD Error;
|
||||||
|
|
||||||
/* prepare full file name buffer */
|
/* prepare full file name buffer */
|
||||||
wcscpy(szFullName, pszPath);
|
wcscpy(szFullName, pszPath);
|
||||||
|
@ -116,9 +117,10 @@ PrintAttribute(
|
||||||
hFind = FindFirstFileW(szFullName, &findData);
|
hFind = FindFirstFileW(szFullName, &findData);
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
if ((GetLastError() != ERROR_DIRECTORY) && (GetLastError() != ERROR_SHARING_VIOLATION)
|
Error = GetLastError();
|
||||||
&& (GetLastError() != ERROR_FILE_NOT_FOUND))
|
if ((Error != ERROR_DIRECTORY) && (Error != ERROR_SHARING_VIOLATION)
|
||||||
ErrorMessage(GetLastError(), pszFile);
|
&& (Error != ERROR_FILE_NOT_FOUND))
|
||||||
|
ErrorMessage(Error, pszFile);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +199,7 @@ ChangeAttribute(
|
||||||
BOOL bIsDir;
|
BOOL bIsDir;
|
||||||
BOOL bExactMatch;
|
BOOL bExactMatch;
|
||||||
DWORD dwAttribute;
|
DWORD dwAttribute;
|
||||||
|
DWORD Error;
|
||||||
|
|
||||||
/* prepare full file name buffer */
|
/* prepare full file name buffer */
|
||||||
wcscpy(szFullName, pszPath);
|
wcscpy(szFullName, pszPath);
|
||||||
|
@ -211,9 +214,10 @@ ChangeAttribute(
|
||||||
hFind = FindFirstFileW(szFullName, &findData);
|
hFind = FindFirstFileW(szFullName, &findData);
|
||||||
if (hFind == INVALID_HANDLE_VALUE)
|
if (hFind == INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
if ((GetLastError() != ERROR_DIRECTORY) && (GetLastError() != ERROR_SHARING_VIOLATION)
|
Error = GetLastError();
|
||||||
&& (GetLastError() != ERROR_FILE_NOT_FOUND))
|
if ((Error != ERROR_DIRECTORY) && (Error != ERROR_SHARING_VIOLATION)
|
||||||
ErrorMessage(GetLastError(), pszFile);
|
&& (Error != ERROR_FILE_NOT_FOUND))
|
||||||
|
ErrorMessage(Error, pszFile);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue