Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

prevent multi dllinjection in created process

Posted on 2004-11-25
3
Medium Priority
?
170 Views
Last Modified: 2010-04-05
hi!

I have a  CreateProcessex(nil,'C:\mygame\mygame.exe',nil, nil, false, 0, nil,nil, si, pi,  'Multiplayer.dll');
i want to prevent that this doesnt happen two times.
how?
0
Comment
Question by:Zabuza-san
  • 2
3 Comments
 
LVL 17

Expert Comment

by:Wim ten Brink
ID: 12680554
Put a mutex in mygame.exe which will be triggered the second time it gets called. With the second call, the game will see that it has been started already thus it can be terminated.

If you want to prevent calling the executable twice from the calling process, check if it's already running by retrieving a list of all active processes.
0
 

Author Comment

by:Zabuza-san
ID: 12682488
how to put the mutex in mygame.exe?
0
 
LVL 17

Accepted Solution

by:
Wim ten Brink earned 2000 total points
ID: 12682960
Well, do you have the sourcecode for mygame.exe?

If so, check out http://www.ibrtses.com/delphi/singleinstance.html for a simple example...
Excerpt of example:

program MyApp;
uses
  Windows,Forms,
  MyApp1 in 'MyApp1.pas' {Form1};
var
  Mutex : THandle;
{$R *.RES}
begin
Mutex := CreateMutex(nil, True, 'MyAppName');
if (Mutex <> 0) and (GetLastError = 0) then
  begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
  if Mutex <> 0 then
    CloseHandle(Mutex);
  end;
end.

Or visit Google http://www.google.com/search?q=delphi+mutex for more links about this. ;-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
As many of you are aware about Scanpst.exe utility which is owned by Microsoft itself to repair inaccessible or damaged PST files, but the question is do you really think Scanpst.exe is capable to repair all sorts of PST related corruption issues?
Suggested Courses

580 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