DarkMultiPlayer Client

DarkMultiPlayer Client

38.8k Downloads

UAC handing issues - uncaught Win32Exception 0x80004005

draeath opened this issue ยท 7 comments

commented

It would be nice if whatever makes UAC escalation necessary for the http server to be optional. It's annoying to work with DMP on a normally headless server without turning UAC off.

I only see one reason for needing it, and it's punching holes through the firewall - something an administrator can do themselves (or perhaps the firewall isn't even enabled!) - unless of course they have chosen a port in the well-known range.

As well, if the user should abort the UAC prompt DMP crashes hard, instead of handling it gracefully (eg, not opening the firewall if that's what is happening) or even shut down properly. As of v0.1.6.1 the following is logged:

[04:37:54][INFO] : Starting HTTP server...
[04:37:54][DEBUG] : HTTP Server: access denied.
[04:37:54][DEBUG] : Prompting user to switch to administrator mode.
[04:38:00][FATAL] : Error in main server thread, Exception: System.ComponentModel.Win32Exception (0x80004005): The operation was canceled by the user
   at System.Diagnostics.Process.StartWithShellExecuteEx(ProcessStartInfo startInfo)
   at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
   at DarkMultiPlayerServer.Server.StartHTTPServer()
   at DarkMultiPlayerServer.Server.Main()

Shortly after, it crashes hard. Here's what's visible in the Windows logs when this occurs:

- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name=".NET Runtime" /> 
  <EventID Qualifiers="0">1026</EventID> 
  <Level>2</Level> 
  <Task>0</Task> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2014-11-03T04:38:00.000000000Z" /> 
  <EventRecordID>25375</EventRecordID> 
  <Channel>Application</Channel> 
  <Computer>epicenter</Computer> 
  <Security /> 
  </System>
- <EventData>
  <Data>Application: DMPServer.exe Framework Version: v4.0.30319 Description: The process was terminated due to an unhandled exception. Exception Info: System.ComponentModel.Win32Exception Stack: at DarkMultiPlayerServer.Server.Main()</Data> 
  </EventData>
  </Event>
- <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
- <System>
  <Provider Name="Application Error" /> 
  <EventID Qualifiers="0">1000</EventID> 
  <Level>2</Level> 
  <Task>100</Task> 
  <Keywords>0x80000000000000</Keywords> 
  <TimeCreated SystemTime="2014-11-03T04:38:01.000000000Z" /> 
  <EventRecordID>25376</EventRecordID> 
  <Channel>Application</Channel> 
  <Computer>epicenter</Computer> 
  <Security /> 
  </System>
- <EventData>
  <Data>DMPServer.exe</Data> 
  <Data>0.0.0.0</Data> 
  <Data>5454970f</Data> 
  <Data>KERNELBASE.dll</Data> 
  <Data>6.3.9600.17278</Data> 
  <Data>53eebf2e</Data> 
  <Data>e0434352</Data> 
  <Data>000000000000606c</Data> 
  <Data>1b20</Data> 
  <Data>01cff71feed6008a</Data> 
  <Data>C:\games\KSP_DMPServer-release\DMPServer.exe</Data> 
  <Data>C:\WINDOWS\system32\KERNELBASE.dll</Data> 
  <Data>30ddda3b-6313-11e4-bed5-74d435856604</Data> 
  <Data /> 
  <Data /> 
  </EventData>
  </Event>
commented

This might be fixed by the work going on in #236, but if whatever is requiring elevation isn't really necessary I still believe this should be configurable in DMPServerSettings.txt - I wish I could submit a pull request, but C# isn't something I'm very comfortable with.

commented

This is an artificial requirement from C#'s HttpListener class on windows. There appears to be nothing I can do about this: http://stackoverflow.com/questions/14962334/httplistenerexception-access-denied-for-non-admins

It works on linux/mac just fine (for ports >1024), and if you leave the http port disabled it doesn't throw the error on windows. The HTTP port is mainly for server lists to scrape, although with VITAS's new server list it runs off a plugin that keeps a connection to the server list, which lets it instantly update.

I'll let @RockyTV weigh in on this one - He runs windows, I run linux ;)

commented

@draeath the problem is, you can't start the HTTPListener unless if you have admin rights. So, giving admins the choice to disable it makes no sense to me. You can't just start the HTTPListener without admin rights on Windows.

commented

Alrighty. That stinks, but hey.

The exception should probably be caught and handled a bit more gracefully, though. Right now it's not handled at all.

commented

Yeah, I tried to get it to work using external port 6702. BOOM. Fixed by using port 1023, which I hope won't cause any issues.

commented

@DuoDex of course you wont be able to listen to 6702, because that is the default port the server listens on.

And whoever said elevation isn't necessary - it is on Windows. Other OS' do not have this issue.
I am doing my best to try and fix the HTTPListener on XP. Right now it is crashing on restart and I am trying to fix it.

commented

Mostly not needed anymore, so I'll close this. Supporting WinXP isn't that great a concern and the server list now has its own plugin and no longer needs the HTTP server.