internal static uint MsiRecordReadStream(int hRecord, uint iField, byte[] szDataBuf, ref uint cbDataBuf)
 {
     if (!RemotingEnabled || !RemotableNativeMethods.IsRemoteHandle(hRecord))
     {
         return(NativeMethods.MsiRecordReadStream(hRecord, iField, szDataBuf, ref cbDataBuf));
     }
     else
     {
         lock (RemotableNativeMethods.remotingDelegate)
         {
             ClearData(requestBuf);
             unchecked
             {
                 WriteInt(requestBuf, 0, RemotableNativeMethods.GetRemoteHandle(hRecord));
                 WriteInt(requestBuf, 1, (int)iField);
                 WriteInt(requestBuf, 2, (int)cbDataBuf);
                 IntPtr resp;
                 remotingDelegate(RemoteMsiFunctionId.MsiRecordReadStream, requestBuf, out resp);
                 uint ret = (uint)ReadInt(resp, 0);
                 if (ret == 0)
                 {
                     cbDataBuf = (uint)ReadInt(resp, 2);
                     if (cbDataBuf > 0)
                     {
                         RemotableNativeMethods.ReadStream(resp, 1, szDataBuf, (int)cbDataBuf);
                     }
                 }
                 return(ret);
             }
         }
     }
 }