Madshi codehook: Double variables on createprocessex = overload

Hey!

I have tried to createprocessex then inject dll. but delphi keeps telling me that there is no overloaded version of createprocessex.

this is the code i have atm that gives me the error 'overloaded':

 ZeroMemory(@si, sizeOf(si));
  CreateProcessex(nil,VARIABLE1, nil, nil, false, 0, nil,nil, si, pi,  VARIABLE2);

to fix the overloaded problem i have to REMOVE one variable as following:

 ZeroMemory(@si, sizeOf(si));
  CreateProcessex(nil,'C:\windows\notepad.exe', nil, nil, false, 0, nil,nil, si, pi,  VARIABLE2);

but still I want to have two variables inside it.
So any here who can help me??
thank you
Zabuza-sanAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

DragonSlayerCommented:
Is variable1 of type PChar?

madshi's CreateProcessEx is declared as follows:

function CreateProcessEx (applicationName, commandLine : pchar;
                          processAttr, threadAttr      : PSecurityAttributes;
                          inheritHandles               : bool;
                          creationFlags                : dword;
                          environment                  : pointer;
                          currentDirectory             : pchar;
                          const startupInfo            : TStartupInfo;
                          var processInfo              : TProcessInformation;
                          loadLibrary                  : string             ) : boolean;

So VARIABLE1 must be a PChar, not a String, unless you typecast it:

ZeroMemory(@si, sizeOf(si));
  CreateProcessex(nil, PChar(VARIABLE1), nil, nil, false, 0, nil,nil, si, pi,  VARIABLE2);
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.