diff options
author | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-05-04 13:18:09 +0400 |
---|---|---|
committer | XhmikosR <xhmikosr@users.sourceforge.net> | 2013-05-07 19:37:43 +0400 |
commit | da78edbb2f15fc75ca6e5182bed9dcbebafad1f0 (patch) | |
tree | dddedc20e3d79e0e3ae24b923a09c951dfa5faac | |
parent | 3aa41222e0644958622aad076f6c3f909b09a7e0 (diff) |
Add a workaround for the VS2012 Update2 bug on XP.
See here for details about the bug:
http://tedwvc.wordpress.com/2013/04/14/how-to-get-visual-c-2012-update-2-statically-linked-applications-to-run-on-windows-xp/
-rw-r--r-- | src/DSUtil/DSUtil.vcxproj | 10 | ||||
-rw-r--r-- | src/DSUtil/DSUtil.vcxproj.filters | 19 | ||||
-rw-r--r-- | src/thirdparty/xpsupportvc11upd2/Readme.txt | 6 | ||||
-rw-r--r-- | src/thirdparty/xpsupportvc11upd2/xpatl.cpp | 56 | ||||
-rw-r--r-- | src/thirdparty/xpsupportvc11upd2/xpatlwrap.asm | 38 | ||||
-rw-r--r-- | src/thirdparty/xpsupportvc11upd2/xpatlwrap64.asm | 33 |
6 files changed, 162 insertions, 0 deletions
diff --git a/src/DSUtil/DSUtil.vcxproj b/src/DSUtil/DSUtil.vcxproj index 156ae0dc1..241bc35ef 100644 --- a/src/DSUtil/DSUtil.vcxproj +++ b/src/DSUtil/DSUtil.vcxproj @@ -48,6 +48,7 @@ </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
</ImportGroup>
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
@@ -110,6 +111,7 @@ </Lib>
</ItemDefinitionGroup>
<ItemGroup>
+ <ClCompile Include="..\thirdparty\xpsupportvc11upd2\xpatl.cpp" />
<ClCompile Include="AudioParser.cpp" />
<ClCompile Include="deinterlace.cpp" />
<ClCompile Include="DSMPropertyBag.cpp" />
@@ -160,7 +162,15 @@ <Project>{0d252872-7542-4232-8d02-53f9182aee15}</Project>
</ProjectReference>
</ItemGroup>
+ <ItemGroup>
+ <MASM Include="..\thirdparty\xpsupportvc11upd2\xpatlwrap.asm" />
+ <MASM Include="..\thirdparty\xpsupportvc11upd2\xpatlwrap64.asm" />
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="..\thirdparty\xpsupportvc11upd2\Readme.txt" />
+ </ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
+ <Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
</ImportGroup>
</Project>
\ No newline at end of file diff --git a/src/DSUtil/DSUtil.vcxproj.filters b/src/DSUtil/DSUtil.vcxproj.filters index c774ab8ec..5ec8f8419 100644 --- a/src/DSUtil/DSUtil.vcxproj.filters +++ b/src/DSUtil/DSUtil.vcxproj.filters @@ -9,6 +9,9 @@ <UniqueIdentifier>{2b09c18b-87fc-47da-a366-3e14c0b9d40f}</UniqueIdentifier>
<Extensions>h;hpp;hxx;hm;inl;inc</Extensions>
</Filter>
+ <Filter Include="VS2012u2-fix">
+ <UniqueIdentifier>{e36bc2f5-e726-4b84-813a-8e871c7a01bc}</UniqueIdentifier>
+ </Filter>
</ItemGroup>
<ItemGroup>
<ClCompile Include="deinterlace.cpp">
@@ -65,6 +68,9 @@ <ClCompile Include="FileVersionInfo.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="..\thirdparty\xpsupportvc11upd2\xpatl.cpp">
+ <Filter>VS2012u2-fix</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="DSMPropertyBag.h">
@@ -128,4 +134,17 @@ <Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
+ <ItemGroup>
+ <MASM Include="..\thirdparty\xpsupportvc11upd2\xpatlwrap.asm">
+ <Filter>VS2012u2-fix</Filter>
+ </MASM>
+ <MASM Include="..\thirdparty\xpsupportvc11upd2\xpatlwrap64.asm">
+ <Filter>VS2012u2-fix</Filter>
+ </MASM>
+ </ItemGroup>
+ <ItemGroup>
+ <Text Include="..\thirdparty\xpsupportvc11upd2\Readme.txt">
+ <Filter>VS2012u2-fix</Filter>
+ </Text>
+ </ItemGroup>
</Project>
\ No newline at end of file diff --git a/src/thirdparty/xpsupportvc11upd2/Readme.txt b/src/thirdparty/xpsupportvc11upd2/Readme.txt new file mode 100644 index 000000000..0d0328940 --- /dev/null +++ b/src/thirdparty/xpsupportvc11upd2/Readme.txt @@ -0,0 +1,6 @@ +Fix for Bug in Update2 for VS2012 which causes apps built with this to fail on XP. +Uninstalling Update2 is unfortunately not an option since it removes +ATL completely, and not even a complete reinstall of VS2012 fixes this. + +Taken from: +http://tedwvc.wordpress.com/2013/04/14/how-to-get-visual-c-2012-update-2-statically-linked-applications-to-run-on-windows-xp/ diff --git a/src/thirdparty/xpsupportvc11upd2/xpatl.cpp b/src/thirdparty/xpsupportvc11upd2/xpatl.cpp new file mode 100644 index 000000000..489de93d9 --- /dev/null +++ b/src/thirdparty/xpsupportvc11upd2/xpatl.cpp @@ -0,0 +1,56 @@ +/* Copyright (c) 2013 Mike Ryan + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software +and associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + + +// XPSupport ATL Wrappers (for VC2012 Update 2) +// Written by Mike Ryan (aka Ted.) +// http://tedwvc.wordpress.com + +// 2013-04-14 1.00 initial release to wrap InitializeCriticalSectionEx +// 2013-04-15 1.01 added x64 asm file (no change to CPP file) +// 2013-04-17 1.02 cleaned up Vista check (was triggering RTCs) + +#include "stdafx.h" + +// ATL stuff + +bool Is_VistaOrLater() { + DWORD version = ::GetVersion(); + DWORD major = (DWORD) (LOBYTE(LOWORD(version))); + + return (major >= 6); +} + +typedef BOOL (WINAPI *pInitializeCriticalSectionEx)(__out LPCRITICAL_SECTION lpCriticalSection, __in DWORD dwSpinCount, __in DWORD Flags); + +extern "C" BOOL WINAPI VC11Update2InitializeCriticalSectionEx(__out LPCRITICAL_SECTION lpCriticalSection, __in DWORD dwSpinCount, __in DWORD Flags) +{ + static pInitializeCriticalSectionEx InitializeCriticalSectionEx_p = NULL; + + if (Is_VistaOrLater()) { // Vista or higher + if (!InitializeCriticalSectionEx_p) { + HMODULE mod = GetModuleHandle( _T("kernel32.dll")); + if (mod) { + InitializeCriticalSectionEx_p = (pInitializeCriticalSectionEx) GetProcAddress(mod, "InitializeCriticalSectionEx"); + } + } + return InitializeCriticalSectionEx_p(lpCriticalSection, dwSpinCount, Flags); + } + + // on XP we'll use InitializeCriticalSectionAndSpinCount + return ::InitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount); +} diff --git a/src/thirdparty/xpsupportvc11upd2/xpatlwrap.asm b/src/thirdparty/xpsupportvc11upd2/xpatlwrap.asm new file mode 100644 index 000000000..883e77252 --- /dev/null +++ b/src/thirdparty/xpsupportvc11upd2/xpatlwrap.asm @@ -0,0 +1,38 @@ +;Copyright (c) 2013 Mike Ryan + +;Permission is hereby granted, free of charge, to any person obtaining a copy of this software +;and associated documentation files (the "Software"), to deal in the Software without restriction, +;including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +;and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +;subject to the following conditions: + +;The above copyright notice and this permission notice shall be included in all copies or substantial +;portions of the Software. + +;THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +;LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +;IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +;OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__ML_64 = OPATTR rax + +IF __ML_64 +ELSE + +.model flat, C + + +VC11Update2InitializeCriticalSectionEx PROTO STDCALL :DWORD,:DWORD,:DWORD + +.data + + __imp__InitializeCriticalSectionEx@12 dd VC11Update2InitializeCriticalSectionEx + + EXTERNDEF __imp__InitializeCriticalSectionEx@12 : DWORD + +.code + +ENDIF + +end diff --git a/src/thirdparty/xpsupportvc11upd2/xpatlwrap64.asm b/src/thirdparty/xpsupportvc11upd2/xpatlwrap64.asm new file mode 100644 index 000000000..2f8a57cea --- /dev/null +++ b/src/thirdparty/xpsupportvc11upd2/xpatlwrap64.asm @@ -0,0 +1,33 @@ +;Copyright (c) 2013 Mike Ryan + +;Permission is hereby granted, free of charge, to any person obtaining a copy of this software +;and associated documentation files (the "Software"), to deal in the Software without restriction, +;including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +;and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +;subject to the following conditions: + +;The above copyright notice and this permission notice shall be included in all copies or substantial +;portions of the Software. + +;THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT +;LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +;IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +;WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +;OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +__ML_64 = OPATTR rax + +IF __ML_64 + +VC11Update2InitializeCriticalSectionEx PROTO :QWORD,:DWORD,:DWORD + +.data + __imp_InitializeCriticalSectionEx dq VC11Update2InitializeCriticalSectionEx + + EXTERNDEF __imp_InitializeCriticalSectionEx : DWORD + +.code + +ENDIF + +end |