Вопрос

Fact 1: Due to some client-constraints we are unable to use Exception mechanism.

Fact 2: Closing a handle which was already closed raises an Exception.

Without going through the reasons for the mention facts, will calling GetHandleInformation() to detect whether or not the handle is still valid, and only if it is calling CloseHandle() would be a good way of avoiding such an exception?

Это было полезно?

Решение

You must not access a closed handle in any way, as it may refer to a different handle due to handle recycling.

handle recycling means that any invalid handle can suddenly become valid again (but refer to an unrelated object).

Raymond Chen - The Old New Thing.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top