Solved

Read and Write files from wpd

Posted on 2011-03-02
45
7,585 Views
Last Modified: 2013-12-17
I'm working on  application that downloading mp3 files to mp3 player. The SanDisk doesn't have a drive letter and uses MTP for file transfer. i tryed with a  sample of connecting to the device at http://wpdtempsensor.codeplex.com/(i transalsted it to c#), but in that sample i figured out how to connect the device,
but once connected, I can't figure out how to actually copy files / create folders on the device.
I would appriccate your answer!
thanx;
0
Comment
Question by:mb1111
  • 25
  • 13
  • +4
45 Comments
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35030970
That is a great question, but unfortunately I don't have much experience with the Windows Portable Device API.  I do, however, have an interest in learning.  It certainly would be good to have a managed WPD API, but I haven't found one yet.

I see where you connect to a device:

     pPortableDevice.Open(PnPDeviceID, pValues)

Open in new window


and, I see the RetrieveTemp method, where you can get a value from the temperature sensor, referenced in the article.

How much do you know about the WPD API?  I don't really want to tell you anything that you already know.

Windows Portable Devices Automation API
http://msdn.microsoft.com/en-us/windows/hardware/gg463548

I believe that what you are looking for is addressed here:

Setting WPD properties in C#
http://blogs.msdn.com/b/dimeby8/archive/2006/12/11/setting-wpd-properties-in-c.aspx

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35030991
I imagine you came across posts like this:

Official WPD (Windows Portable Devices) managed wrapper for .NET
http://connect.microsoft.com/VisualStudio/feedback/details/530040/official-wpd-windows-portable-devices-managed-wrapper-for-net

Thanks again for taking the time to report this. Unfortunately, we won't be able to get to this for the next release of .NET
0
 

Author Comment

by:mb1111
ID: 35054193
thank you for posting your answer, I appricate.
I tried out your link, but my problem is before that;
that link has a link to a previous article of getting propeties'
see here: http://blogs.msdn.com/b/dimeby8/archive/2006/12/11/wpd-property-retrieval-in-c.aspx
my problem is in this line:
pProperties.GetValues(objectID, null, out pPropValues);

Open in new window

the exception that I get is:  "The value was out of range",
I think (but I'm not sure) that I just have to get the number guid of my device, could you please help me??
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35148812
I am having difficulty working with my WPD on my Windows 7 home machine.  I wonder if it is because I upgraded to Windows 7 SP1.  It doesn't recognize any of my devices (camera, satellite radio) as WPD devices.
0
 

Author Comment

by:mb1111
ID: 35154290
How does it recognize? as a normal usb with a drive letter?
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35155174
No, the operating system sees the devices as WPD, but my code won't enumerate them.

        public static void EnumerateDevices()
        {
            
            uint deviceCount = 0;
            PortableDeviceManager manager = new PortableDeviceManager();

            manager.RefreshDeviceList();

            manager.GetPrivateDevices(null, ref deviceCount);

            manager.GetDevices(null, ref deviceCount)

            string deviceIdDescriptionList = new string(' ', (int)deviceCount);
            manager.GetDevices(ref deviceIdDescriptionList, ref deviceCount);
        }

Open in new window

0
 

Author Comment

by:mb1111
ID: 35155585
Try this code:
          uint deviceCount = 0;
            PortableDeviceManager manager = new PortableDeviceManager();

            manager.RefreshDeviceList();
   

            manager.GetDevices(null, ref deviceCount)
            string strVal = string.Empty;
            string [] deviceIdDescriptionList= new string [deviceCount ];
            manager.GetDevices(ref deviceIdDescriptionList[0], ref deviceCount);    
           if (deviceCount  > 0)
            {
                string[] deviceIDs = new string[deviceCount ];
                manager.GetDevices(ref deviceIDs[0], ref deviceCount );
                for (int ndxDevices = 0; ndxDevices < cDevices; ndxDevices++)
                {
                    MessageBox.Show("Device[{0}]: " +
                              ndxDevices + 1 + "          " + deviceIDs[0].ToString());
                    uint nameLength = 30;
                    ushort[] nameBuffer = new ushort[nameLength];
                    devMgr.GetDeviceFriendlyName(deviceIDs[0] , ref nameBuffer[0], ref nameLength);
                                
                    //convert to string
                    string friendlyName = "";
                    foreach (ushort letter in nameBuffer)
                        if (letter != 0) friendlyName += (char)letter;
                    MessageBox.Show("FriendlyName is " + friendlyName);
}

Open in new window

0
 

Author Comment

by:mb1111
ID: 35155594
I'm sorry
but one line you have to delete:
  manager.GetDevices(null, ref deviceCount)

Open in new window

and tryit now again.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35161774
Thanks for trying, but I have the same results (d'oh).  I have interest in this topic, but I don't have the experience to determine if I am working with the device correctly.  I love these kind of questions, since they force me to learn something new and cool, and then quickly find a resolution to your problem.


Snapshot.png
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35161939
Oh, man, it was a simple misunderstanding that was pretty easy to fix.

I found the blog article that shows that you need to set deviceCount to 1, and not 0 like I had (smackin' head).

        //  http://blogs.msdn.com/b/dimeby8/archive/2006/12/05/enumerating-wpd-devices-in-c.aspx
        public static Dictionary<string, string> EnumerateDevices()
        {

            uint deviceCount = 1;
            PortableDeviceManager manager = new PortableDeviceManager();

            string strVal = string.Empty;
            string[] deviceIdDescriptionList = new string[1];

            Dictionary<string, string> deviceMatrix = new Dictionary<string, string>();

            manager.GetDevices(ref deviceIdDescriptionList[0], ref deviceCount);
            if (deviceCount > 0)
            {
                foreach (string deviceId in deviceIdDescriptionList)
                {
                    uint nameLength = 30;
                    ushort[] nameBuffer = new ushort[nameLength];
                    manager.GetDeviceFriendlyName(deviceId, ref nameBuffer[0], ref nameLength);

                    // Convert to string
                    StringBuilder friendlyName = new StringBuilder((int)nameLength);
                    foreach (ushort letter in nameBuffer)
                    {
                        if (letter != 0)
                        {
                            friendlyName.Append((char)letter);
                        }
                    }

                    deviceMatrix.Add(deviceId, friendlyName.ToString());
                }
            }

            return deviceMatrix;
        }

Open in new window

0
 

Author Comment

by:mb1111
ID: 35187779
Hi TheLearnerOne;
have you succeded to write commands to your device (like create folder, copy file etc.)???????
I would pleasure to get your answer!!!!!
0
 

Author Comment

by:mb1111
ID: 35188363
Hi;
can you look at this code and tell me why I'm getting an error message:
  public System.Runtime.InteropServices.ComTypes.IStream GetStream(PortableDevice pPort, string objectId, string freindly)
        {
            //need a contents object to get the propeties
            IPortableDeviceContent content;
            pPort.Content(out content);
            //get transfer interface to this device
            IPortableDeviceResources resources;
            content.Transfer(out resources);
            PortableDeviceApiLib.IStream wpdStream;
            uint optimalTransferSize = 0;
            resources.GetStream(objectId, ref PortableDevicePKeys.WPD_RESOURCE_DEFAULT, 0, ref optimalTransferSize, out wpdStream);
            //convert to a useful stream object
            System.Runtime.InteropServices.ComTypes.IStream sourceStream = (System.Runtime.InteropServices.ComTypes.IStream)wpdStream;
            return sourceStream;
        }

Open in new window

The eror message that I get:
"The value was out of range"
why???????????
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35189146
1) WPD takes a lot of time, since the COM API is messy when working from a managed system like C#.  

2) I  found out that the TLB importer doesn't generate the wrapper class correctly when adding the reference to the COM library.  

3) I am using 2010, which has the concept of embedded interop, which has issues with some of the code that I have tried.

4) There is a very large ocean of GUIDs and _tagpropertykey instances, that I collected from various sources.

5) I am now able to enumerate devices, connect to a device, and determine device capabilities

6) I haven't been able to find that magic piece, yet, that sends commands to the device, but I am still working on this.

7) All this is getting done in my spare time, which I don't have very much of.
0
 

Author Comment

by:mb1111
ID: 35190378
Thank you very much for your answer!
can you send me the code how to determine device capabilities, and in where did you find metarial about wpd?
and again thanx tons!!!!!
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35195056
What I have is not really for public consumption, yet, but this is what I have:

1) Device managed wrapper class

2) PropertyKey _tagpropertykey definition class

3) DeviceGuid GUID definition class

4) PropVariant structure

5) MTP _tagpropertykey and GUID definition class

6) DeviceManager
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35195062
Device.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Text;
using PortableDeviceApiLib;
using Types = PortableDeviceTypesLib;

namespace Wpd
{
    public class Device
    {

        private PortableDevice _portableDevice;

        private IPortableDeviceCapabilities _capabilities;

        public List<string> CommandList { get; private set; }

        public List<KeyValuePair<string, int>> ObjectIdList { get; private set; }

        public string DeviceId { get; private set; }
        public string ClientName { get; private set; }

        public Device(string deviceId, string clientName)
        {
            this.DeviceId = deviceId;
            this.ClientName = clientName;

            this.OpenDevice();

            _portableDevice.Capabilities(out _capabilities);
        }

        #region Public methods

        public void DisplayProperties(string objectID)
        {
            //
            // Retrieve IPortableDeviceContent interface required to
            // obtain the IPortableDeviceProperties interface
            //
            IPortableDeviceContent pContent;
            _portableDevice.Content(out pContent);

            //
            // Retrieve IPortableDeviceProperties interface required
            // to get all the properties
            //
            IPortableDeviceProperties pProperties;
            pContent.Properties(out pProperties);

            //
            // Call the GetValues API, we specify null to indicate we
            // want to retrieve all properties
            //
            IPortableDeviceValues pPropValues;
            pProperties.GetValues(objectID, null, out pPropValues);

            //
            // Get count of properties
            //
            uint count = 0;
            pPropValues.GetCount(ref count);

            for (uint i = 0; i < count; i++)
            {
                //
                // Retrieve the property at index 'i'
                //
                _tagpropertykey propertyKey = new _tagpropertykey();
                tag_inner_PROPVARIANT propertyValue = new tag_inner_PROPVARIANT();
                pPropValues.GetAt(i, ref propertyKey, ref propertyValue);

                PropVariant value = TagInnerPropVariantToPropVariant(propertyValue);

                //
                // Display the property if it a string (VT_LPWSTR is decimal 31)
                //
                if (value.VariantType == 31)
                {
                    Console.WriteLine("{0}: Value is \"{1}\"",
                        (i + 1).ToString(), Marshal.PtrToStringUni(value.PointerValue));
                }
                else
                {
                    Console.WriteLine("{0}: Vartype is {1}",
                        (i + 1).ToString(), value.VariantType.ToString());
                }
            }
        }

        public void GetFunctionalCategories()
        {
            IPortableDevicePropVariantCollection collection;
            _capabilities.GetFunctionalCategories(out collection);

            uint count = 0;
            collection.GetCount(ref count);

            for (int i = 0; i < count; i++)
            {
                tag_inner_PROPVARIANT value = default(tag_inner_PROPVARIANT);
                collection.GetAt((uint)i, ref value);

                PropVariant variant = TagInnerPropVariantToPropVariant(value);
            }
        }

        public void GetSupportedCommands()
        {
            IPortableDeviceKeyCollection commands;
            _capabilities.GetSupportedCommands(out commands);

            uint count = 0;
            commands.GetCount(ref count);

            Dictionary<Guid, string> guidList = DeviceGuid.GuidList;
            Dictionary<string, _tagpropertykey> propertyList = PropertyKey.PropertyKeyList;

            List<Guid> unknownList = new List<Guid>();

            this.CommandList = new List<string>();

            for (int i = 0; i < count; i++)
            {
                _tagpropertykey key = default(_tagpropertykey);
                commands.GetAt((uint)i, ref key);

                Guid guid = key.fmtid;

                string capability = "";

                if (guidList.ContainsKey(guid))
                {
                    capability = guidList[guid];
                }
                else
                {
                    KeyValuePair<string, _tagpropertykey> value = propertyList.Where(w => w.Value.fmtid == guid).FirstOrDefault();

                    if (!value.Equals(default(KeyValuePair<string, _tagpropertykey>)))
                    {
                        capability = value.Key;
                    }
                    else
                    {
                        unknownList.Add(guid);
                    }
                }

                if (!string.IsNullOrWhiteSpace(capability) && !this.CommandList.Contains(capability))
                {
                    this.CommandList.Add(capability);
                }
            }
        }

        public string[] GetAllObjectHandles()
        {

            List<string> tmpHandles = new List<string>();

            try
            {

                IPortableDeviceValues pParameters = (IPortableDeviceValues)new PortableDeviceTypesLib.PortableDeviceValues();
                IPortableDeviceValues pResults = null;

                pParameters.SetGuidValue(ref  Mtp.WPD_COMMAND_MTP_EXT_EXECUTE_COMMAND_WITH_DATA_TO_READ, ref DeviceGuid.WPD_PROPERTY_COMMON_COMMAND_CATEGORY);
                pParameters.SetUnsignedIntegerValue(ref Mtp.WPD_COMMAND_MTP_EXT_EXECUTE_COMMAND_WITH_DATA_TO_READ, PropertyKey.WPD_PROPERTY_COMMON_COMMAND_ID.pid);
                pParameters.SetUnsignedIntegerValue(Mtp.WPD_PROPERTY_MTP_EXT_OPERATION_CODE, 0x1007);

                Types.PortableDevicePropVariantCollection pSubValues = new PortableDeviceTypesLib.PortableDevicePropVariantCollection();

                this.AddSubValue(pSubValues, variantType: 19, longValue: 0xffffffff);
                this.AddSubValue(pSubValues, variantType: 19, longValue: 0x0);
                this.AddSubValue(pSubValues, variantType: 19, longValue: 0x0);

                pParameters.SetIPortableDevicePropVariantCollectionValue(Mtp.WPD_PROPERTY_MTP_EXT_OPERATION_PARAMS,
                    (IPortableDevicePropVariantCollection)pSubValues);

                _portableDevice.SendCommand(0, pParameters, out pResults);

                uint pCelt = 0;
                pResults.GetCount(pCelt);

                if (pCelt <= 1)
                {
                    return tmpHandles.ToArray();
                }

                uint tmpBufferSize = 0;
                uint tmpTransferSize = 0;
                string tmpTransferContext = string.Empty;
                {
                    pResults.GetStringValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_CONTEXT, out tmpTransferContext);
                    pResults.GetUnsignedIntegerValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_TOTAL_DATA_SIZE, out tmpBufferSize);
                    pResults.GetUnsignedIntegerValue(ref Mtp.WPD_PROPERTY_MTP_EXT_OPTIMAL_TRANSFER_BUFFER_SIZE, out tmpTransferSize);

                    try
                    {
                        int pValue;
                        pResults.GetErrorValue(PropertyKey.WPD_PROPERTY_COMMON_HRESULT, out pValue);
                    }
                    catch
                    {
                    }
                }

                pParameters.Clear();
                pResults.Clear();

                byte[] tmpData = new byte[(int)tmpTransferSize];

                pParameters.SetGuidValue(Mtp.WPD_COMMAND_MTP_EXT_READ_DATA, DeviceGuid.WPD_PROPERTY_COMMON_COMMAND_CATEGORY);
                pParameters.SetUnsignedIntegerValue(ref Mtp.WPD_COMMAND_MTP_EXT_READ_DATA, PropertyKey.WPD_PROPERTY_COMMON_COMMAND_ID.pid);
                pParameters.SetStringValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_CONTEXT, tmpTransferContext);
                pParameters.SetBufferValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_DATA, ref tmpData[0], (uint)tmpBufferSize);
                pParameters.SetUnsignedIntegerValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_NUM_BYTES_TO_READ, (uint)tmpBufferSize);

                _portableDevice.SendCommand(0, pParameters, out pResults);

                ulong[] pbBufferOut = new ulong[(int)tmpTransferSize];

                uint cbBytesRead = 0;

                IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf((int)(pbBufferOut[0]) * tmpTransferSize));

                pResults.GetBufferValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_DATA, ptr, out cbBytesRead);

                try
                {
                    int pValue = 0;
                    pResults.GetErrorValue(PropertyKey.WPD_PROPERTY_COMMON_HRESULT, out pValue);
                }
                catch
                {
                }

                byte[] newBuffer = new byte[(int)cbBytesRead];

                IntPtr tmpPtr = new IntPtr((long)pbBufferOut[0]);

                string tmpString = string.Empty;

                for (int i = 0; i <= newBuffer.Length - 1; i += 4)
                {
                    string tmpObjectHandle = "o" + Convert.ToString(Marshal.ReadInt32(tmpPtr, 8 + i), 16).ToUpper();
                    tmpHandles.Add(tmpObjectHandle);
                }

                pParameters.Clear();
                pResults.Clear();

                {
                    pParameters.SetGuidValue(ref Mtp.WPD_COMMAND_MTP_EXT_END_DATA_TRANSFER, ref DeviceGuid.WPD_PROPERTY_COMMON_COMMAND_CATEGORY);
                    pParameters.SetUnsignedIntegerValue(ref Mtp.WPD_COMMAND_MTP_EXT_END_DATA_TRANSFER, PropertyKey.WPD_PROPERTY_COMMON_COMMAND_ID.pid);
                    pParameters.SetStringValue(Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_CONTEXT, tmpTransferContext);
                }

                _portableDevice.SendCommand(0, pParameters, out pResults);

                try
                {
                    int tmpResult = 0;

                    pResults.GetErrorValue(ref PropertyKey.WPD_PROPERTY_COMMON_HRESULT, out tmpResult);
                }
                catch
                {
                }
                Marshal.FreeHGlobal(tmpPtr);

            }

            catch (Exception ex)
            {
            }
            return tmpHandles.ToArray();
        }

        public string[] GetObjectHandles(string parentObjectId)
        {
            IEnumPortableDeviceObjectIDs pEnum = null;

            string[] tmpIds = new string[999];

            uint fetchCount = 0;

            try
            {

                IPortableDeviceContent pContent;
                _portableDevice.Content(out pContent);

                IPortableDeviceValues pFilter = null;
                pContent.EnumObjects(0, parentObjectId, pFilter, out pEnum);

                pEnum.Next((uint)999, out tmpIds[0], ref fetchCount);

                Array.Resize(ref tmpIds, (int)fetchCount);
            }
            catch
            {
            }

            //Place error handling code here... 

            return tmpIds;

        }

        public void StartEnumerate()
        {
            //
            // Get content interface required to enumerate
            //
            IPortableDeviceContent pContent;
            _portableDevice.Content(out pContent);

            ObjectIdList = new List<KeyValuePair<string, int>>();

            Enumerate(ref pContent, "DEVICE", 1);
        }

        #endregion

        #region Public static methods

        public static void SetStringValue(PortableDevice pPortableDevice, string objectID, ref _tagpropertykey propKey, string newValue)
        {
            //
            // Retrieve IPortableDeviceContent interface required to
            // obtain the IPortableDeviceProperties interface
            //
            IPortableDeviceContent pContent;
            pPortableDevice.Content(out pContent);

            //
            // Retrieve IPortableDeviceProperties interface required
            // to get all the properties
            //
            IPortableDeviceProperties pProperties;
            pContent.Properties(out pProperties);

            //
            // Create the Values collection to hold the value to be set
            //
            IPortableDeviceValues pSetValues = (IPortableDeviceValues)new Types.PortableDeviceValues();

            //
            // Use the C# PropVariant definition to set the string value
            //
            PropVariant pvSet = new PropVariant();
            pvSet.VariantType = 31; // VT_LPWSTR
            pvSet.PointerValue = Marshal.StringToCoTaskMemUni(newValue);

            //
            // Marshal our definition into a pointer
            //
            IntPtr ptrValue = Marshal.AllocHGlobal(Marshal.SizeOf(pvSet));
            Marshal.StructureToPtr(pvSet, ptrValue, false);

            //
            // Marshal pointer into the interop PROPVARIANT 
            //
            tag_inner_PROPVARIANT ipSet =
              (tag_inner_PROPVARIANT)Marshal.PtrToStructure(ptrValue, typeof(tag_inner_PROPVARIANT));

            //
            // Call the SetValues API to set the specified property
            //
            pSetValues.SetValue(ref propKey, ref ipSet);

            IPortableDeviceValues pResults;
            pProperties.SetValues(objectID, pSetValues, out pResults);
        }

        public static tag_inner_PROPVARIANT PropVariantToTagInnerPropVariant()
        {
            PropVariant propVariant = new PropVariant();

            IntPtr pointer = Marshal.AllocHGlobal(Marshal.SizeOf(propVariant));
            Marshal.StructureToPtr(propVariant, pointer, fDeleteOld: false);

            return (tag_inner_PROPVARIANT)Marshal.PtrToStructure(pointer, typeof(tag_inner_PROPVARIANT));
        }

        public static PropVariant TagInnerPropVariantToPropVariant(tag_inner_PROPVARIANT tagInnerPropVariant)
        {
            IntPtr pointer = Marshal.AllocHGlobal(Marshal.SizeOf(tagInnerPropVariant));
            Marshal.StructureToPtr(tagInnerPropVariant, pointer, fDeleteOld: false);

            return (PropVariant)Marshal.PtrToStructure(pointer, typeof(PropVariant));
        }

        public static tag_inner_PROPVARIANT StringToPropVariant(string value)
        {
            // We'll use an IPortableDeviceValues object to transform the string into a PROPVARIANT
            IPortableDeviceValues deviceValueCollection = (IPortableDeviceValues)new PortableDeviceTypesLib.PortableDeviceValues();

            tag_inner_PROPVARIANT tagInnerPropVariant = default(tag_inner_PROPVARIANT);
            // Insert the string value into the IPortableDeviceValues object
            // using the SetStringValue method
            deviceValueCollection.SetStringValue(ref PropertyKey.WPD_OBJECT_ID, value);

            // Extract the string into a PROPVARIANT by using the GetValue method.
            deviceValueCollection.GetValue(ref PropertyKey.WPD_OBJECT_ID, out tagInnerPropVariant);

            return tagInnerPropVariant;
        }

        #endregion

        #region Private methods

        private void AddSubValue(Types.PortableDevicePropVariantCollection subValueCollection, short variantType, long longValue)
        {
            PropVariant propVariant = new PropVariant()
            {
                VariantType = variantType,
                LongValue = longValue,
            };

            IntPtr pointer = Marshal.AllocHGlobal(Marshal.SizeOf(propVariant));

            Marshal.StructureToPtr(propVariant, pointer, false);

            Types.tag_inner_PROPVARIANT tagInnerPropVariant = (Types.tag_inner_PROPVARIANT)Marshal.PtrToStructure(pointer,
                typeof(Types.tag_inner_PROPVARIANT));
            subValueCollection.Add(ref tagInnerPropVariant);
        }

        private void Enumerate(ref IPortableDeviceContent content, string parentID, int level)
        {
            //
            // Enumerate children (if any)
            //
            IEnumPortableDeviceObjectIDs pEnum;
            content.EnumObjects(0, parentID, null, out pEnum);

            this.ObjectIdList.Add(new KeyValuePair<string, int>(parentID, level));

            uint fetchCount = 0;
            do
            {
                string objectID;
                pEnum.Next(1, out objectID, ref fetchCount);

                if (fetchCount > 0)
                {
                    //
                    // Recurse into children
                    //
                    Enumerate(ref content, objectID, level + 1);
                }
            } while (fetchCount > 0);
        }

        private void OpenDevice()
        {
            _portableDevice = new PortableDevice();
            IPortableDeviceValues clientInfo = (IPortableDeviceValues)new Types.PortableDeviceValues();

            clientInfo.SetStringValue(PropertyKey.WPD_CLIENT_NAME, this.ClientName);

            Version version = Assembly.GetExecutingAssembly().GetName().Version;
            clientInfo.SetUnsignedIntegerValue(PropertyKey.WPD_CLIENT_MAJOR_VERSION, (uint)version.Major);
            clientInfo.SetUnsignedIntegerValue(PropertyKey.WPD_CLIENT_MINOR_VERSION, (uint)version.Minor);
            clientInfo.SetUnsignedIntegerValue(PropertyKey.WPD_CLIENT_REVISION, (uint)version.Revision);

            _portableDevice.Open(this.DeviceId, clientInfo);
        }

        #endregion

    }
}

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35195066
PropertyKey.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using PortableDeviceApiLib;

