1
0
forked from 0ad/0ad

avoid warning when running a second instance and Mahaf is enabled

This was SVN commit r9863.
This commit is contained in:
janwas 2011-07-17 19:19:33 +00:00
parent a31ce6a3ce
commit aeddb5fb48

View File

@ -347,7 +347,10 @@ static Status Init()
hAken = CreateFileW(L"\\\\.\\Aken", GENERIC_READ, shareMode, 0, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0);
if(hAken == INVALID_HANDLE_VALUE)
{
ENSURE(GetLastError() == ERROR_FILE_NOT_FOUND);
// GetLastError() is ERROR_FILE_NOT_FOUND if the driver isn't running,
// but this is also reached when a handle has already been opened
// (e.g. by a second instance of the same program) - in which case we must
// indicate failure so that clients won't engage in unsynchronized ring 0 operations.
SetLastError(0);
return ERR::INVALID_HANDLE; // NOWARN (happens often due to security restrictions)
}