1 |
/* OpenPGP Smart Card Mini Driver |
2 |
Copyright (C) 2009 Vincent Le Toux |
3 |
|
4 |
This library is Free software; you can redistribute it and/or |
5 |
modify it under the terms of the GNU Lesser General Public |
6 |
License version 2.1 as published by the Free Software Foundation. |
7 |
|
8 |
This library is distributed in the hope that it will be useful, |
9 |
but WITHOUT ANY WARRANTY; without even the implied warranty of |
10 |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
11 |
Lesser General Public License for more details. |
12 |
|
13 |
You should have received a copy of the GNU Lesser General Public |
14 |
License along with this library; if not, write to the Free Software |
15 |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
16 |
*/ |
17 |
|
18 |
#include <windows.h> |
19 |
|
20 |
BOOL fRunOnVistaAndLater; |
21 |
|
22 |
BOOL Is_Vista_or_Later () |
23 |
{ |
24 |
OSVERSIONINFOEX osvi; |
25 |
DWORDLONG dwlConditionMask = 0; |
26 |
int op=VER_GREATER_EQUAL; |
27 |
|
28 |
// Initialize the OSVERSIONINFOEX structure. |
29 |
|
30 |
ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); |
31 |
osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); |
32 |
osvi.dwMajorVersion = 6; |
33 |
|
34 |
// Initialize the condition mask. |
35 |
VER_SET_CONDITION( dwlConditionMask, VER_MAJORVERSION, op ); |
36 |
|
37 |
// Perform the test. |
38 |
return VerifyVersionInfo( |
39 |
&osvi, |
40 |
VER_MAJORVERSION, |
41 |
dwlConditionMask); |
42 |
} |
43 |
|
44 |
/** This function provides handling for load/unload and attach/detach notifications |
45 |
to allow the DLL to manage its state and allocated resources. For more information, |
46 |
see DllMain Callback Function on MSDN®. |
47 |
|
48 |
return TRUE on DLL_PROCESS_ATTACH if initialization of the DLL was successful; |
49 |
otherwise, FALSE. Value ignored at other times by caller. */ |
50 |
BOOL WINAPI DllMain(HINSTANCE hinstDLL, |
51 |
DWORD dwReason, |
52 |
LPVOID lpReserved) |
53 |
{ |
54 |
// Perform actions based on the reason for calling. |
55 |
if (dwReason == DLL_PROCESS_ATTACH) |
56 |
{ |
57 |
fRunOnVistaAndLater = Is_Vista_or_Later(); |
58 |
return TRUE; |
59 |
} |
60 |
else |
61 |
{ |
62 |
return FALSE; |
63 |
} |
64 |
} |