Replace instances of HeapAlloc/MultiByteToWideChar with the internally

defined strdupAtoW.
oldstable
Mike McCormack 2005-03-24 19:04:06 +00:00 committed by Alexandre Julliard
parent f8f64406fc
commit 77a19ed8e6
4 changed files with 76 additions and 118 deletions

View File

@ -203,26 +203,21 @@ UINT WINAPI MsiOpenDatabaseA(LPCSTR szDBPath, LPCSTR szPersist, MSIHANDLE *phDB)
{ {
HRESULT r = ERROR_FUNCTION_FAILED; HRESULT r = ERROR_FUNCTION_FAILED;
LPWSTR szwDBPath = NULL, szwPersist = NULL; LPWSTR szwDBPath = NULL, szwPersist = NULL;
UINT len;
TRACE("%s %s %p\n", debugstr_a(szDBPath), debugstr_a(szPersist), phDB); TRACE("%s %s %p\n", debugstr_a(szDBPath), debugstr_a(szPersist), phDB);
if( szDBPath ) if( szDBPath )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szDBPath, -1, NULL, 0 ); szwDBPath = strdupAtoW( szDBPath );
szwDBPath = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwDBPath ) if( !szwDBPath )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szDBPath, -1, szwDBPath, len );
} }
if( HIWORD(szPersist) ) if( HIWORD(szPersist) )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szPersist, -1, NULL, 0 ); szwPersist = strdupAtoW( szPersist );
szwPersist = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwPersist ) if( !szwPersist )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szPersist, -1, szwPersist, len );
} }
else else
szwPersist = (LPWSTR) szPersist; szwPersist = (LPWSTR) szPersist;
@ -238,17 +233,16 @@ end:
UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct) UINT WINAPI MsiOpenProductA(LPCSTR szProduct, MSIHANDLE *phProduct)
{ {
UINT len, ret; UINT ret;
LPWSTR szwProd = NULL; LPWSTR szwProd = NULL;
TRACE("%s %p\n",debugstr_a(szProduct), phProduct); TRACE("%s %p\n",debugstr_a(szProduct), phProduct);
if( szProduct ) if( szProduct )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); szwProd = strdupAtoW( szProduct );
szwProd = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); if( !szwProd )
if( szwProd ) return ERROR_OUTOFMEMORY;
MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProd, len );
} }
ret = MsiOpenProductW( szwProd, phProduct ); ret = MsiOpenProductW( szwProd, phProduct );
@ -353,20 +347,16 @@ UINT WINAPI MsiInstallProductA(LPCSTR szPackagePath, LPCSTR szCommandLine)
if( szPackagePath ) if( szPackagePath )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szPackagePath, -1, NULL, 0 ); szwPath = strdupAtoW( szPackagePath );
szwPath = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwPath ) if( !szwPath )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szPackagePath, -1, szwPath, len );
} }
if( szCommandLine ) if( szCommandLine )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, NULL, 0 ); szwCommand = strdupAtoW( szCommandLine );
szwCommand = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwCommand ) if( !szwCommand )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, szwCommand, len );
} }
r = MsiInstallProductW( szwPath, szwCommand ); r = MsiInstallProductW( szwPath, szwCommand );
@ -490,10 +480,10 @@ UINT WINAPI MsiConfigureProductExW(LPCWSTR szProduct, int iInstallLevel,
goto end; goto end;
} }
sz = strlenW(szInstalled); sz = lstrlenW(szInstalled);
if (szCommandLine) if (szCommandLine)
sz += strlenW(szCommandLine); sz += lstrlenW(szCommandLine);
commandline = HeapAlloc(GetProcessHeap(),0,sz * sizeof(WCHAR)); commandline = HeapAlloc(GetProcessHeap(),0,sz * sizeof(WCHAR));
@ -525,20 +515,16 @@ UINT WINAPI MsiConfigureProductExA(LPCSTR szProduct, int iInstallLevel,
if( szProduct ) if( szProduct )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); szwProduct = strdupAtoW( szProduct );
szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwProduct ) if( !szwProduct )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
} }
if( szCommandLine) if( szCommandLine)
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, NULL, 0 ); szwCommandLine = strdupAtoW( szCommandLine );
szwCommandLine= HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwCommandLine) if( !szwCommandLine)
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szCommandLine, -1, szwCommandLine, len );
} }
hr = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState, hr = MsiConfigureProductExW( szwProduct, iInstallLevel, eInstallState,
@ -560,11 +546,9 @@ UINT WINAPI MsiConfigureProductA(LPCSTR szProduct, int iInstallLevel,
if( szProduct ) if( szProduct )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); szwProduct = strdupAtoW( szProduct );
szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwProduct ) if( !szwProduct )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
} }
hr = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState ); hr = MsiConfigureProductW( szwProduct, iInstallLevel, eInstallState );
@ -594,11 +578,9 @@ UINT WINAPI MsiGetProductCodeA(LPCSTR szComponent, LPSTR szBuffer)
if( szComponent ) if( szComponent )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 ); szwComponent = strdupAtoW( szComponent );
szwComponent = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwComponent ) if( !szwComponent )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len );
} }
else else
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
@ -635,22 +617,18 @@ UINT WINAPI MsiGetProductInfoA(LPCSTR szProduct, LPCSTR szAttribute,
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
if( szProduct ) if( szProduct )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); szwProduct = strdupAtoW( szProduct );
szwProduct = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwProduct ) if( !szwProduct )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
} }
else else
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
if( szAttribute ) if( szAttribute )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szAttribute, -1, NULL, 0 ); szwAttribute = strdupAtoW( szAttribute );
szwAttribute = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwAttribute ) if( !szwAttribute )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szAttribute, -1, szwAttribute, len );
} }
else else
{ {
@ -722,11 +700,9 @@ UINT WINAPI MsiEnableLogA(DWORD dwLogMode, LPCSTR szLogFile, DWORD attributes)
if( szLogFile ) if( szLogFile )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szLogFile, -1, NULL, 0 ); szwLogFile = strdupAtoW( szLogFile );
szwLogFile = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwLogFile ) if( !szwLogFile )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szLogFile, -1, szwLogFile, len );
} }
else else
return ERROR_INVALID_PARAMETER; return ERROR_INVALID_PARAMETER;
@ -760,23 +736,25 @@ UINT WINAPI MsiEnableLogW(DWORD dwLogMode, LPCWSTR szLogFile, DWORD attributes)
INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct) INSTALLSTATE WINAPI MsiQueryProductStateA(LPCSTR szProduct)
{ {
LPWSTR szwProduct; LPWSTR szwProduct = NULL;
UINT len; INSTALLSTATE r;
INSTALLSTATE rc;
len = MultiByteToWideChar(CP_ACP,0,szProduct,-1,NULL,0); if( szProduct )
szwProduct = HeapAlloc(GetProcessHeap(),0,len*sizeof(WCHAR)); {
MultiByteToWideChar(CP_ACP,0,szProduct,-1,szwProduct,len); szwProduct = strdupAtoW( szProduct );
rc = MsiQueryProductStateW(szwProduct); if( !szwProduct )
HeapFree(GetProcessHeap(),0,szwProduct); return ERROR_OUTOFMEMORY;
return rc; }
r = MsiQueryProductStateW( szwProduct );
HeapFree( GetProcessHeap(), 0, szwProduct );
return r;
} }
INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct) INSTALLSTATE WINAPI MsiQueryProductStateW(LPCWSTR szProduct)
{ {
UINT rc; UINT rc;
INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN; INSTALLSTATE rrc = INSTALLSTATE_UNKNOWN;
HKEY hkey=0; HKEY hkey = 0;
static const WCHAR szWindowsInstaller[] = { static const WCHAR szWindowsInstaller[] = {
'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 }; 'W','i','n','d','o','w','s','I','n','s','t','a','l','l','e','r',0 };
DWORD sz; DWORD sz;
@ -1043,18 +1021,16 @@ UINT WINAPI MsiGetProductPropertyW( MSIHANDLE hProduct, LPCWSTR szProperty,
UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage ) UINT WINAPI MsiVerifyPackageA( LPCSTR szPackage )
{ {
UINT r, len; UINT r;
LPWSTR szPack = NULL; LPWSTR szPack = NULL;
TRACE("%s\n", debugstr_a(szPackage) ); TRACE("%s\n", debugstr_a(szPackage) );
if( szPackage ) if( szPackage )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szPackage, -1, NULL, 0 ); szPack = strdupAtoW( szPackage );
szPack = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
if( !szPack ) if( !szPack )
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
MultiByteToWideChar( CP_ACP, 0, szPackage, -1, szPack, len );
} }
r = MsiVerifyPackageW( szPack ); r = MsiVerifyPackageW( szPack );
@ -1082,27 +1058,23 @@ INSTALLSTATE WINAPI MsiGetComponentPathA(LPCSTR szProduct, LPCSTR szComponent,
{ {
LPWSTR szwProduct = NULL, szwComponent = NULL, lpwPathBuf= NULL; LPWSTR szwProduct = NULL, szwComponent = NULL, lpwPathBuf= NULL;
INSTALLSTATE rc; INSTALLSTATE rc;
UINT len, incoming_len; UINT incoming_len;
if( szProduct ) if( szProduct )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); szwProduct = strdupAtoW( szProduct );
szwProduct= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
if( !szwProduct) if( !szwProduct)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
} }
if( szComponent ) if( szComponent )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szComponent, -1, NULL, 0 ); szwComponent = strdupAtoW( szComponent );
szwComponent= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
if( !szwComponent ) if( !szwComponent )
{ {
HeapFree( GetProcessHeap(), 0, szwProduct); HeapFree( GetProcessHeap(), 0, szwProduct);
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
MultiByteToWideChar( CP_ACP, 0, szComponent, -1, szwComponent, len );
} }
if( pcchBuf && *pcchBuf > 0 ) if( pcchBuf && *pcchBuf > 0 )
@ -1205,29 +1177,24 @@ end:
INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature) INSTALLSTATE WINAPI MsiQueryFeatureStateA(LPCSTR szProduct, LPCSTR szFeature)
{ {
INSTALLSTATE rc; INSTALLSTATE rc;
UINT len;
LPWSTR szwProduct= NULL; LPWSTR szwProduct= NULL;
LPWSTR szwFeature= NULL; LPWSTR szwFeature= NULL;
if( szProduct ) if( szProduct )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szProduct, -1, NULL, 0 ); szwProduct = strdupAtoW( szProduct );
szwProduct= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
if( !szwProduct) if( !szwProduct)
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
MultiByteToWideChar( CP_ACP, 0, szProduct, -1, szwProduct, len );
} }
if( szFeature ) if( szFeature )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szFeature, -1, NULL, 0 ); szwFeature = strdupAtoW( szFeature );
szwFeature= HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
if( !szwFeature) if( !szwFeature)
{ {
HeapFree( GetProcessHeap(), 0, szwProduct); HeapFree( GetProcessHeap(), 0, szwProduct);
return ERROR_OUTOFMEMORY; return ERROR_OUTOFMEMORY;
} }
MultiByteToWideChar( CP_ACP, 0, szFeature, -1, szwFeature, len );
} }
rc = MsiQueryFeatureStateW(szwProduct, szwFeature); rc = MsiQueryFeatureStateW(szwProduct, szwFeature);
@ -1251,15 +1218,13 @@ UINT WINAPI MsiGetFileVersionA(LPCSTR szFilePath, LPSTR lpVersionBuf,
DWORD* pcchVersionBuf, LPSTR lpLangBuf, DWORD* pcchLangBuf) DWORD* pcchVersionBuf, LPSTR lpLangBuf, DWORD* pcchLangBuf)
{ {
LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL; LPWSTR szwFilePath = NULL, lpwVersionBuff = NULL, lpwLangBuff = NULL;
UINT len, ret = ERROR_OUTOFMEMORY; UINT ret = ERROR_OUTOFMEMORY;
if( szFilePath ) if( szFilePath )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szFilePath, -1, NULL, 0 ); szwFilePath = strdupAtoW( szFilePath );
szwFilePath = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
if( !szwFilePath ) if( !szwFilePath )
goto end; goto end;
MultiByteToWideChar( CP_ACP, 0, szFilePath, -1, szwFilePath, len );
} }
if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf ) if( lpVersionBuf && pcchVersionBuf && *pcchVersionBuf )

