Kohei Takahashi : msi: Return -1 on open failure in FDI callbacks.

Alexandre Julliard julliard at winehq.org
Fri Jan 10 14:44:52 CST 2014


Module: wine
Branch: stable
Commit: 96501bd4bc1a8906ce98a033b1c074a1edddfbc4
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=96501bd4bc1a8906ce98a033b1c074a1edddfbc4

Author: Kohei Takahashi <flast at flast.jp>
Date:   Wed Oct 16 01:08:38 2013 +0900

msi: Return -1 on open failure in FDI callbacks.

(cherry picked from commit 953359c73f5c609132e6d7caea0947d164a3d4b4)

---

 dlls/msi/media.c |   15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/dlls/msi/media.c b/dlls/msi/media.c
index d97f4bd..8646069 100644
--- a/dlls/msi/media.c
+++ b/dlls/msi/media.c
@@ -137,7 +137,6 @@ static void CDECL cabinet_free(void *pv)
 
 static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode)
 {
-    HANDLE handle;
     DWORD dwAccess = 0;
     DWORD dwShareMode = 0;
     DWORD dwCreateDisposition = OPEN_EXISTING;
@@ -163,12 +162,8 @@ static INT_PTR CDECL cabinet_open(char *pszFile, int oflag, int pmode)
     else if (oflag & _O_CREAT)
         dwCreateDisposition = CREATE_ALWAYS;
 
-    handle = CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
-                         dwCreateDisposition, 0, NULL);
-    if (handle == INVALID_HANDLE_VALUE)
-        return 0;
-
-    return (INT_PTR)handle;
+    return (INT_PTR)CreateFileA(pszFile, dwAccess, dwShareMode, NULL,
+                                dwCreateDisposition, 0, NULL);
 }
 
 static UINT CDECL cabinet_read(INT_PTR hf, void *pv, UINT cb)
@@ -225,12 +220,12 @@ static INT_PTR CDECL cabinet_open_stream( char *pszFile, int oflag, int pmode )
     if (!cab)
     {
         WARN("failed to get cabinet stream\n");
-        return 0;
+        return -1;
     }
     if (!cab->stream[0] || !(encoded = encode_streamname( FALSE, cab->stream + 1 )))
     {
         WARN("failed to encode stream name\n");
-        return 0;
+        return -1;
     }
     if (msi_clone_open_stream( package_disk.package->db, cab->storage, encoded, &stream ) != ERROR_SUCCESS)
     {
@@ -239,7 +234,7 @@ static INT_PTR CDECL cabinet_open_stream( char *pszFile, int oflag, int pmode )
         {
             WARN("failed to open stream 0x%08x\n", hr);
             msi_free( encoded );
-            return 0;
+            return -1;
         }
     }
     msi_free( encoded );




More information about the wine-cvs mailing list