I'm trying to make a self deleting executable. By using the "spawn a clone flagged with FILE_FLAG_DELETE_ON_CLOSE" technique. (If you're not familiar with this, look here)
But the problem is, the FILE_FLAG_DELETE_ON_CLOSE flag only works if the last handle to the file that gets closed is opened with that flag. Making catch22's method inoperable. So, the question is, is there a way to get CreateProcess to open the executable using FILE_FLAG_DELETE_ON_CLOSE internally?