Not to self: ERROR_ALREADY_EXIST (183) can also mean your named Mutex already exists
Posted by jpluimers on 2020/09/16
A while ago, I had an error like this when debugging plugins:
Project bds.exe raised exception class EOSError with message ‘System Error. Code: 183.
Cannot create a file when that file already exists’.
It got was raised when [WayBack] GetLastError returned ERROR_ALREADY_EXIST which according to [WayBack] System Error Codes (0-499) (Windows) has this description:
ERROR_ALREADY_EXISTS
- 183 (0xB7)
- Cannot create a file when that file already exists.
The last line is the same description that [WayBack] FormatMessage returns. And it put me on the wrong foot as it wasn’t a file, but a mutex that was created: indeed [WayBack] CreateMutex documents it:
If the mutex is a named mutex and the object existed before this function call, the return value is a handle to the existing object, GetLastError returns ERROR_ALREADY_EXISTS, bInitialOwner is ignored, and the calling thread is not granted ownership. However, if the caller has limited access rights, the function will fail with ERROR_ACCESS_DENIED and the caller should use the OpenMutex function.
In the mean time, the plugin doesn’t raise that as an exception any more.
–jeroen
Leave a comment