namespace Wpd
{
    internal static class PropertyKey
    {

        static PropertyKey()
        {
            GetPropertyKeyList();
        }

        public static Dictionary<string, _tagpropertykey> PropertyKeyList { get; private set; }

        private static void GetPropertyKeyList()
        {
            List<FieldInfo> fieldList = typeof(PropertyKey).GetFields(BindingFlags.NonPublic | BindingFlags.Static).ToList();

            PropertyKeyList = new Dictionary<string, _tagpropertykey>();

            foreach (FieldInfo field in fieldList)
            {
                var key = field.GetValue(field);

                if (key is _tagpropertykey)
                {
                    PropertyKeyList.Add(field.Name, (_tagpropertykey)key);
                }
            }
        }

        internal static _tagpropertykey WPD_API_OPTION_IOCTL_ACCESS = new _tagpropertykey() { fmtid = new Guid("10e54a3e-052d-4777-a13c-de7614be2bc4"), pid = 3};
        internal static _tagpropertykey WPD_API_OPTION_USE_CLEAR_DATA_STREAM = new _tagpropertykey() { fmtid = new Guid("10e54a3e-052d-4777-a13c-de7614be2bc4"), pid = 2};
        internal static _tagpropertykey WPD_APPOINTMENT_ACCEPTED_ATTENDEES = new _tagpropertykey() { fmtid = new Guid("f99efd03-431d-40d8-a1c9-4e220d9c88d3"), pid = 10};
        internal static _tagpropertykey WPD_APPOINTMENT_DECLINED_ATTENDEES = new _tagpropertykey() { fmtid = new Guid("f99efd03-431d-40d8-a1c9-4e220d9c88d3"), pid = 13};
        internal static _tagpropertykey WPD_APPOINTMENT_LOCATION = new _tagpropertykey() { fmtid = new Guid("f99efd03-431d-40d8-a1c9-4e220d9c88d3"), pid = 3};
        internal static _tagpropertykey WPD_APPOINTMENT_OPTIONAL_ATTENDEES = new _tagpropertykey() { fmtid = new Guid("f99efd03-431d-40d8-a1c9-4e220d9c88d3"), pid = 9};
        internal static _tagpropertykey WPD_APPOINTMENT_REQUIRED_ATTENDEES = new _tagpropertykey() { fmtid = new Guid("f99efd03-431d-40d8-a1c9-4e220d9c88d3"), pid = 8};
        internal static _tagpropertykey WPD_APPOINTMENT_RESOURCES = new _tagpropertykey() { fmtid = new Guid("f99efd03-431d-40d8-a1c9-4e220d9c88d3"), pid = 11};
        internal static _tagpropertykey WPD_APPOINTMENT_TENTATIVE_ATTENDEES = new _tagpropertykey() { fmtid = new Guid("f99efd03-431d-40d8-a1c9-4e220d9c88d3"), pid = 12};
        internal static _tagpropertykey WPD_APPOINTMENT_TYPE = new _tagpropertykey() { fmtid = new Guid("f99efd03-431d-40d8-a1c9-4e220d9c88d3"), pid = 7};
        internal static _tagpropertykey WPD_AUDIO_BIT_DEPTH = new _tagpropertykey() { fmtid = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6"), pid = 12};
        internal static _tagpropertykey WPD_AUDIO_BITRATE = new _tagpropertykey() { fmtid = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6"), pid = 9};
        internal static _tagpropertykey WPD_AUDIO_BLOCK_ALIGNMENT = new _tagpropertykey() { fmtid = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6"), pid = 13};
        internal static _tagpropertykey WPD_AUDIO_CHANNEL_COUNT = new _tagpropertykey() { fmtid = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6"), pid = 10};
        internal static _tagpropertykey WPD_AUDIO_FORMAT_CODE = new _tagpropertykey() { fmtid = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6"), pid = 11};
        internal static _tagpropertykey WPD_CLASS_EXTENSION_OPTIONS_DEVICE_IDENTIFICATION_VALUES = new _tagpropertykey() { fmtid = new Guid("3e3595da-4d71-49fe-a0b4-d4406c3ae93f"), pid = 3};
        internal static _tagpropertykey WPD_CLASS_EXTENSION_OPTIONS_DONT_REGISTER_WPD_DEVICE_INTERFACE = new _tagpropertykey() { fmtid = new Guid("6309ffef-a87c-4ca7-8434-797576e40a96"), pid = 3};
        internal static _tagpropertykey WPD_CLASS_EXTENSION_OPTIONS_MULTITRANSPORT_MODE = new _tagpropertykey() { fmtid = new Guid("3e3595da-4d71-49fe-a0b4-d4406c3ae93f"), pid = 2};
        internal static _tagpropertykey WPD_CLASS_EXTENSION_OPTIONS_REGISTER_WPD_PRIVATE_DEVICE_INTERFACE = new _tagpropertykey() { fmtid = new Guid("6309ffef-a87c-4ca7-8434-797576e40a96"), pid = 4};
        internal static _tagpropertykey WPD_CLASS_EXTENSION_OPTIONS_SUPPORTED_CONTENT_TYPES = new _tagpropertykey() { fmtid = new Guid("6309ffef-a87c-4ca7-8434-797576e40a96"), pid = 2};
        internal static _tagpropertykey WPD_CLASS_EXTENSION_OPTIONS_TRANSPORT_BANDWIDTH = new _tagpropertykey() { fmtid = new Guid("3e3595da-4d71-49fe-a0b4-d4406c3ae93f"), pid = 4};
        internal static _tagpropertykey WPD_CLIENT_DESIRED_ACCESS = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 9};
        internal static _tagpropertykey WPD_CLIENT_EVENT_COOKIE = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 11};
        internal static _tagpropertykey WPD_CLIENT_MAJOR_VERSION = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 3};
        internal static _tagpropertykey WPD_CLIENT_MINOR_VERSION = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 4};
        internal static _tagpropertykey WPD_CLIENT_NAME = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 2};
        internal static _tagpropertykey WPD_CLIENT_REVISION = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 5};
        internal static _tagpropertykey WPD_CLIENT_SECURITY_QUALITY_OF_SERVICE = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 8};
        internal static _tagpropertykey WPD_CLIENT_SHARE_MODE = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 10};
        internal static _tagpropertykey WPD_CLIENT_WMDRM_APPLICATION_CERTIFICATE = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 7};
        internal static _tagpropertykey WPD_CLIENT_WMDRM_APPLICATION_PRIVATE_KEY = new _tagpropertykey() { fmtid = new Guid("204d9f0c-2292-4080-9f42-40664e70f859"), pid = 6};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_COMMAND_OPTIONS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_EVENT_OPTIONS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 11};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_FIXED_PROPERTY_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 9};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_FUNCTIONAL_OBJECTS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 5};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_COMMANDS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FUNCTIONAL_CATEGORIES = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_CONTENT_TYPES = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 6};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMATS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 7};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 8};
        internal static _tagpropertykey WPD_COMMAND_CAPABILITIES_GET_SUPPORTED_EVENTS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 10};
        internal static _tagpropertykey WPD_COMMAND_CLASS_EXTENSION_REGISTER_SERVICE_INTERFACES = new _tagpropertykey() { fmtid = new Guid("7f0779b5-fa2b-4766-9cb2-f73ba30b6758"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_CLASS_EXTENSION_UNREGISTER_SERVICE_INTERFACES = new _tagpropertykey() { fmtid = new Guid("7f0779b5-fa2b-4766-9cb2-f73ba30b6758"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_CLASS_EXTENSION_WRITE_DEVICE_INFORMATION = new _tagpropertykey() { fmtid = new Guid("33fb0d11-64a3-4fac-b4c7-3dfeaa99b051"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_COMMIT_KEYPAIR = new _tagpropertykey() { fmtid = new Guid("78f9c6fc-79b8-473c-9060-6bd23dd072c4"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_COMMON_GET_OBJECT_IDS_FROM_PERSISTENT_UNIQUE_IDS = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_COMMON_RESET_DEVICE = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_COMMON_SAVE_CLIENT_INFORMATION = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_DEVICE_HINTS_GET_CONTENT_LOCATION = new _tagpropertykey() { fmtid = new Guid("0d5fb92b-cb46-4c4f-8343-0bc3d3f17c84"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_GENERATE_KEYPAIR = new _tagpropertykey() { fmtid = new Guid("78f9c6fc-79b8-473c-9060-6bd23dd072c4"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_MEDIA_CAPTURE_PAUSE = new _tagpropertykey() { fmtid = new Guid("59b433ba-fe44-4d8d-808c-6bcb9b0f15e8"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_MEDIA_CAPTURE_START = new _tagpropertykey() { fmtid = new Guid("59b433ba-fe44-4d8d-808c-6bcb9b0f15e8"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_MEDIA_CAPTURE_STOP = new _tagpropertykey() { fmtid = new Guid("59b433ba-fe44-4d8d-808c-6bcb9b0f15e8"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_ENUMERATION_END_FIND = new _tagpropertykey() { fmtid = new Guid("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_ENUMERATION_FIND_NEXT = new _tagpropertykey() { fmtid = new Guid("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_ENUMERATION_START_FIND = new _tagpropertykey() { fmtid = new Guid("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_MANAGEMENT_COMMIT_OBJECT = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 5};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_MANAGEMENT_COPY_OBJECTS = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 9};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_ONLY = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_MANAGEMENT_CREATE_OBJECT_WITH_PROPERTIES_AND_DATA = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_MANAGEMENT_DELETE_OBJECTS = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 7};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_MANAGEMENT_MOVE_OBJECTS = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 8};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_MANAGEMENT_REVERT_OBJECT = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 6};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_MANAGEMENT_UPDATE_OBJECT_WITH_PROPERTIES_AND_DATA = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 10};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_MANAGEMENT_WRITE_OBJECT_DATA = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_START = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_NEXT = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_LIST_END = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_START = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 5};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_NEXT = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 6};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_BULK_GET_VALUES_BY_OBJECT_FORMAT_END = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 7};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_START = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 8};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_NEXT = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 9};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_BULK_SET_VALUES_BY_OBJECT_LIST_END = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 10};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_DELETE = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 7};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_GET = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_GET_SUPPORTED = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_GET_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_GET_ALL = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 6};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_PROPERTIES_SET = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 5};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_CLOSE = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 7};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_CREATE_RESOURCE = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 9};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_DELETE = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 8};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_GET_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_GET_SUPPORTED = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_OPEN = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_READ = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 5};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_REVERT = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 10};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_SEEK = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 11};
        internal static _tagpropertykey WPD_COMMAND_OBJECT_RESOURCES_WRITE = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 6};
        internal static _tagpropertykey WPD_COMMAND_PROCESS_WIRELESS_PROFILE = new _tagpropertykey() { fmtid = new Guid("78f9c6fc-79b8-473c-9060-6bd23dd072c4"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_METHODS_BY_FORMAT = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_METHOD_PARAMETER_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 5};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMATS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 6};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 7};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_FORMAT_PROPERTIES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 8};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_PROPERTY_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 9};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_EVENTS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 10};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 11};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_EVENT_PARAMETER_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 12};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_INHERITED_SERVICES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 13};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_FORMAT_RENDERING_PROFILES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 14};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_SUPPORTED_COMMANDS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 15};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_CAPABILITIES_GET_COMMAND_OPTIONS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 16};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_COMMON_GET_SERVICE_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("322f071d-36ef-477f-b4b5-6f52d734baee"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_METHODS_CANCEL_INVOKE = new _tagpropertykey() { fmtid = new Guid("2d521ca8-c1b0-4268-a342-cf19321569bc"), pid = 3};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_METHODS_END_INVOKE = new _tagpropertykey() { fmtid = new Guid("2d521ca8-c1b0-4268-a342-cf19321569bc"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_SERVICE_METHODS_START_INVOKE = new _tagpropertykey() { fmtid = new Guid("2d521ca8-c1b0-4268-a342-cf19321569bc"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_SMS_SEND = new _tagpropertykey() { fmtid = new Guid("afc25d66-fe0d-4114-9097-970c93e920d1"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_STILL_IMAGE_CAPTURE_INITIATE = new _tagpropertykey() { fmtid = new Guid("4fcd6982-22a2-4b05-a48b-62d38bf27b32"), pid = 2};
        internal static _tagpropertykey WPD_COMMAND_STORAGE_EJECT = new _tagpropertykey() { fmtid = new Guid("d8f907a6-34cc-45fa-97fb-d007fa47ec94"), pid = 4};
        internal static _tagpropertykey WPD_COMMAND_STORAGE_FORMAT = new _tagpropertykey() { fmtid = new Guid("d8f907a6-34cc-45fa-97fb-d007fa47ec94"), pid = 2};
        internal static _tagpropertykey WPD_COMMON_INFORMATION_BODY_TEXT = new _tagpropertykey() { fmtid = new Guid("b28ae94b-05a4-4e8e-be01-72cc7e099d8f"), pid = 3};
        internal static _tagpropertykey WPD_COMMON_INFORMATION_END_DATETIME = new _tagpropertykey() { fmtid = new Guid("b28ae94b-05a4-4e8e-be01-72cc7e099d8f"), pid = 6};
        internal static _tagpropertykey WPD_COMMON_INFORMATION_NOTES = new _tagpropertykey() { fmtid = new Guid("b28ae94b-05a4-4e8e-be01-72cc7e099d8f"), pid = 7};
        internal static _tagpropertykey WPD_COMMON_INFORMATION_PRIORITY = new _tagpropertykey() { fmtid = new Guid("b28ae94b-05a4-4e8e-be01-72cc7e099d8f"), pid = 4};
        internal static _tagpropertykey WPD_COMMON_INFORMATION_START_DATETIME = new _tagpropertykey() { fmtid = new Guid("b28ae94b-05a4-4e8e-be01-72cc7e099d8f"), pid = 5};
        internal static _tagpropertykey WPD_COMMON_INFORMATION_SUBJECT = new _tagpropertykey() { fmtid = new Guid("b28ae94b-05a4-4e8e-be01-72cc7e099d8f"), pid = 2};
        internal static _tagpropertykey WPD_CONTACT_ANNIVERSARY_DATE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 62};
        internal static _tagpropertykey WPD_CONTACT_ASSISTANT = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 61};
        internal static _tagpropertykey WPD_CONTACT_BIRTHDATE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 57};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_EMAIL = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 34};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_EMAIL2 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 35};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_FAX = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 45};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_FULL_POSTAL_ADDRESS = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 17};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_PHONE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 40};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_PHONE2 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 41};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_LINE1 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 18};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_LINE2 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 19};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_CITY = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 20};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_REGION = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 21};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_POSTAL_CODE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 22};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_POSTAL_ADDRESS_COUNTRY = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 23};
        internal static _tagpropertykey WPD_CONTACT_BUSINESS_WEB_ADDRESS = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 50};
        internal static _tagpropertykey WPD_CONTACT_CHILDREN = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 60};
        internal static _tagpropertykey WPD_CONTACT_COMPANY_NAME = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 54};
        internal static _tagpropertykey WPD_CONTACT_DISPLAY_NAME = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 2};
        internal static _tagpropertykey WPD_CONTACT_FIRST_NAME = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 3};
        internal static _tagpropertykey WPD_CONTACT_INSTANT_MESSENGER = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 51};
        internal static _tagpropertykey WPD_CONTACT_INSTANT_MESSENGER2 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 52};
        internal static _tagpropertykey WPD_CONTACT_INSTANT_MESSENGER3 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 53};
        internal static _tagpropertykey WPD_CONTACT_LAST_NAME = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 5};
        internal static _tagpropertykey WPD_CONTACT_MIDDLE_NAMES = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 4};
        internal static _tagpropertykey WPD_CONTACT_MOBILE_PHONE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 42};
        internal static _tagpropertykey WPD_CONTACT_MOBILE_PHONE2 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 43};
        internal static _tagpropertykey WPD_CONTACT_OTHER_EMAILS = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 36};
        internal static _tagpropertykey WPD_CONTACT_OTHER_FULL_POSTAL_ADDRESS = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 24};
        internal static _tagpropertykey WPD_CONTACT_OTHER_PHONES = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 47};
        internal static _tagpropertykey WPD_CONTACT_OTHER_POSTAL_ADDRESS_CITY = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 27};
        internal static _tagpropertykey WPD_CONTACT_OTHER_POSTAL_ADDRESS_LINE1 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 25};
        internal static _tagpropertykey WPD_CONTACT_OTHER_POSTAL_ADDRESS_LINE2 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 26};
        internal static _tagpropertykey WPD_CONTACT_OTHER_POSTAL_ADDRESS_POSTAL_CODE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 29};
        internal static _tagpropertykey WPD_CONTACT_OTHER_POSTAL_ADDRESS_POSTAL_COUNTRY = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 30};
        internal static _tagpropertykey WPD_CONTACT_OTHER_POSTAL_ADDRESS_REGION = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 28};
        internal static _tagpropertykey WPD_CONTACT_PAGER = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 46};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_EMAIL = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 32};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_EMAIL2 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 33};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_FAX = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 44};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_FULL_POSTAL_ADDRESS = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 10};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_PHONE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 38};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_PHONE2 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 39};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_LINE1 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 11};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_LINE2 = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 12};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_CITY = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 13};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_REGION = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 14};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_POSTAL_CODE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 15};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_POSTAL_ADDRESS_COUNTRY = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 16};
        internal static _tagpropertykey WPD_CONTACT_PERSONAL_WEB_ADDRESS = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 49};
        internal static _tagpropertykey WPD_CONTACT_PHONETIC_COMPANY_NAME = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 55};
        internal static _tagpropertykey WPD_CONTACT_PHONETIC_FIRST_NAME = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 8};
        internal static _tagpropertykey WPD_CONTACT_PHONETIC_LAST_NAME = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 9};
        internal static _tagpropertykey WPD_CONTACT_PREFIX = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 6};
        internal static _tagpropertykey WPD_CONTACT_PRIMARY_EMAIL_ADDRESS = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 31};
        internal static _tagpropertykey WPD_CONTACT_PRIMARY_FAX = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 58};
        internal static _tagpropertykey WPD_CONTACT_PRIMARY_PHONE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 37};
        internal static _tagpropertykey WPD_CONTACT_PRIMARY_WEB_ADDRESS = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 48};
        internal static _tagpropertykey WPD_CONTACT_RINGTONE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 63};
        internal static _tagpropertykey WPD_CONTACT_ROLE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 56};
        internal static _tagpropertykey WPD_CONTACT_SPOUSE = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 59};
        internal static _tagpropertykey WPD_CONTACT_SUFFIX = new _tagpropertykey() { fmtid = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b"), pid = 7};
        internal static _tagpropertykey WPD_DEVICE_DATETIME = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 11};
        internal static _tagpropertykey WPD_DEVICE_FIRMWARE_VERSION = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 3};
        internal static _tagpropertykey WPD_DEVICE_FRIENDLY_NAME = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 12};
        internal static _tagpropertykey WPD_DEVICE_FUNCTIONAL_UNIQUE_ID = new _tagpropertykey() { fmtid = new Guid("463dd662-7fc4-4291-911c-7f4c9cca9799"), pid = 2};
        internal static _tagpropertykey WPD_DEVICE_MANUFACTURER = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 7};
        internal static _tagpropertykey WPD_DEVICE_MODEL = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 8};
        internal static _tagpropertykey WPD_DEVICE_MODEL_UNIQUE_ID = new _tagpropertykey() { fmtid = new Guid("463dd662-7fc4-4291-911c-7f4c9cca9799"), pid = 3};
        internal static _tagpropertykey WPD_DEVICE_NETWORK_IDENTIFIER = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 16};
        internal static _tagpropertykey WPD_DEVICE_POWER_LEVEL = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 4};
        internal static _tagpropertykey WPD_DEVICE_POWER_SOURCE = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 5};
        internal static _tagpropertykey WPD_DEVICE_PROTOCOL = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 6};
        internal static _tagpropertykey WPD_DEVICE_SERIAL_NUMBER = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 9};
        internal static _tagpropertykey WPD_DEVICE_SUPPORTED_DRM_SCHEMES = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 13};
        internal static _tagpropertykey WPD_DEVICE_SUPPORTED_FORMATS_ARE_ORDERED = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 14};
        internal static _tagpropertykey WPD_DEVICE_SUPPORTS_NON_CONSUMABLE = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 10};
        internal static _tagpropertykey WPD_DEVICE_SYNC_PARTNER = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 2};
        internal static _tagpropertykey WPD_DEVICE_TRANSPORT = new _tagpropertykey() { fmtid = new Guid("463dd662-7fc4-4291-911c-7f4c9cca9799"), pid = 4};
        internal static _tagpropertykey WPD_DEVICE_TYPE = new _tagpropertykey() { fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 15};
        internal static _tagpropertykey WPD_DEVICE_USE_DEVICE_STAGE = new _tagpropertykey() { fmtid = new Guid("463dd662-7fc4-4291-911c-7f4c9cca9799"), pid = 5};
        internal static _tagpropertykey WPD_EMAIL_BCC_LINE = new _tagpropertykey() { fmtid = new Guid("41f8f65a-5484-4782-b13d-4740dd7c37c5"), pid = 4};
        internal static _tagpropertykey WPD_EMAIL_CC_LINE = new _tagpropertykey() { fmtid = new Guid("41f8f65a-5484-4782-b13d-4740dd7c37c5"), pid = 3};
        internal static _tagpropertykey WPD_EMAIL_HAS_ATTACHMENTS = new _tagpropertykey() { fmtid = new Guid("41f8f65a-5484-4782-b13d-4740dd7c37c5"), pid = 9};
        internal static _tagpropertykey WPD_EMAIL_HAS_BEEN_READ = new _tagpropertykey() { fmtid = new Guid("41f8f65a-5484-4782-b13d-4740dd7c37c5"), pid = 7};
        internal static _tagpropertykey WPD_EMAIL_RECEIVED_TIME = new _tagpropertykey() { fmtid = new Guid("41f8f65a-5484-4782-b13d-4740dd7c37c5"), pid = 8};
        internal static _tagpropertykey WPD_EMAIL_SENDER_ADDRESS = new _tagpropertykey() { fmtid = new Guid("41f8f65a-5484-4782-b13d-4740dd7c37c5"), pid = 10};
        internal static _tagpropertykey WPD_EMAIL_TO_LINE = new _tagpropertykey() { fmtid = new Guid("41f8f65a-5484-4782-b13d-4740dd7c37c5"), pid = 2};
        internal static _tagpropertykey WPD_EVENT_ATTRIBUTE_NAME = new _tagpropertykey() { fmtid = new Guid("10c96578-2e81-4111-adde-e08ca6138f6d"), pid = 2};
        internal static _tagpropertykey WPD_EVENT_ATTRIBUTE_OPTIONS = new _tagpropertykey() { fmtid = new Guid("10c96578-2e81-4111-adde-e08ca6138f6d"), pid = 4};
        internal static _tagpropertykey WPD_EVENT_ATTRIBUTE_PARAMETERS = new _tagpropertykey() { fmtid = new Guid("10c96578-2e81-4111-adde-e08ca6138f6d"), pid = 3};
        internal static _tagpropertykey WPD_EVENT_OPTION_IS_AUTOPLAY_EVENT = new _tagpropertykey() { fmtid = new Guid("b3d8dad7-a361-4b83-8a48-5b02ce10713b"), pid = 3};
        internal static _tagpropertykey WPD_EVENT_OPTION_IS_BROADCAST_EVENT = new _tagpropertykey() { fmtid = new Guid("b3d8dad7-a361-4b83-8a48-5b02ce10713b"), pid = 2};
        internal static _tagpropertykey WPD_EVENT_PARAMETER_CHILD_HIERARCHY_CHANGED = new _tagpropertykey() { fmtid = new Guid("15ab1953-f817-4fef-a921-5676e838f6e0"), pid = 8};
        internal static _tagpropertykey WPD_EVENT_PARAMETER_EVENT_ID = new _tagpropertykey() { fmtid = new Guid("15ab1953-f817-4fef-a921-5676e838f6e0"), pid = 3};
        internal static _tagpropertykey WPD_EVENT_PARAMETER_OBJECT_CREATION_COOKIE = new _tagpropertykey() { fmtid = new Guid("15ab1953-f817-4fef-a921-5676e838f6e0"), pid = 7};
        internal static _tagpropertykey WPD_EVENT_PARAMETER_OBJECT_PARENT_PERSISTENT_UNIQUE_ID = new _tagpropertykey() { fmtid = new Guid("15ab1953-f817-4fef-a921-5676e838f6e0"), pid = 6};
        internal static _tagpropertykey WPD_EVENT_PARAMETER_OPERATION_PROGRESS = new _tagpropertykey() { fmtid = new Guid("15ab1953-f817-4fef-a921-5676e838f6e0"), pid = 5};
        internal static _tagpropertykey WPD_EVENT_PARAMETER_OPERATION_STATE = new _tagpropertykey() { fmtid = new Guid("15ab1953-f817-4fef-a921-5676e838f6e0"), pid = 4};
        internal static _tagpropertykey WPD_EVENT_PARAMETER_PNP_DEVICE_ID = new _tagpropertykey() { fmtid = new Guid("15ab1953-f817-4fef-a921-5676e838f6e0"), pid = 2};
        internal static _tagpropertykey WPD_EVENT_PARAMETER_SERVICE_METHOD_CONTEXT = new _tagpropertykey() { fmtid = new Guid("52807b8a-4914-4323-9b9a-74f654b2b846"), pid = 2};
        internal static _tagpropertykey WPD_FOLDER_CONTENT_TYPES_ALLOWED = new _tagpropertykey() { fmtid = new Guid("7e9a7abf-e568-4b34-aa2f-13bb12ab177d"), pid = 2};
        internal static _tagpropertykey WPD_FORMAT_ATTRIBUTE_MIMETYPE = new _tagpropertykey() { fmtid = new Guid("a0a02000-bcaf-4be8-b3f5-233f231cf58f"), pid = 3};
        internal static _tagpropertykey WPD_FORMAT_ATTRIBUTE_NAME = new _tagpropertykey() { fmtid = new Guid("a0a02000-bcaf-4be8-b3f5-233f231cf58f"), pid = 2};
        internal static _tagpropertykey WPD_FUNCTIONAL_OBJECT_CATEGORY = new _tagpropertykey() { fmtid = new Guid("8f052d93-abca-4fc5-a5ac-b01df4dbe598"), pid = 2};
        internal static _tagpropertykey WPD_IMAGE_BITDEPTH = new _tagpropertykey() { fmtid = new Guid("63d64908-9fa1-479f-85ba-9952216447db"), pid = 3};
        internal static _tagpropertykey WPD_IMAGE_COLOR_CORRECTED_STATUS = new _tagpropertykey() { fmtid = new Guid("63d64908-9fa1-479f-85ba-9952216447db"), pid = 5};
        internal static _tagpropertykey WPD_IMAGE_CROPPED_STATUS = new _tagpropertykey() { fmtid = new Guid("63d64908-9fa1-479f-85ba-9952216447db"), pid = 4};
        internal static _tagpropertykey WPD_IMAGE_EXPOSURE_INDEX = new _tagpropertykey() { fmtid = new Guid("63d64908-9fa1-479f-85ba-9952216447db"), pid = 8};
        internal static _tagpropertykey WPD_IMAGE_EXPOSURE_TIME = new _tagpropertykey() { fmtid = new Guid("63d64908-9fa1-479f-85ba-9952216447db"), pid = 7};
        internal static _tagpropertykey WPD_IMAGE_FNUMBER = new _tagpropertykey() { fmtid = new Guid("63d64908-9fa1-479f-85ba-9952216447db"), pid = 6};
        internal static _tagpropertykey WPD_IMAGE_HORIZONTAL_RESOLUTION = new _tagpropertykey() { fmtid = new Guid("63d64908-9fa1-479f-85ba-9952216447db"), pid = 9};
        internal static _tagpropertykey WPD_IMAGE_VERTICAL_RESOLUTION = new _tagpropertykey() { fmtid = new Guid("63d64908-9fa1-479f-85ba-9952216447db"), pid = 10};
        internal static _tagpropertykey WPD_MEDIA_ALBUM_ARTIST = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 25};
        internal static _tagpropertykey WPD_MEDIA_ARTIST = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 24};
        internal static _tagpropertykey WPD_MEDIA_BITRATE_TYPE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 3};
        internal static _tagpropertykey WPD_MEDIA_BUY_NOW = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 20};
        internal static _tagpropertykey WPD_MEDIA_BYTE_BOOKMARK = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 36};
        internal static _tagpropertykey WPD_MEDIA_COMPOSER = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 11};
        internal static _tagpropertykey WPD_MEDIA_COPYRIGHT = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 4};
        internal static _tagpropertykey WPD_MEDIA_DESCRIPTION = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 31};
        internal static _tagpropertykey WPD_MEDIA_DESTINATION_URL = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 30};
        internal static _tagpropertykey WPD_MEDIA_DURATION = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 19};
        internal static _tagpropertykey WPD_MEDIA_EFFECTIVE_RATING = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 12};
        internal static _tagpropertykey WPD_MEDIA_ENCODING_PROFILE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 21};
        internal static _tagpropertykey WPD_MEDIA_GENRE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 32};
        internal static _tagpropertykey WPD_MEDIA_GUID = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 38};
        internal static _tagpropertykey WPD_MEDIA_HEIGHT = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 23};
        internal static _tagpropertykey WPD_MEDIA_LAST_ACCESSED_TIME = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 8};
        internal static _tagpropertykey WPD_MEDIA_LAST_BUILD_DATE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 35};
        internal static _tagpropertykey WPD_MEDIA_MANAGING_EDITOR = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 27};
        internal static _tagpropertykey WPD_MEDIA_META_GENRE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 10};
        internal static _tagpropertykey WPD_MEDIA_OBJECT_BOOKMARK = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 34};
        internal static _tagpropertykey WPD_MEDIA_OWNER = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 26};
        internal static _tagpropertykey WPD_MEDIA_PARENTAL_RATING = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 9};
        internal static _tagpropertykey WPD_MEDIA_RELEASE_DATE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 14};
        internal static _tagpropertykey WPD_MEDIA_SAMPLE_RATE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 15};
        internal static _tagpropertykey WPD_MEDIA_SKIP_COUNT = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 7};
        internal static _tagpropertykey WPD_MEDIA_SOURCE_URL = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 29};
        internal static _tagpropertykey WPD_MEDIA_STAR_RATING = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 16};
        internal static _tagpropertykey WPD_MEDIA_SUB_DESCRIPTION = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 39};
        internal static _tagpropertykey WPD_MEDIA_SUB_TITLE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 13};
        internal static _tagpropertykey WPD_MEDIA_SUBSCRIPTION_CONTENT_ID = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 5};
        internal static _tagpropertykey WPD_MEDIA_TIME_BOOKMARK = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 33};
        internal static _tagpropertykey WPD_MEDIA_TIME_TO_LIVE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 37};
        internal static _tagpropertykey WPD_MEDIA_TITLE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 18};
        internal static _tagpropertykey WPD_MEDIA_TOTAL_BITRATE = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 2};
        internal static _tagpropertykey WPD_MEDIA_USE_COUNT = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 6};
        internal static _tagpropertykey WPD_MEDIA_USER_EFFECTIVE_RATING = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 17};
        internal static _tagpropertykey WPD_MEDIA_WEBMASTER = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 28};
        internal static _tagpropertykey WPD_MEDIA_WIDTH = new _tagpropertykey() { fmtid = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8"), pid = 22};
        internal static _tagpropertykey WPD_METHOD_ATTRIBUTE_ACCESS = new _tagpropertykey() { fmtid = new Guid("f17a5071-f039-44af-8efe-432cf32e432a"), pid = 4};
        internal static _tagpropertykey WPD_METHOD_ATTRIBUTE_ASSOCIATED_FORMAT = new _tagpropertykey() { fmtid = new Guid("f17a5071-f039-44af-8efe-432cf32e432a"), pid = 3};
        internal static _tagpropertykey WPD_METHOD_ATTRIBUTE_NAME = new _tagpropertykey() { fmtid = new Guid("f17a5071-f039-44af-8efe-432cf32e432a"), pid = 2};
        internal static _tagpropertykey WPD_METHOD_ATTRIBUTE_PARAMETERS = new _tagpropertykey() { fmtid = new Guid("f17a5071-f039-44af-8efe-432cf32e432a"), pid = 5};
        internal static _tagpropertykey WPD_MUSIC_ALBUM = new _tagpropertykey() { fmtid = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6"), pid = 3};
        internal static _tagpropertykey WPD_MUSIC_LYRICS = new _tagpropertykey() { fmtid = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6"), pid = 6};
        internal static _tagpropertykey WPD_MUSIC_MOOD = new _tagpropertykey() { fmtid = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6"), pid = 8};
        internal static _tagpropertykey WPD_MUSIC_TRACK = new _tagpropertykey() { fmtid = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6"), pid = 4};
        internal static _tagpropertykey WPD_NETWORK_ASSOCIATION_HOST_NETWORK_IDENTIFIERS = new _tagpropertykey() { fmtid = new Guid("e4c93c1f-b203-43f1-a100-5a07d11b0274"), pid = 2};
        internal static _tagpropertykey WPD_NETWORK_ASSOCIATION_X509V3SEQUENCE = new _tagpropertykey() { fmtid = new Guid("e4c93c1f-b203-43f1-a100-5a07d11b0274"), pid = 3};
        internal static _tagpropertykey WPD_OBJECT_BACK_REFERENCES = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 21};
        internal static _tagpropertykey WPD_OBJECT_CAN_DELETE = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 26};
        internal static _tagpropertykey WPD_OBJECT_CONTAINER_FUNCTIONAL_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 23};
        internal static _tagpropertykey WPD_OBJECT_CONTENT_TYPE = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 7};
        internal static _tagpropertykey WPD_OBJECT_DATE_AUTHORED = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 20};
        internal static _tagpropertykey WPD_OBJECT_DATE_CREATED = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 18};
        internal static _tagpropertykey WPD_OBJECT_DATE_MODIFIED = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 19};
        internal static _tagpropertykey WPD_OBJECT_FORMAT = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 6};
        internal static _tagpropertykey WPD_OBJECT_GENERATE_THUMBNAIL_FROM_RESOURCE = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 24};
        internal static _tagpropertykey WPD_OBJECT_HINT_LOCATION_DISPLAY_NAME = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 25};
        internal static _tagpropertykey WPD_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 2};
        internal static _tagpropertykey WPD_OBJECT_IS_DRM_PROTECTED = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 17};
        internal static _tagpropertykey WPD_OBJECT_ISHIDDEN = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 9};
        internal static _tagpropertykey WPD_OBJECT_ISSYSTEM = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 10};
        internal static _tagpropertykey WPD_OBJECT_KEYWORDS = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 15};
        internal static _tagpropertykey WPD_OBJECT_LANGUAGE_LOCALE = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 27};
        internal static _tagpropertykey WPD_OBJECT_NAME = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 4};
        internal static _tagpropertykey WPD_OBJECT_NON_CONSUMABLE = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 13};
        internal static _tagpropertykey WPD_OBJECT_ORIGINAL_FILE_NAME = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 12};
        internal static _tagpropertykey WPD_OBJECT_PARENT_ID = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 3};
        internal static _tagpropertykey WPD_OBJECT_PERSISTENT_UNIQUE_ID = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 5};
        internal static _tagpropertykey WPD_OBJECT_REFERENCES = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 14};
        internal static _tagpropertykey WPD_OBJECT_SIZE = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 11};
        internal static _tagpropertykey WPD_OBJECT_SYNC_ID = new _tagpropertykey() { fmtid = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c"), pid = 16};
        internal static _tagpropertykey WPD_OPTION_OBJECT_MANAGEMENT_RECURSIVE_DELETE_SUPPORTED = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 5001};
        internal static _tagpropertykey WPD_OPTION_OBJECT_RESOURCES_SEEK_ON_READ_SUPPORTED = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 5001};
        internal static _tagpropertykey WPD_OPTION_OBJECT_RESOURCES_SEEK_ON_WRITE_SUPPORTED = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 5002};
        internal static _tagpropertykey WPD_OPTION_SMS_BINARY_MESSAGE_SUPPORTED = new _tagpropertykey() { fmtid = new Guid("afc25d66-fe0d-4114-9097-970c93e920d1"), pid = 5001};
        internal static _tagpropertykey WPD_OPTION_VALID_OBJECT_IDS = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 5001};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_DEFAULT_VALUE = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 5};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_ENUMERATION_ELEMENTS = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 9};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_FORM = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 4};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_MAX_SIZE = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 11};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_NAME = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 13};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_ORDER = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 2};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_RANGE_MAX = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 7};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_RANGE_MIN = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 6};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_RANGE_STEP = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 8};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_REGULAR_EXPRESSION = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 10};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_USAGE = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 3};
        internal static _tagpropertykey WPD_PARAMETER_ATTRIBUTE_VARTYPE = new _tagpropertykey() { fmtid = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58"), pid = 12};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_CAN_DELETE = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 5};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_CAN_READ = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 3};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_CAN_WRITE = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 4};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_DEFAULT_VALUE = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 6};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_ENUMERATION_ELEMENTS = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 11};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_FAST_PROPERTY = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 7};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_FORM = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 2};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_MAX_SIZE = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 13};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_NAME = new _tagpropertykey() { fmtid = new Guid("5d9da160-74ae-43cc-85a9-fe555a80798e"), pid = 2};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_RANGE_MAX = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 9};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_RANGE_MIN = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 8};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_RANGE_STEP = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 10};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_REGULAR_EXPRESSION = new _tagpropertykey() { fmtid = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37"), pid = 12};
        internal static _tagpropertykey WPD_PROPERTY_ATTRIBUTE_VARTYPE = new _tagpropertykey() { fmtid = new Guid("5d9da160-74ae-43cc-85a9-fe555a80798e"), pid = 3};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_COMMAND = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_COMMAND_OPTIONS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_CONTENT_TYPES = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1007};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_CONTENT_TYPE = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1008};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_EVENT = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1014};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_EVENT_OPTIONS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1015};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_FORMAT = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1010};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_FORMATS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1009};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_CATEGORIES = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_CATEGORY = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1005};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_FUNCTIONAL_OBJECTS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1006};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_PROPERTY_KEYS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1011};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_PROPERTY_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1012};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_SUPPORTED_COMMANDS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_CAPABILITIES_SUPPORTED_EVENTS = new _tagpropertykey() { fmtid = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356"), pid = 1013};
        internal static _tagpropertykey WPD_PROPERTY_CLASS_EXTENSION_DEVICE_INFORMATION_VALUES = new _tagpropertykey() { fmtid = new Guid("33fb0d11-64a3-4fac-b4c7-3dfeaa99b051"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_CLASS_EXTENSION_DEVICE_INFORMATION_WRITE_RESULTS = new _tagpropertykey() { fmtid = new Guid("33fb0d11-64a3-4fac-b4c7-3dfeaa99b051"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_CLASS_EXTENSION_SERVICE_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("7f0779b5-fa2b-4766-9cb2-f73ba30b6758"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_CLASS_EXTENSION_SERVICE_INTERFACES = new _tagpropertykey() { fmtid = new Guid("7f0779b5-fa2b-4766-9cb2-f73ba30b6758"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_CLASS_EXTENSION_SERVICE_REGISTRATION_RESULTS = new _tagpropertykey() { fmtid = new Guid("7f0779b5-fa2b-4766-9cb2-f73ba30b6758"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_COMMON_CLIENT_INFORMATION = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 1009};
        internal static _tagpropertykey WPD_PROPERTY_COMMON_CLIENT_INFORMATION_CONTEXT = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 1010};
        internal static _tagpropertykey WPD_PROPERTY_COMMON_COMMAND_CATEGORY = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_COMMON_COMMAND_ID = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_COMMON_COMMAND_TARGET = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 1006};
        internal static _tagpropertykey WPD_PROPERTY_COMMON_DRIVER_ERROR_CODE = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_COMMON_HRESULT = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 1003 };
        internal static _tagpropertykey WPD_PROPERTY_COMMON_OBJECT_IDS = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 1008};
        internal static _tagpropertykey WPD_PROPERTY_COMMON_PERSISTENT_UNIQUE_IDS = new _tagpropertykey() { fmtid = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a"), pid = 1007};
        internal static _tagpropertykey WPD_PROPERTY_DEVICE_HINTS_CONTENT_TYPE = new _tagpropertykey() { fmtid = new Guid("0d5fb92b-cb46-4c4f-8343-0bc3d3f17c84"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_DEVICE_HINTS_CONTENT_LOCATIONS = new _tagpropertykey() { fmtid = new Guid("0d5fb92b-cb46-4c4f-8343-0bc3d3f17c84"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_NULL = new _tagpropertykey() { fmtid = new Guid("00000000-0000-0000-0000-000000000000"), pid = 0};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_ENUMERATION_CONTEXT = new _tagpropertykey() { fmtid = new Guid("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_ENUMERATION_FILTER = new _tagpropertykey() { fmtid = new Guid("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_ENUMERATION_NUM_OBJECTS_REQUESTED = new _tagpropertykey() { fmtid = new Guid("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec"), pid = 1005};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_ENUMERATION_OBJECT_IDS = new _tagpropertykey() { fmtid = new Guid("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_ENUMERATION_PARENT_ID = new _tagpropertykey() { fmtid = new Guid("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_CONTEXT = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_COPY_RESULTS = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1013};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_CREATION_PROPERTIES = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_DATA = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1005};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_DELETE_OPTIONS = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1007};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_DELETE_RESULTS = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1010};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_DESTINATION_FOLDER_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1011};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_MOVE_RESULTS = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1012};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_TO_WRITE = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_NUM_BYTES_WRITTEN = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1006};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_IDS = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1009};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_OBJECT_FORMAT = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1016};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_OPTIMAL_TRANSFER_BUFFER_SIZE = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1008};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_PROPERTY_KEYS = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1015};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_MANAGEMENT_UPDATE_PROPERTIES = new _tagpropertykey() { fmtid = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089"), pid = 1014};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_BULK_OBJECT_IDS = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_BULK_CONTEXT = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_BULK_VALUES = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_BULK_PROPERTY_KEYS = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_BULK_DEPTH = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 1005};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_BULK_PARENT_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 1006};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_BULK_OBJECT_FORMAT = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 1007};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_BULK_WRITE_RESULTS = new _tagpropertykey() { fmtid = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e"), pid = 1008};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_KEYS = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_VALUES = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_WRITE_RESULTS = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 1005};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_PROPERTIES_PROPERTY_DELETE_RESULTS = new _tagpropertykey() { fmtid = new Guid("9e5582e4-0814-44e6-981a-b2998d583804"), pid = 1006};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_ACCESS_MODE = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_CONTEXT = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1005};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_DATA = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1010};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_READ = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1006};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_READ = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1007};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_TO_WRITE = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1008};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_NUM_BYTES_WRITTEN = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1009};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_OPTIMAL_TRANSFER_BUFFER_SIZE = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1011};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_POSITION_FROM_START = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1014};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_KEYS = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_RESOURCE_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_SEEK_OFFSET = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1012};
        internal static _tagpropertykey WPD_PROPERTY_OBJECT_RESOURCES_SEEK_ORIGIN_FLAG = new _tagpropertykey() { fmtid = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a"), pid = 1013};
        internal static _tagpropertykey WPD_PROPERTY_PUBLIC_KEY = new _tagpropertykey() { fmtid = new Guid("78f9c6fc-79b8-473c-9060-6bd23dd072c4"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_METHODS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_METHOD_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1005};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_PARAMETER_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1006};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_FORMATS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1007};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_FORMAT_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1008};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_KEYS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1009};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_PROPERTY_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1010};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_EVENTS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1011};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1012};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_EVENT_ATTRIBUTES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1013};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITANCE_TYPE = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1014};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_INHERITED_SERVICES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1015};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_RENDERING_PROFILES = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1016};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_SUPPORTED_COMMANDS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1017};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1018};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_CAPABILITIES_COMMAND_OPTIONS = new _tagpropertykey() { fmtid = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89"), pid = 1019};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_METHOD = new _tagpropertykey() { fmtid = new Guid("2d521ca8-c1b0-4268-a342-cf19321569bc"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_METHOD_CONTEXT = new _tagpropertykey() { fmtid = new Guid("2d521ca8-c1b0-4268-a342-cf19321569bc"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_METHOD_HRESULT = new _tagpropertykey() { fmtid = new Guid("2d521ca8-c1b0-4268-a342-cf19321569bc"), pid = 1005};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_METHOD_PARAMETER_VALUES = new _tagpropertykey() { fmtid = new Guid("2d521ca8-c1b0-4268-a342-cf19321569bc"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_METHOD_RESULT_VALUES = new _tagpropertykey() { fmtid = new Guid("2d521ca8-c1b0-4268-a342-cf19321569bc"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_SERVICE_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("322f071d-36ef-477f-b4b5-6f52d734baee"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_SMS_BINARY_MESSAGE = new _tagpropertykey() { fmtid = new Guid("afc25d66-fe0d-4114-9097-970c93e920d1"), pid = 1004};
        internal static _tagpropertykey WPD_PROPERTY_SMS_MESSAGE_TYPE = new _tagpropertykey() { fmtid = new Guid("afc25d66-fe0d-4114-9097-970c93e920d1"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_SMS_RECIPIENT = new _tagpropertykey() { fmtid = new Guid("afc25d66-fe0d-4114-9097-970c93e920d1"), pid = 1001};
        internal static _tagpropertykey WPD_PROPERTY_SMS_TEXT_MESSAGE = new _tagpropertykey() { fmtid = new Guid("afc25d66-fe0d-4114-9097-970c93e920d1"), pid = 1003};
        internal static _tagpropertykey WPD_PROPERTY_STORAGE_DESTINATION_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("d8f907a6-34cc-45fa-97fb-d007fa47ec94"), pid = 1002};
        internal static _tagpropertykey WPD_PROPERTY_STORAGE_OBJECT_ID = new _tagpropertykey() { fmtid = new Guid("d8f907a6-34cc-45fa-97fb-d007fa47ec94"), pid = 1001};
        internal static _tagpropertykey WPD_RENDERING_INFORMATION_PROFILE_ENTRY_TYPE = new _tagpropertykey() { fmtid = new Guid("c53d039f-ee23-4a31-8590-7639879870b4"), pid = 3};
        internal static _tagpropertykey WPD_RENDERING_INFORMATION_PROFILE_ENTRY_CREATABLE_RESOURCES = new _tagpropertykey() { fmtid = new Guid("c53d039f-ee23-4a31-8590-7639879870b4"), pid = 4};
        internal static _tagpropertykey WPD_RENDERING_INFORMATION_PROFILES = new _tagpropertykey() { fmtid = new Guid("c53d039f-ee23-4a31-8590-7639879870b4"), pid = 2};
        internal static _tagpropertykey WPD_RESOURCE_ALBUM_ART = new _tagpropertykey() { fmtid = new Guid("f02aa354-2300-4e2d-a1b9-3b6730f7fa21"), pid = 0};
        internal static _tagpropertykey WPD_RESOURCE_ATTRIBUTE_CAN_DELETE = new _tagpropertykey() { fmtid = new Guid("1eb6f604-9278-429f-93cc-5bb8c06656b6"), pid = 5};
        internal static _tagpropertykey WPD_RESOURCE_ATTRIBUTE_CAN_READ = new _tagpropertykey() { fmtid = new Guid("1eb6f604-9278-429f-93cc-5bb8c06656b6"), pid = 3};
        internal static _tagpropertykey WPD_RESOURCE_ATTRIBUTE_CAN_WRITE = new _tagpropertykey() { fmtid = new Guid("1eb6f604-9278-429f-93cc-5bb8c06656b6"), pid = 4};
        internal static _tagpropertykey WPD_RESOURCE_ATTRIBUTE_FORMAT = new _tagpropertykey() { fmtid = new Guid("1eb6f604-9278-429f-93cc-5bb8c06656b6"), pid = 8};
        internal static _tagpropertykey WPD_RESOURCE_ATTRIBUTE_OPTIMAL_READ_BUFFER_SIZE = new _tagpropertykey() { fmtid = new Guid("1eb6f604-9278-429f-93cc-5bb8c06656b6"), pid = 6};
        internal static _tagpropertykey WPD_RESOURCE_ATTRIBUTE_OPTIMAL_WRITE_BUFFER_SIZE = new _tagpropertykey() { fmtid = new Guid("1eb6f604-9278-429f-93cc-5bb8c06656b6"), pid = 7};
        internal static _tagpropertykey WPD_RESOURCE_ATTRIBUTE_RESOURCE_KEY = new _tagpropertykey() { fmtid = new Guid("1eb6f604-9278-429f-93cc-5bb8c06656b6"), pid = 9};
        internal static _tagpropertykey WPD_RESOURCE_ATTRIBUTE_TOTAL_SIZE = new _tagpropertykey() { fmtid = new Guid("1eb6f604-9278-429f-93cc-5bb8c06656b6"), pid = 2};
        internal static _tagpropertykey WPD_RESOURCE_AUDIO_CLIP = new _tagpropertykey() { fmtid = new Guid("3bc13982-85b1-48e0-95a6-8d3ad06be117"), pid = 0};
        internal static _tagpropertykey WPD_RESOURCE_BRANDING_ART = new _tagpropertykey() { fmtid = new Guid("b633b1ae-6caf-4a87-9589-22ded6dd5899"), pid = 0};
        internal static _tagpropertykey WPD_RESOURCE_CONTACT_PHOTO = new _tagpropertykey() { fmtid = new Guid("2c4d6803-80ea-4580-af9a-5be1a23eddcb"), pid = 0};
        internal static _tagpropertykey WPD_RESOURCE_DEFAULT = new _tagpropertykey() { fmtid = new Guid("e81e79be-34f0-41bf-b53f-f1a06ae87842"), pid = 0};
        internal static _tagpropertykey WPD_RESOURCE_GENERIC = new _tagpropertykey() { fmtid = new Guid("b9b9f515-ba70-4647-94dc-fa4925e95a07"), pid = 0};
        internal static _tagpropertykey WPD_RESOURCE_ICON = new _tagpropertykey() { fmtid = new Guid("f195fed8-aa28-4ee3-b153-e182dd5edc39"), pid = 0};
        internal static _tagpropertykey WPD_RESOURCE_THUMBNAIL = new _tagpropertykey() { fmtid = new Guid("c7c407ba-98fa-46b5-9960-23fec124cfde"), pid = 0};
        internal static _tagpropertykey WPD_RESOURCE_VIDEO_CLIP = new _tagpropertykey() { fmtid = new Guid("b566ee42-6368-4290-8662-70182fb79f20"), pid = 0};
        internal static _tagpropertykey WPD_SECTION_DATA_LENGTH = new _tagpropertykey() { fmtid = new Guid("516afd2b-c64e-44f0-98dc-bee1c88f7d66"), pid = 3};
        internal static _tagpropertykey WPD_SECTION_DATA_OFFSET = new _tagpropertykey() { fmtid = new Guid("516afd2b-c64e-44f0-98dc-bee1c88f7d66"), pid = 2};
        internal static _tagpropertykey WPD_SECTION_DATA_REFERENCED_OBJECT_RESOURCE = new _tagpropertykey() { fmtid = new Guid("516afd2b-c64e-44f0-98dc-bee1c88f7d66"), pid = 5};
        internal static _tagpropertykey WPD_SECTION_DATA_UNITS = new _tagpropertykey() { fmtid = new Guid("516afd2b-c64e-44f0-98dc-bee1c88f7d66"), pid = 4};
        internal static _tagpropertykey WPD_SERVICE_VERSION = new _tagpropertykey() { fmtid = new Guid("7510698a-cb54-481c-b8db-0d75c93f1c06"), pid = 2};
        internal static _tagpropertykey WPD_SMS_ENCODING = new _tagpropertykey() { fmtid = new Guid("7e1074cc-50ff-4dd1-a742-53be6f093a0d"), pid = 5};
        internal static _tagpropertykey WPD_SMS_MAX_PAYLOAD = new _tagpropertykey() { fmtid = new Guid("7e1074cc-50ff-4dd1-a742-53be6f093a0d"), pid = 4};
        internal static _tagpropertykey WPD_SMS_PROVIDER = new _tagpropertykey() { fmtid = new Guid("7e1074cc-50ff-4dd1-a742-53be6f093a0d"), pid = 2};
        internal static _tagpropertykey WPD_SMS_TIMEOUT = new _tagpropertykey() { fmtid = new Guid("7e1074cc-50ff-4dd1-a742-53be6f093a0d"), pid = 3};
        internal static _tagpropertykey WPD_STILL_IMAGE_ARTIST = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 29};
        internal static _tagpropertykey WPD_STILL_IMAGE_BURST_INTERVAL = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 24};
        internal static _tagpropertykey WPD_STILL_IMAGE_BURST_NUMBER = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 23};
        internal static _tagpropertykey WPD_STILL_IMAGE_CAMERA_MANUFACTURER = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 31};
        internal static _tagpropertykey WPD_STILL_IMAGE_CAMERA_MODEL = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 30};
        internal static _tagpropertykey WPD_STILL_IMAGE_CAPTURE_DELAY = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 17};
        internal static _tagpropertykey WPD_STILL_IMAGE_CAPTURE_FORMAT = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 3};
        internal static _tagpropertykey WPD_STILL_IMAGE_CAPTURE_MODE = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 18};
        internal static _tagpropertykey WPD_STILL_IMAGE_CAPTURE_RESOLUTION = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 2};
        internal static _tagpropertykey WPD_STILL_IMAGE_COMPRESSION_SETTING = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 4};
        internal static _tagpropertykey WPD_STILL_IMAGE_CONTRAST = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 19};
        internal static _tagpropertykey WPD_STILL_IMAGE_DIGITAL_ZOOM = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 21};
        internal static _tagpropertykey WPD_STILL_IMAGE_EFFECT_MODE = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 22};
        internal static _tagpropertykey WPD_STILL_IMAGE_EXPOSURE_BIAS_COMPENSATION = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 16};
        internal static _tagpropertykey WPD_STILL_IMAGE_EXPOSURE_INDEX = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 15};
        internal static _tagpropertykey WPD_STILL_IMAGE_EXPOSURE_METERING_MODE = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 11};
        internal static _tagpropertykey WPD_STILL_IMAGE_EXPOSURE_PROGRAM_MODE = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 14};
        internal static _tagpropertykey WPD_STILL_IMAGE_EXPOSURE_TIME = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 13};
        internal static _tagpropertykey WPD_STILL_IMAGE_FLASH_MODE = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 12};
        internal static _tagpropertykey WPD_STILL_IMAGE_FNUMBER = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 7};
        internal static _tagpropertykey WPD_STILL_IMAGE_FOCAL_LENGTH = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 8};
        internal static _tagpropertykey WPD_STILL_IMAGE_FOCUS_DISTANCE = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 9};
        internal static _tagpropertykey WPD_STILL_IMAGE_FOCUS_METERING_MODE = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 27};
        internal static _tagpropertykey WPD_STILL_IMAGE_FOCUS_MODE = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 10};
        internal static _tagpropertykey WPD_STILL_IMAGE_RGB_GAIN = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 6};
        internal static _tagpropertykey WPD_STILL_IMAGE_SHARPNESS = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 20};
        internal static _tagpropertykey WPD_STILL_IMAGE_TIMELAPSE_INTERVAL = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 26};
        internal static _tagpropertykey WPD_STILL_IMAGE_TIMELAPSE_NUMBER = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 25};
        internal static _tagpropertykey WPD_STILL_IMAGE_UPLOAD_URL = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 28};
        internal static _tagpropertykey WPD_STILL_IMAGE_WHITE_BALANCE = new _tagpropertykey() { fmtid = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260"), pid = 5};
        internal static _tagpropertykey WPD_STORAGE_ACCESS_CAPABILITY = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 11};
        internal static _tagpropertykey WPD_STORAGE_CAPACITY = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 4};
        internal static _tagpropertykey WPD_STORAGE_CAPACITY_IN_OBJECTS = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 10};
        internal static _tagpropertykey WPD_STORAGE_DESCRIPTION = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 7};
        internal static _tagpropertykey WPD_STORAGE_FILE_SYSTEM_TYPE = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 3};
        internal static _tagpropertykey WPD_STORAGE_FREE_SPACE_IN_BYTES = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 5};
        internal static _tagpropertykey WPD_STORAGE_FREE_SPACE_IN_OBJECTS = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 6};
        internal static _tagpropertykey WPD_STORAGE_MAX_OBJECT_SIZE = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 9};
        internal static _tagpropertykey WPD_STORAGE_SERIAL_NUMBER = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 8};
        internal static _tagpropertykey WPD_STORAGE_TYPE = new _tagpropertykey() { fmtid = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a"), pid = 2};
        internal static _tagpropertykey WPD_TASK_OWNER = new _tagpropertykey() { fmtid = new Guid("e354e95e-d8a0-4637-a03a-0cb26838dbc7"), pid = 11};
        internal static _tagpropertykey WPD_TASK_PERCENT_COMPLETE = new _tagpropertykey() { fmtid = new Guid("e354e95e-d8a0-4637-a03a-0cb26838dbc7"), pid = 8};
        internal static _tagpropertykey WPD_TASK_REMINDER_DATE = new _tagpropertykey() { fmtid = new Guid("e354e95e-d8a0-4637-a03a-0cb26838dbc7"), pid = 10};
        internal static _tagpropertykey WPD_TASK_STATUS = new _tagpropertykey() { fmtid = new Guid("e354e95e-d8a0-4637-a03a-0cb26838dbc7"), pid = 6};
        internal static _tagpropertykey WPD_VIDEO_AUTHOR = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 2};
        internal static _tagpropertykey WPD_VIDEO_BITRATE = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 13};
        internal static _tagpropertykey WPD_VIDEO_BUFFER_SIZE = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 8};
        internal static _tagpropertykey WPD_VIDEO_CREDITS = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 9};
        internal static _tagpropertykey WPD_VIDEO_FOURCC_CODE = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 14};
        internal static _tagpropertykey WPD_VIDEO_FRAMERATE = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 15};
        internal static _tagpropertykey WPD_VIDEO_KEY_FRAME_DISTANCE = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 10};
        internal static _tagpropertykey WPD_VIDEO_QUALITY_SETTING = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 11};
        internal static _tagpropertykey WPD_VIDEO_RECORDEDTV_CHANNEL_NUMBER = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 5};
        internal static _tagpropertykey WPD_VIDEO_RECORDEDTV_REPEAT = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 7};
        internal static _tagpropertykey WPD_VIDEO_RECORDEDTV_STATION_NAME = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 4};
        internal static _tagpropertykey WPD_VIDEO_SCAN_TYPE = new _tagpropertykey() { fmtid = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a"), pid = 12};
    }
}

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35195069
DeviceGuid.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;

