Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 #50617 is a reply to message #50613] Mon, 26 November 2018 17:10 Go to previous messageGo to previous message
peterh is currently offline  peterh
Messages: 46
Registered: November 2018
Location: Germany
Member
		if(hProcess != INVALID_HANDLE_VALUE) {
			DebugActiveProcessStop(processid);
			TerminateProcess(hProcess, 0);
			
                        // Wait for max. 10 seconds. This should solve 99.9% of all problems. I hope so ;-)
                        // TODO: If a complex unknown and possibly buggy process is terminated violently, 
                        // then the error codes are hard to interpret and should be displayed to the user.
                        WaitForSingleObject(hProcess,10000);
                        

                        while(threads.GetCount())
				RemoveThread(threads.GetKey(0)); // To CloseHandle
			UnloadModuleSymbols();
			SymCleanup(hProcess);
			CloseHandle(hProcess);
		}


Possibly I have found a problem.
The TerminateProcess() systemcall is asynchronous and returns immediately, eventually before the process is actually terminated.
Also it kills all threads.
(If the documentation is correct)

Possibly a WaitforSingleObject() call must be inserted here.

https://docs.microsoft.com/en-us/windows/desktop/api/process threadsapi/nf-processthreadsapi-terminateprocess

I think I will try this, when I am at home.

In a later stage the waiting time could be measured, and if it is longer than 9 seconds then the error codes could be displayed to the user and the user should decide if he/she wants to wait longer and retry or ignore the error codes.
This is more work to implement and not necessary for now.
If this approach works, I would be happy to try to write the code. Wink

Edit:

I have now compiled this and it works so far.
If the aforementioned problem shows up again can only be said after some hours of trial.

[Updated on: Mon, 26 November 2018 22:58]

Report message to a moderator

 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: error: expected unqualified-id before '=' token
Next Topic: clang or MinGW
Goto Forum:
  


Current Time: Sun Jul 05 03:17:06 CEST 2020

Total time taken to generate the page: 0.01473 seconds