Use ERROR_SUCCESS when reseting the error code.

Francois Gouget fgouget at free.fr
Thu Jan 4 03:52:12 CST 2007


---
 dlls/kernel32/console.c |    2 +-
 dlls/kernel32/environ.c |    2 +-
 dlls/kernel32/file.c    |    6 +++---
 dlls/kernel32/process.c |    2 +-
 dlls/kernel32/sync.c    |    2 +-
 dlls/setupapi/parser.c  |   18 +++++++++---------
 dlls/uxtheme/metric.c   |    6 +++---
 dlls/version/info.c     |    4 ++--
 dlls/winedos/int21.c    |    2 +-
 dlls/wininet/ftp.c      |   22 +++++++++++-----------
 dlls/wininet/http.c     |    2 +-
 dlls/wininet/internet.c |    4 ++--
 12 files changed, 36 insertions(+), 36 deletions(-)

diff --git a/dlls/kernel32/console.c b/dlls/kernel32/console.c
index a22076e..c53ab21 100644
--- a/dlls/kernel32/console.c
+++ b/dlls/kernel32/console.c
@@ -234,7 +234,7 @@ HANDLE WINAPI OpenConsoleW(LPCWSTR name, DWORD access, BOOL inherit, DWORD creat
         req->access     = access;
         req->attributes = inherit ? OBJ_INHERIT : 0;
         req->share      = FILE_SHARE_READ | FILE_SHARE_WRITE;
-        SetLastError(0);
+        SetLastError(ERROR_SUCCESS);
         wine_server_call_err( req );
         ret = reply->handle;
     }
diff --git a/dlls/kernel32/environ.c b/dlls/kernel32/environ.c
index 414ccbf..3f38ddb 100644
--- a/dlls/kernel32/environ.c
+++ b/dlls/kernel32/environ.c
@@ -180,7 +180,7 @@ DWORD WINAPI GetEnvironmentVariableA( LPCSTR name, LPSTR value, DWORD size )
         return 0;
 
     RtlCreateUnicodeStringFromAsciiz( &us_name, name );
-    SetLastError(0);
+    SetLastError(ERROR_SUCCESS);
     ret = GetEnvironmentVariableW( us_name.Buffer, valueW, size);
     if (ret && ret < size)
     {
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c
index 5a0c5cb..a200e24 100644
--- a/dlls/kernel32/file.c
+++ b/dlls/kernel32/file.c
@@ -845,7 +845,7 @@ DWORD WINAPI GetFileSize( HANDLE hFile, LPDWORD filesizehigh )
     LARGE_INTEGER size;
     if (!GetFileSizeEx( hFile, &size )) return INVALID_FILE_SIZE;
     if (filesizehigh) *filesizehigh = size.u.HighPart;
-    if (size.u.LowPart == INVALID_FILE_SIZE) SetLastError(0);
+    if (size.u.LowPart == INVALID_FILE_SIZE) SetLastError(ERROR_SUCCESS);
     return size.u.LowPart;
 }
 
@@ -928,7 +928,7 @@ DWORD WINAPI SetFilePointer( HANDLE hFile, LONG distance, LONG *highword, DWORD
     if (!SetFilePointerEx( hFile, dist, &newpos, method )) return INVALID_SET_FILE_POINTER;
 
     if (highword) *highword = newpos.u.HighPart;
-    if (newpos.u.LowPart == INVALID_SET_FILE_POINTER) SetLastError( 0 );
+    if (newpos.u.LowPart == INVALID_SET_FILE_POINTER) SetLastError( ERROR_SUCCESS );
     return newpos.u.LowPart;
 }
 
@@ -1428,7 +1428,7 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing,
         else
             SetLastError( RtlNtStatusToDosError(status) );
     }
-    else SetLastError(0);
+    else SetLastError(ERROR_SUCCESS);
     RtlFreeUnicodeString( &nameW );
 
  done:
diff --git a/dlls/kernel32/process.c b/dlls/kernel32/process.c
index 8cdcd72..4d0d25a 100644
--- a/dlls/kernel32/process.c
+++ b/dlls/kernel32/process.c
@@ -815,7 +815,7 @@ static void start_process( void *arg )
             DPRINTF( "%04x:Starting process %s (entryproc=%p)\n", GetCurrentThreadId(),
                      debugstr_w(peb->ProcessParameters->ImagePathName.Buffer), entry );
 
