Example #1
0
        public Partition EndCreatePartitionMbr(IAsyncResult asyncResult)
        {
            VDS_ASYNC_OUTPUT    vds_async_output;
            PartitionProperties properties;

            this.InitializeComInterfaces();
            try
            {
                uint  num;
                Async async = (Async)asyncResult;
                if (async == null)
                {
                    throw new ArgumentNullException("asyncResult");
                }
                InteropHelpers.QueryInterfaceThrow <IVdsAsync>(async.ComUnknown).Wait(out num, out vds_async_output);
                if (num != 0)
                {
                    throw new VdsException("Create partition failed with the following error code: " + num);
                }
            }
            catch (COMException exception)
            {
                throw new VdsException("The call to IVdsAsync::Wait failed.", exception);
            }
            try
            {
                this.advancedDisk.GetPartitionProperties(vds_async_output.Info.Cp.Offset, out properties);
            }
            catch (COMException exception2)
            {
                throw new VdsException("The call to IVdsAdvancedDisk::GetPartitionProperties failed.", exception2);
            }
            return(new MbrPartition(properties, this.advancedDisk));
        }