From 0345245e860375a32c9a437c4a9d9cae807134e9 Mon Sep 17 00:00:00 2001 From: Shashank Date: Mon, 29 May 2017 12:40:26 +0530 Subject: CMSCOPE changed --- libs/GetWindowsVersion/GetWindowsVersion.c | 220 +++++++++++++++++++++ libs/GetWindowsVersion/GetWindowsVersion.h | 52 +++++ libs/GetWindowsVersion/GetWindowsVersion.rc | 96 +++++++++ libs/GetWindowsVersion/GetWindowsVersion.vcxproj | 172 ++++++++++++++++ .../GetWindowsVersion.vcxproj.filters | 32 +++ libs/libs.iss | 17 ++ 6 files changed, 589 insertions(+) create mode 100755 libs/GetWindowsVersion/GetWindowsVersion.c create mode 100755 libs/GetWindowsVersion/GetWindowsVersion.h create mode 100755 libs/GetWindowsVersion/GetWindowsVersion.rc create mode 100755 libs/GetWindowsVersion/GetWindowsVersion.vcxproj create mode 100755 libs/GetWindowsVersion/GetWindowsVersion.vcxproj.filters create mode 100755 libs/libs.iss (limited to 'libs') diff --git a/libs/GetWindowsVersion/GetWindowsVersion.c b/libs/GetWindowsVersion/GetWindowsVersion.c new file mode 100755 index 000000000..56fadc67a --- /dev/null +++ b/libs/GetWindowsVersion/GetWindowsVersion.c @@ -0,0 +1,220 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006 - INRIA - Allan CORNET + * Copyright (C) 2011 - DIGITEO - Allan CORNET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +#include "GetWindowsVersion.h" +/*-----------------------------------------------------------------------------------*/ +typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS) (HANDLE, PBOOL); +typedef void (WINAPI *PGNSI)(LPSYSTEM_INFO); +#define SM_SERVERR2 89 +/*-----------------------------------------------------------------------------------*/ +IMPORT_EXPORT_GETWINDOWSVERSION_DLL int GetWindowsVersion(void) +{ + OSVERSIONINFOEX osvi; + BOOL bOsVersionInfoEx; + + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + if ( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) + { + osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); + if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) + { + return OS_ERROR; + } + } + + switch (osvi.dwPlatformId) + { + case VER_PLATFORM_WIN32_NT: + + if (osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 2) + { + if ( osvi.wProductType == VER_NT_WORKSTATION ) + { +#ifdef _WIN64 + return OS_WIN32_WINDOWS_EIGHT_64; +#else + if (IsWow64()) + { + return OS_WIN32_WINDOWS_EIGHT_64; + } + else + { + return OS_WIN32_WINDOWS_EIGHT; + } +#endif + } + else + { +#ifdef _WIN64 + return OS_WIN32_WINDOWS_EIGHT_SERVER_64; +#else + if (IsWow64()) + { + return OS_WIN32_WINDOWS_EIGHT_SERVER_64; + } + else + { + return OS_WIN32_WINDOWS_EIGHT_SERVER; + } +#endif + } + } + + if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 1 ) + { + if ( osvi.wProductType == VER_NT_WORKSTATION ) + { +#ifdef _WIN64 + return OS_WIN32_WINDOWS_SEVEN_64; +#else + if (IsWow64()) + { + return OS_WIN32_WINDOWS_SEVEN_64; + } + else + { + return OS_WIN32_WINDOWS_SEVEN; + } +#endif + } + else + { +#ifdef _WIN64 + return OS_WIN32_WINDOWS_SEVEN_SERVER_64; +#else + if (IsWow64()) + { + return OS_WIN32_WINDOWS_SEVEN_SERVER_64; + } + else + { + return OS_WIN32_WINDOWS_SEVEN_SERVER; + } +#endif + } + } + + if ( osvi.dwMajorVersion == 6 && osvi.dwMinorVersion == 0 ) + { + if ( osvi.wProductType == VER_NT_WORKSTATION ) + { +#ifdef _WIN64 + return OS_WIN32_WINDOWS_VISTA_64; +#else + if (IsWow64()) + { + return OS_WIN32_WINDOWS_VISTA_64; + } + else + { + return OS_WIN32_WINDOWS_VISTA; + } +#endif + } + else + { +#ifdef _WIN64 + return OS_WIN32_WINDOWS_SERVER_2008_64; +#else + if (IsWow64()) + { + return OS_WIN32_WINDOWS_SERVER_2008_64; + } + else + { + return OS_WIN32_WINDOWS_SERVER_2008; + } +#endif + } + } + + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) + { + SYSTEM_INFO si; + PGNSI pGNSI; + pGNSI = (PGNSI) GetProcAddress(GetModuleHandle("kernel32.dll"), "GetNativeSystemInfo"); + if (NULL != pGNSI) + { + pGNSI(&si); + } + + if ( GetSystemMetrics(SM_SERVERR2) ) + { + return OS_WIN32_WINDOWS_SERVER_2003_R2; + } + else if ( osvi.wProductType == VER_NT_WORKSTATION && si.wProcessorArchitecture == PROCESSOR_ARCHITECTURE_AMD64) + { + return OS_WIN32_WINDOWS_XP_64; + } + else + { + return OS_WIN32_WINDOWS_SERVER_2003; + } + } + + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 1 ) + { + return OS_WIN32_WINDOWS_XP; + } + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) + { + return OS_WIN32_WINDOWS_2000; + } + if ( osvi.dwMajorVersion == 4 ) + { + return OS_WIN32_WINDOWS_NT_4_0; + } + if ( osvi.dwMajorVersion == 3 && osvi.dwMinorVersion == 51 ) + { + return OS_WIN32_WINDOWS_NT_3_51; + } + break; + + case VER_PLATFORM_WIN32_WINDOWS: + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 0) + { + return OS_WIN32_WINDOWS_95; + } + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 10) + { + return OS_WIN32_WINDOWS_98; + } + if (osvi.dwMajorVersion == 4 && osvi.dwMinorVersion == 90) + { + return OS_WIN32_WINDOWS_Me; + } + break; + } + return OS_ERROR; +} +/*-----------------------------------------------------------------------------------*/ +BOOL IsWow64(void) +{ + BOOL bIsWow64 = FALSE; + LPFN_ISWOW64PROCESS fnIsWow64Process; + + fnIsWow64Process = (LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle("kernel32"), "IsWow64Process"); + + if (NULL != fnIsWow64Process) + { + if (!fnIsWow64Process(GetCurrentProcess(), &bIsWow64)) + { + + } + } + return bIsWow64; +} +/*-----------------------------------------------------------------------------------*/ + diff --git a/libs/GetWindowsVersion/GetWindowsVersion.h b/libs/GetWindowsVersion/GetWindowsVersion.h new file mode 100755 index 000000000..0cb45bc64 --- /dev/null +++ b/libs/GetWindowsVersion/GetWindowsVersion.h @@ -0,0 +1,52 @@ +/* + * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab + * Copyright (C) 2006 - INRIA - Allan CORNET + * Copyright (C) 2011 - DIGITEO - Allan CORNET + * + * This file must be used under the terms of the CeCILL. + * This source file is licensed as described in the file COPYING, which + * you should have received as part of this distribution. The terms + * are also available at + * http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt + * + */ + +#ifndef __GETWINDOWSVERSION_H__ +#define __GETWINDOWSVERSION_H__ +#include +/*-----------------------------------------------------------------------------------*/ +#ifdef EXPORT_GETWINDOWSVERSION_DLL +#define IMPORT_EXPORT_GETWINDOWSVERSION_DLL __declspec(dllexport) +#else +#define IMPORT_EXPORT_GETWINDOWSVERSION_DLL __declspec(dllimport) +#endif + +#define OS_ERROR -1 +#define OS_WIN32_WINDOWS_NT_3_51 0 +#define OS_WIN32_WINDOWS_NT_4_0 1 +#define OS_WIN32_WINDOWS_95 2 +#define OS_WIN32_WINDOWS_98 3 +#define OS_WIN32_WINDOWS_Me 4 +#define OS_WIN32_WINDOWS_2000 5 +#define OS_WIN32_WINDOWS_XP 6 +#define OS_WIN32_WINDOWS_XP_64 7 +#define OS_WIN32_WINDOWS_SERVER_2003 8 +#define OS_WIN32_WINDOWS_SERVER_2003_R2 9 +#define OS_WIN32_WINDOWS_SERVER_2003_64 10 +#define OS_WIN32_WINDOWS_VISTA 11 +#define OS_WIN32_WINDOWS_VISTA_64 12 +#define OS_WIN32_WINDOWS_SERVER_2008 13 +#define OS_WIN32_WINDOWS_SERVER_2008_64 14 +#define OS_WIN32_WINDOWS_SEVEN 15 +#define OS_WIN32_WINDOWS_SEVEN_64 16 +#define OS_WIN32_WINDOWS_SEVEN_SERVER 17 +#define OS_WIN32_WINDOWS_SEVEN_SERVER_64 18 +#define OS_WIN32_WINDOWS_EIGHT 19 +#define OS_WIN32_WINDOWS_EIGHT_64 20 +#define OS_WIN32_WINDOWS_EIGHT_SERVER 21 +#define OS_WIN32_WINDOWS_EIGHT_SERVER_64 22 +/*-----------------------------------------------------------------------------------*/ +IMPORT_EXPORT_GETWINDOWSVERSION_DLL int GetWindowsVersion(void); +IMPORT_EXPORT_GETWINDOWSVERSION_DLL BOOL IsWow64(void); +/*-----------------------------------------------------------------------------------*/ +#endif /* __GETWINDOWSVERSION_H__ */ diff --git a/libs/GetWindowsVersion/GetWindowsVersion.rc b/libs/GetWindowsVersion/GetWindowsVersion.rc new file mode 100755 index 000000000..1b4957466 --- /dev/null +++ b/libs/GetWindowsVersion/GetWindowsVersion.rc @@ -0,0 +1,96 @@ +// Microsoft Visual C++ generated resource script. +// + + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +//#include "afxres.h" +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// French (France) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_FRA) +#ifdef _WIN32 +LANGUAGE LANG_FRENCH, SUBLANG_FRENCH +#pragma code_page(1252) +#endif //_WIN32 + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 5,5,2,0 + PRODUCTVERSION 5,5,2,0 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040c04b0" + BEGIN + VALUE "FileDescription", "GetWindowsVersion library for Scilab 5.x" + VALUE "FileVersion", "5, 5, 2, 0" + VALUE "InternalName", "GetWindowsVersion library for Scilab 5.x" + VALUE "LegalCopyright", "Copyright (C) 2017" + VALUE "OriginalFilename", "GetWindowsVersion.dll" + VALUE "ProductName", "GetWindowsVersion library for Scilab 5.x" + VALUE "ProductVersion", "5, 5, 2, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x40c, 1200 + END +END + +#endif // French (France) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/libs/GetWindowsVersion/GetWindowsVersion.vcxproj b/libs/GetWindowsVersion/GetWindowsVersion.vcxproj new file mode 100755 index 000000000..4873ffa90 --- /dev/null +++ b/libs/GetWindowsVersion/GetWindowsVersion.vcxproj @@ -0,0 +1,172 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {982BF37F-42C4-4D37-8D14-60521B141503} + GetWindowsVersion + Win32Proj + + + + DynamicLibrary + MultiByte + false + v110 + + + DynamicLibrary + MultiByte + v110 + + + DynamicLibrary + MultiByte + false + v110 + + + DynamicLibrary + MultiByte + v110 + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)bin\ + $(ProjectDir)$(Configuration)\ + false + $(SolutionDir)bin\ + $(ProjectDir)$(Configuration)\ + false + $(SolutionDir)bin\ + $(ProjectDir)$(Configuration)\ + false + $(SolutionDir)bin\ + $(ProjectDir)$(Configuration)\ + false + + + + Disabled + EXPORT_GETWINDOWSVERSION_DLL;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + + + $(SolutionDir)bin\$(ProjectName).dll + true + Windows + $(SolutionDir)bin\$(ProjectName).lib + MachineX86 + true + false + + + + + X64 + + + Disabled + EXPORT_GETWINDOWSVERSION_DLL;%(PreprocessorDefinitions) + MultiThreadedDebugDLL + Level3 + + + $(SolutionDir)bin\$(ProjectName).dll + true + Windows + $(SolutionDir)bin\$(ProjectName).lib + MachineX64 + true + false + + + + + false + EXPORT_GETWINDOWSVERSION_DLL;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + true + + + $(SolutionDir)bin\$(ProjectName).dll + false + Windows + true + true + $(SolutionDir)bin\$(ProjectName).lib + MachineX86 + true + false + + + + + X64 + + + false + EXPORT_GETWINDOWSVERSION_DLL;%(PreprocessorDefinitions) + MultiThreadedDLL + Level3 + true + + + $(SolutionDir)bin\$(ProjectName).dll + false + Windows + true + true + $(SolutionDir)bin\$(ProjectName).lib + MachineX64 + true + false + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/libs/GetWindowsVersion/GetWindowsVersion.vcxproj.filters b/libs/GetWindowsVersion/GetWindowsVersion.vcxproj.filters new file mode 100755 index 000000000..0b2e68c0d --- /dev/null +++ b/libs/GetWindowsVersion/GetWindowsVersion.vcxproj.filters @@ -0,0 +1,32 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav + + + + + Source Files + + + + + Header Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/libs/libs.iss b/libs/libs.iss new file mode 100755 index 000000000..b5ccbaef6 --- /dev/null +++ b/libs/libs.iss @@ -0,0 +1,17 @@ +; +; Scilab ( http://www.scilab.org/ ) - This file is part of Scilab +; Copyright (C) 2008 - DIGITEO - Allan CORNET +; +; This file must be used under the terms of the CeCILL. +; This source file is licensed as described in the file COPYING, which +; you should have received as part of this distribution. The terms +; are also available at +; http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt +; +; +; f2c directory +Source: libs\f2c\f2c.h; DestDir: {app}\libs\f2c; Components: {#COMPN_SCILAB} +; +; intl used by localization +Source: libs\intl\*.h; DestDir: {app}\libs\intl; Components: {#COMPN_SCILAB} +; -- cgit