c00000fd
c00000fd

Reputation: 22327

OpenThread with a nonexistent thread ID

Say, if I call OpenThread with a thread ID that no longer exists and get NULL as a result, I can't seem to find a documentation on what would be the error code in GetLastError? My tests on the Windows 8 machine get me ERROR_INVALID_PARAMETER instead of the expected ERROR_FILE_NOT_FOUND.

Upvotes: 0

Views: 985

Answers (2)

Jonathan Potter
Jonathan Potter

Reputation: 37202

Internally, OpenThread calls the PsLookupThreadByThreadId function, which is documented as returning:

STATUS_INVALID_PARAMETER      The thread ID was not found.

Upvotes: 2

David Heffernan
David Heffernan

Reputation: 613592

There is no documentation that will tell you what the error code may be set to when OpenThread fails. In general, there are very few Win32 functions that document such information. Primarily this is because Microsoft do not want to constrain future development. They do not want developers to take dependencies on the error codes that are returned. They want flexibility to change that behaviour in future versions.

Upvotes: 2

Related Questions