View File

@ -86,11 +86,9 @@ UINT WINAPI MsiDatabaseOpenViewA(MSIHANDLE hdb,
if( szQuery ) if( szQuery )
{ {
UINT len = MultiByteToWideChar( CP_ACP, 0, szQuery, -1, NULL, 0 ); szwQuery = strdupAtoW( szQuery );
szwQuery = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) );
if( !szwQuery ) if( !szwQuery )
return ERROR_FUNCTION_FAILED; return ERROR_FUNCTION_FAILED;
MultiByteToWideChar( CP_ACP, 0, szQuery, -1, szwQuery, len );
} }
else else
szwQuery = NULL; szwQuery = NULL;
@ -672,16 +670,15 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysA(MSIHANDLE hdb,
LPCSTR table, MSIHANDLE* phRec) LPCSTR table, MSIHANDLE* phRec)
{ {
LPWSTR szwTable = NULL; LPWSTR szwTable = NULL;
DWORD len;
UINT r; UINT r;
TRACE("%ld %s %p\n", hdb, debugstr_a(table), phRec); TRACE("%ld %s %p\n", hdb, debugstr_a(table), phRec);
if( table ) if( table )
{ {
len = MultiByteToWideChar( CP_ACP, 0, table, -1, NULL, 0 ); szwTable = strdupAtoW( table );
szwTable = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); if( !szwTable )
MultiByteToWideChar( CP_ACP, 0, table, -1, szwTable, len ); return ERROR_OUTOFMEMORY;
} }
r = MsiDatabaseGetPrimaryKeysW( hdb, szwTable, phRec ); r = MsiDatabaseGetPrimaryKeysW( hdb, szwTable, phRec );
HeapFree( GetProcessHeap(), 0, szwTable ); HeapFree( GetProcessHeap(), 0, szwTable );

View File

@ -469,14 +469,13 @@ UINT WINAPI MsiOpenPackageW(LPCWSTR szPackage, MSIHANDLE *phPackage)
UINT WINAPI MsiOpenPackageExA(LPCSTR szPackage, DWORD dwOptions, MSIHANDLE *phPackage) UINT WINAPI MsiOpenPackageExA(LPCSTR szPackage, DWORD dwOptions, MSIHANDLE *phPackage)
{ {
LPWSTR szwPack = NULL; LPWSTR szwPack = NULL;
UINT len, ret; UINT ret;
if( szPackage ) if( szPackage )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szPackage, -1, NULL, 0 ); szwPack = strdupAtoW( szPackage );
szwPack = HeapAlloc( GetProcessHeap(), 0, len * sizeof (WCHAR) ); if( !szwPack )
if( szwPack ) return ERROR_OUTOFMEMORY;
MultiByteToWideChar( CP_ACP, 0, szPackage, -1, szwPack, len );
} }
ret = MsiOpenPackageExW( szwPack, dwOptions, phPackage ); ret = MsiOpenPackageExW( szwPack, dwOptions, phPackage );
@ -638,29 +637,20 @@ UINT WINAPI MsiSetPropertyA( MSIHANDLE hInstall, LPCSTR szName, LPCSTR szValue)
{ {
LPWSTR szwName = NULL, szwValue = NULL; LPWSTR szwName = NULL, szwValue = NULL;
UINT hr = ERROR_INSTALL_FAILURE; UINT hr = ERROR_INSTALL_FAILURE;
UINT len;
if (0 == hInstall) { if( szName )
return ERROR_INVALID_HANDLE; {
} szwName = strdupAtoW( szName );
if (NULL == szName) { if( !szwName )
return ERROR_INVALID_PARAMETER; goto end;
}
if (NULL == szValue) {
return ERROR_INVALID_PARAMETER;
} }
len = MultiByteToWideChar( CP_ACP, 0, szName, -1, NULL, 0 ); if( szValue )
szwName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); {
if( !szwName ) szwValue = strdupAtoW( szValue );
goto end; if( !szwValue)
MultiByteToWideChar( CP_ACP, 0, szName, -1, szwName, len ); goto end;
}
len = MultiByteToWideChar( CP_ACP, 0, szValue, -1, NULL, 0 );
szwValue = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) );
if( !szwValue)
goto end;
MultiByteToWideChar( CP_ACP, 0, szValue , -1, szwValue, len );
hr = MsiSetPropertyW( hInstall, szwName, szwValue); hr = MsiSetPropertyW( hInstall, szwName, szwValue);
@ -703,7 +693,7 @@ UINT MSI_SetPropertyW( MSIPACKAGE *package, LPCWSTR szName, LPCWSTR szValue)
} }
else else
{ {
strcpyW(Query,Insert); strcpyW(Query,Insert);
row = MSI_CreateRecord(2); row = MSI_CreateRecord(2);
MSI_RecordSetStringW(row,1,szName); MSI_RecordSetStringW(row,1,szName);
@ -732,8 +722,13 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
MSIPACKAGE *package; MSIPACKAGE *package;
UINT ret; UINT ret;
if (NULL == szName)
return ERROR_INVALID_PARAMETER;
if (NULL == szValue)
return ERROR_INVALID_PARAMETER;
package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE); package = msihandle2msiinfo( hInstall, MSIHANDLETYPE_PACKAGE);
if( !package) if( !package )
return ERROR_INVALID_HANDLE; return ERROR_INVALID_HANDLE;
ret = MSI_SetPropertyW( package, szName, szValue); ret = MSI_SetPropertyW( package, szName, szValue);
msiobj_release( &package->hdr ); msiobj_release( &package->hdr );
@ -808,17 +803,18 @@ UINT MSI_GetPropertyA(MSIPACKAGE *package, LPCSTR szName,
LPSTR szValueBuf, DWORD* pchValueBuf) LPSTR szValueBuf, DWORD* pchValueBuf)
{ {
MSIRECORD *row; MSIRECORD *row;
UINT rc, len; UINT rc;
LPWSTR szwName; LPWSTR szwName = NULL;
if (*pchValueBuf > 0) if (*pchValueBuf > 0)
szValueBuf[0] = 0; szValueBuf[0] = 0;
len = MultiByteToWideChar( CP_ACP, 0, szName, -1, NULL, 0 ); if( szName )
szwName = HeapAlloc( GetProcessHeap(), 0, len * sizeof(WCHAR) ); {
if (!szwName) szwName = strdupAtoW( szName );
return ERROR_NOT_ENOUGH_MEMORY; if (!szwName)
MultiByteToWideChar( CP_ACP, 0, szName, -1, szwName, len ); return ERROR_NOT_ENOUGH_MEMORY;
}
rc = MSI_GetPropertyRow(package, szwName, &row); rc = MSI_GetPropertyRow(package, szwName, &row);
if (rc == ERROR_SUCCESS) if (rc == ERROR_SUCCESS)

View File

@ -132,16 +132,16 @@ UINT WINAPI MsiPreviewDialogW( MSIHANDLE hPreview, LPCWSTR szDialogName )
UINT WINAPI MsiPreviewDialogA( MSIHANDLE hPreview, LPCSTR szDialogName ) UINT WINAPI MsiPreviewDialogA( MSIHANDLE hPreview, LPCSTR szDialogName )
{ {
UINT r, len; UINT r;
LPWSTR strW = NULL; LPWSTR strW = NULL;
TRACE("%ld %s\n", hPreview, debugstr_a(szDialogName)); TRACE("%ld %s\n", hPreview, debugstr_a(szDialogName));
if( szDialogName ) if( szDialogName )
{ {
len = MultiByteToWideChar( CP_ACP, 0, szDialogName, -1, NULL, 0 ); strW = strdupAtoW( szDialogName );
strW = HeapAlloc( GetProcessHeap(), 0, len*sizeof(WCHAR) ); if( !strW )
MultiByteToWideChar( CP_ACP, 0, szDialogName, -1, strW, len ); return ERROR_OUTOFMEMORY;
} }
r = MsiPreviewDialogW( hPreview, strW ); r = MsiPreviewDialogW( hPreview, strW );
HeapFree( GetProcessHeap(), 0, strW ); HeapFree( GetProcessHeap(), 0, strW );