FransBouma / InjectableGenericCameraSystem

This is a generic camera system to be used as the base for cameras for taking screenshots within games. The main purpose of the system is to hijack the in-game 3D camera by overwriting values in its camera structure with our own values so we can control where the camera is located, it's pitch/yaw/roll values, its FoV and the camera's look vector.
BSD 2-Clause "Simplified" License
718 stars 249 forks source link

Let IGCSInjectorUI fail "gracefully" when it can't find an EXE to extract icon #124

Closed apocalyptech closed 4 years ago

apocalyptech commented 4 years ago

This is very much a niche case, but I'm using IGCSInjectorUI to inject a DLL into a Windows game that's running on Linux, via Steam's Proton (which is a version of Wine which lets us Linux weirdos run Windows games, etc). When I click on IGCSInjectorUI's button to select a process, I get this error:

System.IO.FileNotFoundException: Couldn't find specified file.
File name: 'C:\windows\system32\steam.exe'
  at System.Drawing.Icon.ExtractAssociatedIcon (System.String filePath) [0x0002f] in <a3003ab57e8d46439df2e20f3cf113cd>:0
  at IGCSInjectorUI.ProcessSelector.RefreshProcessList () [0x00085] in <a4beadb6fe6143a6b197d617416e6906>:0 
  at IGCSInjectorUI.ProcessSelector.OnLoad (System.EventArgs e) [0x00007] in <a4beadb6fe6143a6b197d617416e6906>:0
  at System.Windows.Forms.Form.OnCreateControl () [0x00031] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.Windows.Forms.Control.CreateControl (System.Boolean fIgnoreVisible) [0x000ed] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.Windows.Forms.Control.CreateControl () [0x00008] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.Windows.Forms.Control.WmShowWindow (System.Windows.Forms.Message& m) [0x00051] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.Windows.Forms.Control.WndProc (System.Windows.Forms.Message& m) [0x0071b] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.ScrollableControl.WndProc (System.Windows.Forms.Message& m) [0x00043] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.Windows.Forms.ContainerControl.WndProc (System.Windows.Forms.Message& m) [0x0001a] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.Windows.Forms.Form.WmShowWindow (System.Windows.Forms.Message& m) [0x00013] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.Windows.Forms.Form.WndProc (System.Windows.Forms.Message& m) [0x00290] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.Windows.Forms.Control+ControlNativeWindow.OnMessage (System.Windows.Forms.Message& m) [0x00001] in <afc71676634a41889c6929c14e8a57bd>:0
  at System.Windows.Forms.Control+ControlNativeWindow.WndProc (System.Windows.Forms.Message& m) [0x000b3] in <afc71676634a41889c6929c14e8a57bd>:0 
  at System.Windows.Forms.NativeWindow.Callback (System.IntPtr hWnd, System.Int32 msg, System.IntPtr wparam, System.IntPtr lparam) [0x00030] in <afc71676634a41889c6929c14e8a57bd>:0 

... and no processes are listed to check. I realize this is quite a bizarre use case, but the reason it can't find steam.exe (and presumably why it's looking for it in such a weird place) is that I'm using the native Linux Steam client, and just launching the game via Wine.

Anyway, an easy way to get around it is to just copy any old EXE into the Wine root's windows\system32 dir, with the name steam.exe, and I can then select a process. Still, it might be nice if the injector would fail a bit more gracefully and continue on, even if it's not able to load an icon for whatever reason.

As I say, I'm aware this is a very weird edge case, so feel free to tell me to GTFO. :)

Many thanks for the injector, though! It's the only one I've found which works reliably under Wine/Proton at all, so I've been very grateful to have it.

FransBouma commented 4 years ago

Ah, first I thought... "I don't link to steam.exe", but it sees the process running, wants to extract the icon from that, which leads to steam.exe in the windows path for some reason (according to the process info), which then leads to the crash.

Will add a guard clause :)

FransBouma commented 4 years ago

(will update release shortly)

FransBouma commented 4 years ago

See: https://github.com/FransBouma/InjectableGenericCameraSystem/releases/tag/IGCSInjectorUI_103

apocalyptech commented 4 years ago

Thanks! Have a good one