kubo / injector

Library for injecting a shared library into a Linux or Windows process
GNU General Public License v2.0
503 stars 97 forks source link

Wine? #28

Closed KP2048 closed 1 year ago

KP2048 commented 1 year ago

could this be used to inject dlls into a wine process?

kubo commented 1 year ago

No, it couldn't.

I guess that this can inject linux shared libraries though they cannot call functions compiled for Windows.

ohchase commented 1 year ago

Above he mentions injecting a dll into a wine process, so that should actually be possible with this library. I just was working on this oddly, and got my dll injected into an exe running in wine environment.

So firstly things outside this library which you need to do: You must spawn the process yourself so you have permission to interact with it and see it. If you start the process/your game with the wine cli and then run your injector separately through the wine cli again and try to dynamically inject to the target process you will not be able to find the process in your environment. Your injector should issue a spawn command (CreateProcess msdn) and use that handle.

I haven't had time to specifically test this injector library in wine, but my simple loadlibrary create remote thread injection is working. So given this works on windows it should just work in wine. Just a couple hoops to jump through

KP2048 commented 1 year ago

I've been making a dll inject decky loader plugin, so I'll probably end up wrapping things with a custom steam compatibility tool

kubo commented 1 year ago

As far as I checked, it works on Wine. Wine seems to provide special mechanism to enable CreateRemoteThread.

In README.md:

Wine (on Linux x86_64):

injector process \ target process x64 x86
x64 😃 success 💀 failure
x86 💀 failure 😃 success