hi
how can freez (suspend a process) and how can resume that process after suspend?
i see this work in "Resource monitor" in windows,but i need this work in nsis.
thanks
how can freeze (suspend) a process and resume that later?
8 posts
There is no clean way of doing this and no matter what you do you will have to use the system plugin...
Why do you need to suspend a process? Are you doing something evil?
Why do you need to suspend a process? Are you doing something evil?
Originally Posted by Anders View PostThere is no clean way of doing this and no matter what you do you will have to use the system plugin...
Why do you need to suspend a process? Are you doing something evil?
In my opinion suspend process is a good way and a practical method....
for example:
I am currently doing setup a game....
Now i need copy files to a flash memory ...when my speed for copy files to flash Low because i now setup a game! and this game have not a stop button!!!!!
i can suspend setup process and copy files to flash with high speed and later resume process for resume setup game!..... this is a good way....no?
i want do this whit nsis.... Is it possible?
I just told you that there is no clean documented way of suspending a process, this should tell you that this might not be the best solution.
You have no idea which files a process has open or if it has taken any locks at the time you suspend it.
It is probably better for the install to just take a little longer to complete...
You have no idea which files a process has open or if it has taken any locks at the time you suspend it.
It is probably better for the install to just take a little longer to complete...
I suggest you to write C++ plug-in.
System plug-in is not powerful enough for such sophisticated tasks....
System plug-in is not powerful enough for such sophisticated tasks....
Windows has no way to suspend a complete process at once, but it does have functions to suspend or resume threads. And there also are functions to enumerate all threads of a certain process. So you can simply suspend all of a process' threads - and resume them later. It's actually not that complicated! But if you don't want to code it yourself, there is small command-line unity PsSuspend from Sysinternals which can accomplish the task. You could include it into your installer and call it via Exec or ExecWait, I think.
Still I don't really see how this can be useful for an installer. Even if some process interferes with your installer, how do you detect this case? And how do you know which process is the one you need to suspend? You'll at least have to know the process Id. And if the "problematic" process has files locked, they will remain locked. Finally, what will the user say, if you installer makes another program "freeze" ???
Still I don't really see how this can be useful for an installer. Even if some process interferes with your installer, how do you detect this case? And how do you know which process is the one you need to suspend? You'll at least have to know the process Id. And if the "problematic" process has files locked, they will remain locked. Finally, what will the user say, if you installer makes another program "freeze" ???
This is not true but the function is undocumented. Debug attaching will also do it but going that route has other issues.Originally Posted by LoRd_MuldeR View PostWindows has no way to suspend a complete process at once
If the installer crashes or the user kills the installer, the process will remain suspended and this is really bad and the only way to even tell that it is suspended is to use Process Explorer.
For a real game installer and if this was a real issue you could just add pause support to your game or otherwise work around it but I suspect we are dealing with some sort of game mod here or maybe what he really wants to do is bypass anti-virus (they usually block OpenProcess calls that ask for those types of powers so it would not work on AV).
Didn't know about the undocumented function, but there is no "official" way, at least. And relying on undocumented functions always comes at the danger that your code will break, because the function is going to be removed (or modified in an incompatible way).Originally Posted by Anders View PostThis is not true but the function is undocumented
That's certainly true. If this is about some "mod" installer, it would probably be better to just ask the user to exit the game before proceeding with the installation. Then restart the game afterwards. LockedList plug-in could be very helpful here. If the installer needs to modify some of the game's file, this probably won't work while the game is running anyway - and suspending doesn't help at all. And even if the installer only adds new files to the game (not modify existing ones), a restart would probably be required to make the game "recognize" the new files.Originally Posted by Anders View PostIf the installer crashes or the user kills the installer, the process will remain suspended and this is really bad.