[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now


Madshi codehook: Double variables on createprocessex = overload

Posted on 2004-11-18
Medium Priority
Last Modified: 2010-04-04

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
Question by:Zabuza-san
1 Comment
LVL 14

Accepted Solution

DragonSlayer earned 2000 total points
ID: 12621765
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);

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses
Course of the Month20 days, 4 hours left to enroll

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question