Re: DMProcessConfigXML CM_MAPPINGS



For example this is what I get back:-

<wap-provisioningdoc>
<characteristic type="CM_Mappings">
<characteristic type="16777216">
<parm name="Pattern" value="http://myserver.com/MyWebServiceFolder/SyncService.asmx/*"; />
<parm name="Network" value="{A1182988-0D73-439E-87AD-2A5B369F808B}" />
</characteristic>
<characteristic type="536870912">
<parm name="Pattern" value="wsp://*/*" />
<parm name="Network" value="{7022E968-5A97-4051-BC1C-C578E2FBA5D9}" />
</characteristic>
<characteristic type="553648128">
<parm name="Pattern" value="wsps://*/*" />
<parm name="Network" value="{F28D1F74-72BE-4394-A4A7-4E296219390C}" />
</characteristic>
<characteristic type="570425344">
<parm name="Pattern" value="*://*.*/*" />
<parm name="Network" value="{436EF144-B4FB-4863-A041-8F905A62C572}" />
</characteristic>
<characteristic type="587202560">
<parm name="Pattern" value="*://*/*" />
<parm name="Network" value="{A1182988-0D73-439E-87AD-2A5B369F808B}" />
</characteristic>
</characteristic>
</wap-provisioningdoc>

From this I can deduce that the mapping indexes are nothing like what the
documentation says is used for the standard mappings - and user mappings start at 0x1000000. Also both Pattern and Network parm names are capitalized though I'm not sure if the API is case sensitive.

Peter

--
Peter Foot
Device Application Development MVP
www.peterfoot.net | www.inthehand.com

"Peter Foot [MVP]" <feedback@xxxxxxxxxxxxxxxxxxxx> wrote in message news:2713C8AE-83AB-476C-AE07-E4306DF075CD@xxxxxxxxxxxxxxxx
My guess is the issue is with the mapping index you are using (1005). Suggest you add a mapping manually, then call the provisioning API to query the current mappings and see how it is setup e.g.

<wap-provisioningdoc>
<characteristic-query type="CM_Mappings"/>
</wap-provisioningdoc>

Also while the first code example is 99% correct, you should free the returned string pointer with free not LocalFree e.g.
[DllImport("coredll.dll", SetLastError = true)]
private static extern void free(IntPtr ptr);

Peter

--
Peter Foot
Device Application Development MVP
www.peterfoot.net | www.inthehand.com


"Peter Morris" <support@xxxxxxxxxxxxxxxxxxxx> wrote in message news:uar82ZnWHHA.468@xxxxxxxxxxxxxxxxxxxxxxx
Hi all

I am using the following code to try to add a URL exception to the networks list on my PocketPC 2003.

================
public enum ConfigFlag : uint
{
/// <summary>
/// The configuration management service and the
/// Configuration Service Providers (CSPs) process
/// the input data.
/// </summary>
Process = 1,

/// <summary>
/// The configuration management service gathers
/// and returns metadata for any XML parm elements
/// it encounters.
/// </summary>
Metadata = 2
}

public class ConfigWrapper
{
[DllImport("aygshell.dll")]
private extern static UInt32 DMProcessConfigXML(string xmlIn, UInt32 flag, out IntPtr xmlOutPtr);

[DllImport("coredll.dll")]
private extern static IntPtr LocalFree(IntPtr hMem);

public static string ProcessXml(string xml)
{
return ProcessXml(xml, ConfigFlag.Process);
}

/// <summary>
/// This function wraps acts as a managed interface to the
/// DMProcessConfigXML in Pocket PC 2003+ and Smartphone 2002+
/// The DMProcessConfigXML function grants remote access to the
/// configuration management functionality of the mobile device.
/// This function enables the submission of Extensible Markup
/// Language (XML) information that causes the settings of a
/// mobile device to change. See "Configuration Service Providers"
/// in the API for details on the XML schema.
/// </summary>
/// <param name="xml">
/// String of valid XML containing configuration data
/// </param>
/// <param name="flag">
/// Action flag (see ConfigFlag for details)
/// </param>
/// <returns>
/// String of valid XML containing the result of this operation
/// </returns>
public static string ProcessXml(string xml, ConfigFlag flag)
{
IntPtr xmlOutPtr;
string xmlOutStr;
long result;

result = DMProcessConfigXML(xml, (uint)flag, out xmlOutPtr);

// marshal the output string
xmlOutStr = Marshal.PtrToStringUni(xmlOutPtr);

// free the memory allocated by the API
LocalFree(xmlOutPtr);

// throw an exception if an error code was returned
if (result != 0)
{
throw new ArgumentException(String.Format(
"DMProcessConfigXML returned error code {0}", result),
xml);
}

return xmlOutStr;
}
}
================================


