internal static uint MsiRecordSetInteger(int hRecord, uint iField, int iValue)
 {
     if (!RemotingEnabled || !RemotableNativeMethods.IsRemoteHandle(hRecord))
     {
         return(NativeMethods.MsiRecordSetInteger(hRecord, iField, iValue));
     }
     else
     {
         return(RemotableNativeMethods.MsiFunc_III(
                    RemoteMsiFunctionId.MsiRecordSetInteger,
                    RemotableNativeMethods.GetRemoteHandle(hRecord),
                    (int)iField,
                    iValue));
     }
 }
 internal static uint MsiRecordGetFieldCount(int hRecord)
 {
     if (!RemotingEnabled || !RemotableNativeMethods.IsRemoteHandle(hRecord))
     {
         return(NativeMethods.MsiRecordGetFieldCount(hRecord));
     }
     else
     {
         return(RemotableNativeMethods.MsiFunc_III(
                    RemoteMsiFunctionId.MsiRecordGetFieldCount,
                    RemotableNativeMethods.GetRemoteHandle(hRecord),
                    0,
                    0));
     }
 }
 internal static uint MsiVerifyDiskSpace(int hInstall)
 {
     if (!RemotingEnabled || !RemotableNativeMethods.IsRemoteHandle(hInstall))
     {
         return(NativeMethods.MsiVerifyDiskSpace(hInstall));
     }
     else
     {
         return(RemotableNativeMethods.MsiFunc_III(
                    RemoteMsiFunctionId.MsiVerifyDiskSpace,
                    RemotableNativeMethods.GetRemoteHandle(hInstall),
                    0,
                    0));
     }
 }
 internal static uint MsiSetMode(int hInstall, uint iRunMode, bool fState)
 {
     if (!RemotingEnabled || !RemotableNativeMethods.IsRemoteHandle(hInstall))
     {
         return(NativeMethods.MsiSetMode(hInstall, iRunMode, fState));
     }
     else
     {
         return(RemotableNativeMethods.MsiFunc_III(
                    RemoteMsiFunctionId.MsiSetMode,
                    RemotableNativeMethods.GetRemoteHandle(hInstall),
                    (int)iRunMode,
                    fState ? 1 : 0));
     }
 }
 internal static uint MsiSetInstallLevel(int hInstall, int iInstallLevel)
 {
     if (!RemotingEnabled || !RemotableNativeMethods.IsRemoteHandle(hInstall))
     {
         return(NativeMethods.MsiSetInstallLevel(hInstall, iInstallLevel));
     }
     else
     {
         return(RemotableNativeMethods.MsiFunc_III(
                    RemoteMsiFunctionId.MsiSetInstallLevel,
                    RemotableNativeMethods.GetRemoteHandle(hInstall),
                    iInstallLevel,
                    0));
     }
 }
 internal static int MsiGetActiveDatabase(int hInstall)
 {
     if (!RemotingEnabled || !RemotableNativeMethods.IsRemoteHandle(hInstall))
     {
         return(NativeMethods.MsiGetActiveDatabase(hInstall));
     }
     else
     {
         int hDatabase = (int)RemotableNativeMethods.MsiFunc_III(
             RemoteMsiFunctionId.MsiGetActiveDatabase,
             RemotableNativeMethods.GetRemoteHandle(hInstall),
             0,
             0);
         return(RemotableNativeMethods.MakeRemoteHandle(hDatabase));
     }
 }
 internal static int MsiGetLastErrorRecord(int hAny)
 {
     // When remoting is enabled, we might need to create either a local or
     // remote record, depending on the handle it is to have an affinity with.
     // If no affinity handle is specified, create a remote record (the 99% case).
     if (!RemotingEnabled ||
         (hAny != 0 && !RemotableNativeMethods.IsRemoteHandle(hAny)))
     {
         return(NativeMethods.MsiGetLastErrorRecord());
     }
     else
     {
         int hRecord = unchecked ((int)RemotableNativeMethods.MsiFunc_III(
                                      RemoteMsiFunctionId.MsiGetLastErrorRecord, 0, 0, 0));
         return(RemotableNativeMethods.MakeRemoteHandle(hRecord));
     }
 }