| 1 |
/* Hey EMACS -*- win32-c -*- */ |
| 2 |
/* $Id$ */ |
| 3 |
|
| 4 |
/* libticables2 - link cable library, a part of the TiLP project |
| 5 |
* Copyright (C) 1999-2005 Romain Lievin |
| 6 |
* |
| 7 |
* This program is free software; you can redistribute it and/or modify |
| 8 |
* it under the terms of the GNU General Public License as published by |
| 9 |
* the Free Software Foundation; either version 2 of the License, or |
| 10 |
* (at your option) any later version. |
| 11 |
* |
| 12 |
* This program is distributed in the hope that it will be useful, |
| 13 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 |
* GNU General Public License for more details. |
| 16 |
* |
| 17 |
* You should have received a copy of the GNU General Public License |
| 18 |
* along with this program; if not, write to the Free Software Foundation, |
| 19 |
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 20 |
*/ |
| 21 |
|
| 22 |
/* Win32 probing module */ |
| 23 |
|
| 24 |
#include <windows.h> |
| 25 |
|
| 26 |
#include "../error.h" |
| 27 |
#include "../logging.h" |
| 28 |
#include "detect.h" |
| 29 |
|
| 30 |
#include "../win32/dha.h" |
| 31 |
#include "../win64/rwp.h" |
| 32 |
|
| 33 |
#include "../win32/usb.h" |
| 34 |
|
| 35 |
#ifdef __MINGW32__ |
| 36 |
#include "../win32/dha.c" |
| 37 |
#include "../win64/rwp.c" |
| 38 |
#endif |
| 39 |
|
| 40 |
// Note: the kernel version of XP x64 is 5.2, like Windows 2003, not 5.1 as |
| 41 |
// Windows XP 32-Bit. |
| 42 |
|
| 43 |
int win32_check_os(void) |
| 44 |
{ |
| 45 |
OSVERSIONINFO os; |
| 46 |
SYSTEM_INFO si; |
| 47 |
|
| 48 |
GetSystemInfo(&si); // should use GetNativeSystemInfo(&si); & si.wProcessorArchitecture but MSVC too old |
| 49 |
if(si.dwProcessorType > 586) |
| 50 |
return WIN_64; |
| 51 |
|
| 52 |
memset(&os, 0, sizeof(OSVERSIONINFO)); |
| 53 |
os.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); |
| 54 |
GetVersionEx(&os); |
| 55 |
|
| 56 |
if (os.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS) |
| 57 |
return WIN_9X; |
| 58 |
else if (os.dwPlatformId == VER_PLATFORM_WIN32_NT) |
| 59 |
return WIN_NT; |
| 60 |
else |
| 61 |
return WIN_NT; |
| 62 |
|
| 63 |
return 0; |
| 64 |
} |
| 65 |
|
| 66 |
int win32_check_dha(void) |
| 67 |
{ |
| 68 |
#ifndef _WIN64 |
| 69 |
int result = 0; |
| 70 |
|
| 71 |
dha_detect(&result); |
| 72 |
|
| 73 |
return result ? 0 : ERR_DHA_NOT_FOUND; |
| 74 |
#else |
| 75 |
return 0; |
| 76 |
#endif |
| 77 |
} |
| 78 |
|
| 79 |
int win32_check_rwp(void) |
| 80 |
{ |
| 81 |
#ifdef _WIN64 |
| 82 |
int result = 0; |
| 83 |
|
| 84 |
rwp_detect(&result); |
| 85 |
|
| 86 |
return result ? 0: ERR_RWP_NOT_FOUND; |
| 87 |
#else |
| 88 |
return 0; |
| 89 |
#endif |
| 90 |
} |
| 91 |
|
| 92 |
int win32_check_libusb(void) |
| 93 |
{ |
| 94 |
if(usb_get_version() != NULL) |
| 95 |
return 0; |
| 96 |
else |
| 97 |
return ERR_LIBUSBWIN32_NOT_PRESENT; |
| 98 |
} |