Re: returning an HRESULT that represents a warning



That's the convention for internal NT codes. For example,
0xC0000005 is Access Violation and is an error (highest
two bits are 1s). HRESULT doesn't use that scheme though.
Instead, it uses a single severity bit to distinguish between
errors and success (warnings and info results are considered
success).

--
=====================================
Alexander Nickolov
Microsoft MVP [VC], MCSD
email: agnickolov@xxxxxxxx
MVP VC FAQ: http://vcfaq.mvps.org
=====================================

"Brian Muth" <bmuth@xxxxxxxx> wrote in message
news:%23YukgwS4HHA.1188@xxxxxxxxxxxxxxxxxxxxxxx

"John" <John@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:DA0478E1-73D6-448D-B039-8FEE89872BEE@xxxxxxxxxxxxxxxx
Is it possible to return an HRESULT that represents a warning as opposed
to
an error?

I thought the severity code was the following;

00 - Success
01 - Informational
10 - Warning
11 - Error

I'm not sure where you got this information from. Can you provide a
reference?


But if you look at the HRESULT_SEVERITY macro

#define HRESULT_SEVERITY(hr) (((hr) >> 31) & 0x1)

This would indicate that an error and a warning are both errors.

HRESULT are either success (if non-negative) or fail (negative). There is
no "information" or "warning" level that I'm aware of.

Brian


.



Relevant Pages

  • Fax Server Role fails to create shared fax printer
    ... I added the fax server roles to a SBS 2008 server. ... IWorker.Fax.Common.TaskConfigureFaxServer, RootTaskId = ... IWorker.Fax.FaxConfiguration.TaskFaxConfigurationComposite, Success: False, ... Warning: False, Continue: True, Message: The Fax service could not be ...
    (microsoft.public.windows.server.sbs)
  • Re: WMT_ERROR, WMT_ERROR_WITHURL
    ... In fact I'm saying that if you call Open, and it returns success, you are ... > HRESULT from it, subsequently see a WMT_ERROR event, and then get ... >> have a failure HRESULT associated with it. ...
    (microsoft.public.windowsmedia.sdk)
  • Re: Is IoStatus.Status reliable?
    ... > I take it you were thinking of informational type messages not warning? ... The status is what the lower driver provided (I'm assuming drivers ... NT_SUCCSS returns true for either SUCCESS or WARNING class messages, ...
    (microsoft.public.win32.programmer.kernel)
  • Re: Return value(s) from functions - any defacto standard?
    ... values that indicate success and fail. ... success, returns 0 for some calls and returns 1 on others. ... suppose if you want to mix in failure mode codes as returns from these ... report error codes some other way. ...
    (microsoft.public.vc.mfc)
  • Return value(s) from functions - any defacto standard?
    ... values that indicate success and fail. ... success, returns 0 for some calls and returns 1 on others. ... suppose if you want to mix in failure mode codes as returns from these ...
    (microsoft.public.vc.mfc)