Sample XML document for ProvisioningAgent.provisionFromXmlDocumentAsync()

Below is an example of a provisioning XML document that may be passed to the ProvisioningAgent.provisionFromXmlDocumentAsync method. The following fields need to be customized at the least – Issuer and Subscriber. The value for the Subscriber node must be set to the subscriber ID for a mobile-broadband interface (can be retrieved by running ‘netsh mbn…

1

Change ‘Unidentified network’ from Public to Work in Windows 7

There isn’t an easy way to set the category of an Unidentified network in Windows 7 RC+ builds. By default, an Unidentified network will be set to Public for security. Often, the Unidentified network is setup intentionally (e.g. two machines connected via a hub; a network TV tuner, etc.). In these cases, Home/Work is a…

26

Where is wpdmtpextensions.h?

The header file – Wpdmtpextensions.h – has been referenced in several of my posts and is needed to talk MTP to the device through WPD. The header file is not available in the Vista SDK/WDK or the WMP 11 SDK, but is planned for inclusion in the Windows Server code name “Longhorn” SDK. I’ve just…

0

Creating a WPD playlist object in C#

This is a C# follow-up post on the earlier C++ playlist creation post. Be sure to read the earlier post for background information on playlists and how it stores references. We will also re-use the StringToPropVariant helper function that we defined in our previous post. To create a playlist object, the objects to be referenced…

5

Creating WPD PROPVARIANTs in C# without using interop

Previous posts have covered how to create, manage and marshal PROPVARIANTs using interop. Here’s a way on how to create a PROPVARIANT without interop. The IPortableDeviceValues interface exposes a SetStringValue method that allows a regular C# string to be added into the collection. IPortableDeviceValues also exposes a GetValue method which lets us retrieve any added…

3

Connecting to a WPD device in C#

This is the C# equivalent of an earlier C++ post on connecting to a WPD device. We’ll concentrate on the implementation here – you may refer back to that earlier post for further explanation. // Create our client information collection PortableDeviceApiLib.IPortableDeviceValues pValues = (PortableDeviceApiLib.IPortableDeviceValues) new PortableDeviceTypesLib.PortableDeviceValuesClass(); // We have to provide at the least our name,…

3

Marshalling variant properties in C#

This post is a continuation of the one covering WPD property retrieval in C#. That post explained how to marshal strings and the basic int properties. Handling other types such as VT_DATE and VT_BOOL is trickier so I’ll try to cover them here. VT_DATE VT_DATE variants hold the date time value in a field of type…

3

WPD Content Enumeration in C#

WPD content enumeration in C# is pretty close to the C++ style. Here’s a basic example that enumerates the object IDs of the objects present on the device. static void Enumerate( ref PortableDeviceApiLib.IPortableDeviceContent pContent, string parentID, string indent) { // // Output object ID // Console.WriteLine(indent + parentID); indent += ” “; // // Enumerate…

0

Setting WPD properties in C#

Since setting a WPD property requires manipulating a PROPVARIANT structure through interop, we must make use of the marshalling rules we set in our last post. We’ll take a look at a function that allows string properties to be set. static void SetStringValue( PortableDeviceApiLib.PortableDeviceClass pPortableDevice, string objectID, ref PortableDeviceApiLib._tagpropertykey propKey, string newValue) { // //…

0

WPD property retrieval in C#

WPD property values are retrieved as PROPVARIANTs through the WPD API. Unfortunately there is no native support for PROPVARIANTs in C#. To correctly retrieve the property values (or anything that is in a PROPVARIANT) through the WPD API in C#, we must use marshalling. PortableDeviceApiLib.tag_inner_PROPVARIANT is the data-type exposed through the WPD Interop layer. This…

9