namespace Wpd
{
    internal static class DeviceGuid
    {

        public static Dictionary<Guid, string> GuidList { get; private set; }

        static DeviceGuid()
        {
            GetDeviceGuidList();
        }

        private static void GetDeviceGuidList()
        {
            List<FieldInfo> fieldList = typeof(DeviceGuid).GetFields(BindingFlags.NonPublic | BindingFlags.Static).ToList();

            GuidList = new Dictionary<Guid, string>();

            foreach (FieldInfo field in fieldList)
            {
                var value = field.GetValue(field);

                if (value is Guid)
                {
                    GuidList.Add((Guid)value, field.Name);
                }
            }
        }

        internal static Guid GUID_DEVINTERFACE_WPD = new Guid("6ac27878-a6fa-4155-ba85-f98f491d4f33");
        internal static Guid GUID_DEVINTERFACE_WPD_PRIVATE = new Guid("ba0c718f-4ded-49b7-bdd3-fabe28661211");
        internal static Guid GUID_DEVINTERFACE_WPD_SERVICE = new Guid("9ef44f80-3d64-4246-a6aa-206f328d1edc");
        internal static Guid WPD_API_OPTIONS_V1 = new Guid("10e54a3e-052d-4777-a13c-de7614be2bc4");
        internal static Guid WPD_APPOINTMENT_OBJECT_PROPERTIES_V1 = new Guid("f99efd03-431d-40d8-a1c9-4e220d9c88d3");
        internal static Guid WPD_CATEGORY_CAPABILITIES = new Guid("0cabec78-6b74-41c6-9216-2639d1fce356");
        internal static Guid WPD_CATEGORY_COMMON = new Guid("f0422a9c-5dc8-4440-b5bd-5df28835658a");
        internal static Guid WPD_CATEGORY_DEVICE_HINTS = new Guid("0d5fb92b-cb46-4c4f-8343-0bc3d3f17c84");
        internal static Guid WPD_CATEGORY_MEDIA_CAPTURE = new Guid("59b433ba-fe44-4d8d-808c-6bcb9b0f15e8");
        internal static Guid WPD_CATEGORY_NETWORK_CONFIGURATION = new Guid("78f9c6fc-79b8-473c-9060-6bd23dd072c4");
        internal static Guid WPD_CATEGORY_NULL = new Guid("00000000-0000-0000-0000-000000000000");
        internal static Guid WPD_CATEGORY_OBJECT_ENUMERATION = new Guid("b7474e91-e7f8-4ad9-b400-ad1a4b58eeec");
        internal static Guid WPD_CATEGORY_OBJECT_MANAGEMENT = new Guid("ef1e43dd-a9ed-4341-8bcc-186192aea089");
        internal static Guid WPD_CATEGORY_OBJECT_PROPERTIES = new Guid("9e5582e4-0814-44e6-981a-b2998d583804");
        internal static Guid WPD_CATEGORY_OBJECT_PROPERTIES_BULK = new Guid("11c824dd-04cd-4e4e-8c7b-f6efb794d84e");
        internal static Guid WPD_CATEGORY_OBJECT_RESOURCES = new Guid("b3a2b22d-a595-4108-be0a-fc3c965f3d4a");
        internal static Guid WPD_CATEGORY_SERVICE_CAPABILITIES = new Guid("24457e74-2e9f-44f9-8c57-1d1bcb170b89");
        internal static Guid WPD_CATEGORY_SERVICE_COMMON = new Guid("322f071d-36ef-477f-b4b5-6f52d734baee");
        internal static Guid WPD_CATEGORY_SERVICE_METHODS = new Guid("2d521ca8-c1b0-4268-a342-cf19321569bc");
        internal static Guid WPD_CATEGORY_SMS = new Guid("afc25d66-fe0d-4114-9097-970c93e920d1");
        internal static Guid WPD_CATEGORY_STILL_IMAGE_CAPTURE = new Guid("4fcd6982-22a2-4b05-a48b-62d38bf27b32");
        internal static Guid WPD_CATEGORY_STORAGE = new Guid("d8f907a6-34cc-45fa-97fb-d007fa47ec94");
        internal static Guid WPD_CLASS_EXTENSION_OPTIONS_V1 = new Guid("6309ffef-a87c-4ca7-8434-797576e40a96");
        internal static Guid WPD_CLASS_EXTENSION_OPTIONS_V2 = new Guid("3e3595da-4d71-49fe-a0b4-d4406c3ae93f");
        internal static Guid WPD_CLASS_EXTENSION_V1 = new Guid("33fb0d11-64a3-4fac-b4c7-3dfeaa99b051");
        internal static Guid WPD_CLASS_EXTENSION_V2 = new Guid("7f0779b5-fa2b-4766-9cb2-f73ba30b6758");
        internal static Guid WPD_CLIENT_INFORMATION_PROPERTIES_V1 = new Guid("204d9f0c-2292-4080-9f42-40664e70f859");
        internal static Guid WPD_COMMON_INFORMATION_OBJECT_PROPERTIES_V1 = new Guid("b28ae94b-05a4-4e8e-be01-72cc7e099d8f");
        internal static Guid WPD_PROPERTY_COMMON_COMMAND_CATEGORY = new Guid("4d545058-1a2e-4106-a357-771e0819fc56");
        internal static Guid WPD_CONTACT_OBJECT_PROPERTIES_V1 = new Guid("fbd4fdab-987d-4777-b3f9-726185a9312b");
        internal static Guid WPD_CONTENT_TYPE_ALL = new Guid("80e170d2-1055-4a3e-b952-82cc4f8a8689");
        internal static Guid WPD_CONTENT_TYPE_APPOINTMENT = new Guid("0fed060e-8793-4b1e-90c9-48ac389ac631");
        internal static Guid WPD_CONTENT_TYPE_AUDIO = new Guid("4ad2c85e-5e2d-45e5-8864-4f229e3c6cf0");
        internal static Guid WPD_CONTENT_TYPE_AUDIO_ALBUM = new Guid("aa18737e-5009-48fa-ae21-85f24383b4e6");
        internal static Guid WPD_CONTENT_TYPE_CALENDAR = new Guid("a1fd5967-6023-49a0-9df1-f8060be751b0");
        internal static Guid WPD_CONTENT_TYPE_CERTIFICATE = new Guid("dc3876e8-a948-4060-9050-cbd77e8a3d87");
        internal static Guid WPD_CONTENT_TYPE_CONTACT = new Guid("eaba8313-4525-4707-9f0e-87c6808e9435");
        internal static Guid WPD_CONTENT_TYPE_CONTACT_GROUP = new Guid("346b8932-4c36-40d8-9415-1828291f9de9");
        internal static Guid WPD_CONTENT_TYPE_DOCUMENT = new Guid("680adf52-950a-4041-9b41-65e393648155");
        internal static Guid WPD_CONTENT_TYPE_EMAIL = new Guid("8038044a-7e51-4f8f-883d-1d0623d14533");
        internal static Guid WPD_CONTENT_TYPE_FUNCTIONAL_OBJECT = new Guid("99ed0160-17ff-4c44-9d98-1d7a6f941921");
        internal static Guid WPD_CONTENT_TYPE_GENERIC_FILE = new Guid("0085e0a6-8d34-45d7-bc5c-447e59c73d48");
        internal static Guid WPD_CONTENT_TYPE_GENERIC_MESSAGE = new Guid("e80eaaf8-b2db-4133-b67e-1bef4b4a6e5f");
        internal static Guid WPD_CONTENT_TYPE_IMAGE = new Guid("ef2107d5-a52a-4243-a26b-62d4176d7603");
        internal static Guid WPD_CONTENT_TYPE_IMAGE_ALBUM = new Guid("75793148-15f5-4a30-a813-54ed8a37e226");
        internal static Guid WPD_CONTENT_TYPE_MEDIA_CAST = new Guid("5e88b3cc-3e65-4e62-bfff-229495253ab0");
        internal static Guid WPD_CONTENT_TYPE_MEMO = new Guid("9cd20ecf-3b50-414f-a641-e473ffe45751");
        internal static Guid WPD_CONTENT_TYPE_MIXED_CONTENT_ALBUM = new Guid("00f0c3ac-a593-49ac-9219-24abca5a2563");
        internal static Guid WPD_CONTENT_TYPE_NETWORK_ASSOCIATION = new Guid("031da7ee-18c8-4205-847e-89a11261d0f3");
        internal static Guid WPD_CONTENT_TYPE_PLAYLIST = new Guid("1a33f7e4-af13-48f5-994e-77369dfe04a3");
        internal static Guid WPD_CONTENT_TYPE_PROGRAM = new Guid("d269f96a-247c-4bff-98fb-97f3c49220e6");
        internal static Guid WPD_CONTENT_TYPE_SECTION = new Guid("821089f5-1d91-4dc9-be3c-bbb1b35b18ce");
        internal static Guid WPD_CONTENT_TYPE_TASK = new Guid("63252f2c-887f-4cb6-b1ac-d29855dcef6c");
        internal static Guid WPD_CONTENT_TYPE_TELEVISION = new Guid("60a169cf-f2ae-4e21-9375-9677f11c1c6e");
        internal static Guid WPD_CONTENT_TYPE_UNSPECIFIED = new Guid("28d8d31e-249c-454e-aabc-34883168e634");
        internal static Guid WPD_CONTENT_TYPE_VIDEO = new Guid("9261b03c-3d78-4519-85e3-02c5e1f50bb9");
        internal static Guid WPD_CONTENT_TYPE_VIDEO_ALBUM = new Guid("012b0db7-d4c1-45d6-b081-94b87779614f");
        internal static Guid WPD_CONTENT_TYPE_WIRELESS_PROFILE = new Guid("0bac070a-9f5f-4da4-a8f6-3de44d68fd6c");
        internal static Guid WPD_DEVICE_PROPERTIES_V1 = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc");
        internal static Guid WPD_DEVICE_PROPERTIES_V2 = new Guid("463dd662-7fc4-4291-911c-7f4c9cca9799");
        internal static Guid WPD_DOCUMENT_OBJECT_PROPERTIES_V1 = new Guid("0b110203-eb95-4f02-93e0-97c631493ad5");
        internal static Guid WPD_EMAIL_OBJECT_PROPERTIES_V1 = new Guid("41f8f65a-5484-4782-b13d-4740dd7c37c5");
        internal static Guid WPD_EVENT_ATTRIBUTES_V1 = new Guid("10c96578-2e81-4111-adde-e08ca6138f6d");
        internal static Guid WPD_EVENT_DEVICE_CAPABILITIES_UPDATED = new Guid("36885aa1-cd54-4daa-b3d0-afb3e03f5999");
        internal static Guid WPD_EVENT_DEVICE_REMOVED = new Guid("e4cbca1b-6918-48b9-85ee-02be7c850af9");
        internal static Guid WPD_EVENT_DEVICE_RESET = new Guid("7755cf53-c1ed-44f3-b5a2-451e2c376b27");
        internal static Guid WPD_EVENT_OBJECT_ADDED = new Guid("a726da95-e207-4b02-8d44-bef2e86cbffc");
        internal static Guid WPD_EVENT_OBJECT_REMOVED = new Guid("be82ab88-a52c-4823-96e5-d0272671fc38");
        internal static Guid WPD_EVENT_OBJECT_TRANSFER_REQUESTED = new Guid("8d16a0a1-f2c6-41da-8f19-5e53721adbf2");
        internal static Guid WPD_EVENT_OBJECT_UPDATED = new Guid("1445a759-2e01-485d-9f27-ff07dae697ab");
        internal static Guid WPD_EVENT_OPTIONS_V1 = new Guid("b3d8dad7-a361-4b83-8a48-5b02ce10713b");
        internal static Guid WPD_EVENT_PROPERTIES_V1 = new Guid("15ab1953-f817-4fef-a921-5676e838f6e0");
        internal static Guid WPD_EVENT_PROPERTIES_V2 = new Guid("52807b8a-4914-4323-9b9a-74f654b2b846");
        internal static Guid WPD_EVENT_SERVICE_METHOD_COMPLETE = new Guid("8a33f5f8-0acc-4d9b-9cc4-112d353b86ca");
        internal static Guid WPD_EVENT_STORAGE_FORMAT = new Guid("3782616b-22bc-4474-a251-3070f8d38857");
        internal static Guid WPD_FOLDER_OBJECT_PROPERTIES_V1 = new Guid("7e9a7abf-e568-4b34-aa2f-13bb12ab177d");
        internal static Guid WPD_FORMAT_ATTRIBUTES_V1 = new Guid("a0a02000-bcaf-4be8-b3f5-233f231cf58f");
        internal static Guid WPD_FUNCTIONAL_CATEGORY_ALL = new Guid("2d8a6512-a74c-448e-ba8a-f4ac07c49399");
        internal static Guid WPD_FUNCTIONAL_CATEGORY_AUDIO_CAPTURE = new Guid("3f2a1919-c7c2-4a00-855d-f57cf06debbb");
        internal static Guid WPD_FUNCTIONAL_CATEGORY_DEVICE = new Guid("08ea466b-e3a4-4336-a1f3-a44d2b5c438c");
        internal static Guid WPD_FUNCTIONAL_CATEGORY_NETWORK_CONFIGURATION = new Guid("48f4db72-7c6a-4ab0-9e1a-470e3cdbf26a");
        internal static Guid WPD_FUNCTIONAL_CATEGORY_RENDERING_INFORMATION = new Guid("08600ba4-a7ba-4a01-ab0e-0065d0a356d3");
        internal static Guid WPD_FUNCTIONAL_CATEGORY_SMS = new Guid("0044a0b1-c1e9-4afd-b358-a62c6117c9cf");
        internal static Guid WPD_FUNCTIONAL_CATEGORY_STILL_IMAGE_CAPTURE = new Guid("613ca327-ab93-4900-b4fa-895bb5874b79");
        internal static Guid WPD_FUNCTIONAL_CATEGORY_STORAGE = new Guid("23f05bbc-15de-4c2a-a55b-a9af5ce412ef");
        internal static Guid WPD_FUNCTIONAL_CATEGORY_VIDEO_CAPTURE = new Guid("e23e5f6b-7243-43aa-8df1-0eb3d968a918");
        internal static Guid WPD_FUNCTIONAL_OBJECT_PROPERTIES_V1 = new Guid("8f052d93-abca-4fc5-a5ac-b01df4dbe598");
        internal static Guid WPD_IMAGE_OBJECT_PROPERTIES_V1 = new Guid("63d64908-9fa1-479f-85ba-9952216447db");
        internal static Guid WPD_MEDIA_PROPERTIES_V1 = new Guid("2ed8ba05-0ad3-42dc-b0d0-bc95ac396ac8");
        internal static Guid WPD_MEMO_OBJECT_PROPERTIES_V1 = new Guid("5ffbfc7b-7483-41ad-afb9-da3f4e592b8d");
        internal static Guid WPD_METHOD_ATTRIBUTES_V1 = new Guid("f17a5071-f039-44af-8efe-432cf32e432a");
        internal static Guid WPD_MUSIC_OBJECT_PROPERTIES_V1 = new Guid("b324f56a-dc5d-46e5-b6df-d2ea414888c6");
        internal static Guid WPD_NETWORK_ASSOCIATION_PROPERTIES_V1 = new Guid("e4c93c1f-b203-43f1-a100-5a07d11b0274");
        internal static Guid WPD_OBJECT_FORMAT_3GP = new Guid("b9840000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_AAC = new Guid("b9030000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_ABSTRACT_CONTACT = new Guid("bb810000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_ABSTRACT_CONTACT_GROUP = new Guid("ba060000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_ABSTRACT_MEDIA_CAST = new Guid("ba0b0000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_AIFF = new Guid("30070000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_ALL = new Guid("c1f62eb2-4bb3-479c-9cfa-05b5f3a57b22");
        internal static Guid WPD_OBJECT_FORMAT_ASF = new Guid("300c0000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_ASXPLAYLIST = new Guid("ba130000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_AUDIBLE = new Guid("b9040000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_AVI = new Guid("300a0000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_BMP = new Guid("38040000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_CIFF = new Guid("38050000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_DPOF = new Guid("30060000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_EXECUTABLE = new Guid("30030000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_EXIF = new Guid("38010000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_FLAC = new Guid("b9060000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_FLASHPIX = new Guid("38030000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_GIF = new Guid("38070000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_HTML = new Guid("30050000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_ICALENDAR = new Guid("be030000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_ICON = new Guid("077232ed-102c-4638-9c22-83f142bfc822");
        internal static Guid WPD_OBJECT_FORMAT_JFIF = new Guid("38080000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_JP2 = new Guid("380f0000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_JPX = new Guid("38100000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_M3UPLAYLIST = new Guid("ba110000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_M4A = new Guid("30aba7ac-6ffd-4c23-a359-3e9b52f3f1c8");
        internal static Guid WPD_OBJECT_FORMAT_MHT_COMPILED_HTML = new Guid("ba840000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_MICROSOFT_EXCEL = new Guid("ba850000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_MICROSOFT_POWERPOINT = new Guid("ba860000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_MICROSOFT_WFC = new Guid("b1040000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_MICROSOFT_WORD = new Guid("ba830000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_MP2 = new Guid("b9830000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_MP3 = new Guid("30090000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_MP4 = new Guid("b9820000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_MPEG = new Guid("300b0000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_MPLPLAYLIST = new Guid("ba120000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_NETWORK_ASSOCIATION = new Guid("b1020000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_OGG = new Guid("b9020000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_PCD = new Guid("38090000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_PICT = new Guid("380a0000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_PLSPLAYLIST = new Guid("ba140000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_PNG = new Guid("380b0000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_PROPERTIES_ONLY = new Guid("30010000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_SCRIPT = new Guid("30020000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_TEXT = new Guid("30040000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_TIFF = new Guid("380d0000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_TIFFEP = new Guid("38020000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_TIFFIT = new Guid("380e0000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_UNSPECIFIED = new Guid("30000000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_VCALENDAR1 = new Guid("be020000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_VCARD2 = new Guid("bb820000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_VCARD3 = new Guid("bb830000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_WAVE = new Guid("30080000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_WINDOWSIMAGEFORMAT = new Guid("b8810000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_WMA = new Guid("b9010000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_WMV = new Guid("b9810000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_WPLPLAYLIST = new Guid("ba100000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_X509V3CERTIFICATE = new Guid("b1030000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_FORMAT_XML = new Guid("ba820000-ae6c-4804-98ba-c57b46965fe7");
        internal static Guid WPD_OBJECT_PROPERTIES_V1 = new Guid("ef6b490d-5cd8-437a-affc-da8b60ee4a3c");
        internal static Guid WPD_PARAMETER_ATTRIBUTES_V1 = new Guid("e6864dd7-f325-45ea-a1d5-97cf73b6ca58");
        internal static Guid WPD_PROPERTY_ATTRIBUTES_V1 = new Guid("ab7943d8-6332-445f-a00d-8d5ef1e96f37");
        internal static Guid WPD_PROPERTY_ATTRIBUTES_V2 = new Guid("5d9da160-74ae-43cc-85a9-fe555a80798e");
        internal static Guid WPD_RENDERING_INFORMATION_OBJECT_PROPERTIES_V1 = new Guid("c53d039f-ee23-4a31-8590-7639879870b4");
        internal static Guid WPD_RESOURCE_ATTRIBUTES_V1 = new Guid("1eb6f604-9278-429f-93cc-5bb8c06656b6");
        internal static Guid WPD_SECTION_OBJECT_PROPERTIES_V1 = new Guid("516afd2b-c64e-44f0-98dc-bee1c88f7d66");
        internal static Guid WPD_SERVICE_PROPERTIES_V1 = new Guid("7510698a-cb54-481c-b8db-0d75c93f1c06");
        internal static Guid WPD_SMS_OBJECT_PROPERTIES_V1 = new Guid("7e1074cc-50ff-4dd1-a742-53be6f093a0d");
        internal static Guid WPD_STILL_IMAGE_CAPTURE_OBJECT_PROPERTIES_V1 = new Guid("58c571ec-1bcb-42a7-8ac5-bb291573a260");
        internal static Guid WPD_STORAGE_OBJECT_PROPERTIES_V1 = new Guid("01a3057a-74d6-4e80-bea7-dc4c212ce50a");
        internal static Guid WPD_TASK_OBJECT_PROPERTIES_V1 = new Guid("e354e95e-d8a0-4637-a03a-0cb26838dbc7");
        internal static Guid WPD_VIDEO_OBJECT_PROPERTIES_V1 = new Guid("346f2163-f998-4146-8b01-d19b4c00de9a");
    }

}

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35195074
PropVariant.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

namespace Wpd
{
    [StructLayout(LayoutKind.Explicit, Size = 16)]
    public struct PropVariant
    {
        [FieldOffset(0)]
        public short VariantType;

        [FieldOffset(8)]
        public IntPtr PointerValue;

        [FieldOffset(8)]
        public byte ByteValue;

        [FieldOffset(8)]
        public long LongValue;
    }
}

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35195082
Mtp.cs

using System;
using PortableDeviceApiLib;

namespace Wpd
{
    class Mtp
    {

        internal static Guid WPD_CATEGORY_MTP_EXT_VENDOR_OPERATIONS = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56);
        internal static Guid WPD_PROPERTIES_MTP_VENDOR_EXTENDED_OBJECT_PROPS = new Guid(0x4d545058, 0x4fce, 0x4578, 0x95, 0xc8, 0x86, 0x98, 0xa9, 0xbc, 0xf, 0x49);
        internal static Guid WPD_PROPERTIES_MTP_VENDOR_EXTENDED_DEVICE_PROPS = new Guid(0x4d545058, 0x8900, 0x40b3, 0x8f, 0x1d, 0xdc, 0x24, 0x6e, 0x1e, 0x83, 0x70);
        internal static Guid WPD_EVENT_MTP_VENDOR_EXTENDED_EVENTS = new Guid(0x00000000, 0x5738, 0x4ff2, 0x84, 0x45, 0xbe, 0x31, 0x26, 0x69, 0x10, 0x59);

        internal static _tagpropertykey WPD_COMMAND_MTP_EXT_GET_SUPPORTED_VENDOR_OPCODES = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 11 };
        internal static _tagpropertykey WPD_COMMAND_MTP_EXT_EXECUTE_COMMAND_WITHOUT_DATA_PHASE = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 12 };
        internal static _tagpropertykey WPD_COMMAND_MTP_EXT_EXECUTE_COMMAND_WITH_DATA_TO_READ = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 13 };
        internal static _tagpropertykey WPD_COMMAND_MTP_EXT_EXECUTE_COMMAND_WITH_DATA_TO_WRITE = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 14 };
        internal static _tagpropertykey WPD_COMMAND_MTP_EXT_READ_DATA = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 15 };
        internal static _tagpropertykey WPD_COMMAND_MTP_EXT_WRITE_DATA = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 16 };
        internal static _tagpropertykey WPD_COMMAND_MTP_EXT_END_DATA_TRANSFER = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 17 };
        internal static _tagpropertykey WPD_COMMAND_MTP_EXT_GET_VENDOR_EXTENSION_DESCRIPTION = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 18 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_OPERATION_CODE = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1001 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_OPERATION_PARAMS = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1002 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_RESPONSE_CODE = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1003 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_RESPONSE_PARAMS = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1004 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_VENDOR_OPERATION_CODES = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1005 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_TRANSFER_CONTEXT = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1006 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_TRANSFER_TOTAL_DATA_SIZE = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1007 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_TRANSFER_NUM_BYTES_TO_READ = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1008 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_TRANSFER_NUM_BYTES_READ = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1009 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_TRANSFER_NUM_BYTES_TO_WRITE = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1010 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_TRANSFER_NUM_BYTES_WRITTEN = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1011 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_TRANSFER_DATA = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1012 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_OPTIMAL_TRANSFER_BUFFER_SIZE = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1013 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_VENDOR_EXTENSION_DESCRIPTION = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56), pid = 1014 };
        internal static _tagpropertykey WPD_PROPERTY_MTP_EXT_EVENT_PARAMS = new _tagpropertykey() { fmtid = new Guid(0x4d545058, 0xef88, 0x4e4d, 0x95, 0xc3, 0x4f, 0x32, 0x7f, 0x72, 0x8a, 0x96), pid = 1011 };

    }
}

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35195087
DeviceManager.cs

using System;
using System.Collections.Generic;
using System.Text;
using PortableDeviceApiLib;

namespace Wpd
{
    public class DeviceManager
    {

        //  http://blogs.msdn.com/b/dimeby8/archive/2006/12/05/enumerating-wpd-devices-in-c.aspx

        /*
            Mike R. brought to my notice that the above sample only enumerates one device even if more than one are connected. 
            This is a marshalling restriction - we can work around it by manually fixing up the generated Interop assembly. 
            Follow the steps below to edit the assembly:
            
            1.  Disassemble the PortableDeviceApi interop using the command -
            ildasm Interop.PortableDeviceApiLib.dll /out:pdapi.il 
            
            2.  Open the IL in Notepad and search for the following string
            instance void  GetDevices([in][out] string&  marshal( lpwstr) pPnPDeviceIDs,
            
            3.  Replace all instances of the string above with the following string
            instance void  GetDevices([in][out] string[]  marshal([]) pPnPDeviceIDs,
            
            4.Save the IL and reassemble the interop using the command -
            ilasm pdapi.il /dll /output=Interop.PortableDeviceApiLib.dll
 
            You can now rebuild your project. You can now first call GetDevices with a NULL parameter to get the count of devices 
            and then call it again with an array to get the device IDs.
*/
        public static Dictionary<string, string> EnumerateDevices()
        {

            uint deviceCount = 1;
            PortableDeviceManager manager = new PortableDeviceManager();

            string strVal = string.Empty;
            string[] deviceIdDescriptionList = new string[1];

            Dictionary<string, string> deviceMatrix = new Dictionary<string, string>();

            manager.GetDevices(ref deviceIdDescriptionList[0], ref deviceCount);
            if (deviceCount > 0)
            {
                foreach (string deviceId in deviceIdDescriptionList)
                {
                    string friendlyName = GetDeviceFriendlyName(manager, deviceId);
                    deviceMatrix.Add(friendlyName, deviceId);
                }
            }

            return deviceMatrix;
        }

        private const uint MAXCHARS = 255;

        private static string GetDeviceFriendlyName(PortableDeviceManager manager, string deviceId)
        {
            ushort[] nameBuffer = new ushort[MAXCHARS];
            uint nameLength = MAXCHARS;

            // Convert to string
            StringBuilder builder = new StringBuilder((int)nameLength);

            manager.GetDeviceFriendlyName(deviceId, ref nameBuffer[0], ref nameLength);

            foreach (ushort letter in nameBuffer)
            {
                if (letter != 0)
                {
                    builder.Append((char)letter);
                }
            }

            return builder.ToString();
        }

    }

}

Open in new window

0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:mb1111
ID: 35196545
Hi ThelearnerOne
You are amazing!!!!!!!!
thanx alot!!!
I'm now trying it out,
but also here I get the same eror message
in this line:
    public void DisplayProperties(string objectID)
        {
            //
            // Retrieve IPortableDeviceContent interface required to
            // obtain the IPortableDeviceProperties interface
            //
            IPortableDeviceContent pContent;
            _portableDevice.Content(out pContent);

            //
            // Retrieve IPortableDeviceProperties interface required
            // to get all the properties
            //
            IPortableDeviceProperties pProperties;
            pContent.Properties(out pProperties);

            //
            // Call the GetValues API, we specify null to indicate we
            // want to retrieve all properties
            //
            IPortableDeviceValues pPropValues;
          [u]  pProperties.GetValues(objectID, null, out pPropValues);[/u]
}

Open in new window

The message that I get is :
The valuev was out of range!
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35197834
That is what I am working on now, and I can't get past that problem--what you see is what I got!!
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35204115
This class combines all the GUIDs into one lookup table, so that I can cross-reference a GUID against a name:

GuidLookup.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using PortableDeviceApiLib;

namespace Wpd
{
    internal static class GuidLookup
    {

        public static List<LookupItem> LookupTable;

        static GuidLookup()
        {
            LookupTable = new List<LookupItem>();

            ScanForGuid(typeof(DeviceGuid));
            ScanForTagPropertyKey(typeof(PropertyKey));

            ScanForGuid(typeof(Mtp));
            ScanForTagPropertyKey(typeof(Mtp));
        }
        
        private static void ScanForGuid(Type type)
        {
            List<FieldInfo> fieldList = type
                .GetFields(BindingFlags.NonPublic | BindingFlags.Static)
                .ToList();          

            foreach (FieldInfo field in fieldList)
            {
                var value = field.GetValue(field);

                if (value is Guid)
                {
                    Guid guidValue = (Guid)value;
                    string fieldName = field.Name;

                    LookupTable.Add(new LookupItem(fieldName, guidValue, 0));
                }
            }
        }

        private static void ScanForTagPropertyKey(Type type)
        {
            List<FieldInfo> fieldList = type
                .GetFields(BindingFlags.NonPublic | BindingFlags.Static)
                .ToList();

            foreach (FieldInfo field in fieldList)
            {
                var key = field.GetValue(field);
                string fieldName = field.Name;

                if (key is _tagpropertykey)
                {
                    _tagpropertykey propertyKey = (_tagpropertykey)key;

                    Guid guidValue = propertyKey.fmtid;

                    LookupTable.Add(new LookupItem(fieldName, guidValue, (int)propertyKey.pid));
                }
            }
        }


        public class LookupItem
        {

            public LookupItem(string name, Guid guid, int index)
            {
                this.Name = name;
                this.Guid = guid;
                this.Index = index;
            }

            public string Name { get; private set; }
            public Guid Guid { get; private set; }
            public int Index { get; private set; }
        }

    }
}

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35204119
Updated Device wrapper, with a new BuildFullPropertyList that works with my Canon SX210 camera.

using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Reflection;
using System.Runtime.InteropServices;
using PortableDeviceApiLib;
using Types = PortableDeviceTypesLib;

namespace Wpd
{
    public class Device
    {

        private PortableDevice _portableDevice;

        private IPortableDeviceCapabilities _capabilities;

        public List<string> CommandList { get; private set; }

        public List<KeyValuePair<string, int>> ObjectIdList { get; private set; }

        public string DeviceId { get; private set; }
        public string ClientName { get; private set; }

        public Device(string deviceId, string clientName)
        {
            this.DeviceId = deviceId;
            this.ClientName = clientName;

            this.OpenDevice();

            _portableDevice.Capabilities(out _capabilities);
        }

        #region Public methods

        public List<PropertyPair> DisplayProperties(string objectID)
        {
            //
            // Retrieve IPortableDeviceContent interface required to
            // obtain the IPortableDeviceProperties interface
            //
            IPortableDeviceContent pContent;
            _portableDevice.Content(out pContent);

            //
            // Retrieve IPortableDeviceProperties interface required
            // to get all the properties
            //
            IPortableDeviceProperties pProperties;
            pContent.Properties(out pProperties);

            //
            // Call the GetValues API, we specify null to indicate we
            // want to retrieve all properties
            //
            IPortableDeviceValues pPropValues;
            pProperties.GetValues(objectID, null, out pPropValues);

            //
            // Get count of properties
            //
            uint count = 0;
            pPropValues.GetCount(ref count);

            List<PropertyPair> propertyList = new List<PropertyPair>();

            for (uint i = 0; i < count; i++)
            {
                //
                // Retrieve the property at index 'i'
                //
                _tagpropertykey propertyKey = new _tagpropertykey();
                tag_inner_PROPVARIANT propertyValue = new tag_inner_PROPVARIANT();
                pPropValues.GetAt(i, ref propertyKey, ref propertyValue);

                PropVariant value = TagInnerPropVariantToPropVariant(propertyValue);

                //
                // Display the property if it a string (VT_LPWSTR is decimal 31)
                //
                string stringValue = "";

                if (value.VariantType == 31)
                {
                    stringValue = Marshal.PtrToStringUni(value.PointerValue);
                }
                else
                {
                    stringValue = value.VariantType.ToString();
                }

                Guid guid = propertyKey.fmtid;

                GuidLookup.LookupItem lookup = GuidLookup.LookupTable
                    .Where(w => w.Guid == guid)
                    .FirstOrDefault();

                if (lookup != null)
                {
                    propertyList.Add(new PropertyPair(lookup.Name, stringValue));
                }

            }

            return propertyList;
        }

        public List<PropertyPair> BuildFullPropertyList()
        {
            this.StartEnumerate();

            List<PropertyPair> fullPropertyList = new List<PropertyPair>();

            foreach (KeyValuePair<string, int> pair in this.ObjectIdList)
            {
                fullPropertyList.AddRange(this.DisplayProperties(pair.Key));
            }

            return fullPropertyList;
        }

        public void GetFunctionalCategories()
        {
            IPortableDevicePropVariantCollection collection;
            _capabilities.GetFunctionalCategories(out collection);

            uint count = 0;
            collection.GetCount(ref count);

            for (int i = 0; i < count; i++)
            {
                tag_inner_PROPVARIANT value = default(tag_inner_PROPVARIANT);
                collection.GetAt((uint)i, ref value);

                PropVariant variant = TagInnerPropVariantToPropVariant(value);
            }
        }

        public void GetSupportedCommands()
        {
            IPortableDeviceKeyCollection commands;
            _capabilities.GetSupportedCommands(out commands);

            uint count = 0;
            commands.GetCount(ref count);

            List<GuidLookup.LookupItem> guidList = GuidLookup.LookupTable;

            List<Guid> unknownList = new List<Guid>();

            this.CommandList = new List<string>();

            for (int i = 0; i < count; i++)
            {
                _tagpropertykey key = default(_tagpropertykey);
                commands.GetAt((uint)i, ref key);

                Guid guid = key.fmtid;

                string capability = "";

                GuidLookup.LookupItem lookup = guidList.Where(w => w.Guid.Equals(guid)).FirstOrDefault();

                if (lookup == null)
                    throw new InvalidOperationException("Cannot find match for GUID " + lookup.Guid);

                capability = lookup.Name;

                if (!string.IsNullOrWhiteSpace(capability) && !this.CommandList.Contains(capability))
                {
                    this.CommandList.Add(capability);
                }
            }
        }

        public string[] GetAllObjectHandles()
        {

            List<string> tmpHandles = new List<string>();

            try
            {

                IPortableDeviceValues pParameters = (IPortableDeviceValues)new PortableDeviceTypesLib.PortableDeviceValues();
                IPortableDeviceValues pResults = null;

                pParameters.SetGuidValue(ref  Mtp.WPD_COMMAND_MTP_EXT_EXECUTE_COMMAND_WITH_DATA_TO_READ, ref DeviceGuid.WPD_PROPERTY_COMMON_COMMAND_CATEGORY);
                pParameters.SetUnsignedIntegerValue(ref Mtp.WPD_COMMAND_MTP_EXT_EXECUTE_COMMAND_WITH_DATA_TO_READ, PropertyKey.WPD_PROPERTY_COMMON_COMMAND_ID.pid);
                pParameters.SetUnsignedIntegerValue(Mtp.WPD_PROPERTY_MTP_EXT_OPERATION_CODE, 0x1007);

                Types.PortableDevicePropVariantCollection pSubValues = new PortableDeviceTypesLib.PortableDevicePropVariantCollection();

                this.AddSubValue(pSubValues, variantType: 19, longValue: 0xffffffff);
                this.AddSubValue(pSubValues, variantType: 19, longValue: 0x0);
                this.AddSubValue(pSubValues, variantType: 19, longValue: 0x0);

                pParameters.SetIPortableDevicePropVariantCollectionValue(Mtp.WPD_PROPERTY_MTP_EXT_OPERATION_PARAMS,
                    (IPortableDevicePropVariantCollection)pSubValues);

                _portableDevice.SendCommand(0, pParameters, out pResults);

                uint pCelt = 0;
                pResults.GetCount(pCelt);

                if (pCelt <= 1)
                {
                    return tmpHandles.ToArray();
                }

                uint tmpBufferSize = 0;
                uint tmpTransferSize = 0;
                string tmpTransferContext = string.Empty;
                {
                    pResults.GetStringValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_CONTEXT, out tmpTransferContext);
                    pResults.GetUnsignedIntegerValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_TOTAL_DATA_SIZE, out tmpBufferSize);
                    pResults.GetUnsignedIntegerValue(ref Mtp.WPD_PROPERTY_MTP_EXT_OPTIMAL_TRANSFER_BUFFER_SIZE, out tmpTransferSize);

                    try
                    {
                        int pValue;
                        pResults.GetErrorValue(PropertyKey.WPD_PROPERTY_COMMON_HRESULT, out pValue);
                    }
                    catch
                    {
                    }
                }

                pParameters.Clear();
                pResults.Clear();

                byte[] tmpData = new byte[(int)tmpTransferSize];

                pParameters.SetGuidValue(Mtp.WPD_COMMAND_MTP_EXT_READ_DATA, DeviceGuid.WPD_PROPERTY_COMMON_COMMAND_CATEGORY);
                pParameters.SetUnsignedIntegerValue(ref Mtp.WPD_COMMAND_MTP_EXT_READ_DATA, PropertyKey.WPD_PROPERTY_COMMON_COMMAND_ID.pid);
                pParameters.SetStringValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_CONTEXT, tmpTransferContext);
                pParameters.SetBufferValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_DATA, ref tmpData[0], (uint)tmpBufferSize);
                pParameters.SetUnsignedIntegerValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_NUM_BYTES_TO_READ, (uint)tmpBufferSize);

                _portableDevice.SendCommand(0, pParameters, out pResults);

                ulong[] pbBufferOut = new ulong[(int)tmpTransferSize];

                uint cbBytesRead = 0;

                IntPtr ptr = Marshal.AllocHGlobal(Marshal.SizeOf((int)(pbBufferOut[0]) * tmpTransferSize));

                pResults.GetBufferValue(ref Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_DATA, ptr, out cbBytesRead);

                try
                {
                    int pValue = 0;
                    pResults.GetErrorValue(PropertyKey.WPD_PROPERTY_COMMON_HRESULT, out pValue);
                }
                catch
                {
                }

                byte[] newBuffer = new byte[(int)cbBytesRead];

                IntPtr tmpPtr = new IntPtr((long)pbBufferOut[0]);

                string tmpString = string.Empty;

                for (int i = 0; i <= newBuffer.Length - 1; i += 4)
                {
                    string tmpObjectHandle = "o" + Convert.ToString(Marshal.ReadInt32(tmpPtr, 8 + i), 16).ToUpper();
                    tmpHandles.Add(tmpObjectHandle);
                }

                pParameters.Clear();
                pResults.Clear();

                {
                    pParameters.SetGuidValue(ref Mtp.WPD_COMMAND_MTP_EXT_END_DATA_TRANSFER, ref DeviceGuid.WPD_PROPERTY_COMMON_COMMAND_CATEGORY);
                    pParameters.SetUnsignedIntegerValue(ref Mtp.WPD_COMMAND_MTP_EXT_END_DATA_TRANSFER, PropertyKey.WPD_PROPERTY_COMMON_COMMAND_ID.pid);
                    pParameters.SetStringValue(Mtp.WPD_PROPERTY_MTP_EXT_TRANSFER_CONTEXT, tmpTransferContext);
                }

                _portableDevice.SendCommand(0, pParameters, out pResults);

                try
                {
                    int tmpResult = 0;

                    pResults.GetErrorValue(ref PropertyKey.WPD_PROPERTY_COMMON_HRESULT, out tmpResult);
                }
                catch
                {
                }
                Marshal.FreeHGlobal(tmpPtr);

            }

            catch (Exception ex)
            {
            }
            return tmpHandles.ToArray();
        }

        public string[] GetObjectHandles(string parentObjectId)
        {
            IEnumPortableDeviceObjectIDs pEnum = null;

            string[] tmpIds = new string[999];

            uint fetchCount = 0;

            try
            {

                IPortableDeviceContent pContent;
                _portableDevice.Content(out pContent);

                IPortableDeviceValues pFilter = null;
                pContent.EnumObjects(0, parentObjectId, pFilter, out pEnum);

                pEnum.Next((uint)999, out tmpIds[0], ref fetchCount);

                Array.Resize(ref tmpIds, (int)fetchCount);
            }
            catch
            {
            }

            //Place error handling code here... 

            return tmpIds;

        }

        public void StartEnumerate()
        {
            //
            // Get content interface required to enumerate
            //
            IPortableDeviceContent pContent;
            _portableDevice.Content(out pContent);

            ObjectIdList = new List<KeyValuePair<string, int>>();

            Enumerate(ref pContent, "DEVICE", 1);
        }

        #endregion

        #region Public static methods

        public static void SetStringValue(PortableDevice pPortableDevice, string objectID, ref _tagpropertykey propKey, string newValue)
        {
            //
            // Retrieve IPortableDeviceContent interface required to
            // obtain the IPortableDeviceProperties interface
            //
            IPortableDeviceContent pContent;
            pPortableDevice.Content(out pContent);

            //
            // Retrieve IPortableDeviceProperties interface required
            // to get all the properties
            //
            IPortableDeviceProperties pProperties;
            pContent.Properties(out pProperties);

            //
            // Create the Values collection to hold the value to be set
            //
            IPortableDeviceValues pSetValues = (IPortableDeviceValues)new Types.PortableDeviceValues();

            //
            // Use the C# PropVariant definition to set the string value
            //
            PropVariant pvSet = new PropVariant();
            pvSet.VariantType = 31; // VT_LPWSTR
            pvSet.PointerValue = Marshal.StringToCoTaskMemUni(newValue);

            //
            // Marshal our definition into a pointer
            //
            IntPtr ptrValue = Marshal.AllocHGlobal(Marshal.SizeOf(pvSet));
            Marshal.StructureToPtr(pvSet, ptrValue, false);

            //
            // Marshal pointer into the interop PROPVARIANT 
            //
            tag_inner_PROPVARIANT ipSet =
              (tag_inner_PROPVARIANT)Marshal.PtrToStructure(ptrValue, typeof(tag_inner_PROPVARIANT));

            //
            // Call the SetValues API to set the specified property
            //
            pSetValues.SetValue(ref propKey, ref ipSet);

            IPortableDeviceValues pResults;
            pProperties.SetValues(objectID, pSetValues, out pResults);
        }

        public static tag_inner_PROPVARIANT PropVariantToTagInnerPropVariant()
        {
            PropVariant propVariant = new PropVariant();

            IntPtr pointer = Marshal.AllocHGlobal(Marshal.SizeOf(propVariant));
            Marshal.StructureToPtr(propVariant, pointer, fDeleteOld: false);

            return (tag_inner_PROPVARIANT)Marshal.PtrToStructure(pointer, typeof(tag_inner_PROPVARIANT));
        }

        public static PropVariant TagInnerPropVariantToPropVariant(tag_inner_PROPVARIANT tagInnerPropVariant)
        {
            IntPtr pointer = Marshal.AllocHGlobal(Marshal.SizeOf(tagInnerPropVariant));
            Marshal.StructureToPtr(tagInnerPropVariant, pointer, fDeleteOld: false);

            return (PropVariant)Marshal.PtrToStructure(pointer, typeof(PropVariant));
        }

        public static tag_inner_PROPVARIANT StringToPropVariant(string value)
        {
            // We'll use an IPortableDeviceValues object to transform the string into a PROPVARIANT
            IPortableDeviceValues deviceValueCollection = (IPortableDeviceValues)new PortableDeviceTypesLib.PortableDeviceValues();

            tag_inner_PROPVARIANT tagInnerPropVariant = default(tag_inner_PROPVARIANT);
            // Insert the string value into the IPortableDeviceValues object
            // using the SetStringValue method
            deviceValueCollection.SetStringValue(ref PropertyKey.WPD_OBJECT_ID, value);

            // Extract the string into a PROPVARIANT by using the GetValue method.
            deviceValueCollection.GetValue(ref PropertyKey.WPD_OBJECT_ID, out tagInnerPropVariant);

            return tagInnerPropVariant;
        }

        #endregion

        #region Private methods

        private void AddSubValue(Types.PortableDevicePropVariantCollection subValueCollection, short variantType, long longValue)
        {
            PropVariant propVariant = new PropVariant()
            {
                VariantType = variantType,
                LongValue = longValue,
            };

            IntPtr pointer = Marshal.AllocHGlobal(Marshal.SizeOf(propVariant));

            Marshal.StructureToPtr(propVariant, pointer, false);

            Types.tag_inner_PROPVARIANT tagInnerPropVariant = (Types.tag_inner_PROPVARIANT)Marshal.PtrToStructure(pointer,
                typeof(Types.tag_inner_PROPVARIANT));
            subValueCollection.Add(ref tagInnerPropVariant);
        }

        private void Enumerate(ref IPortableDeviceContent content, string parentID, int level)
        {
            //
            // Enumerate children (if any)
            //
            IEnumPortableDeviceObjectIDs pEnum;
            content.EnumObjects(0, parentID, null, out pEnum);

            this.ObjectIdList.Add(new KeyValuePair<string, int>(parentID, level));

            uint fetchCount = 0;
            do
            {
                string objectID;
                pEnum.Next(1, out objectID, ref fetchCount);

                if (fetchCount > 0)
                {
                    //
                    // Recurse into children
                    //
                    Enumerate(ref content, objectID, level + 1);
                }
            } while (fetchCount > 0);
        }

        private void OpenDevice()
        {
            _portableDevice = new PortableDevice();
            IPortableDeviceValues clientInfo = (IPortableDeviceValues)new Types.PortableDeviceValues();

            clientInfo.SetStringValue(PropertyKey.WPD_CLIENT_NAME, this.ClientName);

            Version version = Assembly.GetExecutingAssembly().GetName().Version;
            clientInfo.SetUnsignedIntegerValue(PropertyKey.WPD_CLIENT_MAJOR_VERSION, (uint)version.Major);
            clientInfo.SetUnsignedIntegerValue(PropertyKey.WPD_CLIENT_MINOR_VERSION, (uint)version.Minor);
            clientInfo.SetUnsignedIntegerValue(PropertyKey.WPD_CLIENT_REVISION, (uint)version.Revision);

            _portableDevice.Open(this.DeviceId, clientInfo);
        }

        #endregion

    }
}

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35204124
I created a new PropertyPair class, so that I could read the debug output more easily.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Wpd
{
    public class PropertyPair
    {

        public PropertyPair(string name, string value)
        {
            this.Name = name;
            this.Value = value;
        }

        public string Name { get; private set; }
        public string Value { get; private set; }

        public override string ToString()
        {
            return string.Format("{0} [name={1}, value={2}]", this.GetType().Name, this.Name, this.Value);
        }

    }
}

Open in new window

0
 
LVL 96

Accepted Solution

by:
Bob Learned earned 500 total points
ID: 35204134
Debug output sample.


Snapshot.png
0
 

Author Comment

by:mb1111
ID: 35209931
Hi TheLearnerOne
I tried your code and it is working great!!
I hope that from here it will be easer to create folders.
there is a command of creating objects like folders etc.
  pContent.CreateObjectWithPropertiesOnly(pFinalObjectProperties,ref  pszNewlyCreatedObject);

Open in new window

but I get an exception "The component was not found"
If you succeeded to do something with it, I will appriccate.
and again thank you very much!
0
 

Author Comment

by:mb1111
ID: 35236052
Hi,
I succeded creating folder on the wpd(it's woking great on my mp3 player)
here is the code:
     public  void CreateFolderOnDevice(ref   PortableDevice    pDevice,string newFolder)
         {
          if (pDevice ==null )
             {
               System.Windows.Forms.MessageBox.Show("! A NULL IPortableDevice interface pointer was received\n");
                return;
             }

    
              string  szSelection ;
              string  szFolderName ;
              IPortableDeviceValues pFinalObjectProperties=(IPortableDeviceValues)new PortableDeviceTypesLib.PortableDeviceValues();
              IPortableDeviceContent     pContent;
              _pPort.Content(out pContent);
    
              // Prompt user to enter an object identifier for the parent object on the device to transfer.

              szSelection =newfolder;
                
              // Prompt user to enter an object identifier for the parent object on the device to transfer.
    
              szFolderName= newFolder ;
    
             // 1) Get an IPortableDeviceContent interface from the IPortableDevice interface to
             // access the content-specific methods.
          try 
         	{
              pDevice.Content(out pContent);      
		
	         }
	      catch (Exception)
	       {
		    System.Windows.Forms.MessageBox.Show("! Failed to get IPortableDeviceContent from IPortableDevice, hr = 0x%lx\n");
		
	         }
    {
        try
        {
            GetRequiredPropertiesForFolder(_objectId  ,  szFolderName, ref pFinalObjectProperties);
            
        }
        catch (Exception)
        {
            System.Windows.Forms.MessageBox.Show("! Failed to get required properties neebded to transfer an image file to the device, hr = 0x%lx\n");

        }
      // Returned properties describing the folder
       
    }

    // 3) Transfer the content to the device by creating a properties-only object
   
        string  pszNewlyCreatedObject = string.Empty ;
         // Properties describing the object data
            try 
	{	        
          pContent.CreateObjectWithPropertiesOnly(pFinalObjectProperties,ref  pszNewlyCreatedObject);
        System.Windows.Forms.MessageBox.Show("The folder was created on the device.\nThe newly created object's ID is:  " + pszNewlyCreatedObject);
		
	}
	catch (Exception)
	{
            System.Windows.Forms.MessageBox.Show("! Failed to create a new folder on the device, hr = 0x%lx\n");

	}
       
        

        // Free the object identifier string returned from CreateObjectWithPropertiesOnly
    //    CoTaskMemFree(pszNewlyCreatedObject);
    //    pszNewlyCreatedObject = NULL;
    //}

}

        IPortableDeviceValues pObjectProperties;
        [DllImport("ole32.dll", ExactSpelling = true, PreserveSig = false)]
        public static extern object CoCreateInstance([In] ref Guid clsid, [MarshalAs(UnmanagedType.Interface)] object punkOuter, int context, [In] ref Guid iid);
        public void GetRequiredPropertiesForFolder(string parentFolder, string folderName, ref  IPortableDeviceValues ppObjectProperties)
        {
            
            ppObjectProperties.SetStringValue(ref PropertyKey.WPD_OBJECT_PARENT_ID, parentFolder);
            ppObjectProperties.SetStringValue(ref PropertyKey.WPD_OBJECT_NAME , folderName );
            ppObjectProperties.SetGuidValue(ref PropertyKey.WPD_OBJECT_CONTENT_TYPE,ref DeviceGuid.WPD_CONTENT_TYPE_FOLDER );
        }

Open in new window

and on the DeviceGuid class I added this guid:
 internal static Guid WPD_CONTENT_TYPE_FOLDER = new Guid( 0x27E2E392, 0xA111, 0x48E0, 0xAB, 0x0C, 0xE1, 0x77, 0x05, 0xA0, 0x5F, 0x85 );

Open in new window

now Im working on copy files into the device.
if you get it, send your code.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35237606
Thank you for that contribution to the problem at hand.  I have been exploring the IPortableDeviceServiceManager interface, since it is part of the Windows 7 API, and is not part of the Interop.PortableDeviceApi.  I wanted to see what you can achieve from this interface, but it has been a hard road to navigate from managed code.

I found this sample C++ application, that enumerates services:

WpdServicesApiSample Application
http://msdn.microsoft.com/en-us/library/dd389002(v=vs.85).aspx
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35237621
Where is _objectId coming from in this line?

            GetRequiredPropertiesForFolder(_objectId, szFolderName, pFinalObjectProperties);

Open in new window


What is _pPort in this line?

_pPort.Content(out pContent);

Open in new window

0
 

Author Comment

by:mb1111
ID: 35284405
Hi TheLearnerOne!!
Thank you for your answers, they helped me alot!!
I succeded to transfer files and create folder.
if you want the code I can sent you.
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35289761
I am trying to figure out the entire set of possibilities with the WPD interface, and since the resources are limited, it has taken a lot longer than anticipated.  I would love to see what you came up with, since my end goal is to develop a managed wrapper that translates the COM interface to something more .NET-specific.  I was hoping that I could find an answer for you quicker, but I am always glad when someone can find an answer for themselves.

Here is my current code set in a .zip file:

https://filedb.experts-exchange.com/incoming/ee-stuff/8080-Wpd.zip
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35289808
Pay special attention to the cross-reference stuff, since it uses a dictionary to cross-reference all the GUIDs and PropertyKeys to an enum, by attaching an attribute (CrossReferenceAttribute) to each of the fields in the 4 classes.  Then, you can reference the values by name, or by enum.

Example:

var reference = ReferenceService.GetCrossReference<Guid, Event>(Event.ObjectAdded);

That finds this GUID element in the EventNotification class:

        //   This event is sent after a new object is available on the device.
        [CrossReference(category: "Event", name: "ObjectAdded")]
        internal static Guid WPD_EVENT_OBJECT_ADDED = new Guid("a726da95-e207-4b02-8d44-bef2e86cbffc");
0
 

Expert Comment

by:ChSchmidt81
ID: 35382598
Hi mb1111,

this is really a great post. I am currently searching for transferring files to WPD. Could you please give me a hint or provide some code-snippet? I have downloaded the project from TheLearnedOne and can connect to my camera.

Thanks
0
 

Expert Comment

by:carloviv15
ID: 35417542
I'm looking to create a service that automatically copies files from a digital camera to the pc.  Looks like you  have come a long way towards what i'm looking for.  Has anyone written a method to enumerate the files on a camera and copy them to the local pc?

thanks
0
 

Author Comment

by:mb1111
ID: 35473252
Hi ChShmdt
Here is a class with all commands that I needed, I hope it will help you.
if you have any problem I can send you my project.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using PortableDeviceApiLib;
using System.Runtime.InteropServices;
using System.Xml;
using System.IO;

namespace WPD
{
    class Commands
    {
        string _objectId = string.Empty;
        string _freindlyName = string.Empty;
        PortableDevice _pPort;
        public Commands(PortableDevice pPort, string objectId, string freindly)
        {
            this._pPort = pPort;
            this._freindlyName = freindly;
            this._objectId = objectId;
            //CreateFolderOnDevice(ref _pPort, "KolHadaf");
        }
        //ok
        public void CreateFolderOnDevice(PortableDevice pDevice, string newFolder)
        {
            if (pDevice == null)
            {
                System.Windows.Forms.MessageBox.Show("! A NULL IPortableDevice interface pointer was received\n");
                return;
            }
            string szSelection;
            string szFolderName;
            IPortableDeviceValues pFinalObjectProperties = (IPortableDeviceValues)new PortableDeviceTypesLib.PortableDeviceValues();
            IPortableDeviceContent pContent;
            pDevice.Content(out pContent);
            // Prompt user to enter an object identifier for the parent object on the device to transfer.

            // Prompt user to enter an object identifier for the parent object on the device to transfer.

            szFolderName = newFolder;

            // 1) Get an IPortableDeviceContent interface from the IPortableDevice interface to
            // access the content-specific methods.
            try
            {
                pDevice.Content(out pContent);

            }
            catch (Exception)
            {
                System.Windows.Forms.MessageBox.Show("! Failed to get IPortableDeviceContent from IPortableDevice, hr = 0x%lx\n");

            }
            {
                try
                {
                    GetRequiredPropertiesForFolder(_objectId, szFolderName, ref pFinalObjectProperties);

                }
                catch (Exception)
                {
                    System.Windows.Forms.MessageBox.Show("! Failed to get required properties neebded to transfer an image file to the device, hr = 0x%lx\n");

                }
                // Returned properties describing the folder

            }

            // 3) Transfer the content to the device by creating a properties-only object
            _pPort.Content(out pContent);
            string pszNewlyCreatedObject = string.Empty;
            // Properties describing the object data
            try
            {
                pContent.CreateObjectWithPropertiesOnly(pFinalObjectProperties, ref  pszNewlyCreatedObject);
                Guid g;
                pObjectProperties.GetGuidValue(ref PropertyKey.WPD_OBJECT_CONTENT_TYPE, out g);
                DeviceFolder d = new DeviceFolder(newFolder,pszNewlyCreatedObject,_objectId ,_pPort,g);
                MusicSoftware.GUI.StartForm.folderList.Add(d);
                //DeleteFileFromWPd(ref _pPort, "G:\\¿¿¿¿ ¿¿ ¿¿¿¿.wma");
            }
            catch (Exception)
            {

            }




            // Free the object identifier string returned from CreateObjectWithPropertiesOnly
            //    CoTaskMemFree(pszNewlyCreatedObject);
            //    pszNewlyCreatedObject = NULL;
            //}

        }
        IPortableDeviceValues pObjectProperties;
        [DllImport("ole32.dll", ExactSpelling = true, PreserveSig = false)]
        public static extern object CoCreateInstance([In] ref Guid clsid, [MarshalAs(UnmanagedType.Interface)] object punkOuter, int context, [In] ref Guid iid);
        //ok
        public void GetRequiredPropertiesForFolder(string parentFolder, string folderName, ref  IPortableDeviceValues ppObjectProperties)
        {
            //CoCreateInstance(ref DeviceGuid.WPD_CLASS_EXTENSION_V1,null,0x1,ref PropertyKey.WPD_OBJECT_ID.fmtid );
            ppObjectProperties.SetStringValue(ref PropertyKey.WPD_OBJECT_PARENT_ID, parentFolder);
            ppObjectProperties.SetStringValue(ref PropertyKey.WPD_OBJECT_NAME, folderName);
            ppObjectProperties.SetStringValue(ref PropertyKey.WPD_OBJECT_ORIGINAL_FILE_NAME, folderName);
            
            ppObjectProperties.SetGuidValue(ref PropertyKey.WPD_OBJECT_CONTENT_TYPE, ref DeviceGuid.WPD_CONTENT_TYPE_FOLDER);
        }
        //ok
        public static IStream GetStream(PortableDevice pPort, string objectId, string freindly)
        {
            //need a contents object to get the propeties
            IPortableDeviceContent content;
            pPort.Content(out content);
            //get transfer interface to this device
            IPortableDeviceResources resources;
            content.Transfer(out resources);

            PortableDeviceApiLib.IStream wpdStream;
            uint optimalTransferSize = uint.MinValue;
            try
            {
                resources.GetStream(objectId, ref PropertyKey.WPD_RESOURCE_DEFAULT, 0, ref optimalTransferSize, out wpdStream);
                System.Windows.Forms.MessageBox.Show(objectId + "      WO?WWWWWWWWWWWWW");
                System.Runtime.InteropServices.ComTypes.IStream sourceStream = (System.Runtime.InteropServices.ComTypes.IStream)wpdStream;

                return wpdStream;
            }
            catch (Exception ec)
            {
                System.Windows.Forms.MessageBox.Show(objectId + "  noooop");
                return null;
            }
            //convert to a useful stream object
        }
        //ok
        public void StreamCopy(ref IStream pDestStream, ref    IStream pSourceStream, uint cbTransferSize, ref uint pcbWritten)
        {

            // Allocate a temporary buffer (of Optimal transfer size) for the read results to
            // be written to.
            byte[] pObjectData = new byte[cbTransferSize];
            if (pObjectData != null)
            {
                uint cbTotalBytesRead = 0;
                uint cbTotalBytesWritten = 0;

                uint cbBytesRead = 0;
                uint cbBytesWritten = 0;

                // Read until the number of bytes returned from the source stream is 0, or
                // an error occured during transfer.
                do
                {
                    // Read object data from the source stream
                    try
                    {
                        pSourceStream.RemoteRead(out pObjectData[0], cbTransferSize, out cbBytesRead);
                    }
                    catch
                    {
                        return;
                        //System.Windows.Forms.MessageBox.Show("! Failed to read %d bytes from the source stream, hr = 0x%lx\n  " + cbTransferSize);
                    }

                    // Write object data to the destination stream
                    cbTotalBytesRead += cbBytesRead; // Calculating total bytes read from device for debugging purposes only
                    try
                    {

                        pDestStream.RemoteWrite(ref pObjectData[0], cbBytesRead, out  cbBytesWritten);
                    }
                    catch
                    {
                        //System.Windows.Forms.MessageBox.Show("Eror: There is already ");
                        return;
                    }
                    cbTotalBytesWritten += cbBytesWritten; // Calculating total bytes written to the file for debugging purposes only

                    // Output Read/Write operation information only if we have received data and if no error has occured so far.
                } while (cbBytesRead > 0);
              
                // If the caller supplied a pcbWritten parameter and we
                // and we are successful, set it to cbTotalBytesWritten
                // before exiting.
                if (pcbWritten != null)
                {
                    pcbWritten = cbTotalBytesWritten;
                }

                // Remember to delete the temporary transfer buffer
                //delete [] pObjectData;
                pObjectData = null;
            }
            else
            {
                System.Windows.Forms.MessageBox.Show("! Failed to allocate %d bytes for the temporary transfer buffer    " + cbTransferSize);
            }
        }
          [DllImport("shlwapi.dll", CharSet = CharSet.Unicode)]
          static internal extern uint SHCreateStreamOnFile
         (string pszFile, uint grfMode, out IStream ppstm);
        public void TransferContentToDevice(PortableDevice pDevice, ref Guid guidContentType, FileInfo file, string devicePath,string parentId)
        {
            if (pDevice == null)
            {
                System.Windows.Forms.MessageBox.Show("! A NULL IPortableDevice interface pointer was received\n");
                return;
            }
            //<SnippetContentTransfer1>
            ulong fileSize = (ulong)(file.Length);
            string szSelection;
            string szFilePath = file.FullName;
            uint cbOptimalTransferSize = 0;
            IStream pFileStream;
            IStream pFinalObjectDataStream;
            IPortableDeviceValues pFinalObjectProperties = (IPortableDeviceValues)new PortableDeviceTypesLib.PortableDeviceValues();
            IPortableDeviceContent pContent;
            pDevice.Content(out pContent);
            IStream pTempStream;  // Temporary IStream which we use to QI for IPortableDeviceDataStream
            // Prompt user to enter an object identifier for the parent object on the device to transfer.
            szSelection =devicePath  ;
           
            SHCreateStreamOnFile(file.FullName, 0x00000000 | 0x00000040, out pFileStream);
         
            GetRequiredPropertiesForContentType(ref guidContentType,           // Content type of the data
                                                   szSelection,              // Parent to transfer the data under
                                                   szFilePath,               // Full file path to the data file
                                                   ref pFileStream,               // Open IStream that contains the data
                                                    ref   pFinalObjectProperties, fileSize);  // Returned properties describing the data

            string nullString = "";
            pContent.CreateObjectWithPropertiesAndData(pFinalObjectProperties,    // Properties describing the object data
                                                               out  pTempStream,              // Returned object data stream (to transfer the data to)
                                                               ref cbOptimalTransferSize,    // Returned optimal buffer size to use during transfer
                                                               ref  nullString);
        
            uint cbTotalBytesWritten = 0;
            try
            {
                pFinalObjectDataStream = pTempStream;
                StreamCopy(ref pFinalObjectDataStream, // Destination (The Object to transfer to)
                                ref  pFileStream,            // Source (The File data to transfer from)
                                 cbOptimalTransferSize,  // The driver specified optimal transfer buffer size
                                 ref cbTotalBytesWritten);  // The total number of bytes transferred from file to the device
                pFinalObjectDataStream.Commit(0);

            }
            catch
            {
                //System.Windows.Forms.MessageBox.Show("! Failed to get IStream (representing destination object data on the device) from IPortableDeviceContent, hr = 0x%lx\n");
            }
        }
        public void GetRequiredPropertiesForContentType(ref Guid ContentType, string pszParentObjectID, string pszFilePath, ref 
        IStream pFileStream, ref   IPortableDeviceValues ppObjectProperties, ulong sizeFile)
        {

            // CoCreate an IPortableDeviceValues interface to hold the the object information

            if (ppObjectProperties != null)
            {
                // Fill out required properties for ALL content types
                GetRequiredPropertiesForAllContentTypes(ref ppObjectProperties,
                                                               pszParentObjectID,
                                                               pszFilePath,
                                                              ref  pFileStream, sizeFile);
                if (ContentType == DeviceGuid.WPD_CONTENT_TYPE_AUDIO)
                {
                    GetRequiredPropertiesForMusicContentTypes(ref ppObjectProperties);
                }

            }
            else
            {
                System.Windows.Forms.MessageBox.Show("! Failed to get required properties common to ALL content types, hr = 0x%lx\n");
            }

            // If everything was successful above, QI for the IPortableDeviceValues to return
            // to the caller.  A temporary CComPtr IPortableDeviceValues was used for easy cleanup
            // in case of a failure.
            //if (SUCCEEDED(hr))
            //{
            //    hr = pObjectProperties->QueryInterface(IID_PPV_ARGS(ppObjectProperties));
            //    if (FAILED(hr))
            //    {
            //        printf("! Failed to QueryInterface for IPortableDeviceValues, hr = 0x%lx\n",hr);
            //    }
            //}
            //    else
            //{

            //    ("! Failed to create property information because we were returned a NULL IPortableDeviceValues interface pointer, hr = 0x%lx\n",hr);
            //}

        }
        private void GetRequiredPropertiesForAllContentTypes(ref IPortableDeviceValues pObjectProperties, string pszParentObjectID, string pszFilePath, ref IStream pFileStream, ulong fileSize)
        {
            // Set the WPD_OBJECT_PARENT_ID
            pObjectProperties.SetStringValue(ref PropertyKey.WPD_OBJECT_PARENT_ID, pszParentObjectID);
            // Set the WPD_OBJECT_SIZE by requesting the total size of the
            // data stream.
            tagSTATSTG statstg = new tagSTATSTG();
            statstg.grfStateBits = 0;
            try
            {
                pFileStream.Stat(out statstg, statstg.grfStateBits);
            }

            catch
            {
            }
            // Set the WPD_OBJECT_ORIGINAL_FILE_NAME by splitting the file path
            // into a separate filename.
            string szFileName = pszFilePath;
            string szFileExt;

            //if (_wsplitpath_s(pszFilePath, null ,0,null ,0,
            //                   szFileName,ARRAYSIZE(szFileName),
            //                   szFileExt, ARRAYSIZE(szFileExt)))
            //{
            //    hr = E_INVALIDARG;
            //    printf("! Failed to split the file path, hr = 0x%lx\n",hr);    

            //}
            FileInfo f = new FileInfo(szFileName);
            string strOriginalFileName = f.Name;
            string[] k = f.Name.Split('.');
            pObjectProperties.SetStringValue(ref PropertyKey.WPD_OBJECT_ORIGINAL_FILE_NAME, f.Name);
            // Set the WPD_OBJECT_NAME.  We are using the  file name without its file extension in this
            // example for the object's name.  The object name could be a more friendly name like
            // "This Cool Song" or "That Cool Picture".O
            pObjectProperties.SetUnsignedLargeIntegerValue(ref PropertyKey.WPD_OBJECT_SIZE, fileSize);
            pObjectProperties.SetStringValue(ref PropertyKey.WPD_OBJECT_NAME,k[0] );
        }
        public void GetRequiredPropertiesForMusicContentTypes(ref IPortableDeviceValues pObjectProperties)
        {
            // Set the WPD_OBJECT_CONTENT_TYPE to WPD_CONTENT_TYPE_AUDIO because we are
            // creating/transferring music content to the device.
            try
            {
                pObjectProperties.SetGuidValue(ref PropertyKey.WPD_OBJECT_CONTENT_TYPE, ref DeviceGuid.WPD_CONTENT_TYPE_AUDIO);
            }
            catch
            {
                System.Windows.Forms.MessageBox.Show("! Failed to set WPD_OBJECT_CONTENT_TYPE to WPD_CONTENT_TYPE_AUDIO, hr = 0x%lx\n");
            }
        }
        //IPortableDevicePropVariantCollection pObjectsToDelete;
        //[DllImport("ole32.dll", ExactSpelling = true, PreserveSig = false)]
        //public static extern object CoCreateInstance([In] ref Guid clsid, [MarshalAs(UnmanagedType.Interface)] object punkOuter, int context, [In] ref Guid iid);

        //void DeleteContentFromDevice(ref IPortableDevice pDevice, string pathFileToDelete)
        //{
        //    string szSelection;
        //    IPortableDeviceContent pContent;
        //    IPortableDevicePropVariantCollection pObjectsFailedToDelete;
        //    if (pDevice == null)
        //    {
        //        System.Windows.Forms.MessageBox.Show("! A NULL IPortableDevice interface pointer was received\n");
        //        return;
        //    }

        //    // Prompt user to enter an object identifier on the device to delete.
        //    szSelection = pathFileToDelete;


        //    // 1) get an IPortableDeviceContent interface from the IPortableDevice interface to
        //    // access the content-specific methods.

        //    pDevice.Content(out pContent);
        //    // 2) CoCreate an IPortableDevicePropVariantCollection interface to hold the the object identifiers
        //    // to delete.
        //    //
        //    // NOTE: This is a collection interface so more than 1 object can be deleted at a time.
        //    //       This sample only deletes a single object.

        //    //hr = CoCreateInstance(CLSID_PortableDevicePropVariantCollection,
        //    //                      NULL,
        //    //                      CLSCTX_INPROC_SERVER,
        //    //                      IID_PPV_ARGS(&pObjectsToDelete));
        //    //if (SUCCEEDED(hr))
        //    //{
        //    if (pObjectsToDelete != null)
        //    {
        //        tag_inner_PROPVARIANT pv = new tag_inner_PROPVARIANT();


        //        PropVariant prv = new PropVariant();

        //        //// Initialize a PROPVARIANT structure with the object identifier string
        //        //// that the user selected above. Notice we are allocating memory for the
        //        //// PWSTR value.  This memory will be freed when PropVariantClear() is
        //        //// called below.
        //        //pv.vt=
        //        //pv.pwszVal = AtlAllocTaskWideString(szSelection);
        //        //if (pv.pwszVal != null)
        //        //{
        //        // Add the object identifier to the objects-to-delete list
        //        // (We are only deleting 1 in this example)

        //        pObjectsToDelete.Add(ref pv);
        //        // Attempt to delete the object from the device
        //        pContent.Delete(0,  // Deleting with no recursion
        //                             pObjectsToDelete, ref  pObjectsFailedToDelete);// Object(s) to delete

        //        // An S_OK return lets the caller know that the deletion was successful

        //        System.Windows.Forms.MessageBox.Show("The object '%ws' was deleted from the devic   " + szSelection);
        //    }
        //    else
        //    {
        //        System.Windows.Forms.MessageBox.Show("! Failed to delete an object from the device because we could no allocate memory for the object identifier string, hr = 0x%lx\n");
        //    }

        //    // Free any allocated values in the PROPVARIANT before exiting
        //    //PropVariantClear(&pv);
        //}
        IPortableDeviceValues pDdevValues;
     
        public void DeleteContentFromDevice( PortableDevice pDevice,DeviceFolder objectInfo)
{
    string szSelection;
    IPortableDeviceContent  pContent;
    IPortableDevicePropVariantCollection pObjectsToDelete = (IPortableDevicePropVariantCollection)new PortableDeviceTypesLib.PortableDevicePropVariantCollection();
    IPortableDevicePropVariantCollection pObjectsFailedToDelete= (IPortableDevicePropVariantCollection) new PortableDeviceTypesLib.PortableDevicePropVariantCollection();

    if (pDevice == null)
    {
        System.Windows.Forms.MessageBox.Show("! A NULL IPortableDevice interface pointer was received\n");
        return;
    }

    // Prompt user to enter an object identifier on the device to delete.
    szSelection = objectInfo.Value;
   

    // 1) get an IPortableDeviceContent interface from the IPortableDevice interface to
    // access the content-specific methods.
   pDevice.Content(out pContent);
       
          //  System.Windows.Forms.MessageBox.Show("! Failed to get IPortableDeviceContent from IPortableDevice, hr = 0x%lx\n");
       
   

    // 2) CoCreate an IPortableDevicePropVariantCollection interface to hold the the object identifiers
    // to delete.
    //
    // NOTE: This is a collection interface so more than 1 object can be deleted at a time.
    //       This sample only deletes a single object.
    //if (SUCCEEDED(hr))
    //{
    //    hr = CoCreateInstance(CLSID_PortableDevicePropVariantCollection,
    //                          NULL,
    //                          CLSCTX_INPROC_SERVER,
    //                          IID_PPV_ARGS(&pObjectsToDelete));
              PropVariant pvSet = new PropVariant();
                 pvSet.VariantType = 31; // VT_LPWSTR
                 pvSet.PointerValue = Marshal.StringToCoTaskMemUni(objectInfo.Value );  
                // Initialize a PROPVARIANT structure with the object identifier string
                // that the user selected above. Notice we are allocating memory for the
                // PWSTR value.  This memory will be freed when PropVariantClear() is
                // called below.
                //pv.pwszVal = AtlAllocTaskWideString(szSelection);
               
                if (pvSet.PointerValue!=null)
                {
                    // Add the object identifier to the objects-to-delete list
                    // (We are only deleting 1 in this example)
                    tag_inner_PROPVARIANT tag = Device.PropVariantToTagInnerPropVariant(pvSet );
                    pObjectsToDelete.Add(ref tag );
                                            // Attempt to delete the object from the device
                    pContent.Delete(1,  // Deleting with no recursion
                                              pObjectsToDelete,                     // Object(s) to delete
                                              ref pObjectsFailedToDelete );                                // Object(s) that failed to delete (we are only deleting 1, so we can pass NULL here)
                        
                }
                // Free any allocated values in the PROPVARIANT before exiting
              
    }

    }
}

Open in new window

0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35474683
Since this is such an awesome subject, I decided to start a blog to explore this topic more fully, and find a way to use the COM PortableDeviceApi.dll in the managed world.  Thanks for all your help!!

http://www.experts-exchange.com/blogs/TheLearnedOne/

Bob
0
 

Author Comment

by:mb1111
ID: 35503295
Hi TheLearnerOne
regards for your new blog;
it seems very useful'
now I have another question witha portable device:
How do I recognize that a portable device was insert?
(a normal usb I can recognize with wndProc function, the wparam parametet gets a new value
but a portable device doesn't get a new value).
Thank you very much,
0
 
LVL 96

Expert Comment

by:Bob Learned
ID: 35512503
0
 

Expert Comment

by:mmmattos
ID: 36112245
Hi TheLearnedOne,

All the info you´ve shared here was valuable for getting awareness of PD connection and enumeration of its objects using C#.

Could you share an example of MTP command for transfering an image from the enumerated device (using C#) ?

Thanks a lot :D
0
 
LVL 5

Expert Comment

by:knowlton
ID: 36451946
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
0
 
LVL 2

Expert Comment

by:SeanDevoy
ID: 37793315
I am getting an unresolved reference to "DeviceFolder" and several dozen compilation errors in VS 2010.  Can you post a ZIP of your actual project?  Or email it to SDevoy.at.bizfocused<DOT>com

Thanks
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

707 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now