msi: Avoid using HIWORD() on string pointers.

This commit is contained in:
Michael Stefaniuc 2010-01-29 15:01:17 +01:00 committed by Alexandre Julliard
parent 5b6eada53f
commit a0774cabab
1 changed files with 5 additions and 3 deletions

View File

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