Michael Stefaniuc : msi: Avoid using HIWORD() on string pointers.

Alexandre Julliard julliard at winehq.org
Fri Jan 29 10:56:36 CST 2010


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

Author: Michael Stefaniuc <mstefani at redhat.de>
Date:   Fri Jan 29 15:01:17 2010 +0100

msi: Avoid using HIWORD() on string pointers.

---

 dlls/msi/database.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/dlls/msi/database.c b/dlls/msi/database.c
index b0966a2..7855fea 100644
--- a/dlls/msi/database.c
+++ b/dlls/msi/database.c
@@ -51,6 +51,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(msi);
  *  Any binary data in a table is a reference to a stream.
  */
 
+#define IS_INTMSIDBOPEN(x)      (((ULONG_PTR)(x) >> 16) == 0)
+
 typedef struct tagMSITRANSFORM {
     struct list entry;
     IStorage *stg;
@@ -306,7 +308,7 @@ UINT MSI_OpenDatabaseW(LPCWSTR szDBPath, LPCWSTR szPersist, MSIDATABASE **pdb)
 
     save_path = szDBPath;
     szMode = szPersist;
-    if( HIWORD( szPersist ) )
+    if( !IS_INTMSIDBOPEN(szPersist) )
     {
         if (!CopyFileW( szDBPath, szPersist, FALSE ))
             return ERROR_OPEN_FAILED;
@@ -459,7 +461,7 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
             goto end;
     }
 
-    if( HIWORD(szPersist) )
+    if( !IS_INTMSIDBOPEN(szPersist) )
     {
         szwPersist = strdupAtoW( szPersist );
         if( !szwPersist )
@@ -471,7 +473,7 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
     r = MsiOpenDatabaseW( szwDBPath, szwPersist, phDB );
 
 end:
-    if( HIWORD(szPersist) )
+    if( !IS_INTMSIDBOPEN(szPersist) )
         msi_free( szwPersist );
     msi_free( szwDBPath );
 




More information about the wine-cvs mailing list