code: def winapi_result( result ):
      
      if not result:
          raise WinApiException("%d (%x): %s" % (ctypes.GetLastError(),
                  ctypes.GetLastError(), ctypes.FormatError()))
      return result
docs: Validate WINAPI BOOL result, raise exception if failed