CreateProcessEx failing on 32 bit Windows 7

c++ / delphi package - dll injection and api hooking
Post Reply
hardik.choudhary
Posts: 4
Joined: Wed Nov 13, 2019 1:01 pm

CreateProcessEx failing on 32 bit Windows 7

Post by hardik.choudhary »

HI
I tried CreateProcessEx on a 32 bit Windows 7, it fails with GetLastError() 123(ERROR_INVALID_NAME). Any suggestions as to why this could be?
Thanks
iconic
Site Admin
Posts: 1065
Joined: Wed Jun 08, 2005 5:08 am

Re: CreateProcessEx failing on 32 bit Windows 7

Post by iconic »

Does the same thing happen with the regular Win32 API CreateProcessA/W? Obviously, you wouldn't append the extra DLL name parameter.
That error code is usually a result of needing to relocate param 1 (ApplicationName) to param 2 (Commandline), make sure to set param 1
to NULL if you end up using param 2. If you're still getting the error please post your call parameters so we can see them

--Iconic
hardik.choudhary
Posts: 4
Joined: Wed Nov 13, 2019 1:01 pm

Re: CreateProcessEx failing on 32 bit Windows 7

Post by hardik.choudhary »

Thanks, I tried that but same error. It's a createProcessW callback, and the same parameters that were there for CreateProcessW are passed into CreateProcessExW along with the extra dll. Funny thing is it works for a 64 bit OS opening a 32 bit process, so I know the callback code, and what I'm injecting works there. Is there an environment related issue, that might be interfering? (GetLastError() 123)?
iconic
Site Admin
Posts: 1065
Joined: Wed Jun 08, 2005 5:08 am

Re: CreateProcessEx failing on 32 bit Windows 7

Post by iconic »

Hello,

Thanks for replying. Hmmm, can you upload a sample project
or show code? I’ll test before the weekend and try to reproduce,
but it may be hard, depending on the params etc. Will try however

--Iconic
iconic
Site Admin
Posts: 1065
Joined: Wed Jun 08, 2005 5:08 am

Re: CreateProcessEx failing on 32 bit Windows 7

Post by iconic »

One last quick check, does this happen with CreateProcessExA() ? The cmdline is very different here, believe it or not, and it’s mentioned on MSDN. Basically, you shouldn’t use a literal/const string, but a buffer for the commandline arg

P.S: We really can help more with a code sample, otherwise we are reduced to *guess*work

--Iconic
hardik.choudhary
Posts: 4
Joined: Wed Nov 13, 2019 1:01 pm

Re: CreateProcessEx failing on 32 bit Windows 7

Post by hardik.choudhary »

"Basically, you shouldn’t use a literal/const string, but a buffer for the commandline arg", yes I've learnt that the hard way.

It's fine, it was a different issue, altogether.

Thanks for your time and suggestions.
iconic
Site Admin
Posts: 1065
Joined: Wed Jun 08, 2005 5:08 am

Re: CreateProcessEx failing on 32 bit Windows 7

Post by iconic »

Glad the issue is resolved. Thanks for letting us know

—Iconic
Post Reply