3

Closed

Multiple Commandline input

description

I have a problem to inject multiple commandline example:

string commandline = "/noconsole /triPlatform=dx9";
EasyHook.RemoteHooking.CreateAndInject(Folder, commandline, (int)InjectionOptions.Default, injectionfile, injectionfile, out -1);

If try to use one only (string commandline = "/noconsole") working, with two don't working

With old EasyHook, before febrary release working without issue.
Closed Mar 21, 2015 at 7:07 AM by spazzarama
Fixed on changeset 75632

comments

bbday wrote Mar 28, 2014 at 7:42 PM

I changed thread.c line 481
from
if(!CreateProcessW(
        FullExePath, 
        FullCommandLine,
to
if(!CreateProcessW(
        FullExePath, 
        InCommandLine,
and it working again

spazzarama wrote Mar 30, 2014 at 10:30 AM

Thanks bbday I'll look at checking and adding this fix.

wrote Mar 30, 2014 at 10:30 AM

wrote Mar 30, 2014 at 10:30 AM

koczkatamas wrote Feb 25, 2015 at 1:35 PM

I made a similar fix by changes this line:
swprintf_s(FullCommandLine, MAX_PATH, L"\"%s\" \"%s\"", FullExePath, InCommandLine);
to this:
swprintf_s(FullCommandLine, MAX_PATH, L"\"%s\" %s", FullExePath, InCommandLine);
As bbday's solution would cause an abnormal behaviour, because normally the first argument should be the filename of the executable: https://support.microsoft.com/kb/175986?wa=wsignin1.0

The problem with the original code is that it passes the whole command line as the first parameter. And it breaks functionality if you does not send any parameter at all (for example if you call CreateAndInject for C:\Windows\notepad.exe then it will try to create a file called ".txt", because it thinks that the first parameter "" is a filename, but the expected behaviour would be to just launch the notepad application and do not try to create or open any file).

https://support.microsoft.com/kb/175986?wa=wsignin1.0

wrote Feb 25, 2015 at 1:40 PM

wrote Mar 21, 2015 at 7:07 AM

Fixed on changeset 75632

wrote Mar 21, 2015 at 7:07 AM