Commit baea371c authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

msi: Add exception handling around all custom action RPC calls.

parent bfe8510e
......@@ -39,6 +39,7 @@
#include "msipriv.h"
#include "winemsi.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "wine/list.h"
......@@ -858,7 +859,17 @@ MSICONDITION WINAPI MsiEvaluateConditionW( MSIHANDLE hInstall, LPCWSTR szConditi
if (!szCondition)
return MSICONDITION_NONE;
return remote_EvaluateCondition(remote, szCondition);
__TRY
{
ret = remote_EvaluateCondition(remote, szCondition);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return ret;
}
ret = MSI_EvaluateConditionW( package, szCondition );
......
......@@ -76,6 +76,11 @@ void __RPC_USER MIDL_user_free(void __RPC_FAR * ptr)
heap_free(ptr);
}
LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr)
{
return I_RpcExceptionFilter(eptr->ExceptionRecord->ExceptionCode);
}
UINT msi_schedule_action( MSIPACKAGE *package, UINT script, const WCHAR *action )
{
UINT count;
......
......@@ -35,6 +35,7 @@
#include "msipriv.h"
#include "winemsi.h"
#include "wine/exception.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
......@@ -919,7 +920,15 @@ UINT WINAPI MsiFormatRecordW( MSIHANDLE hInstall, MSIHANDLE hRecord,
if ((remote = msi_get_remote(hInstall)))
{
__TRY
{
r = remote_FormatRecord(remote, (struct wire_record *)&record->count, &value);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r)
r = msi_strncpyW(value, -1, szResult, sz);
......@@ -968,7 +977,15 @@ UINT WINAPI MsiFormatRecordA(MSIHANDLE hinst, MSIHANDLE hrec, char *buf, DWORD *
if ((remote = msi_get_remote(hinst)))
{
__TRY
{
r = remote_FormatRecord(remote, (struct wire_record *)&rec->count, &value);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r)
r = msi_strncpyWtoA(value, -1, buf, sz, TRUE);
......
......@@ -36,6 +36,7 @@
#include "winemsi.h"
#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
......@@ -80,7 +81,17 @@ UINT WINAPI MsiDoActionW( MSIHANDLE hInstall, LPCWSTR szAction )
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
return remote_DoAction(remote, szAction);
__TRY
{
ret = remote_DoAction(remote, szAction);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return ret;
}
ret = ACTION_PerformAction(package, szAction);
......@@ -129,7 +140,17 @@ UINT WINAPI MsiSequenceW( MSIHANDLE hInstall, LPCWSTR szTable, INT iSequenceMode
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
return remote_Sequence(remote, szTable, iSequenceMode);
__TRY
{
ret = remote_Sequence(remote, szTable, iSequenceMode);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return ret;
}
ret = MSI_Sequence( package, szTable );
msiobj_release( &package->hdr );
......@@ -257,7 +278,16 @@ UINT WINAPI MsiGetTargetPathA(MSIHANDLE hinst, const char *folder, char *buf, DW
return ERROR_INVALID_HANDLE;
}
__TRY
{
r = remote_GetTargetPath(remote, folderW, &path);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r)
r = msi_strncpyWtoA(path, -1, buf, sz, TRUE);
......@@ -300,7 +330,16 @@ UINT WINAPI MsiGetTargetPathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf,
if (!(remote = msi_get_remote(hinst)))
return ERROR_INVALID_HANDLE;
__TRY
{
r = remote_GetTargetPath(remote, folder, &path);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r)
r = msi_strncpyW(path, -1, buf, sz);
......@@ -396,7 +435,16 @@ UINT WINAPI MsiGetSourcePathA(MSIHANDLE hinst, const char *folder, char *buf, DW
return ERROR_INVALID_HANDLE;
}
__TRY
{
r = remote_GetSourcePath(remote, folderW, &path);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r)
r = msi_strncpyWtoA(path, -1, buf, sz, TRUE);
......@@ -439,7 +487,16 @@ UINT WINAPI MsiGetSourcePathW(MSIHANDLE hinst, const WCHAR *folder, WCHAR *buf,
if (!(remote = msi_get_remote(hinst)))
return ERROR_INVALID_HANDLE;
__TRY
{
r = remote_GetSourcePath(remote, folder, &path);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r)
r = msi_strncpyW(path, -1, buf, sz);
......@@ -560,7 +617,17 @@ UINT WINAPI MsiSetTargetPathW(MSIHANDLE hInstall, LPCWSTR szFolder,
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
return remote_SetTargetPath(remote, szFolder, szFolderPath);
__TRY
{
ret = remote_SetTargetPath(remote, szFolder, szFolderPath);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return ret;
}
ret = MSI_SetTargetPathW( package, szFolder, szFolderPath );
......@@ -616,7 +683,17 @@ BOOL WINAPI MsiGetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode)
if (!(remote = msi_get_remote(hInstall)))
return FALSE;
return remote_GetMode(remote, iRunMode);
__TRY
{
r = remote_GetMode(remote, iRunMode);
}
__EXCEPT(rpc_filter)
{
r = FALSE;
}
__ENDTRY
return r;
}
switch (iRunMode)
......@@ -699,7 +776,17 @@ UINT WINAPI MsiSetMode(MSIHANDLE hInstall, MSIRUNMODE iRunMode, BOOL fState)
if (!(remote = msi_get_remote(hInstall)))
return FALSE;
return remote_SetMode(remote, iRunMode, fState);
__TRY
{
r = remote_SetMode(remote, iRunMode, fState);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
return r;
}
switch (iRunMode)
......@@ -877,7 +964,17 @@ UINT WINAPI MsiSetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
return remote_SetFeatureState(remote, szFeature, iState);
__TRY
{
rc = remote_SetFeatureState(remote, szFeature, iState);
}
__EXCEPT(rpc_filter)
{
rc = GetExceptionCode();
}
__ENDTRY
return rc;
}
rc = MSI_SetFeatureStateW(package,szFeature,iState);
......@@ -1008,11 +1105,17 @@ UINT WINAPI MsiGetFeatureStateW(MSIHANDLE hInstall, LPCWSTR szFeature,
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
/* FIXME: should use SEH */
if (!piInstalled || !piAction)
return RPC_X_NULL_REF_POINTER;
__TRY
{
ret = remote_GetFeatureState(remote, szFeature, piInstalled, piAction);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return remote_GetFeatureState(remote, szFeature, piInstalled, piAction);
return ret;
}
ret = MSI_GetFeatureStateW(package, szFeature, piInstalled, piAction);
......@@ -1123,11 +1226,17 @@ UINT WINAPI MsiGetFeatureCostW(MSIHANDLE hInstall, LPCWSTR szFeature,
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
/* FIXME: should use SEH */
if (!piCost)
return RPC_X_NULL_REF_POINTER;
__TRY
{
ret = remote_GetFeatureCost(remote, szFeature, iCostTree, iState, piCost);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return remote_GetFeatureCost(remote, szFeature, iCostTree, iState, piCost);
return ret;
}
if (!piCost)
......@@ -1370,7 +1479,17 @@ UINT WINAPI MsiSetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent,
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
return remote_SetComponentState(remote, szComponent, iState);
__TRY
{
ret = remote_SetComponentState(remote, szComponent, iState);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return ret;
}
ret = MSI_SetComponentStateW(package, szComponent, iState);
......@@ -1401,11 +1520,17 @@ UINT WINAPI MsiGetComponentStateW(MSIHANDLE hInstall, LPCWSTR szComponent,
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
/* FIXME: should use SEH */
if (!piInstalled || !piAction)
return RPC_X_NULL_REF_POINTER;
__TRY
{
ret = remote_GetComponentState(remote, szComponent, piInstalled, piAction);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return remote_GetComponentState(remote, szComponent, piInstalled, piAction);
return ret;
}
ret = MSI_GetComponentStateW( package, szComponent, piInstalled, piAction);
......@@ -1429,7 +1554,17 @@ LANGID WINAPI MsiGetLanguage(MSIHANDLE hInstall)
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
return remote_GetLanguage(remote);
__TRY
{
langid = remote_GetLanguage(remote);
}
__EXCEPT(rpc_filter)
{
langid = 0;
}
__ENDTRY
return langid;
}
langid = msi_get_property_int( package->db, szProductLanguage, 0 );
......@@ -1478,7 +1613,17 @@ UINT WINAPI MsiSetInstallLevel(MSIHANDLE hInstall, int iInstallLevel)
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
return remote_SetInstallLevel(remote, iInstallLevel);
__TRY
{
r = remote_SetInstallLevel(remote, iInstallLevel);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
return r;
}
r = MSI_SetInstallLevel( package, iInstallLevel );
......
......@@ -47,6 +47,7 @@
#include "msxml2.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
WINE_DEFAULT_DEBUG_CHANNEL(msi);
......@@ -2026,7 +2027,16 @@ UINT WINAPI MsiEnumComponentCostsW( MSIHANDLE handle, LPCWSTR component, DWORD i
if (!(remote = msi_get_remote(handle)))
return ERROR_INVALID_HANDLE;
__TRY
{
r = remote_EnumComponentCosts(remote, component, index, state, buffer, cost, temp);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (r == ERROR_SUCCESS)
{
lstrcpynW(drive, buffer, *buflen);
......
......@@ -741,6 +741,7 @@ UINT msi_strcpy_to_awstring(const WCHAR *, int, awstring *, DWORD *) DECLSPEC_HI
/* msi server interface */
extern MSIHANDLE msi_get_remote(MSIHANDLE handle) DECLSPEC_HIDDEN;
extern LONG WINAPI rpc_filter(EXCEPTION_POINTERS *eptr) DECLSPEC_HIDDEN;
/* handle functions */
extern void *msihandle2msiinfo(MSIHANDLE handle, UINT type) DECLSPEC_HIDDEN;
......
......@@ -26,6 +26,7 @@
#include "winbase.h"
#include "winerror.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "msi.h"
#include "msiquery.h"
......@@ -258,7 +259,16 @@ UINT WINAPI MsiDatabaseOpenViewW(MSIHANDLE hdb,
if (!(remote = msi_get_remote(hdb)))
return ERROR_INVALID_HANDLE;
__TRY
{
ret = remote_DatabaseOpenView(remote, szQuery, &remote_view);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
if (!ret)
*phView = alloc_msi_remote_handle(remote_view);
return ret;
......@@ -397,7 +407,16 @@ UINT WINAPI MsiViewFetch(MSIHANDLE hView, MSIHANDLE *record)
if (!(remote = msi_get_remote(hView)))
return ERROR_INVALID_HANDLE;
__TRY
{
ret = remote_ViewFetch(remote, &wire_rec);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
if (!ret)
{
ret = unmarshal_record(wire_rec, record);
......@@ -447,7 +466,17 @@ UINT WINAPI MsiViewClose(MSIHANDLE hView)
if (!(remote = msi_get_remote(hView)))
return ERROR_INVALID_HANDLE;
return remote_ViewClose(remote);
__TRY
{
ret = remote_ViewClose(remote);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return ret;
}
ret = MSI_ViewClose( query );
......@@ -494,7 +523,15 @@ UINT WINAPI MsiViewExecute(MSIHANDLE hView, MSIHANDLE hRec)
if (!(remote = msi_get_remote(hView)))
return ERROR_INVALID_HANDLE;
__TRY
{
ret = remote_ViewExecute(remote, rec ? (struct wire_record *)&rec->count : NULL);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
if (rec)
msiobj_release(&rec->hdr);
......@@ -611,7 +648,16 @@ UINT WINAPI MsiViewGetColumnInfo(MSIHANDLE hView, MSICOLINFO info, MSIHANDLE *hR
if (!(remote = msi_get_remote(hView)))
return ERROR_INVALID_HANDLE;
__TRY
{
r = remote_ViewGetColumnInfo(remote, info, &wire_rec);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r)
{
r = unmarshal_record(wire_rec, hRec);
......@@ -680,8 +726,17 @@ UINT WINAPI MsiViewModify( MSIHANDLE hView, MSIMODIFY eModifyMode,
if (!(remote = msi_get_remote(hView)))
return ERROR_INVALID_HANDLE;
__TRY
{
r = remote_ViewModify(remote, eModifyMode,
(struct wire_record *)&rec->count, &wire_refreshed);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r && (eModifyMode == MSIMODIFY_REFRESH || eModifyMode == MSIMODIFY_SEEK))
{
r = copy_remote_record(wire_refreshed, hRecord);
......@@ -1004,7 +1059,16 @@ UINT WINAPI MsiDatabaseGetPrimaryKeysW( MSIHANDLE hdb,
if (!(remote = msi_get_remote(hdb)))
return ERROR_INVALID_HANDLE;
__TRY
{
r = remote_DatabaseGetPrimaryKeys(remote, table, &wire_rec);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r)
{
r = unmarshal_record(wire_rec, phRec);
......@@ -1083,7 +1147,17 @@ MSICONDITION WINAPI MsiDatabaseIsTablePersistentW(
if (!(remote = msi_get_remote(hDatabase)))
return MSICONDITION_ERROR;
return remote_DatabaseIsTablePersistent(remote, szTableName);
__TRY
{
r = remote_DatabaseIsTablePersistent(remote, szTableName);
}
__EXCEPT(rpc_filter)
{
r = MSICONDITION_ERROR;
}
__ENDTRY
return r;
}
r = MSI_DatabaseIsTablePersistent( db, szTableName );
......
......@@ -44,6 +44,7 @@
#include "wine/heap.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "msipriv.h"
......@@ -1739,9 +1740,17 @@ MSIHANDLE WINAPI MsiGetActiveDatabase(MSIHANDLE hInstall)
}
else if ((remote = msi_get_remote(hInstall)))
{
handle = remote_GetActiveDatabase(remote);
__TRY
{
handle = remote_GetActiveDatabase(hInstall);
handle = alloc_msi_remote_handle(handle);
}
__EXCEPT(rpc_filter)
{
handle = 0;
}
__ENDTRY
}
return handle;
}
......@@ -2100,7 +2109,15 @@ INT WINAPI MsiProcessMessage( MSIHANDLE hInstall, INSTALLMESSAGE eMessageType,
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
__TRY
{
ret = remote_ProcessMessage(remote, eMessageType, (struct wire_record *)&record->count);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
msiobj_release(&record->hdr);
return ret;
......@@ -2230,7 +2247,17 @@ UINT WINAPI MsiSetPropertyW( MSIHANDLE hInstall, LPCWSTR szName, LPCWSTR szValue
if (!(remote = msi_get_remote(hInstall)))
return ERROR_INVALID_HANDLE;
return remote_SetProperty(remote, szName, szValue);
__TRY
{
ret = remote_SetProperty(remote, szName, szValue);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
return ret;
}
ret = msi_set_property( package->db, szName, szValue, -1 );
......@@ -2407,7 +2434,16 @@ UINT WINAPI MsiGetPropertyA(MSIHANDLE hinst, const char *name, char *buf, DWORD
return ERROR_INVALID_HANDLE;
}
__TRY
{
r = remote_GetProperty(remote, nameW, &value, &len);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
heap_free(nameW);
if (!r)
......@@ -2463,7 +2499,16 @@ UINT WINAPI MsiGetPropertyW(MSIHANDLE hinst, const WCHAR *name, WCHAR *buf, DWOR
if (!(remote = msi_get_remote(hinst)))
return ERROR_INVALID_HANDLE;
__TRY
{
r = remote_GetProperty(remote, name, &value, &len);
}
__EXCEPT(rpc_filter)
{
r = GetExceptionCode();
}
__ENDTRY
if (!r)
{
/* String might contain embedded nulls.
......
......@@ -29,6 +29,7 @@
#include "winnls.h"
#include "shlwapi.h"
#include "wine/debug.h"
#include "wine/exception.h"
#include "wine/unicode.h"
#include "msi.h"
#include "msiquery.h"
......@@ -528,7 +529,16 @@ UINT WINAPI MsiGetSummaryInformationW( MSIHANDLE hDatabase,
if (!(remote = msi_get_remote(hDatabase)))
return ERROR_INVALID_HANDLE;
__TRY
{
ret = remote_DatabaseGetSummaryInformation(remote, uiUpdateCount, &remote_suminfo);
}
__EXCEPT(rpc_filter)
{
ret = GetExceptionCode();
}
__ENDTRY
if (!ret)
*pHandle = alloc_msi_remote_handle(remote_suminfo);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment