I am finding myself out of my depth when trying to programatically add a Windows 8 'Metro' application to the Loopback exceptions list using the code provided by Microsoft below:
// Call this API to enumerate all of the AppContainers on the system
[DllImport("FirewallAPI.dll")]
internal static extern uint NetworkIsolationEnumAppContainers(out uint pdwCntPublicACs, out IntPtr ppACs);
// Call this API to free the memory returned by the Enumeration API
[DllImport("FirewallAPI.dll")]
internal static extern void NetworkIsolationFreeAppContainers(IntPtr pACs);
// Call this API to load the current list of Loopback-enabled AppContainers
[DllImport("FirewallAPI.dll")]
internal static extern uint NetworkIsolationGetAppContainerConfig(out uint pdwCntACs, out IntPtr appContainerSids);
// Call this API to set the Loopback-exemption list
[DllImport("FirewallAPI.dll")]
internal static extern uint NetworkIsolationSetAppContainerConfig(uint pdwCntACs, SID_AND_ATTRIBUTES[] appContainerSids);
// Use this API to convert a string SID into an actual SID
[DllImport("advapi32.dll", SetLastError=true)]
internal static extern bool ConvertStringSidToSid(string strSid, out IntPtr pSid);
// Use this API to convert a string reference (e.g. "@{blah.pri?ms-resource://whatever}") into a plain string
[DllImport("shlwapi.dll", CharSet=CharSet.Unicode, ExactSpelling=true)]
internal static extern int SHLoadIndirectString(string pszSource, StringBuilder pszOutBuf, int cchOutBuf, IntPtr ppvReserved);
For those unaware of the Windows 8 application security, 'Metro' apps are not allowed to communicate with localhost unless added to the exceptions list. The above code facilitates this (apparently), but I cannot work out for example how to add Internet Explorer to the exceptions list.
Can anybody provide any examples on how to use this code? I'm really lost!