2

Does anyone know the specification for how UrlAcl data is stored in the registry? I know I can find the values at HKLM\System\CurrentControlSet\services\HTTP\Parameters\UrlAclInfo. Each value name is the actual URL being registered, however, the rest of the actual data is in binary. I need to be able to get the user name the urlacl was registered to. Does anyone know where I can find how to parse the binary data to get the information I need?

Thanks!

Josh Johnson
  • 135
  • 2
  • 14
  • I'd go with Jim Mischel's suggestion of using the API. Most registry data is not publicly specified or intended to be interpreted by anything other than the code which created it. Even if you think you've successfully reverse-engineered it, it only takes one corner case your tests haven't seen before to bring the whole thing to a screeching halt :) – anton.burger Aug 31 '12 at 08:38

1 Answers1

3

An alternative would be to have your program run netsh http show urlacl, redirect the output, and then parse it. See Redirecting console output to another application for an example.

Ideally, you'd be able to access the information from the Windows API. I know that at one point the API in question was "unpublished." I don't know if it's been documented by now.

Update: Perhaps HttpQueryServiceConfiguration is what you're looking for? There are several C# wrappers for the HttpApi functions. Search for [httpapi C#]. I don't know if any of them will do what you want, but they look promising.

According to the docs, HttpApi is available for Windows XP with SP2, Windows Server 2003, and all later releases.

Community
  • 1
  • 1
Jim Mischel
  • 131,090
  • 20
  • 188
  • 351
  • Unfortunately, I need to support Windows XP and Server 2003 as well, or I would probably go this route. And I can't rely on the user having the Support Utils installed to use httpconfig for those systems. Thanks for your input, though! – Josh Johnson Aug 31 '12 at 01:23
  • @JimMischel I think that is the right API. The [WiX-contrib project](http://wixcontrib.codeplex.com/) has an extension intended to create URL ACLs during application installation. Although it's not production code (and the relevant parts are in C++), it might have some handy usage pointers. – anton.burger Aug 31 '12 at 08:35
  • I will look into this API and report back. Thanks for your help, guys! – Josh Johnson Aug 31 '12 at 13:31
  • 1
    I ended up using HttpSetServiceConfiguration and HttpDeleteServiceConfiguration. I still find that enumerating the keys in the registry is the easiest way to find out which ports are being used in my situation. But the HttpApi functions are working like a charm to register/unregister the ports. Thanks for the pointer! – Josh Johnson Sep 15 '12 at 16:50
  • One important thing to note with the route of parsing netsh output is that netsh is localized, so what may parse fine on your PC can fail on a PC with a different language setting. – Jens Oct 01 '20 at 08:45