mirror of
https://github.com/chibicitiberiu/rainmeter-studio.git
synced 2024-02-24 04:33:31 +00:00
NowPlaying: Add workaround for ATL's broken XP support in VS2012 Update 2
https://connect.microsoft.com/VisualStudio/feedback/details/783276/vs2012-2-v110-xp-broken-the-procedure-entry-point-initializecriticalsectionex-could-not-be-located-in-the-dynamic-link-library-kernel32-dll
This commit is contained in:
parent
18d5ee383d
commit
bb823b798e
@ -11,6 +11,7 @@
|
||||
<Import Project="$(SolutionDir)\Rainmeter.props" />
|
||||
<Import Project="$(SolutionDir)\Plugins\Plugins.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.props" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
@ -144,6 +145,7 @@
|
||||
<ClCompile Include="taglib\toolkit\unicode.cpp" />
|
||||
<ClCompile Include="taglib\wavpack\wavpackfile.cpp" />
|
||||
<ClCompile Include="taglib\wavpack\wavpackproperties.cpp" />
|
||||
<ClCompile Include="XPATL.cpp" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Cover.h" />
|
||||
@ -170,7 +172,20 @@
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="PluginNowPlaying.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="XPATLx64.asm">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</ExcludedFromBuild>
|
||||
</MASM>
|
||||
<MASM Include="XPATLx86.asm">
|
||||
<FileType>Document</FileType>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</ExcludedFromBuild>
|
||||
<ExcludedFromBuild Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</ExcludedFromBuild>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
<Import Project="$(VCTargetsPath)\BuildCustomizations\masm.targets" />
|
||||
</ImportGroup>
|
||||
</Project>
|
@ -25,6 +25,9 @@
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{abad9374-731c-48b4-8ae1-45793b348013}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="XPATL">
|
||||
<UniqueIdentifier>{d22781ac-b5c3-48db-b89f-3429215cc8cf}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="SDKs\iTunes\iTunesCOMInterface_i.c">
|
||||
@ -270,6 +273,9 @@
|
||||
<ClCompile Include="Internet.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="XPATL.cpp">
|
||||
<Filter>XPATL</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="SDKs\AIMP\aimp2_sdk.h">
|
||||
@ -338,4 +344,12 @@
|
||||
<Filter>Source Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<MASM Include="XPATLx86.asm">
|
||||
<Filter>XPATL</Filter>
|
||||
</MASM>
|
||||
<MASM Include="XPATLx64.asm">
|
||||
<Filter>XPATL</Filter>
|
||||
</MASM>
|
||||
</ItemGroup>
|
||||
</Project>
|
53
Plugins/PluginNowPlaying/XPATL.cpp
Normal file
53
Plugins/PluginNowPlaying/XPATL.cpp
Normal file
@ -0,0 +1,53 @@
|
||||
/* 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"
|
||||
|
||||
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(L"KERNEL32.DLL");
|
||||
if (mod)
|
||||
InitializeCriticalSectionEx_p = (pInitializeCriticalSectionEx) GetProcAddress(mod, "InitializeCriticalSectionEx");
|
||||
}
|
||||
return InitializeCriticalSectionEx_p(lpCriticalSection, dwSpinCount, Flags);
|
||||
}
|
||||
|
||||
// on XP we'll use InitializeCrticialSectionAndSpinCount
|
||||
return ::InitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount);
|
||||
}
|
34
Plugins/PluginNowPlaying/XPATLx64.asm
Normal file
34
Plugins/PluginNowPlaying/XPATLx64.asm
Normal file
@ -0,0 +1,34 @@
|
||||
;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
|
||||
|
42
Plugins/PluginNowPlaying/XPATLx86.asm
Normal file
42
Plugins/PluginNowPlaying/XPATLx86.asm
Normal file
@ -0,0 +1,42 @@
|
||||
;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
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user