|
|
Home » U++ TheIDE » U++ TheIDE: Compiling, Linking, Debugging of your packages » I keep getting the same "cannot open exe for writing" error...
Re: I keep getting the same "cannot open exe for writing" error... [message #50947 is a reply to message #50914] |
Mon, 14 January 2019 22:49 |
|
koldo
Messages: 3357 Registered: August 2008
|
Senior Veteran |
|
|
peterh wrote on Mon, 14 January 2019 11:31Now, if it happens only once a week this should not be a problem.
When I had the problem, it happened again and again.
I debugged simple programs without child processes.
And after the latest modification (DebugProcessStop) I had not a single problem and I did heavy repeated testing and I tried to provoke the problem.
It did not happen again here. Yes I agree.
Without changes you have to close TheIDE many times every day.
I do not know if the code I use is the best, as I do not know the root cause of the problem.
However, you should remember that TerminateProcess() does not terminate child process, so I call TerminateChildProcesses(hProcessId, 0); just before.
It uses dwProcessId from pdb.cpp, line 117:
hProcess = pi.hProcess;
hProcessId = pi.dwProcessId; // Added
mainThread = pi.hThread;
mainThreadId = pi.dwThreadId;
and TerminateChildProcesses() is implemented like this:
#include <TlHelp32.h>
Vector<DWORD> GetChildProcessList(DWORD processId) {
Vector<DWORD> child, all, parents;
HANDLE hSnap = CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
if (hSnap == INVALID_HANDLE_VALUE)
return child;
PROCESSENTRY32 proc;
proc.dwSize = sizeof(proc);
if (!Process32First(hSnap, &proc)) {
CloseHandle(hSnap);
return child;
}
do {
all << proc.th32ProcessID;
parents << proc.th32ParentProcessID;
} while(Process32Next(hSnap, &proc));
CloseHandle(hSnap);
child << processId;
int init = 0;
while (true) {
int count = child.GetCount();
if (init >= count)
break;
for (int cid = init; cid < count; ++cid) {
for (int i = 0; i < all.GetCount(); ++i) {
if (parents[i] == child[cid])
child << all[i];
}
}
init = count;
}
child.Remove(0);
return child;
}
void TerminateChildProcesses(DWORD dwProcessId, UINT uExitCode) {
Vector<DWORD> children = GetChildProcessList(dwProcessId);
for (int i = 0; i < children.GetCount(); ++i) {
HANDLE hProcess = OpenProcess(PROCESS_TERMINATE, FALSE, children[i]);
TerminateProcess(hProcess, uExitCode);
CloseHandle(hProcess);
}
}
Best regards
IƱaki
|
|
|
|
|
I keep getting the same "cannot open exe for writing" error...
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Fri, 08 June 2007 17:06
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Tue, 06 November 2018 17:06
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Tue, 06 November 2018 19:05
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Wed, 07 November 2018 12:44
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Wed, 07 November 2018 16:44
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Sun, 25 November 2018 17:40
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Mon, 26 November 2018 10:54
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Mon, 26 November 2018 12:45
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Mon, 26 November 2018 17:10
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Tue, 27 November 2018 00:14
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Tue, 27 November 2018 08:54
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Tue, 27 November 2018 09:42
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Tue, 27 November 2018 09:50
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Tue, 27 November 2018 10:07
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Tue, 27 November 2018 13:25
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Tue, 27 November 2018 21:09
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Wed, 28 November 2018 10:49
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Wed, 28 November 2018 10:57
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Thu, 29 November 2018 12:23
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Thu, 29 November 2018 14:10
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Thu, 29 November 2018 13:41
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Fri, 30 November 2018 09:01
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Fri, 30 November 2018 11:48
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Wed, 05 December 2018 21:52
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Wed, 05 December 2018 23:09
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Wed, 05 December 2018 23:40
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Thu, 06 December 2018 10:32
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Thu, 06 December 2018 10:35
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Thu, 06 December 2018 19:23
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Thu, 06 December 2018 20:53
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Sat, 08 December 2018 17:00
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Sat, 08 December 2018 18:33
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Sat, 08 December 2018 19:27
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Sat, 08 December 2018 19:50
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Sun, 09 December 2018 10:01
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Sun, 09 December 2018 11:07
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Fri, 04 January 2019 09:42
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Sun, 13 January 2019 01:02
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Sun, 13 January 2019 19:19
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: peterh on Mon, 14 January 2019 11:31
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Mon, 14 January 2019 11:52
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Mon, 14 January 2019 22:49
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Sat, 19 January 2019 17:49
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: mirek on Sat, 19 January 2019 19:22
|
|
|
Re: I keep getting the same "cannot open exe for writing" error...
By: koldo on Sun, 20 January 2019 14:52
|
Goto Forum:
Current Time: Sat Apr 27 20:00:18 CEST 2024
Total time taken to generate the page: 2.99485 seconds
|
|
|