Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Suppose some author has enforced his Windows application to be single instance. Is there any way to make multiple instance of this application (aside from running inside a virtual machine or requesting the author to rewrite the app)?

If there is a readymade tool, I would like to know it. (I have tried sandboxie and Altiris SVS without luck).

If there is nothing out there, I want to program a tool/hack that will let me do this. I am looking for pointers where to start - what will be involved, what skills would be needed. I have moderate programming skills in C and Java.

If this cannot be done, please explain why.

EDIT: I know its a bad idea but I still need to do it (for various reasons). I want a generic way that works for any application and does not introduce errors.

share|improve this question

migrated from stackoverflow.com Jul 21 '10 at 2:47

This question came from our site for professional and enthusiast programmers.

3  
Windows applications are not singletons by default. If they are, it means someone put in the extra effort to make it a singleton and probably has a reason for doing so. –  In silico Jul 20 '10 at 18:56
1  
Depends on how the application is checking for multiple copies. Various applications check in different ways and some applications will check in multiple ways. –  ho1 Jul 20 '10 at 18:57
    
As In Silico says though, it's probably not a good idea. The app might corrupt data, crash or cause other problems if you've got multiple copies running when they're not meant to. –  ho1 Jul 20 '10 at 18:59
    
There are many ways a process can enforce running only a single instance; I don't think it is feasible to build a generic tool capable of preventing this. You would have to examine each application individually and write something tailored specifically for it. –  Luke Jul 20 '10 at 19:42
    
Have you found a solution? –  Tomas Jun 25 '12 at 10:09

5 Answers 5

up vote 1 down vote accepted

Many applications check the global list of processes (with EnumProcesses, OpenProcess, GetModuleBaseName, and similar functions) or list of windows (with EnumWindows, EnumChildWindows).

You may try to set hook (see samples SetWindowsHookEx, CallNextHookEx, etc) to hook those specific API function calls from that application and replace requested data in response with yours to fool the application.

share|improve this answer
    
Thanks for all the answers. I guess the tool needs some careful design. The envisioned tool should be somewhat like a very lightweight virtual OS environment that does not involve running a full copy of windows, yet fools all applications. –  Jus12 Aug 6 '10 at 8:31

There is no generic way because different applications use different methods. A small number of apps do this simply for "usability", but for many others, there may be a good reason to enforce singletons. Bypassing that could lead to data corruption or simply failing to run.

share|improve this answer

Lock files, named pipes and synchronisation events are some of the common ways applications use to check they're the only running instance. To work around lock files you'd either have to virtualise the file system, hook into it or do a carefully timed delete (and that may not work if it locks the file open too). Named pipes and synchronisation events will be much more difficult because you don't have the same control from outside the application that you do with files.

share|improve this answer

It is possible!

Here is an image of me running half-life 1 4x in 4 windows all connected to the same LAN server, the only problem is the controllers not being independently linked to each window.

http://img29.imageshack.us/img29/5642/yc0y.jpg

To do this, you need 'Process Explorer' - a program that allows you to do what is known as 'Close Handle' on the '\BaseNamedObjects\ValveHalfLifeLauncherMutex' sub-process or something. its not that hard. go here for detailed instructions - http://am.half-lifecreations.com/forums/index.php?topic=479.0

But yeah that's for half-life but get Process Explorer and im sure you'll be able to find which handle/process you need to close in order to get the programs u want running multi times.

I dont see why windows doesn't implement running games multi times in splits/snaps as a feature anyway! its clearly because people wouldn't buy as many PC's... also check out SoftXSpand really awesome, allows u to run multiple instances of windows as independent users

share|improve this answer
    
Close a mutant handle works for me. It's not half-life but using a mutex on the programmer's side is pretty common so this solution is kind of generic. –  AZ. Mar 27 at 16:49

You can run application on different users accounts and instance checking will not work anymore.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.