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
!= NULL
);
32 // We must get this function explicitly because some DLLs don't implement it.
33 DLLGETVERSIONPROC pfnDllGetVersion
= (DLLGETVERSIONPROC
)::GetProcAddress(hInstDLL
, "DllGetVersion");
35 if(pfnDllGetVersion
== NULL
)
40 return (*pfnDllGetVersion
)(pDllVersionInfo
);
43 inline HRESULT
GetDllVersion(
44 _In_z_ LPCTSTR lpstrDllName
,
45 _Out_ DLLVERSIONINFO
* pDllVersionInfo
)
47 HINSTANCE hInstDLL
= ::LoadLibrary(lpstrDllName
);
50 return AtlHresultFromLastError();
52 HRESULT hRet
= GetDllVersion(hInstDLL
, pDllVersionInfo
);
53 ::FreeLibrary(hInstDLL
);
58 // WinNT 4.0 maj=4 min=00
59 // IE 3.x, IE 4.0 without Web Integrated Desktop maj=4 min=00
60 // IE 4.0 with Web Integrated Desktop maj=4 min=71
61 // IE 4.01 with Web Integrated Desktop maj=4 min=72
62 // Win2000 maj=5 min=00
63 inline HRESULT
GetShellVersion(
64 _Out_ LPDWORD pdwMajor
,
65 _Out_ LPDWORD pdwMinor
)
67 ATLENSURE(( pdwMajor
!= NULL
) && ( pdwMinor
!= NULL
));
70 memset(&dvi
, 0, sizeof(dvi
));
71 dvi
.cbSize
= sizeof(dvi
);
72 HRESULT hRet
= GetDllVersion(_T("shell32.dll"), &dvi
);
76 *pdwMajor
= dvi
.dwMajorVersion
;
77 *pdwMinor
= dvi
.dwMinorVersion
;