<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Reading a contract from the other side: Application publishers</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2004/08/31/223271.aspx</link><description>This time we'll look at the IAppPublisher interface.</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title>re: Reading a contract from the other side: Application publishers</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2004/08/31/223271.aspx#224782</link><pubDate>Thu, 02 Sep 2004 16:34:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:224782</guid><dc:creator>Raymond Chen</dc:creator><description>And that's what the NT team did - with STATUS and HRESULT codes.  But the registry stuff predates NT. The only thing the NT team could do with the registry stuff was come up with names for things that already existed.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=224782" width="1" height="1"&gt;</description></item><item><title>re: Reading a contract from the other side: Application publishers</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2004/08/31/223271.aspx#224408</link><pubDate>Thu, 02 Sep 2004 02:15:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:224408</guid><dc:creator>Norman Diamond</dc:creator><description>8/31/2004 6:46 PM Raymond Chen&lt;br&gt;&lt;br&gt;&amp;gt; It's called ERROR_SUCCESS because it's an&lt;br&gt;&amp;gt; error code [...] What would you call it?&lt;br&gt;&lt;br&gt;I would have defined return codes or status codes instead of error codes.  I would have allowed the possibility of a successful return code or successful status code.  I would probably call the thing SUCCESS or STATUS_SUCCESS.  Despite my cynicism, I think there were known cases of operations performing as intended even before the codes here were designed as error codes. &lt;br&gt;&lt;br&gt;For comparison:  When programs under VMS returned a value whose meaning meant a warning level but success, the fault was in those programs not the OS.  The OS did define a value whose meaning meant a success level together with success.  The OS came with impeccable documentation of this fact.  Some programs even obeyed it.&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=224408" width="1" height="1"&gt;</description></item><item><title>re: Reading a contract from the other side: Application publishers</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2004/08/31/223271.aspx#223806</link><pubDate>Wed, 01 Sep 2004 05:44:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:223806</guid><dc:creator>darwou</dc:creator><description>&amp;gt; Now just to be snarky, having observed &lt;br&gt;&amp;gt; cases of &amp;quot;if ([...] == ERROR_SUCCESS)&amp;quot; &lt;br&gt;&amp;gt; and &amp;quot;if (SUCCEEDED([...]))&amp;quot; in the same &lt;br&gt;&amp;gt; code sample, I can't help wondering. &lt;br&gt;&amp;gt; Shouldn't the latter macro have been &lt;br&gt;&amp;gt; ERROR_SUCCEEDED? Or ERRORED_SUCCESSFULLY?&lt;br&gt;&lt;br&gt;SUCCEEDED() is unrelated to ERROR_SUCCESS.&lt;br&gt;&lt;br&gt;HRESULTS are not Win32 errors.&lt;br&gt;&lt;br&gt;ERROR_SUCCESS is the Win32 error code indicating success. It is defined as 0.&lt;br&gt;&lt;br&gt;Win32 API errors are positive integers. For example, ERROR_NOT_ENOUGH_MEMORY is defined as 8.&lt;br&gt;&lt;br&gt;On the other hand, an HRESULT is an error returned from a COM interface or API. &lt;br&gt;&lt;br&gt;S_OK is the error code that indicates success. It is also defined as 0. &lt;br&gt;&lt;br&gt;However, HRESULT codes representing errors are all negative. For example, E_OUTOFMEMORY is defined as 0x8007000E.&lt;br&gt;&lt;br&gt;SUCCEEDED() and FAILED() are both macros designed to work only with HRESULT. They check to see if the error code is negative to determine whether to return TRUE or FALSE.&lt;br&gt;&lt;br&gt;Hence, you must NEVER use either macro with the error code returned from a Win32 API like RegEnumKeyW or RegQueryValueW().&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=223806" width="1" height="1"&gt;</description></item><item><title>re: Reading a contract from the other side: Application publishers</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2004/08/31/223271.aspx#223751</link><pubDate>Wed, 01 Sep 2004 01:46:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:223751</guid><dc:creator>Raymond Chen</dc:creator><description>It's called ERROR_SUCCESS because it's an error code (and therefore must be named ERROR_something) but no error occurred. What would you call it?&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=223751" width="1" height="1"&gt;</description></item><item><title>re: Reading a contract from the other side: Application publishers</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2004/08/31/223271.aspx#223742</link><pubDate>Wed, 01 Sep 2004 01:18:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:223742</guid><dc:creator>Norman Diamond</dc:creator><description>Seriously, a lower-case l is a terrible name for an identifier, whether or not you intend for your code to be read by humans.&lt;br&gt;&lt;br&gt;Now just to be snarky, having observed cases of &amp;quot;if ([...] == ERROR_SUCCESS)&amp;quot; and &amp;quot;if (SUCCEEDED([...]))&amp;quot; in the same code sample, I can't help wondering.  Shouldn't the latter macro have been ERROR_SUCCEEDED?  Or ERRORED_SUCCESSFULLY?&lt;br&gt;Too bad this one doesn't have a screenshot:&lt;br&gt;&lt;a target="_new" href="http://www.sonic.net/~ezzell/Error%20Messages/Nothing_Goes_Wrong_Like_Success.htm#Nothing_Like_Success"&gt;http://www.sonic.net/~ezzell/Error%20Messages/Nothing_Goes_Wrong_Like_Success.htm#Nothing_Like_Success&lt;/a&gt;&lt;br&gt;but this one does:&lt;br&gt;&lt;a target="_new" href="http://home.comcast.net/~anon4321/niceone.gif"&gt;http://home.comcast.net/~anon4321/niceone.gif&lt;/a&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=223742" width="1" height="1"&gt;</description></item><item><title>re: Reading a contract from the other side: Application publishers</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2004/08/31/223271.aspx#223406</link><pubDate>Tue, 31 Aug 2004 17:38:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:223406</guid><dc:creator>Filip</dc:creator><description>You may call me pedantic ... but I tried to compile your program:&lt;br&gt;&lt;br&gt;  if (SUCCEEDED(CoInitialize(NULL))) { &amp;lt;-- Missing parenthesis&lt;br&gt;&lt;br&gt;and &lt;br&gt;&lt;br&gt;        if (RegQueryValueW(hkPub, szKey, szCLSID, &amp;amp;l) == ERROR_SUCCESS)&lt;br&gt;        { &amp;lt;== Missing bracket&lt;br&gt;&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=223406" width="1" height="1"&gt;</description></item><item><title>re: Reading a contract from the other side: Application publishers</title><link>http://blogs.msdn.com/b/oldnewthing/archive/2004/08/31/223271.aspx#223339</link><pubDate>Tue, 31 Aug 2004 15:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:223339</guid><dc:creator>Michael</dc:creator><description>What a great article!  I am going to sit down and run some tests and really sink my teeth into this subject for some work I have to do later next week.  What a great resource your site has become.  Thanks!  Finally,  for one am glad you do not use smart pointers in you examples.  Not that I do not use raw pointers in my work, it just makes it easier to follow.&lt;br&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=223339" width="1" height="1"&gt;</description></item></channel></rss>