[−][src]Macro comedy::call_handle_getter
Call a function that returns a HANDLE
(NULL
or INVALID_HANDLE_VALUE
on failure), wrap result.
The handle is wrapped in a Handle
which will automatically call
CloseHandle()
on it. If the function fails, the error is retrieved via GetLastError()
and
augmented with the name of the function and the file and line number of the macro usage.
Example
unsafe fn find_first(name: &[u16], data: &mut WIN32_FIND_DATAW) -> Result<Handle, Win32Error> { call_handle_getter!(FindFirstFileW(name.as_ptr(), data)) }