Jump to content

Talk:HRESULT

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia

HRESULT Constant

[edit]

This is my first post ever to WikiPedia, so I'm sure I'll do something wrong... My only comment here is that the constant for a successful HRESULT has been omitted. That's the only thing I'm after. MSDN forgot to make that easy to find, as did Wikipedia. And uh, yeah, I know it equals zero. Gee whiz. (Yuban 17:40, 12 April 2007 (UTC))[reply]

There is no single constant for success because an HRESULT can be S_OK(0) or S_FALSE(1) which are both success codes, or the HRESULT can contain user defined success codes where bit 31=0 and bit 29=1. So use SUCCEEDED() or FAILED() on the value to determine whether the operation succeeded. --Traal (talk) 20:12, 28 November 2022 (UTC)[reply]

HRESULT data type

[edit]

The provided documentation on how the HRESULT values are constructed is extremely helpful! I don't want to ding anyone for providing this very, very important information. That said...

Another point I'd like to bring up... The HRESULT data type ( if we can call it that ) actually predates the existence of COM objects. Almost every Win32 routine I've ever used is documented as having a return value of type HRESULT. The current introduction implies that HRESULT is particular to COM objects, which in my experience is not the case.

However, there is life outside of COM objects. Someone might read this page, and if they are anything like me will get an intense urge to vomit as soon as they see the term COM object. (Yuban 22:18, 12 April 2007 (UTC))[reply]

You are wrong. Most Win32 functions return either a value depending on the function (for example a window handle) or a BOOL. Importantly, most Win32 functions indicate failure by returning 0, which is success in COM. While it is true that HRESULT predates COM, it only does so by three years, and then only in COM's predecessor. Shinobu 14:29, 17 June 2007 (UTC)[reply]

Facility code discrepancy

[edit]

PLEASE explain the discrepancies between the facility code list given in the article and that given in the first external source reference. For instance, the article says Facility 10 is SCARD. The MOSP reference says it is CONTROL. And if the bits indicate an NTSTATUS code, Facility 10 appears to me to be TERMINAL_SERVER. I don't get it. Looks to me like whoever authored that list had some of their bits shifted incorrectly. 24.253.133.33 (talk) 15:56, 4 August 2008 (UTC)[reply]

I believe you are referring to this reference? I agree that things should be cleared up - it looks like either the original text was missing some Facility types, or else other facility codes have since been added by Microsoft. In either case I vote we change the article to match the reference. In addition, I vote we shorten the list to not include all Facility types. There are currently 80 facility codes listed on the Microsoft reference, and it doesn't make sense to duplicate them and try to keep them up to date here when the reader can simply follow the link. --Culix (talk) 17:52, 14 July 2009 (UTC)[reply]

Article cleanup

[edit]

I tried to add some context to make a better intro for this topic and move technical details into their own sections. It still needs some work though. Any suggestions on what to do? Can someone who knows more about the technical details comment on those sections? --Culix (talk) 18:44, 14 July 2009 (UTC)[reply]

Took a while, but done, updated, enhanced, more correct, more readable :) --Stevebroshar (talk) 16:15, 11 July 2022 (UTC)[reply]

HRESULT Origin

[edit]

I read in a book (Inside COM by Dale Rogerson, Chapter 6, page 104) that the name 'HRESULT' is historical (with the 'H' standing for neither "handle" nor "historical"). What did the 'H' originally stand for? —Preceding unsigned comment added by Mistemy (talkcontribs) 12:57, 4 July 2010 (UTC)[reply]

According Raymond Chen, https://devblogs.microsoft.com/oldnewthing/20180117-00/?p=97815, "in the old days it really was a handle to an object that contained rich error information ... The COM team decided that the cost/benefit simply wasn’t worth it, so the HRESULT turned into a simple number. But the name stuck.". So it stands for handle, even though the value isn't a handle :) --Stevebroshar (talk) 16:22, 11 July 2022 (UTC)[reply]

HRESULT Bit indexing

[edit]

I think the bits in section HRESULT format should be numbered from 31 to 0, from left to right, (MSB = bit 31, LSB = bit 0) as usual in computer science. 89.246.178.25 (talk) 15:30, 17 May 2011 (UTC)[reply]

I agree. Changed. -LesPaul75talk 04:26, 4 June 2011 (UTC)[reply]