public static void ReAclListenUrls(string userName, string[] urlsToDeAcl, string[] urlsToAcl) { using (HttpConfig.HttpApi httpApi = new HttpConfig.HttpApi()) { ReAclListenUrlsInternal(userName, urlsToDeAcl, urlsToAcl); } }
internal static void VerifySuccess(HttpApi.Error error, string format, params object[] args) { if (error == HttpApi.Error.NO_ERROR) return; format = string.Format("Error {0}. ", error) + format; VerifySuccess(false, format, args); }
public static Hashtable QueryConfig() { Hashtable items = new Hashtable(); HttpApi.HTTP_SERVICE_CONFIG_URLACL_QUERY query = new HttpApi.HTTP_SERVICE_CONFIG_URLACL_QUERY(); query.QueryDesc = HttpApi.HTTP_SERVICE_CONFIG_QUERY_TYPE.HttpServiceConfigQueryNext; HttpApi.Error error = HttpApi.Error.NO_ERROR; IntPtr pInput = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(HttpApi.HTTP_SERVICE_CONFIG_URLACL_QUERY))); try { for (query.dwToken = 0; ; query.dwToken++) { Marshal.StructureToPtr(query, pInput, false); int requiredBufferLength = 0; error = QueryServiceConfig(pInput, IntPtr.Zero, 0, out requiredBufferLength); if (error == HttpApi.Error.ERROR_NO_MORE_ITEMS) { break; } else if (error != HttpApi.Error.ERROR_INSUFFICIENT_BUFFER) { throw new HttpApiException(error, "HttpQueryServiceConfiguration (URLACL) failed. Error = " + error); } IntPtr pOutput = Marshal.AllocHGlobal(requiredBufferLength); try { HttpApi.ZeroMemory(pOutput, requiredBufferLength); error = QueryServiceConfig(pInput, pOutput, requiredBufferLength, out requiredBufferLength); if (error != HttpApi.Error.NO_ERROR) { throw new HttpApiException(error, "HttpQueryServiceConfiguration (URLACL) failed. Error = " + error); } UrlAclConfigItem item = Deserialize(pOutput); items.Add(item.Key, item); } finally { Marshal.FreeHGlobal(pOutput); } } } finally { Marshal.FreeHGlobal(pInput); } return(items); }