More than one instance detection

Started by
10 comments, last by thedevdan 19 years, 6 months ago
Hello all. Well here is my problem. I have a program, and it will not allow me to open more than one instance of it. If it detects another instance, it terminated immediatly. My questions are these. How is it detecting if it is already open already? Is there any way i can prevent it from checking if it's already open already? If you wish to test out different things, let me give you some background on the situation more. I want to open more than one version of America Online 8.0, and i don't know how it's finding out if it's already open. What possible API calls could it be making? Any c++ code is always useful. If you can help me put together some concepts for code that would load aol but not give it access to information, for instance deny it requests for other processes, that would be awsome.
Advertisement
This is platform dependent. What OS are you using?

If you are using Windows, you may be able to make a cope of the aol exe and change the name to aol_second.exe and run them both. However this will result in undefined behaviour as they both try to obtain the same resources (modem, whathaveyou).

[Edited by - flangazor on October 4, 2004 9:39:07 AM]
If it only lets you open one then there's a good chance that running two won't work correctly.
It's probably using a named semaphore (or mutex).
Try searching for some kind of spy program that can give you the name of this semaphore and then you could just unlock it manually.

AOL has probably got a good reason for restricting you to one instance though so be careful. And make sure that they don't try to access the same database.
I have a better question, WHY are you trying to open two copies of AOL? The main AOL application is there to allow you to log in and connect to the internet, if you are having two copies open they are going to conflict and want to fight over your internet connection.
Quote:Original post by doynax
It's probably using a named semaphore (or mutex).
Try searching for some kind of spy program that can give you the name of this semaphore and then you could just unlock it manually.

AOL has probably got a good reason for restricting you to one instance though so be careful. And make sure that they don't try to access the same database.
The spyware program you talk about would actually be called a daemon (or "service" in Windows nomenclature).
If you are using Windows, the standard way to prevent an application from opening another copy of itself is to try and create a global mutex (mentioned above). If the creation of the mutex fails, this mutex has already been created and hence a copy of the program is already running.

Magius
or, ofcourse, the even easier way would be to try to register a window class, if that fails assume another copy is running and exit...
This almost certainly goes against your lisence agreement, so I'm only saying this for informational purposes. Disassemble the exe file, and see if you can find a reference to the semaphore being created or tested for creation. Then replace the testing code with noop instructions.

But as hammerstein_02 said; Why?
Quote:Original post by Evil Steve
This almost certainly goes against your lisence agreement, so I'm only saying this for informational purposes. Disassemble the exe file, and see if you can find a reference to the semaphore being created or tested for creation. Then replace the testing code with noop instructions.

But as hammerstein_02 said; Why?


What would i look for after i disassemle the exe file? What is a semaphore, or a mutex?

As to why, the answer is this: I would simply like to log onto aol on more than one screen name at once.


Please, don't anyone post warning me of potential problems this could cause, as i am fully aware of the risks and have done many similar things with other versions of aol. The only problem i have to solve is opening more than one version. I'm grateful to the people that have posted helpful comments, but anyone that takes the time to write "you shouldn't do that", or something similar, is just waisting posts and filling up the thread.

This topic is closed to new replies.

Advertisement