I have also tried this



=================================
internal static class XmlConfig
{
[DllImport("aygshell.dll")]
private static extern int DMProcessConfigXML(string pszWXMLin, int dwFlags, IntPtr ppszwXmlOut);

[DllImport("coredll.dll")]
private static extern void free(int buffer);

unsafe static public void ProcessXml(string Xml)
{
fixed (int* OutPtr = new int[1])
{
IntPtr outptr = (IntPtr)OutPtr;
int result = DMProcessConfigXML(Xml, 1, outptr);
if (result != 0)
throw new Exception("Could not set network preferences");
else
free(*OutPtr);
}
}
==============================



The XML being sent is as follows:
<wap-provisioningdoc>

<characteristic type="CM_Mappings">

<characteristic type="1005">

<param name="pattern" value="http://myserver.com/MyWebServiceFolder/SyncService.asmx"; />

<param name="network" value="{A1182988-0D73-439e-87AD-2A5B369F808B}" />

</characteristic>

</characteristic>

</wap-provisioningdoc>







If I manually add an exception then my app does not invoke the GPRS dialler and connects to the server through the WORK connection, if I remove this manual exception and try to add it using either of the two above methods the dialler dialog still appears and the Internet connection is used. As far as I can see from all sources on the web I am doing this correctly, but it just isn't working. Can anyone help me with this? I saw Peter Foot asking how to do the same thing quite some time ago so I hope he at least has achieved his goal and might share the answer :-)





Thanks in advance!





Pete




.



Relevant Pages

  • Re: DMProcessConfigXML CM_MAPPINGS
    ... Also while the first code example is 99% correct, you should free the returned string pointer with free not LocalFree e.g. ... /// Configuration Service Providers process ... /// and returns metadata for any XML parm elements ... private extern static UInt32 DMProcessConfigXML(string xmlIn, UInt32 flag, out IntPtr xmlOutPtr); ...
    (microsoft.public.dotnet.framework.compactframework)
  • DMProcessConfigXML CM_MAPPINGS
    ... I am using the following code to try to add a URL exception to the networks ... /// Configuration Service Providers process ... /// and returns metadata for any XML parm elements ... /// String of valid XML containing configuration data ...
    (microsoft.public.dotnet.framework.compactframework)
  • XML Serialization problems related to framework versions
    ... I get an exception when trying to deserialize a simple configuration ... .NET 1.0 XML assembly. ... at System.Reflection.Assembly.nLoad(AssemblyName fileName, String ... Boolean stringized, Evidence assemblySecurity, StackCrawlMark& ...
    (microsoft.public.dotnet.framework)
  • Re: SP1 Problem SOAPException doesnt return quote and Umlaute correcty
    ... Our app returns XML in the fault string. ... returned in the fault string of a soap exception. ...
    (microsoft.public.dotnet.framework.webservices)
  • RE: SP1 Problem SOAPException doesnt return quote and Umlaute correcty
    ... At the core of it is: Should SOAP fault description strings be intended ... unicode string is being URLEncoded as part of converting it to XML. ...
    (microsoft.public.dotnet.framework.webservices)

Quantcast