winlabs/gowin32 — pull request #21 by dgolub (2014-12-12 21:09:48+00:00)
Title: MMSBUILD-249 (Mark) Refactor handling of COM error codes

@markbenvenuto Wrappers for functions that return an `HRESULT` no longer return a `syscall.Errno` and instead return an unsigned integer. This allow users calling the wrappers directly to distinguish between different success codes instead of having them all mapped to `nil`. Users can check for success or failure by calling `SUCCEEDED` or `FAILED` just like in C/C++. Even though `HRESULT` is defined by Win32 as a signed 32-bit integer, I define it as an unsigned 32-bit integer in gowin32 because most error codes are hexadecimal values greater than or equal to `0x80000000`, which causes Go to give an error if you try to assign them to a signed integer variable. The higher-level helpers take `HRESULT` errors and wrap them in a new object called a `COMError` that implements the Go `error` interface and provides methods to extract the facility and code components.