-        SetLastError( 0 );  /* clear error code */
+        SetLastError( ERROR_SUCCESS );  /* clear error code */
         if (peb->BeingDebugged) DbgBreakPoint();
         ExitThread( entry( peb ) );
     }
diff --git a/dlls/kernel32/sync.c b/dlls/kernel32/sync.c
index eaa0f70..48bfb4a 100644
--- a/dlls/kernel32/sync.c
+++ b/dlls/kernel32/sync.c
@@ -1158,7 +1158,7 @@ HANDLE WINAPI CreateNamedPipeW( LPCWSTR name, DWORD dwOpenMode,
 
     timeout.QuadPart = (ULONGLONG)nDefaultTimeOut * -10000;
 
-    SetLastError(0);
+    SetLastError(ERROR_SUCCESS);
         
     status = NtCreateNamedPipeFile(&handle, GENERIC_READ|GENERIC_WRITE, &attr, &iosb,
                                    0, FILE_OVERWRITE_IF, options, pipe_type,
diff --git a/dlls/setupapi/parser.c b/dlls/setupapi/parser.c
index 3c2c7ad..965547e 100644
--- a/dlls/setupapi/parser.c
+++ b/dlls/setupapi/parser.c
@@ -1144,7 +1144,7 @@ HINF WINAPI SetupOpenInfFileW( PCWSTR name, PCWSTR class, DWORD style, UINT *err
     }
     TRACE( "%s -> %p\n", debugstr_w(path), file );
     file->filename = path;
-    SetLastError( 0 );
+    SetLastError( ERROR_SUCCESS );
     return (HINF)file;
 }
 
@@ -1309,7 +1309,7 @@ BOOL WINAPI SetupGetLineByIndexW( HINF hinf, PCWSTR section, DWORD index, INFCON
             context->CurrentInf = file;
             context->Section    = section_index;
             context->Line       = index;
-            SetLastError( 0 );
+            SetLastError( ERROR_SUCCESS );
             TRACE( "(%p,%s): returning %d/%d\n",
                    hinf, debugstr_w(section), section_index, index );
             return TRUE;
@@ -1378,7 +1378,7 @@ BOOL WINAPI SetupFindFirstLineW( HINF hinf, PCWSTR section, PCWSTR key, INFCONTE
             context->CurrentInf = file;
             context->Section    = section_index;
             context->Line       = 0;
-            SetLastError( 0 );
+            SetLastError( ERROR_SUCCESS );
             TRACE( "(%p,%s,%s): returning %d/0\n",
                    hinf, debugstr_w(section), debugstr_w(key), section_index );
             return TRUE;
@@ -1404,7 +1404,7 @@ BOOL WINAPI SetupFindNextLine( PINFCONTEXT context_in, PINFCONTEXT context_out )
     {
         if (context_out != context_in) *context_out = *context_in;
         context_out->Line++;
-        SetLastError( 0 );
+        SetLastError( ERROR_SUCCESS );
         return TRUE;
     }
 
@@ -1420,7 +1420,7 @@ BOOL WINAPI SetupFindNextLine( PINFCONTEXT context_in, PINFCONTEXT context_out )
             context_out->CurrentInf = file;
             context_out->Section    = section_index;
             context_out->Line       = 0;
-            SetLastError( 0 );
+            SetLastError( ERROR_SUCCESS );
             return TRUE;
         }
     }
@@ -1476,7 +1476,7 @@ BOOL WINAPI SetupFindNextMatchLineW( PINFCONTEXT context_in, PCWSTR key,
         {
             if (context_out != context_in) *context_out = *context_in;
             context_out->Line = i;
-            SetLastError( 0 );
+            SetLastError( ERROR_SUCCESS );
             TRACE( "(%p,%s,%s): returning %d\n",
                    file, debugstr_w(section->name), debugstr_w(key), i );
             return TRUE;
@@ -1499,7 +1499,7 @@ BOOL WINAPI SetupFindNextMatchLineW( PINFCONTEXT context_in, PCWSTR key,
                 context_out->CurrentInf = file;
                 context_out->Section    = section_index;
                 context_out->Line       = i;
-                SetLastError( 0 );
+                SetLastError( ERROR_SUCCESS );
                 TRACE( "(%p,%s,%s): returning %d/%d\n",
                        file, debugstr_w(section->name), debugstr_w(key), section_index, i );
                 return TRUE;
@@ -1639,7 +1639,7 @@ BOOL WINAPI SetupGetStringFieldA( PINFCONTEXT context, DWORD index, PSTR buffer,
     struct field *field = get_field( file, context->Section, context->Line, index );
     unsigned int len;
 
-    SetLastError(0);
+    SetLastError(ERROR_SUCCESS);
     if (!field) return FALSE;
     len = PARSER_string_substA( file, field->text, NULL, 0 );
     if (required) *required = len + 1;
@@ -1670,7 +1670,7 @@ BOOL WINAPI SetupGetStringFieldW( PINFCONTEXT context, DWORD index, PWSTR buffer
     struct field *field = get_field( file, context->Section, context->Line, index );
     unsigned int len;
 
-    SetLastError(0);
+    SetLastError(ERROR_SUCCESS);
     if (!field) return FALSE;
     len = PARSER_string_substW( file, field->text, NULL, 0 );
     if (required) *required = len + 1;
diff --git a/dlls/uxtheme/metric.c b/dlls/uxtheme/metric.c
index c683a67..3aea5ab 100644
--- a/dlls/uxtheme/metric.c
+++ b/dlls/uxtheme/metric.c
@@ -47,7 +47,7 @@ BOOL WINAPI GetThemeSysBool(HTHEME hTheme, int iBoolID)
     BOOL ret;
 
     TRACE("(%p, %d)\n", hTheme, iBoolID);
-    SetLastError(0);
+    SetLastError(ERROR_SUCCESS);
     if(hTheme) {
         if((tp = MSSTYLES_FindMetric(TMT_BOOL, iBoolID))) {
             hr = MSSTYLES_GetPropertyBool(tp, &ret);
@@ -77,7 +77,7 @@ COLORREF WINAPI GetThemeSysColor(HTHEME hTheme, int iColorID)
     PTHEME_PROPERTY tp;
 
     TRACE("(%p, %d)\n", hTheme, iColorID);
-    SetLastError(0);
+    SetLastError(ERROR_SUCCESS);
     if(hTheme) {
         if((tp = MSSTYLES_FindMetric(TMT_COLOR, iColorID))) {
             COLORREF color;
@@ -188,7 +188,7 @@ int WINAPI GetThemeSysSize(HTHEME hTheme, int iSizeID)
                 break;
             }
         }
-        SetLastError(0);
+        SetLastError(ERROR_SUCCESS);
         if(id != -1) {
             if((tp = MSSTYLES_FindMetric(TMT_SIZE, id))) {
                 if(SUCCEEDED(MSSTYLES_GetPropertyInt(tp, &i))) {
diff --git a/dlls/version/info.c b/dlls/version/info.c
index 92553ea..5d3d213 100644
--- a/dlls/version/info.c
+++ b/dlls/version/info.c
@@ -513,7 +513,7 @@ DWORD WINAPI GetFileVersionInfoSizeW( LPCWSTR filename, LPDWORD handle )
          len = (len * 2) + 4;
     }
 
-    SetLastError(0);
+    SetLastError(ERROR_SUCCESS);
     return len;
 }
 
@@ -602,7 +602,7 @@ BOOL WINAPI GetFileVersionInfoW( LPCWSTR filename, DWORD handle,
         }
     }
 
-    SetLastError(0);
+    SetLastError(ERROR_SUCCESS);
     return TRUE;
 }
 
diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c
index 86224ae..1f359c2 100644
--- a/dlls/winedos/int21.c
+++ b/dlls/winedos/int21.c
@@ -4165,7 +4165,7 @@ void WINAPI DOSVM_Int21Handler( CONTEXT86 *context )
     * be cleared before handling the function.
     */
     if (AH_reg(context) >= 0x2f && AH_reg(context) != 0x59) 
-        SetLastError(0);
+        SetLastError(ERROR_SUCCESS);
 
     RESET_CFLAG(context); /* Not sure if this is a good idea. */
 
diff --git a/dlls/wininet/ftp.c b/dlls/wininet/ftp.c
index e473b5b..fe3c6e1 100644
--- a/dlls/wininet/ftp.c
+++ b/dlls/wininet/ftp.c
@@ -265,7 +265,7 @@ BOOL WINAPI FTP_FtpPutFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszLocalFile,
     assert( WH_HFTPSESSION == lpwfs->hdr.htype);
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
     hIC = lpwfs->lpAppInfo;
 
     /* Open file to be uploaded */
@@ -434,7 +434,7 @@ BOOL WINAPI FTP_FtpSetCurrentDirectoryW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpsz
     }
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     hIC = lpwfs->lpAppInfo;
     if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_CWD, lpszDirectory,
@@ -571,7 +571,7 @@ BOOL WINAPI FTP_FtpCreateDirectoryW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszDire
     }
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_MKD, lpszDirectory, 0, 0, 0))
         goto lend;
@@ -718,7 +718,7 @@ HINTERNET WINAPI FTP_FtpFindFirstFileW(LPWININETFTPSESSIONW lpwfs,
     assert(WH_HFTPSESSION == lpwfs->hdr.htype);
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     if (!FTP_InitListenSocket(lpwfs))
         goto lend;
@@ -912,7 +912,7 @@ BOOL WINAPI FTP_FtpGetCurrentDirectoryW(LPWININETFTPSESSIONW lpwfs, LPWSTR lpszC
     }
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     ZeroMemory(lpszCurrentDirectory, *lpdwCurrentDirectory);
 
@@ -1087,7 +1087,7 @@ HINTERNET FTP_FtpOpenFileW(LPWININETFTPSESSIONW lpwfs,
     assert (WH_HFTPSESSION == lpwfs->hdr.htype);
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     if (GENERIC_READ == fdwAccess)
     {
@@ -1282,7 +1282,7 @@ BOOL WINAPI FTP_FtpGetFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszRemoteFile,
     assert (WH_HFTPSESSION == lpwfs->hdr.htype);
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     /* Ensure we can write to lpszNewfile by opening it */
     hFile = CreateFileW(lpszNewFile, GENERIC_WRITE, 0, 0, fFailIfExists ?
@@ -1451,7 +1451,7 @@ BOOL FTP_FtpDeleteFileW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszFileName)
     assert (WH_HFTPSESSION == lpwfs->hdr.htype);
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_DELE, lpszFileName, 0, 0, 0))
         goto lend;
@@ -1581,7 +1581,7 @@ BOOL FTP_FtpRemoveDirectoryW(LPWININETFTPSESSIONW lpwfs, LPCWSTR lpszDirectory)
     assert (WH_HFTPSESSION == lpwfs->hdr.htype);
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_RMD, lpszDirectory, 0, 0, 0))
         goto lend;
@@ -1718,7 +1718,7 @@ BOOL FTP_FtpRenameFileW( LPWININETFTPSESSIONW lpwfs,
     assert (WH_HFTPSESSION == lpwfs->hdr.htype);
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     if (!FTP_SendCommand(lpwfs->sndSocket, FTP_CMD_RNFR, lpszSrc, 0, 0, 0))
         goto lend;
@@ -2834,7 +2834,7 @@ BOOL WINAPI FTP_FindNextFileW(LPWININETFTPFINDNEXTW lpwh, LPVOID lpvFindData)
     assert (lpwh->hdr.htype == WH_HFTPFINDNEXT);
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     lpFindFileData = (LPWIN32_FIND_DATAW) lpvFindData;
     ZeroMemory(lpFindFileData, sizeof(WIN32_FIND_DATAA));
diff --git a/dlls/wininet/http.c b/dlls/wininet/http.c
index 813d99e..100a366 100644
--- a/dlls/wininet/http.c
+++ b/dlls/wininet/http.c
@@ -2233,7 +2233,7 @@ BOOL WINAPI HTTP_HttpSendRequestW(LPWININETHTTPREQW lpwhr, LPCWSTR lpszHeaders,
     assert(lpwhr->hdr.htype == WH_HHTTPREQ);
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     HTTP_FixVerb(lpwhr);
     
diff --git a/dlls/wininet/internet.c b/dlls/wininet/internet.c
index 6a155c5..035aa94 100644
--- a/dlls/wininet/internet.c
+++ b/dlls/wininet/internet.c
@@ -491,7 +491,7 @@ HINTERNET WINAPI InternetOpenW(LPCWSTR lpszAgent, DWORD dwAccessType,
     }
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
 
     lpwai = HeapAlloc(GetProcessHeap(), 0, sizeof(WININETAPPINFOW));
     if (NULL == lpwai)
@@ -800,7 +800,7 @@ HINTERNET WINAPI InternetConnectW(HINTERNET hInternet,
     }
 
     /* Clear any error information */
-    INTERNET_SetLastError(0);
+    INTERNET_SetLastError(ERROR_SUCCESS);
     hIC = (LPWININETAPPINFOW) WININET_GetObject( hInternet );
     if ( (hIC == NULL) || (hIC->hdr.htype != WH_HINIT) )
     {
-- 
1.4.4.2




More information about the wine-patches mailing list