1
// TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2012 - TortoiseSVN
5 // This program is free software; you can redistribute it and/or
6 // modify it under the terms of the GNU General Public License
7 // as published by the Free Software Foundation; either version 2
8 // of the License, or (at your option) any later version.
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 // GNU General Public License for more details.
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software Foundation,
17 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 // functions copied from atlbase.h: those functions got removed
23 // removed functions: AtlGetShellVersion, AtlGetDllVersion
26 inline HRESULT
GetDllVersion(
27 _In_ HINSTANCE hInstDLL
,
28 _Out_ DLLVERSIONINFO
* pDllVersionInfo
)
30 ATLENSURE(pDllVersionInfo
);
32 // We must get this function explicitly because some DLLs don't implement it.
33 auto pfnDllGetVersion
= static_cast<DLLGETVERSIONPROC
>(::GetProcAddress(hInstDLL
, "DllGetVersion"));
35 if (!pfnDllGetVersion
)
38 return (*pfnDllGetVersion
)(pDllVersionInfo
);
41 inline HRESULT
GetDllVersion(
42 _In_z_ LPCTSTR lpstrDllName
,
43 _Out_ DLLVERSIONINFO
* pDllVersionInfo
)
45 CAutoLibrary hInstDLL
= ::LoadLibrary(lpstrDllName
);
47 return AtlHresultFromLastError();
48 HRESULT hRet
= GetDllVersion(hInstDLL
, pDllVersionInfo
);
53 // WinNT 4.0 maj=4 min=00
54 // IE 3.x, IE 4.0 without Web Integrated Desktop maj=4 min=00
55 // IE 4.0 with Web Integrated Desktop maj=4 min=71
56 // IE 4.01 with Web Integrated Desktop maj=4 min=72
57 // Win2000 maj=5 min=00
58 inline HRESULT
GetShellVersion(
59 _Out_ LPDWORD pdwMajor
,
60 _Out_ LPDWORD pdwMinor
)
62 ATLENSURE(pdwMajor
&& pdwMinor
);
64 DLLVERSIONINFO dvi
= { 0 };
65 dvi
.cbSize
= sizeof(dvi
);
66 HRESULT hRet
= GetDllVersion(L
"shell32.dll", &dvi
);
70 *pdwMajor
= dvi
.dwMajorVersion
;
71 *pdwMinor
= dvi
.dwMinorVersion
;