void IParseDisplayName.ParseDisplayName(IBindCtx pbc, string pszDisplayName, IntPtr pchEaten, IntPtr ppmkOut)
        {
            if (IntPtr.Zero == ppmkOut)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("ppmkOut");
            }

            System.Runtime.InteropServices.Marshal.WriteIntPtr(ppmkOut, IntPtr.Zero);

            if (IntPtr.Zero == pchEaten)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("pchEaten");
            }

            if (string.IsNullOrEmpty(pszDisplayName))
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("pszDisplayName");
            }


            MonikerUtility.Parse(pszDisplayName, ref PropertyTable);
            ComPlusServiceMonikerTrace.Trace(TraceEventType.Verbose, TraceCode.ComIntegrationServiceMonikerParsed,
                                             SR.TraceCodeComIntegrationServiceMonikerParsed, PropertyTable);

            System.Runtime.InteropServices.Marshal.WriteInt32(pchEaten, pszDisplayName.Length);

            IntPtr ppv = InterfaceHelper.GetInterfacePtrForObject(typeof(IMoniker).GUID, this);

            System.Runtime.InteropServices.Marshal.WriteIntPtr(ppmkOut, ppv);
        }
Ejemplo n.º 2
0
        public void CreateVoter(
            ITransactionVoterNotifyAsync2 voterNotification,
            IntPtr voterBallot)
        {
            if (IntPtr.Zero == voterBallot)
            {
                throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("voterBallot");
            }

            lock (this.syncRoot)
            {
                if (this.currentVoter != null)
                {
                    // transactions require failfasts to prevent corruption
                    DiagnosticUtility.FailFast("Assumption: proxy only needs one voter");
                }

                VoterBallot voter = new VoterBallot(voterNotification, this);
                if (this.currentTransaction != null)
                {
                    voter.SetTransaction(this.currentTransaction);
                }

                this.currentVoter = voter;

                IntPtr ppv = InterfaceHelper.GetInterfacePtrForObject(typeof(ITransactionVoterBallotAsync2).GUID, this.currentVoter);

                Marshal.WriteIntPtr(voterBallot, ppv);
            }
        }
 public void CreateVoter(ITransactionVoterNotifyAsync2 voterNotification, IntPtr voterBallot)
 {
     if (IntPtr.Zero == voterBallot)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("voterBallot");
     }
     lock (this.syncRoot)
     {
         if (this.currentVoter != null)
         {
             DiagnosticUtility.FailFast("Assumption: proxy only needs one voter");
         }
         VoterBallot ballot = new VoterBallot(voterNotification, this);
         if (this.currentTransaction != null)
         {
             ballot.SetTransaction(this.currentTransaction);
         }
         this.currentVoter = ballot;
         IntPtr interfacePtrForObject = InterfaceHelper.GetInterfacePtrForObject(typeof(ITransactionVoterBallotAsync2).GUID, this.currentVoter);
         Marshal.WriteIntPtr(voterBallot, interfacePtrForObject);
     }
 }