<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Ted&#039;s Blog</title>
	<atom:link href="http://tedwvc.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://tedwvc.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Fri, 06 Jan 2012 19:10:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='tedwvc.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Ted&#039;s Blog</title>
		<link>http://tedwvc.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://tedwvc.wordpress.com/osd.xml" title="Ted&#039;s Blog" />
	<atom:link rel='hub' href='http://tedwvc.wordpress.com/?pushpress=hub'/>
		<item>
		<title>New feature for MFC vNext: small statically linked dialog based and console apps</title>
		<link>http://tedwvc.wordpress.com/2011/11/15/new-feature-for-mfc-vnext-small-statically-linked-dialog-based-and-console-apps/</link>
		<comments>http://tedwvc.wordpress.com/2011/11/15/new-feature-for-mfc-vnext-small-statically-linked-dialog-based-and-console-apps/#comments</comments>
		<pubDate>Wed, 16 Nov 2011 00:38:42 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=144</guid>
		<description><![CDATA[If you&#8217;ve read my blog in the past, you&#8217;ve noticed that I&#8217;ve written several articles relating to reducing the size of statically linked MFC apps. Ever since the feature pack classes were added to MFC (in 2008 SP1) there have been various regressions that caused even the simplest of MFC applications to be super-large when [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=144&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you&#8217;ve read my blog in the past, you&#8217;ve noticed that I&#8217;ve written several articles relating to reducing the size of statically linked MFC apps.  Ever since the feature pack classes were added to MFC (in 2008 SP1) there have been various regressions that caused even the simplest of MFC applications to be super-large when building a release version.  </p>
<p>In vNext, Microsoft has attempted to address this issue by adding a new define: _AFX_NO_MFC_CONTROLS_IN_DIALOGS that basically says: I know that I will not have any of the &#8220;feature pack&#8221; controls in my app, so don&#8217;t link any code into the app that I&#8217;m not going to need.  </p>
<p>From my testing so far, it only appears to work in console apps and MFC Dialog based apps.  If you use it with a single document interface app, it will fail with a linker error.  </p>
<p>The sizing results are dramatic, and I suggest you give the define a try if you are using MFC vNext and have a statically linked app.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/144/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/144/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/144/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=144&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2011/11/15/new-feature-for-mfc-vnext-small-statically-linked-dialog-based-and-console-apps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
		<item>
		<title>Apps created with CRT and MFC vNext (11) cannot be used on Windows XP SP3</title>
		<link>http://tedwvc.wordpress.com/2011/09/28/apps-created-with-crt-and-mfc-vnext-11-cannot-be-used-on-windows-xp-sp3/</link>
		<comments>http://tedwvc.wordpress.com/2011/09/28/apps-created-with-crt-and-mfc-vnext-11-cannot-be-used-on-windows-xp-sp3/#comments</comments>
		<pubDate>Wed, 28 Sep 2011 11:34:10 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=139</guid>
		<description><![CDATA[I filed a bug relating to no longer being able to target XP when creating a Visual C++ vNext app. I got a reply from a member of the Microsoft libraries team stating this is by design and only Vista and above or Windows Server 2008 SP2 and above can be targeted when creating a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=139&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I filed a bug relating to no longer being able to target XP when creating a Visual C++ vNext app.  I got a reply from a member of the Microsoft libraries team stating this is by design and only Vista and above or Windows Server 2008 SP2 and above can be targeted when creating a vNext application.  </p>
<p>Please read the following and vote on it, add comments to it as well.  If you believe that being able to create a single binary that can target XP and above, and still have access to the latest compilers, libraries, and headers that vNext provides (i.e. not have to use the &#8220;native multi-targeting&#8221; feature, then please see below:</p>
<p><a href="http://connect.microsoft.com/VisualStudio/feedback/details/690617">http://connect.microsoft.com/VisualStudio/feedback/details/690617</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/139/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/139/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/139/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=139&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2011/09/28/apps-created-with-crt-and-mfc-vnext-11-cannot-be-used-on-windows-xp-sp3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
		<item>
		<title>MS11-025 has been reissued &#8211; all previously mentioned problems have been solved</title>
		<link>http://tedwvc.wordpress.com/2011/06/18/ms11-025-has-been-reissued-all-previously-mentioned-problems-have-been-solved/</link>
		<comments>http://tedwvc.wordpress.com/2011/06/18/ms11-025-has-been-reissued-all-previously-mentioned-problems-have-been-solved/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 01:13:57 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=131</guid>
		<description><![CDATA[Thank you to several readers who have alerted me to the fact that on June 15th, a whole new set of tools and redistributable patches for Visual C++ 2005, 2008, and 2010 have been released, fixing the problems that I blogged about a couple months ago. Please read MS11-025 where you&#8217;ll find links to the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=131&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Thank you to several readers who have alerted me to the fact that on June 15th, a whole new set of tools and redistributable patches for Visual C++ 2005, 2008, and 2010 have been released, fixing the problems that I blogged about a couple months ago. Please read <a href="http://www.microsoft.com/technet/security/Bulletin/MS11-025.mspx">MS11-025</a> where you&#8217;ll find links to the new tools updates and redistributables. </p>
<p>So any workarounds I&#8217;ve posted for the April 15th patches are no longer necessary once you update to the latest versions.  </p>
<p>Relevant redist DLL versions:<br />
VC2005 SP1 + <a href="http://support.microsoft.com/kb/2538218">KB2538218</a>: 8.0.50727.6195<br />
VC2008 SP1 + <a href="http://support.microsoft.com/kb/2538241">KB2538241</a>: 9.0.30729.6161</p>
<p>As a bonus: the VC2008 SP1 static code bloat problem caused by the April 15th update has also been fixed by the above patch.</p>
<p>Of course, for VC2005 SP1 users, this blog post is still relevant if you want to control the version number in your manifest: </p>
<p><a href="http://tedwvc.wordpress.com/2009/08/10/avoiding-problems-with-vc2005-sp1-security-update-kb971090/">Avoiding problems with VC2005 SP1 Security update KB971090</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=131&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2011/06/18/ms11-025-has-been-reissued-all-previously-mentioned-problems-have-been-solved/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
		<item>
		<title>Unexpected updates to developer tools caused by security updates &#8211; what do to about it?</title>
		<link>http://tedwvc.wordpress.com/2011/04/17/unexpected-updates-to-developer-tools-caused-by-security-updates-what-do-to-about-it/</link>
		<comments>http://tedwvc.wordpress.com/2011/04/17/unexpected-updates-to-developer-tools-caused-by-security-updates-what-do-to-about-it/#comments</comments>
		<pubDate>Sun, 17 Apr 2011 18:59:24 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=116</guid>
		<description><![CDATA[The past week&#8217;s activity in security updates have generated a lot of new blog entries on this page. But does it have to be that way? Martin Richter has written up a very good summary of why developers need the ability to freeze their environments (or at least be properly warned!!) when tools updates are [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=116&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The past week&#8217;s activity in security updates have generated a lot of new blog entries on this page.  But does it have to be that way? </p>
<p>Martin Richter has written up a very good summary of why developers need the ability to freeze their environments (or at least be properly warned!!) when tools updates are released as important security updates.  The main reason is because they need to target particular runtimes, and if they have to release hotfixes their manifests must match what is already out there.   Another reason is that they simply cannot keep track of all the updates, and having your tools changed out from under you out of the blue can have major repercussions, especially if there are new bugs in those tools.  It can cause massive numbers of hours of lost productivity in reconfiguring a whole organization&#8217;s developer machines.  </p>
<p>I suggest you sign up for connect.microsoft.com (Visual Studio and .NET Framework) and read this (don&#8217;t forget to vote on it while you&#8217;re there):</p>
<p><a href="http://connect.microsoft.com/VisualStudio/feedback/details/662511/always-ask-the-developer-before-applying-a-security-fix-or-service-pack-to-visual-studio-that-need-changed-the-c-runtime-dlls-atl-mfc-crt">Feature request: Always ask the developer before applying a security fix or service pack to Visual Studio that need changed the C++ runtime DLLs ATL/MFC/CRT </a></p>
<p>I definitely support having some better communication about the issues as well at the time they are released, like when <a href="http://support.microsoft.com/kb/971090">KB971090</a> was released there was a video on channel 9 &#8211; see <a href="http://channel9.msdn.com/Blogs/Charles/Out-of-Band-Inside-the-ATL-Security-Update">http://channel9.msdn.com/Blogs/Charles/Out-of-Band-Inside-the-ATL-Security-Update</a> for the type of info that should be communicated.  </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/116/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/116/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/116/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=116&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2011/04/17/unexpected-updates-to-developer-tools-caused-by-security-updates-what-do-to-about-it/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
		<item>
		<title>Fixing problems with FindActCtxSectionString in MFC security updates</title>
		<link>http://tedwvc.wordpress.com/2011/04/16/fixing-problems-with-findactctxsectionstring-in-mfc-security-updates/</link>
		<comments>http://tedwvc.wordpress.com/2011/04/16/fixing-problems-with-findactctxsectionstring-in-mfc-security-updates/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 05:46:58 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=96</guid>
		<description><![CDATA[EDIT &#8211; June 18th, 2011 &#8211; the below blog entry is out of date &#8211; click here for up to date information. In this blog entry I attempt to fix 3 of the problems associated with FindActCtxSectionString in a statically linked application (2005 and 2008). What I&#8217;m going to do is override the appcore.cpp that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=96&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>EDIT &#8211; June 18th, 2011</strong> &#8211; the below blog entry is out of date &#8211; click <a href="http://tedwvc.wordpress.com/2011/06/18/ms11-025-has-been-reissued-all-previously-mentioned-problems-have-been-solved/">here</a> for up to date information. </p>
<p>In this blog entry I attempt to fix 3 of the problems associated with FindActCtxSectionString in a statically linked application (2005 and 2008).  What I&#8217;m going to do is override the appcore.cpp that gets included in every static app with one that we&#8217;ll include in our app (again, like the last blog, no editing of the included file is necessary, which is a good thing because if there any updates you&#8217;ll get them by rebuilding)</p>
<p>1) Open up your stdafx.cpp file in your project (a statically linked MFC project)<br />
2) Paste the following code after the include:</p>
<pre>
#undef FindActCtxSectionString
#define FindActCtxSectionString MyFindActCtxSectionString

#ifdef _UNICODE
#define _FINDACTCTXSECTIONSTRING "FindActCtxSectionStringW"
#else
#define _FINDACTCTXSECTIONSTRING "FindActCtxSectionStringA"
#endif

typedef BOOL (WINAPI * PFN_FINDAC)(DWORD dwFlags, const GUID *lpExtensionGuid,ULONG ulSectionId,LPCTSTR lpStringToFind,PACTCTX_SECTION_KEYED_DATA ReturnedData);

BOOL WINAPI MyFindActCtxSectionString(
     DWORD dwFlags,
     const GUID *lpExtensionGuid,
     ULONG ulSectionId,
     LPCTSTR lpStringToFind,
     PACTCTX_SECTION_KEYED_DATA ReturnedData)
{
	// Bug #1 - Windows 2000
	PFN_FINDAC pfnFindActCtxSectionString =NULL;
	{
		HINSTANCE hKernel32 = GetModuleHandle(_T("kernel32.dll"));
		if (hKernel32 == NULL)
		{
			return FALSE;
		}

		pfnFindActCtxSectionString = (PFN_FINDAC) GetProcAddress(hKernel32, _FINDACTCTXSECTIONSTRING);

		if (pfnFindActCtxSectionString == NULL)
		{
			/* pre-fusion OS, so no more checking.*/
			return FALSE;
		}
	}

	ReturnedData-&gt;cbSize = sizeof(ACTCTX_SECTION_KEYED_DATA); // Bug #2 - missing cbSize initializer
	return pfnFindActCtxSectionString(/* dwFlags */ 0,  // Bug #3 memory leak - pass in zero as return handle not freed
		lpExtensionGuid, ulSectionId, lpStringToFind, ReturnedData);
}

#include "..\src\mfc\appcore.cpp"
</pre>
<p>3) rebuild your app</p>
<p>Now, you get the following benefits<br />
1) Successful running under Windows 2000<br />
2) Properly initialized cbSize (see previous blog discussion)<br />
3) Memory leak fix (passing in first parameter leaks a context handle)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/96/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/96/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/96/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=96&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2011/04/16/fixing-problems-with-findactctxsectionstring-in-mfc-security-updates/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
		<item>
		<title>Static MFC code bloat problem from VC2010 is now in VC2008 SP1+security fix</title>
		<link>http://tedwvc.wordpress.com/2011/04/16/static-mfc-code-bloat-problem-from-vc2010-is-now-in-vc2008-sp1security-fix/</link>
		<comments>http://tedwvc.wordpress.com/2011/04/16/static-mfc-code-bloat-problem-from-vc2010-is-now-in-vc2008-sp1security-fix/#comments</comments>
		<pubDate>Sat, 16 Apr 2011 04:51:57 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=89</guid>
		<description><![CDATA[EDIT &#8211; June 18th, 2011 &#8211; the below blog entry is out of date &#8211; click here for up to date information. Thanks to Owen Wengerd from Outside the Box for letting me know about this one &#8211; it&#8217;s a big regression. Turns out the the code bloat release size problem introduced in VC2010 with [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=89&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>EDIT &#8211; June 18th, 2011</strong> &#8211; the below blog entry is out of date &#8211; click <a href="http://tedwvc.wordpress.com/2011/06/18/ms11-025-has-been-reissued-all-previously-mentioned-problems-have-been-solved/">here</a> for up to date information. </p>
<p>Thanks to Owen Wengerd from <a href="http://otb.manusoft.com/2011/04/the-mfc-balloon.htm">Outside the Box</a> for letting me know about this one &#8211; it&#8217;s a big regression.  Turns out the the code bloat release size problem introduced in VC2010 with MFC statically linked applications is now a problem in VC2008 SP1, thanks to the new security updates of April 12th.  </p>
<p>Problem:</p>
<p>It all started with <a href="http://www.microsoft.com/technet/security/Bulletin/MS11-025.mspx">MS11-025</a>.  This security update caused a multitude of problems with MFC, some of which are mentioned in previous posts.  This particular one is specific to VC2008 SP1, it appears after installing <a href="http://www.microsoft.com/downloads/details.aspx?familyid=4149f21c-37f7-4516-83e1-d70c738d612b">KB2465361</a> and then rebuilding your existing statically linked MFC application(s).</p>
<p>What happened is that themehelper.cpp now uses the function AfxLoadSystemLibraryUsingFullPath which resides in the afxglobals.cpp file (as an inline function, no less!).  As we know from previous experience in VC2010, if your app has to pull in afxglobals.obj for any reason, a cascade effect occurs and approximately 1.2 megs are added to your release EXE size.  For example, using the Appwizard to generate a simple MDI app with a classic menu and toolbar, and no visual styles, and building a release is 553KB before the security update, and 1763KB after the security update.</p>
<p>Solution:</p>
<p>Luckily there&#8217;s a quick solution.  Owen suggested one solution which was similar to my previous blog entry about reducing static size in VC2010, which is to copy and edit the afxglobals.cpp file.  But it&#8217;s actually easier than that.  When I originally wrote this blog entry, I made this suggestion: we&#8217;ll include themehelper.cpp in our stdafx.cpp file without copying it, just including it directly, and use some preprocessor magic to make it use our own local version of the AfxLoadSystemLibraryUsingFullPath function instead of the one in afxglobals.cpp.  But Owen realized that all you really need is your own local copy of the AfxLoadSystemLibraryUsingFullPath function somewhere in your app, and even better, there won&#8217;t be any duplicate symbol errors!  So the full solution is:</p>
<p>1) open up your stdafx.cpp from your project<br />
2) paste the following code after the <code>#include "stdafx.h"</code></p>
<pre>

// this is our own local copy of the AfxLoadSystemLibraryUsingFullPath function
HMODULE AfxLoadSystemLibraryUsingFullPath(const WCHAR *pszLibrary)
{
	WCHAR wszLoadPath[MAX_PATH+1];
	if (::GetSystemDirectoryW(wszLoadPath, _countof(wszLoadPath)) == 0)
	{
		return NULL;
	}

	if (wszLoadPath[wcslen(wszLoadPath)-1] != L'\\')
	{
		if (wcscat_s(wszLoadPath, _countof(wszLoadPath), L"\\") != 0)
		{
			return NULL;
		}
	}

	if (wcscat_s(wszLoadPath, _countof(wszLoadPath), pszLibrary) != 0)
	{
		return NULL;
	}

	return(::AfxCtxLoadLibraryW(wszLoadPath));
}
</pre>
<p>3) Rebuild your app, and voila, it&#8217;s all better now.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/89/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/89/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/89/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=89&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2011/04/16/static-mfc-code-bloat-problem-from-vc2010-is-now-in-vc2008-sp1security-fix/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
		<item>
		<title>Problem with FindActCtxSectionString in MFC security updates on all platforms</title>
		<link>http://tedwvc.wordpress.com/2011/04/14/problem-with-findactctxsectionstring-in-mfc-security-updates-on-all-platforms/</link>
		<comments>http://tedwvc.wordpress.com/2011/04/14/problem-with-findactctxsectionstring-in-mfc-security-updates-on-all-platforms/#comments</comments>
		<pubDate>Thu, 14 Apr 2011 15:47:08 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=76</guid>
		<description><![CDATA[Martin Richter has written a blog entry on a serious issue that was introduced when the MFC security updates were released on April 12. The culprit is, again, FindActCtxSectionString, but in this case it actually affects ALL platforms. Please read the following blog entry: BUG: Black Patchday for all OS from XP and later 3. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=76&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Martin Richter has written a blog entry on a serious issue that was introduced when the MFC security updates were released on April 12.  The culprit is, again, FindActCtxSectionString, but in this case it actually affects ALL platforms.  Please read the following blog entry:</p>
<p><a href="http://blog.m-ri.de/index.php/2011/04/14/bug-black-patchday-for-all-os-from-xp-and-later-3-mfc-8-0-vc-2005-or-mfc-9-0-vc-2008-linked-dynamically-to-the-mfc-may-not-find-the-mfc-language-dlls-after-installation-of-the-security-packs-d/">BUG: Black Patchday for all OS from XP and later 3. – MFC 8.0 (VC-2005) or MFC 9.0 (VC-2008) linked dynamically to the MFC may not find the MFC language DLLs after installation of the security packs dated April 12th 2011</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/76/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/76/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/76/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=76&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2011/04/14/problem-with-findactctxsectionstring-in-mfc-security-updates-on-all-platforms/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
		<item>
		<title>New redists break all dynamically linked MFC 2005/2008 apps on Windows 2000</title>
		<link>http://tedwvc.wordpress.com/2011/04/13/new-redists-break-all-dynamically-linked-mfc-20052008-apps-on-windows-2000/</link>
		<comments>http://tedwvc.wordpress.com/2011/04/13/new-redists-break-all-dynamically-linked-mfc-20052008-apps-on-windows-2000/#comments</comments>
		<pubDate>Wed, 13 Apr 2011 14:52:02 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=63</guid>
		<description><![CDATA[EDIT &#8211; June 18th, 2011 &#8211; the below blog entry is out of date &#8211; click here for up to date information. Step by step instructions for Windows 2000 end users that want to get up and running quickly after having installed one or both of the invalid Visual C++ security redistributables on Windows 2000: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=63&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>EDIT &#8211; June 18th, 2011</strong> &#8211; the below blog entry is out of date &#8211; click <a href="http://tedwvc.wordpress.com/2011/06/18/ms11-025-has-been-reissued-all-previously-mentioned-problems-have-been-solved/">here</a> for up to date information. </p>
<p>Step by step instructions for Windows 2000 end users that want to get up and running quickly after having installed one or both of the invalid Visual C++ security redistributables on Windows 2000:</p>
<p>1) go to Control Panel &#8211; Add/Remove Programs, and uninstall the following (one or both may be installed)<br />
a) Microsoft Visual C++ 2005 Redistributable &#8211; KB2467175<br />
b) Microsoft Visual C++ 2008 Redistributable &#8211; KB2467174 &#8211; x86 9.0.30729.5570</p>
<p>Important: look for entries in the add/remove programs with the exact titles above, i.e including those KB article numbers in the title of the entry, as there may be similar looking ones in there (ignore those ones)</p>
<p>2) Find your &#8220;Windows&#8221; folder.  Usually this is at c:\windows or c:\winnt . For the purposes of these instructions, I&#8217;ll assume it&#8217;s c:\windows (replace that below with your actual Windows folder)</p>
<p>3) Create a folder on your desktop named WORKDIR.  You&#8217;ll use this later to hold all the DLLs you&#8217;ll be copying to your system32 folder. </p>
<p>4) Using Windows Explorer, go to c:\windows\winsxs.  Hit the search button.  For &#8220;Search for files or folders named&#8221;, type in 4053, and then hit ENTER.  If nothing has been found type in 762 and hit ENTER.</p>
<p>5) There should be 5 folders that were found (as well as various other files that should be ignored, also, ignore any folders with amd64 at the beginning of their folder names).  Note there may be some debug folders in here as well, brining the folder count up to 8.   </p>
<p>Example of folder name: x86_Microsoft.VC80.MFC_1fc8b3b9a1e18e3b_8.0.50727.4053_x-ww_b77cec8e</p>
<p>6) For each of these 5 folders (or 8 if you have Debug some debug folders), do the following:<br />
a) double click on the folder.<br />
b) Edit &#8211; Select all (or CTRL+A)<br />
c) Edit-Copy (or CTRL+C)<br />
d) click on your desktop and open the WORKDIR folder you created above, and then hit Paste (or CTRL+V).<br />
e) return to the Windows Explorer search window and click the &#8220;Back&#8221; button.</p>
<p>7) Repeat step (4) except search for 4148.  If nothing found, search for 21022, then repeat steps 5 and 6.</p>
<p>8) Now your WORKDIR folder should be full of all the DLLs you will require to have copied to your C:\Windows\System32 folder.  Open the WORKDIR folder on your desktop, and select all (CTRL+A) and then Edit-Copy (CTRL+C).  Then navigate to your Windows\System32 folder and Paste (CTRL+V).  If you receive any errors pasting (files in use) you may have to reboot and/or exclude the MSVCR* files when copying and pasting.   At a minimum, you&#8217;ll need to copy at least the MFC related DLL files (files with MFC in their names)</p>
<p>9) Try running the problematic applications again, to make sure the problem has been fixed.  </p>
<p>More background info:</p>
<p>Thanks to Martin Richter on letting me know about this one &#8211; the new VCRedists that were rolled out yesterday due to the multi-version security update breaks all dynamically linked MFC 8.0 and 9.0 (VC2005/VC2008) apps that have ever shipped and are deployed to Windows 2000.  Any app that doesn&#8217;t have a local copy of MFC in their program folder is affected (due to DLL Hell in system32)</p>
<p>If you install them (do this on a test machine not a production machine!), run <a href="http://www.dependencywalker.com">dependency walker </a>on the updated mfc80.dll and mfc90.dll versions on Windows 2000 and see a new function being called that is not available under XP:</p>
<p>FindActCtxSectionStringA (or FindActCtxSectionStringW with the Unicode version)</p>
<p>These are the links to the broken redistributables:</p>
<p><a href="http://www.microsoft.com/downloads/en/details.aspx?familyid=fb01abe6-9099-4544-9aec-0ac13f19bc50&amp;displaylang=en">VC2005</a></p>
<p><a href="http://www.microsoft.com/downloads/en/details.aspx?familyid=05ce856d-8128-408b-96fa-5e1f57b097d8&amp;displaylang=en">VC2008</a></p>
<p>A simple workaround under Windows 2000 is to copy the older versions of MFC80.DLL and MFC90.DLL (or their corresponding Unicode versions) to your program folder(s).  Then your app will use those instead (remember Windows 2000 was a pre-SxS world).</p>
<p>To find these old DLLs is tricky &#8211; what would have been nice is that something like this would work:<br />
(1) Uninstall redist update<br />
(2) copy older versions from system32 to your program folder</p>
<p>but unfortunately, uninstalling it just leaves the new (broken ones) in system32.  No way to retrieve the old ones.  Or is there????? </p>
<p>Yes it turns out: Luckily (and luckily I remembered this from years ago), Windows 2000 still installs the DLLs to WinSxS.  So the old ones are still there.  So the workaround is to copy from the WinSxS folder the older version of MFC8 or 9 back to system32 or your program folder.  But of course, this solution not benefitting from the security updates that are so important.  So the best workaround is wait for a new version to be issued by Microsoft.</p>
<p>Special note for those that statically link their MFC apps: you will only be affected if you update your tools (i.e. <a href="http://www.microsoft.com/downloads/details.aspx?familyid=30db022a-c05e-4d7d-a6eb-ef13ed8cce09">KB2465367 </a>for VS2005, or <a href="http://www.microsoft.com/downloads/details.aspx?familyid=4149f21c-37f7-4516-83e1-d70c738d612b">KB2465361</a> for VS2008, VS2003 may be affected as well but I don&#8217;t have time to check it &#8211; see <a href="http://www.microsoft.com/downloads/details.aspx?familyid=e9501082-a651-452b-8c1a-43987ffd3102">KB2465373</a>) and then recompile your application.  Then your app will no longer run on Windows 2000.  So beware of installing these tools updates if you plan on rebuilding your app and releasing it and expect it to work on Windows 2000.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/63/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/63/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/63/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=63&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2011/04/13/new-redists-break-all-dynamically-linked-mfc-20052008-apps-on-windows-2000/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
		<item>
		<title>KB2465367 &#8211; a repeat of the KB971090 roll-out problems?</title>
		<link>http://tedwvc.wordpress.com/2011/04/12/kb2465367-a-repeat-of-the-kb971090-roll-out-problems/</link>
		<comments>http://tedwvc.wordpress.com/2011/04/12/kb2465367-a-repeat-of-the-kb971090-roll-out-problems/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 21:10:37 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>
		<category><![CDATA[C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=44</guid>
		<description><![CDATA[Today Microsoft released KB2465367, a Microsoft Visual C++ 2005 tools update. See: KB2465367 download http://support.microsoft.com/kb/2500212 http://support.microsoft.com/kb/2465367 For those of you that remember the problems that KB971090 caused to developers, I suggest you look at this patch carefully before rolling this out, to see if it affects your particular development environment. To remind you of this, [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=44&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Today Microsoft released KB2465367, a Microsoft Visual C++ 2005 tools update.  See:</p>
<p><a href="http://www.microsoft.com/downloads/en/details.aspx?familyid=30db022a-c05e-4d7d-a6eb-ef13ed8cce09&amp;displaylang=en">KB2465367 download</a></p>
<p><a href="http://support.microsoft.com/kb/2500212">http://support.microsoft.com/kb/2500212</a></p>
<p><a href="http://support.microsoft.com/kb/2465367">http://support.microsoft.com/kb/2465367</a></p>
<p>For those of you that remember the problems that KB971090 caused to developers, I suggest you look at this patch carefully before rolling this out, to see if it affects your particular development environment.  To remind you of this, please go and read my blog article about KB971090 at:</p>
<p><a href="http://tedwvc.wordpress.com/2009/08/10/avoiding-problems-with-vc2005-sp1-security-update-kb971090/">http://tedwvc.wordpress.com/2009/08/10/avoiding-problems-with-vc2005-sp1-security-update-kb971090/</a></p>
<p>NOTE: I&#8217;ve confirmed that the exact same technique used to update the VC libraries and DLLs in KB971090 are used in KB2465367 also.  That is, the manifest version of your app will be increased to 8.0.50727.5592 (from 8.0.50727.762 which was the original SP1, or 8.0.50727.4053 which was the July 2009 security update).  This security update contains the new MFC fixes, as well as the original ATL fixes from July 2009.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/44/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/44/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/44/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=44&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2011/04/12/kb2465367-a-repeat-of-the-kb971090-roll-out-problems/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
		<item>
		<title>How to get Visual C++ 2010 MFC applications to run on Windows 2000</title>
		<link>http://tedwvc.wordpress.com/2010/11/07/how-to-get-visual-c-2010-mfc-applications-to-run-on-windows-2000/</link>
		<comments>http://tedwvc.wordpress.com/2010/11/07/how-to-get-visual-c-2010-mfc-applications-to-run-on-windows-2000/#comments</comments>
		<pubDate>Sun, 07 Nov 2010 23:26:21 +0000</pubDate>
		<dc:creator>tedwvc</dc:creator>
				<category><![CDATA[Visual C++]]></category>

		<guid isPermaLink="false">http://tedwvc.wordpress.com/?p=47</guid>
		<description><![CDATA[One of the annoying things about Visual Studio 2010 is that it does not create applications that can run on Windows 2000, Windows XP up to SP1, and Windows Server 2003 RTM. This can be embarrassing to say the least, you ship a cool app, and someone on one of these platforms gets an annoying [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=47&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>One of the annoying things about Visual Studio 2010 is that it does not create applications that can run on Windows 2000, Windows XP up to SP1, and Windows Server 2003 RTM.  This can be embarrassing to say the least, you ship a cool app, and someone on one of these platforms gets an annoying error.  See<br />
<a href="http://qualapps.blogspot.com/2010/04/visual-c-2010-apps-dont-support-windows.html">http://qualapps.blogspot.com/2010/04/visual-c-2010-apps-dont-support-windows.html</a><br />
for more information about this limitation.  </p>
<p>Recently, someone over at stackoverflow discovered a quick and easy way of running Win32 (non-MFC) apps on Windows 2000 through the use of a little bit of assembly code &#8211; see:<br />
<a href="http://stackoverflow.com/questions/2484511/can-i-use-visual-studio-2010s-c-compiler-with-visual-studio-2008s-c-runtime">http://stackoverflow.com/questions/2484511/can-i-use-visual-studio-2010s-c-compiler-with-visual-studio-2008s-c-runtime</a><br />
Ignore the title of the above stack overflow question for the moment &#8211; the important part for our purposes, is Tomasz Grobelny&#8217;s MASM translation of snemarch&#8217;s FASM answer.  I say this because Visual Studio 2010 has MASM tools built-in so we don&#8217;t need any extra downloads.  </p>
<p>Let me explain.  Win32 apps compiled with Visual C++ 2010 have a couple of hard dependencies (EncodePointer/DecodePointer) that we want to get rid of.  The bit of assembly in the above article is exactly what we need.  </p>
<p>I won&#8217;t go into a lot of details about that here, so if you&#8217;re only interested in Win32 apps the following article may not be of interest to you, except for the part about configuration of MASM in your project (keep reading below).</p>
<p>So what about MFC apps?  Reading Jim&#8217;s article above, as you can see there are 4 more dependencies we want to get rid of, all Activation context functions.</p>
<p>So, how can we easily get rid of these without rebuilding MFC?</p>
<p>I had hoped it would be as easy as replacing afxstate.cpp with Visual Studio 2008 SP1&#8242;s version (which has most of the wrapper of the activation context APIs), however, Microsoft made it a bit more difficult for us.   Looking at the source code and includes for mfc (if you have WinDiff handy and both 2008 SP1 and 2010 installed, feel free to following along with me) &#8211; in afxcomctl32.h &#8211; notice the devastating change in the macros: AFX_ISOLATIONAWARE_COMMON_ACTIVATE and AFX_ISOLATIONAWARE_FUNC_DEACTIVATE: Microsoft has changed the calls of AfxActivateActCtxWrapper to ActivateActCtx, and similarly AfxDeactivateActCtx to DeactivateActCtx.  Unfortunately, these macros are baked into the MFC object code provided by Microsoft.  Nothing we do is going to change that.  So we have to workaround this problem.  More on that later.  </p>
<p>So, how about we replace afxstate.cpp as a start, with the 2008 implementation.  Another way to accomplish the same thing, is to include a few redefining macros in our code, then immediately after, include the 2010 code in our stdafx.cpp.  This will replace the obj that we&#8217;re linking to with the one in our project.  </p>
<p>Now, back to those pesky calls to ActivateActCtx and DeactivateActCtx in the include file.  This is where the first article at stack overflow helped me immensely.  But, instead of doing what they did with EncodePointer and DecodePointer (created dummy functions instead of actually doing the encoding/decoding), we&#8217;re going to redirect any call ActivateActCtx and DeactivateActCtx in our binary over to our own Afx versions.   </p>
<p>I won&#8217;t go into details about the assembly code here, suffice it to say, I&#8217;m not a very good assembly programmer, so this part was the most time consuming part of my research.  Once I discovered the invoke command, it became easier to create a solution.  </p>
<p>The final step of the puzzle was realizing that MFC apps have a hard dependency on gdiplus.dll, so on Windows 2000, make sure you copy gdiplus.dll to your program folder before running (there are exceptions to this requirement for certain apps, more on that below)</p>
<p>So, after all that, here it is, a walkthrough on how to create an MFC app in Visual Studio 2010 that runs on Windows 2000 (resulting executable tested on Windows 2000 SP4 including Update Rollup 1 <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyId=B54730CF-8850-4531-B52B-BF28B324C662&amp;displaylang=en">KB891861</a> which is required for the HeapSetInformation function)</p>
<p>1) Launch Visual Studio 2010<br />
2) Create an MFC app, keep all the defaults (yes, leave all that feature pack stuff on too :)) Hit Finish.<br />
3) Right click on the project and hit Properties.  Choose from configuation dropdown: All Configurations<br />
4) Under configuration properties &#8211; General, choose Use of MFC &#8211; Use MFC in a Static Library<br />
5) Under Linker &#8211; System, type in 5.0 beside Minimum Required version<br />
6) Under Linker &#8211; Input, type in gdiplus.dll beside Delay loaded Dlls and then hit OK.<br />
7) Right click on the project and choose &#8220;Build Customizations&#8230;&#8221; menu item.<br />
8) Click on the checkbox beside &#8220;MASM (.targets,.props), and hit OK.<br />
9) Right click on Source Files folder, and choose Add &#8211; New Item<br />
10) Click on Code, then C++ file, then type in pointer.asm (not pointer.cpp) in the Name field and hit OK.<br />
11) In the newly created pointer.asm, paste in the following MASM assembly code:<br />
<code><br />
.model flat, C </p>
<p>AfxActivateActCtxWrapper   PROTO STDCALL  :DWORD,:DWORD<br />
AfxDeactivateActCtx   PROTO STDCALL :DWORD,:DWORD</p>
<p>.data<br />
__imp__EncodePointer@4 dd dummy<br />
__imp__DecodePointer@4 dd dummy<br />
__imp__ActivateActCtx@8 dd ActActCtx<br />
__imp__DeactivateActCtx@8 dd DeacActCtx</p>
<p>EXTERNDEF __imp__EncodePointer@4 : DWORD<br />
EXTERNDEF __imp__DecodePointer@4 : DWORD<br />
EXTERNDEF __imp__ActivateActCtx@8 : DWORD<br />
EXTERNDEF __imp__DeactivateActCtx@8 : DWORD </p>
<p>.code<br />
dummy proc<br />
mov eax, [esp+4]<br />
ret 4<br />
dummy endp </p>
<p>ActActCtx proc uses ebx ecx hActCtx:DWORD,lpCookie:DWORD<br />
invoke AfxActivateActCtxWrapper, hActCtx, lpCookie<br />
ret 8<br />
ActActCtx endp</p>
<p>DeacActCtx proc uses ebx ecx dwFlags:DWORD,ulCookie:DWORD<br />
invoke AfxDeactivateActCtx, dwFlags, ulCookie<br />
ret 8<br />
DeacActCtx endp</p>
<p>end<br />
</code></p>
<p>12) Save the pointer.asm file, and open the stdafx.cpp file<br />
13) Paste in the following code in the stdafx.cpp file (after the #include)</p>
<p><code><br />
#define DELETE_EXCEPTION(e) do { if(e) { e-&gt;Delete(); } } while (0)<br />
#include "afxpriv.h"</p>
<p>HANDLE AFXAPI AfxCreateActCtxW(PCACTCTXW pActCtx);<br />
void AFXAPI AfxReleaseActCtx(HANDLE hActCtx);<br />
extern "C" BOOL AFXAPI AfxActivateActCtx(HANDLE hActCtx, ULONG_PTR *lpCookie);<br />
extern "C" BOOL AFXAPI AfxDeactivateActCtx(DWORD dwFlags, ULONG_PTR ulCookie);<br />
extern "C" eActCtxResult AFXAPI AfxActivateActCtxWrapper(HANDLE hActCtx, ULONG_PTR *lpCookie);</p>
<p>// begin stuff ripped off from VC2008 SP1 afxstate.cpp</p>
<p>#define AFX_ACTCTX_API_INIT_PROCPTR(hKernel,name) pfn##name = (PFN_##name) GetProcAddress(hKernel, #name)<br />
#define AFX_ACTCTX_API_PTR_DEFINE(name, type, params) typedef type (WINAPI* PFN_##name)params; PFN_##name pfn##name = NULL;<br />
AFX_ACTCTX_API_PTR_DEFINE(CreateActCtxW, HANDLE, (PCACTCTXW));<br />
AFX_ACTCTX_API_PTR_DEFINE(ReleaseActCtx, void, (HANDLE));<br />
AFX_ACTCTX_API_PTR_DEFINE(ActivateActCtx, BOOL, (HANDLE, ULONG_PTR*));<br />
AFX_ACTCTX_API_PTR_DEFINE(DeactivateActCtx, BOOL, (DWORD, ULONG_PTR));</p>
<p>AFX_STATIC void AFXAPI _AfxInitContextAPI()<br />
{<br />
	static HMODULE hKernel = NULL;<br />
	if (hKernel == NULL)<br />
	{<br />
		hKernel = GetModuleHandle(_T("KERNEL32"));<br />
		ENSURE(hKernel != NULL);<br />
		AFX_ACTCTX_API_INIT_PROCPTR(hKernel,CreateActCtxW);<br />
		AFX_ACTCTX_API_INIT_PROCPTR(hKernel,ReleaseActCtx);<br />
		AFX_ACTCTX_API_INIT_PROCPTR(hKernel,ActivateActCtx);<br />
		AFX_ACTCTX_API_INIT_PROCPTR(hKernel,DeactivateActCtx);<br />
	}<br />
}</p>
<p>eActCtxResult AFXAPI AfxActivateActCtxWrapper(HANDLE hActCtx, ULONG_PTR *lpCookie)<br />
{<br />
	ENSURE_ARG(lpCookie!=NULL);</p>
<p>	eActCtxResult eResult=ActCtxFailed;<br />
	if (pfnActivateActCtx != 0)<br />
	{<br />
		eResult=AfxActivateActCtx(hActCtx, lpCookie) ? ActCtxSucceeded : ActCtxFailed;<br />
	} else<br />
	{<br />
		eResult=ActCtxNoFusion;<br />
	}</p>
<p>	return eResult;<br />
}</p>
<p>// end of stuff ripped off from VC2008 SP1 afxstate.cpp</p>
<p>// initialize Context API functions<br />
class InitContext<br />
{<br />
public:<br />
	InitContext() { _AfxInitContextAPI(); }<br />
};</p>
<p>InitContext context;</p>
<p>// magic defines to avoid calling context APIs in afxstate.cpp<br />
#define AfxActivateActCtxWrapper AfxActivateActCtxWrapperVC10<br />
#define ActivateActCtx(hActCtx, lpCookie) (pfnActivateActCtx != 0 ? pfnActivateActCtx(hActCtx, lpCookie) : FALSE)<br />
#define DeactivateActCtx(dwFlags, ulCookie) (pfnDeactivateActCtx != 0 ? pfnDeactivateActCtx(dwFlags, ulCookie) : FALSE)<br />
#define CreateActCtxW(pActCtx) (pfnCreateActCtxW != 0 ? pfnCreateActCtxW(pActCtx) : INVALID_HANDLE_VALUE)<br />
#define ReleaseActCtx(hActCtx) if(pfnReleaseActCtx != 0) { pfnReleaseActCtx(hActCtx); }</p>
<p>#include "..\src\mfc\afxstate.cpp"<br />
</code></p>
<p>14) Build your application.<br />
15) Copy GDIplus.dll to your debug and/or release folder (where your EXE was built).  You can get gdiplus for Windows 2000 from here:<br />
<a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyId=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&amp;displaylang=en">http://www.microsoft.com/downloads/en/details.aspx?FamilyId=6A63AB9C-DF12-4D41-933C-BE590FEAA05A&amp;displaylang=en</a><br />
16) head over to a Windows 2000 machine (or VM) and copy your debug/release folder over there, and try running the app.  If all steps above were performed correctly, you now have your first MFC 2010 app running on Windows 2000.  </p>
<p>It was quite satisfying to see that Visual C++ 2010 application come up for the first time on Windows 2000.</p>
<p>Note: for Win32 (non-MFC) apps follow the same directions, except you only need to keep the code in the asm relating to EncodePointer/DecodePointer, and don&#8217;t worry about the code in the stdafx.cpp.  Also you&#8217;ll need to manually change the C runtime library to the non-DLL (static) versions in the project properties (this step was done for us automatically when changing MFC from shared DLL to static)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/tedwvc.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/tedwvc.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/tedwvc.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/tedwvc.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/tedwvc.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/tedwvc.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/tedwvc.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/tedwvc.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/tedwvc.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/tedwvc.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/tedwvc.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/tedwvc.wordpress.com/47/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/tedwvc.wordpress.com/47/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/tedwvc.wordpress.com/47/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=tedwvc.wordpress.com&amp;blog=8952849&amp;post=47&amp;subd=tedwvc&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://tedwvc.wordpress.com/2010/11/07/how-to-get-visual-c-2010-mfc-applications-to-run-on-windows-2000/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/f9edde9a9be311917c16c14b4394c415?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">tedwvc</media:title>
		</media:content>
	</item>
	</channel>
</rss>
