Nikolay Sivov : ole32: Test HRESULT values using proper success code.

Alexandre Julliard julliard at winehq.org
Tue Aug 20 14:38:37 CDT 2013


Module: wine
Branch: master
Commit: ba999f05e11f1e09e43dea1032076576693dd4f1
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=ba999f05e11f1e09e43dea1032076576693dd4f1

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Sun Aug 18 09:14:20 2013 +0400

ole32: Test HRESULT values using proper success code.

---

 dlls/ole32/compobj.c |    4 ++--
 dlls/ole32/git.c     |    2 +-
 dlls/ole32/rpc.c     |   17 +++++++++--------
 3 files changed, 12 insertions(+), 11 deletions(-)

diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 710f21e..45376d1 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -2910,7 +2910,7 @@ HRESULT WINAPI CoCreateInstance(
     {
         IGlobalInterfaceTable *git = get_std_git();
         hres = IGlobalInterfaceTable_QueryInterface(git, iid, ppv);
-        if (hres) return hres;
+        if (hres != S_OK) return hres;
 
         TRACE("Retrieved GIT (%p)\n", *ppv);
         return S_OK;
@@ -2992,7 +2992,7 @@ HRESULT WINAPI CoCreateInstanceEx(
 			&IID_IUnknown,
 			(VOID**)&pUnk);
 
-  if (hr)
+  if (hr != S_OK)
     return hr;
 
   /*
diff --git a/dlls/ole32/git.c b/dlls/ole32/git.c
index ad921ed..f5dd00b 100644
--- a/dlls/ole32/git.c
+++ b/dlls/ole32/git.c
@@ -296,7 +296,7 @@ StdGlobalInterfaceTable_GetInterfaceFromGlobal(
   hres = CoUnmarshalInterface(stream, riid, ppv);
   IStream_Release(stream);
 
-  if (hres) {
+  if (hres != S_OK) {
     WARN("Failed to unmarshal stream\n");
     return hres;
   }
diff --git a/dlls/ole32/rpc.c b/dlls/ole32/rpc.c
index 5bade5c..dd67546 100644
--- a/dlls/ole32/rpc.c
+++ b/dlls/ole32/rpc.c
@@ -1519,7 +1519,7 @@ static void __RPC_STUB dispatch_rpc(RPC_MESSAGE *msg)
 
     /* if IRpcStubBuffer_Invoke fails, we should raise an exception to tell
      * the RPC runtime that the call failed */
-    if (hr) RpcRaiseException(hr);
+    if (hr != S_OK) RpcRaiseException(hr);
 }
 
 /* stub registration */
@@ -1656,6 +1656,7 @@ static HRESULT create_server(REFCLSID rclsid, HANDLE *process)
     DWORD               size = (MAX_PATH+1) * sizeof(WCHAR);
     STARTUPINFOW        sinfo;
     PROCESS_INFORMATION pinfo;
+    LONG ret;
 
     hres = COM_OpenKeyForCLSID(rclsid, wszLocalServer32, KEY_READ, &key);
     if (FAILED(hres)) {
@@ -1663,9 +1664,9 @@ static HRESULT create_server(REFCLSID rclsid, HANDLE *process)
         return hres;
     }
 
-    hres = RegQueryValueExW(key, NULL, NULL, NULL, (LPBYTE)command, &size);
+    ret = RegQueryValueExW(key, NULL, NULL, NULL, (LPBYTE)command, &size);
     RegCloseKey(key);
-    if (hres) {
+    if (ret) {
         WARN("No default value for LocalServer32 key\n");
         return REGDB_E_CLASSNOTREG; /* FIXME: check retval */
     }
@@ -1861,9 +1862,9 @@ HRESULT RPC_GetLocalClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
         return E_NOINTERFACE;
     
     hres = CreateStreamOnHGlobal(0,TRUE,&pStm);
-    if (hres) return hres;
+    if (hres != S_OK) return hres;
     hres = IStream_Write(pStm,marshalbuffer,bufferlen,&res);
-    if (hres) goto out;
+    if (hres != S_OK) goto out;
     seekto.u.LowPart = 0;seekto.u.HighPart = 0;
     hres = IStream_Seek(pStm,seekto,STREAM_SEEK_SET,&newpos);
     
@@ -1935,13 +1936,13 @@ static DWORD WINAPI local_server_thread(LPVOID param)
         TRACE("marshalling LocalServer to client\n");
         
         hres = IStream_Stat(pStm,&ststg,STATFLAG_NONAME);
-        if (hres)
+        if (hres != S_OK)
             break;
 
         seekto.u.LowPart = 0;
         seekto.u.HighPart = 0;
         hres = IStream_Seek(pStm,seekto,STREAM_SEEK_SET,&newpos);
-        if (hres) {
+        if (hres != S_OK) {
             FIXME("IStream_Seek failed, %x\n",hres);
             break;
         }
@@ -1950,7 +1951,7 @@ static DWORD WINAPI local_server_thread(LPVOID param)
         buffer = HeapAlloc(GetProcessHeap(),0,buflen);
         
         hres = IStream_Read(pStm,buffer,buflen,&res);
-        if (hres) {
+        if (hres != S_OK) {
             FIXME("Stream Read failed, %x\n",hres);
             HeapFree(GetProcessHeap(),0,buffer);
             break;




More information about the wine-cvs mailing list