From 9f9dc7cea11e1cc9b1766da10eb3f4aabc8b65d1 Mon Sep 17 00:00:00 2001 From: luca Date: Mon, 5 Apr 2004 13:03:51 +0000 Subject: [PATCH] Patch level :2.1 022 Files correlati :xvagadll.dll Ricompilazione Demo : [ ] Commento :aggiunta gestione delle licenze e degli utenti nel caso di Win2000 term server. Aggiunta anche la creazione del campo.ini per ogni utente in questa configurazione. git-svn-id: svn://10.65.10.50/trunk@11934 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- xvaga/oswin32.cpp | 104 +++++++++++++++++++++++++++++++++++++++++++++ xvaga/oswin32.h | 1 + xvaga/xvaga.cpp | 12 ++++-- xvaga/xvt_env.h | 1 + xvaga/xvtextra.cpp | 28 ++++++++---- 5 files changed, 135 insertions(+), 11 deletions(-) diff --git a/xvaga/oswin32.cpp b/xvaga/oswin32.cpp index da152e601..065ce8893 100755 --- a/xvaga/oswin32.cpp +++ b/xvaga/oswin32.cpp @@ -819,3 +819,107 @@ int OsWin32_GetSessionId() return (int) h; } +#define BUFSIZE 80 + +bool OsWin32_IsWindowsServer() +{ + bool server = false; + OSVERSIONINFOEX osvi; + BOOL bOsVersionInfoEx; + + // Try calling GetVersionEx using the OSVERSIONINFOEX structure. + // If that fails, try using the OSVERSIONINFO structure. + + ZeroMemory(&osvi, sizeof(OSVERSIONINFOEX)); + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX); + + if( !(bOsVersionInfoEx = GetVersionEx ((OSVERSIONINFO *) &osvi)) ) + { + osvi.dwOSVersionInfoSize = sizeof (OSVERSIONINFO); + if (! GetVersionEx ( (OSVERSIONINFO *) &osvi) ) + return FALSE; + } + + switch (osvi.dwPlatformId) + { + // Test for the Windows NT product family. + case VER_PLATFORM_WIN32_NT: + + // Test for the specific product family. + if ( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) + server = true; // Microsoft Windows Server 2003 family + + // Test for specific product on Windows NT 4.0 SP6 and later. + if( bOsVersionInfoEx ) + { + const BYTE wProductType = osvi.wReserved[1]& 0xFF; + // Test for the server type. + if ( wProductType == 3 ) // VER_NT_SERVER + { + if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 2 ) + { + /*if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + server = true; // Datacenter Edition + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + server = true; // Enterprise Edition + else if ( osvi.wSuiteMask == VER_SUITE_BLADE ) + server = true; // Web Edition + else + server = true; // Standard Edition*/ + server = true; + } + + else if( osvi.dwMajorVersion == 5 && osvi.dwMinorVersion == 0 ) + { + /*if( osvi.wSuiteMask & VER_SUITE_DATACENTER ) + server = true; // Datacenter Server + else if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + server = true; // Advanced Server + else + server = true; // Server*/ + server = true; + } + + else // Windows NT 4.0 + { + /*if( osvi.wSuiteMask & VER_SUITE_ENTERPRISE ) + server = true; // Server 4.0, Enterprise Edition + else + server = true; // Server 4.0*/ + server = true; + } + } + } + else // Test for specific product on Windows NT 4.0 SP5 and earlier + { + HKEY hKey; + char szProductType[BUFSIZE]; + DWORD dwBufLen=BUFSIZE; + LONG lRet; + + lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, + "SYSTEM\\CurrentControlSet\\Control\\ProductOptions", + 0, KEY_QUERY_VALUE, &hKey ); + if( lRet != ERROR_SUCCESS ) + return FALSE; + + lRet = RegQueryValueEx( hKey, "ProductType", NULL, NULL, + (LPBYTE) szProductType, &dwBufLen); + if( (lRet != ERROR_SUCCESS) || (dwBufLen > BUFSIZE) ) + return FALSE; + + RegCloseKey( hKey ); + + if ( lstrcmpi( "LANMANNT", szProductType) == 0 ) + server = true; // Server + if ( lstrcmpi( "SERVERNT", szProductType) == 0 ) + server = true; // Advanced Server + } + + break; + + default: + break; + } + return server; +} diff --git a/xvaga/oswin32.h b/xvaga/oswin32.h index c02daa013..8a2fb6a44 100755 --- a/xvaga/oswin32.h +++ b/xvaga/oswin32.h @@ -34,6 +34,7 @@ bool OsWin32_SL_WriteBlock(unsigned short reg, unsigned short size, const unsign BOOL OsWin32_SpoolRow(const char* pData, unsigned int cbBytes, unsigned int hPrnDC); int OsWin32_GetSessionId(); +bool OsWin32_IsWindowsServer(); #ifdef SPEECH_API bool OsWin32_InitializeSpeech(); diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index d8a46b90b..297a94b03 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -3915,12 +3915,18 @@ int xvt_sys_get_os_version() int major, minor; switch (::wxGetOsVersion(&major, &minor)) { - case wxGTK: - os = XVT_WS_LINUX_GTK; break; +#ifdef WIN32 case wxWIN95: os = minor == 0 ? XVT_WS_WIN_95 : XVT_WS_WIN_98; break; case wxWINDOWS_NT: - os = XVT_WS_WIN_NT; break; + os = XVT_WS_WIN_NT; + if (OsWin32_IsWindowsServer()) + os = XVT_WS_WIN_SERVER; + break; +#else + case wxGTK: + os = XVT_WS_LINUX_GTK; break; +#endif default: break; } diff --git a/xvaga/xvt_env.h b/xvaga/xvt_env.h index afe88e8b9..f0419b445 100755 --- a/xvaga/xvt_env.h +++ b/xvaga/xvt_env.h @@ -14,6 +14,7 @@ #define XVT_WS_WIN_NT 411 #define XVT_WS_WIN_2000 412 #define XVT_WS_WIN_XP 413 +#define XVT_WS_WIN_SERVER 414 #define ATTR_WIN_BASE 10000 #define ATTR_WIN_CMD_LINE (ATTR_WIN_BASE + 0) diff --git a/xvaga/xvtextra.cpp b/xvaga/xvtextra.cpp index 2fe32b788..7b9f56ea7 100755 --- a/xvaga/xvtextra.cpp +++ b/xvaga/xvtextra.cpp @@ -781,20 +781,32 @@ const char* xvt_fsys_get_campo_ini() xvt_fsys_convert_dir_to_str(&dir, exedir, sizeof(exedir)); #ifdef WIN32 if (xvt_fsys_is_network_drive(exedir)) - { bFound = xvt_fsys_get_campo_stp_value("CampoIni", path, sizeof(path)); - if (!bFound) + + if (!bFound) + { +/* const char* pp = getenv("PREFPATH"); + if (pp != NULL) { - const char* pp = getenv("PREFPATH"); - if (pp != NULL) + char dri[_MAX_DRIVE], dir[_MAX_PATH]; + xvt_fsys_parse_pathname(pp, dri, dir, NULL, NULL, NULL); + xvt_fsys_build_pathname(path, dri, dir, "campo", "ini", NULL); + bFound = TRUE; + }*/ + if (xvt_sys_get_os_version() == XVT_WS_WIN_SERVER) + { + xvt_fsys_build_pathname(path, NULL, wxGetHomeDir(), "campo", "ini", NULL); + bFound = xvt_fsys_file_exists(path); + if (!bFound) { - char dri[_MAX_DRIVE], dir[_MAX_PATH]; - xvt_fsys_parse_pathname(pp, dri, dir, NULL, NULL, NULL); - xvt_fsys_build_pathname(path, dri, dir, "campo", "ini", NULL); - bFound = TRUE; + char pathstd[_MAX_PATH]; + xvt_fsys_build_pathname(pathstd, NULL, exedir, "campo", "ini", NULL); + if (xvt_fsys_file_exists(pathstd)) + wxCopyFile(pathstd, path); } } } + if (!bFound) xvt_fsys_build_pathname(path, NULL, exedir, "campo", "ini", NULL); #else