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 - 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.

link|improve this question
2  
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
feedback

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

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

3 Answers

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.

link|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
feedback

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.

link|improve this answer
feedback

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.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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