From a52978c51e1f54e5795213a4aaa8dc737de62be1 Mon Sep 17 00:00:00 2001 From: guy Date: Tue, 9 Feb 2010 10:16:51 +0000 Subject: [PATCH] Patch level : 10.0 Files correlati : authoriz.exe, lurch.exe Ricompilazione Demo : [ ] Commento : Aggiunto supporto per vecchie chiavi Hardlock in Win 2003, Vista, 2008, 7 git-svn-id: svn://10.65.10.50/trunk@20086 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- server/authoriz.cpp | 7 ++-- server/baseserv.cpp | 31 +++++++++++++++- server/baseserv.h | 3 ++ server/fastapi.h | 90 ++++++++++++++++++++++++++++++++++----------- server/hlapi_c.h | 5 ++- server/lurch.cpp | 13 ++++--- 6 files changed, 117 insertions(+), 32 deletions(-) diff --git a/server/authoriz.cpp b/server/authoriz.cpp index a9b43fdf0..61158bcc5 100755 --- a/server/authoriz.cpp +++ b/server/authoriz.cpp @@ -935,7 +935,7 @@ void TAuthorizationServer::ProcessCommand(wxString cmd, wxSocketBase& outs) bool TAuthorizationServer::Initialization() { -#ifdef WIN32 +#ifdef __WXMSW__ // Add global atom if not already present if (::GlobalFindAtom(ATOMIC_SEMAPHORE) == NULL) ::GlobalAddAtom(ATOMIC_SEMAPHORE); // Same as old Frontend.exe @@ -946,9 +946,10 @@ bool TAuthorizationServer::Initialization() if (m_MaxTries < 8) m_MaxTries = 8; - for (int i = 0; i < 3; i++) + const bool bTestAll = GetOemInt("OEM") == 0; + for (unsigned int i = 0; i < m_MaxTries; i++) { - if (m_Dongle.Login()) + if (m_Dongle.Login(bTestAll)) break; wxSleep(delay); } diff --git a/server/baseserv.cpp b/server/baseserv.cpp index 2d4718ffb..d2b2207ec 100755 --- a/server/baseserv.cpp +++ b/server/baseserv.cpp @@ -526,7 +526,8 @@ void TBaseServerApp::OnSocketEvent(wxSocketEvent& e) case wxSOCKET_LOST: if (m_bLogVerbose) WriteLog("--- Socket lost."); - sock->Destroy(); + if (GetOemInt("OEM") == 0) + sock->Destroy(); break; default: break; @@ -645,6 +646,34 @@ int TBaseServerApp::GetDefaultPort() const return GetConfigInt("Port", 3883); } +wxString TBaseServerApp::GetOemString(const wxChar* key, const wxChar* def) const +{ + static int _oem = -1; + wxString str; +#ifdef __WXMSW__ + if (_oem < 0) + _oem = ::GetPrivateProfileInt("MAIN", "OEM", 0, wxT("../setup/oem.ini")); + if (wxStrcmp(key, "OEM") != 0) + { + wxChar value[512]; memset(value, 0, sizeof(value)); + str.Printf("OEM_%d", _oem); + ::GetPrivateProfileString(str, key, def, value, sizeof(value)-1, wxT("../setup/oem.ini")); + str = value; + } + else + str.Printf("%d", _oem); +#endif + return str; +} + +int TBaseServerApp::GetOemInt(const wxChar* key, int def) const +{ + wxString strDef; + if (def != 0) strDef.Printf("%d", def); + const wxString strVal = GetOemString(key, strDef); + return wxAtoi(strVal); +} + wxString TBaseServerApp::GetLogFileName() const { return GetConfigString("LogFile"); diff --git a/server/baseserv.h b/server/baseserv.h index 1b6b513cc..1fdfce81f 100755 --- a/server/baseserv.h +++ b/server/baseserv.h @@ -113,6 +113,9 @@ protected: virtual void ProcessFormCommand(wxString cmd, wxSocketBase& outs); virtual void ProcessHttpGet(wxString cmd, wxSocketBase& outs); + wxString GetOemString(const wxChar* key, const wxChar* def = wxEmptyString) const; + int GetOemInt(const wxChar* key, int def = 0) const; + public: // Utilities virtual const wxChar* GetAppName() const = 0; diff --git a/server/fastapi.h b/server/fastapi.h index f395ad156..8af877e48 100755 --- a/server/fastapi.h +++ b/server/fastapi.h @@ -11,35 +11,42 @@ /** Revision history **/ /** ---------------- *** $Log: not supported by cvs2svn $ -*** Revision 1.1.2.1 2002/10/16 10:45:22 guy -*** Patch level : 2.0 -*** Files correlati : servers -*** Ricompilazione Demo : [ ] -*** Commento : -*** Creata una camionata di servers +*** Revision 1.52 2003/04/30 12:21:14 chris +*** fix structure packing for Borland *** -*** Revision 1.1.2.1 2002/05/30 13:42:20 guy -*** Patch level : 2.0 nopatch -*** Files correlati : fastapi.h -*** Ricompilazione Demo : [ ] -*** Commento : -*** Sarà d'uopo includere anch'esso, va là! +*** Revision 1.51 2003/02/24 08:00:28 werner +*** Added RUS-Flag: DISABLE_TS_CHECK for Terminal Server detection +*** +*** Revision 1.50 2003/01/30 09:48:13 axel +*** added functions API_GETHLSADDR 108, API_GETHLSTEXT 109 +*** added error NO_LOCAL_FUNCTION 61 +*** +*** Revision 1.49 2002/08/23 10:47:10 axel +*** added API_READ_HLS, API_CALC_HLS and NO_REMOTE_FUNCTION +*** (used for detecting HL-Server Hardlock licenses) +*** +*** Revision 1.48 2002/08/22 16:15:27 alex +*** added define _AKS_QT_APPLICATION_ if you want to compile with Qt, +*** because slots from lic structure is a Qt keyword +*** +*** Revision 1.47 2002/03/18 13:24:34 chris +*** Win64 changes *** *** Revision 1.46 2000/12/19 16:37:41 chris *** detect MacOS X -*** +*** *** Revision 1.45 2000/07/30 22:22:17 chris *** ia64 detection -*** +*** *** Revision 1.44 2000/07/10 09:45:09 chris *** Module2 field -*** +*** *** Revision 1.43 2000/05/25 14:11:43 chris *** added some HASP stuff -*** +*** *** Revision 1.42 2000/03/21 14:18:28 chris *** HL_SIS and HL_LIS structure definitions -*** +*** *** Revision 1.41 2000/02/18 14:04:44 chris *** fixed pascal define for CygWin & MingW32 *** @@ -224,9 +231,15 @@ #endif #endif +#ifdef __BORLANDC__ + #pragma pack(1) +#endif + #if defined(WINNT) || defined(__WIN32__) || defined(_WIN32) - #ifndef __386__ /* Watcom doesnt like it */ - #define __386__ + #if !defined(_WIN64) && !defined(WIN64) + #ifndef __386__ /* Watcom doesnt like it */ + #define __386__ + #endif #endif #ifdef DLL #define CALL_ __stdcall @@ -235,6 +248,15 @@ #endif #endif +#if defined(_WIN64) || defined(WIN64) + #ifndef __64BIT__ + #define __64BIT__ + #endif + #define DATAFAR_ + #define FAR_ + #define pascal __stdcall +#endif + #ifdef DOS386 /* Symantec C */ #define __386__ #pragma pack(2) @@ -325,8 +347,12 @@ /* -------------------------------- */ #ifdef __64BIT__ typedef unsigned int Long; +#if !defined(_WIN64) && !defined(WIN64) typedef unsigned long Int64; #else +typedef unsigned __int64 Int64; /* stupid Windows convention */ +#endif +#else typedef unsigned long Long; #endif #ifndef __BCPLUSPLUS__ @@ -489,7 +515,11 @@ typedef _PACKED struct ALIGN_ { Long num_slots; Word glob_exp_date; Word res2; /* filler to make size multiple of 4 bytes */ +#ifdef __AKS_QT_APPLICATION__ + HL_SIS slot[1]; /* slots is a keyword in Qt application, renamed array */ +#else HL_SIS slots[1]; + #endif } ALIGN_GCC HL_LIS; #ifdef UNIX32 @@ -500,6 +530,10 @@ typedef _PACKED struct ALIGN_ { #pragma pack() #endif +#ifdef __BORLANDC__ + #pragma pack(1) +#endif + #ifdef _MSC_VER #if _MSC_VER >= 900 #pragma pack(pop,_fastapi_h_) @@ -548,9 +582,17 @@ typedef _PACKED struct ALIGN_ { /* -------------- */ /* LM functions : */ /* -------------- */ -#define API_LMINIT 40 /* LM compatible API_INIT replacement */ -#define API_LMPING 41 /* checks if LM dongle and slot is available */ -#define API_LMINFO 42 /* info about currently used LIMA */ +#define API_LMINIT 40 /* LM compatible API_INIT replacement */ +#define API_LMPING 41 /* checks if LM dongle and slot is available */ +#define API_LMINFO 42 /* info about currently used LIMA */ + +#define API_READ_HLS 78 /* get number of licences for USB server HL */ +#define API_CALC_HLS 79 /* calculate num of licenses for parallel server HL */ + + +#define API_GETHLSADDR 108 /* get addr struc of currently used HLS */ +#define API_GETHLSTEXT 109 /* get text addr of currently used HLS */ + /* --------------- */ /* RUS functions : */ @@ -587,6 +629,7 @@ typedef _PACKED struct ALIGN_ { /* RUS flags: */ /* ---------- */ #define FORCE_RUS 1 /* Enable RUS init without VK */ +#define DISABLE_TS_CHECK 2 /* Disable Terminal Server Detection */ #define FORCE_ALF_CREATE 1 /* Force creation of ALF file in HLM_WRITELICENSE */ /* ------------------ */ @@ -642,6 +685,9 @@ typedef _PACKED struct ALIGN_ { #define RUS_INVALID_RTB 39 /* Invalid updated data (RTB) */ #define RUS_RTB_EXPIRED 40 /* Update data (RTB) has expired. */ #define RUS_SERIAL_MISMATCH 41 /* Update data serial does not match */ +#define NO_REMOTE_FUNCTION 60 /* function is available locally only */ +#define NO_LOCAL_FUNCTION 61 /* function is available remotely only */ + #define TOO_MANY_USERS 256 /* Login table full (remote) */ #define SELECT_DOWN 257 /* Printer not On-line */ #define NO_SERIALID 258 /* Serial ID not readable or n/a */ diff --git a/server/hlapi_c.h b/server/hlapi_c.h index 7f5a1b175..a41c5b801 100755 --- a/server/hlapi_c.h +++ b/server/hlapi_c.h @@ -1,4 +1,4 @@ -/* $Id: hlapi_c.h,v 1.2 2002-10-24 10:47:33 alex Exp $ */ +/* $Id: hlapi_c.h,v 1.3 2010-02-09 10:16:51 guy Exp $ */ #include "fastapi.h" @@ -30,6 +30,9 @@ RET_ FAR_ CALL_ HL_VERSION (void); RET_ FAR_ CALL_ HL_HLSVERS (void); RET_ FAR_ CALL_ HL_SELECT (HL_API DATAFAR_ *hl_ptr); RET_ FAR_ CALL_ HL_READID (Word DATAFAR_ *IDLow, Word DATAFAR_ *IDHigh); +RET_ FAR_ CALL_ HL_SERVERLICENSES (Word DATAFAR_ *Value); +RET_ FAR_ CALL_ HL_SERVERADDR (char *text, Long *textsize); + /* ---------------- */ /* Hardlock RUS API */ diff --git a/server/lurch.cpp b/server/lurch.cpp index fcba01b4e..3cbeebd47 100755 --- a/server/lurch.cpp +++ b/server/lurch.cpp @@ -296,10 +296,13 @@ void TLurchServer::GenerateFile(wxString& strFilename) wxString strHost; strHost << wxGetHostName() << wxT(":") << GetDefaultPort(); tr1.AddChild("td").AddEnclosedText(strHost); - TXmlItem& tr2 = panel.AddChild("tr"); - tr2.AddChild("td").AddEnclosedText("Ping Frequency"); - wxString strFreq; strFreq << m_PingTimer.GetInterval()/1000; - tr2.AddChild("td").AddEnclosedText(strFreq); + if (GetOemInt("OEM") == 0) + { + TXmlItem& tr2 = panel.AddChild("tr"); + tr2.AddChild("td").AddEnclosedText("Ping Frequency"); + wxString strFreq; strFreq << m_PingTimer.GetInterval()/1000; + tr2.AddChild("td").AddEnclosedText(strFreq); + } html.Save(strFilename); } @@ -647,7 +650,7 @@ bool TLurchServer::Initialization() { const wxArrayString& arr = GetAutoRunList(); const size_t nAuto = arr.GetCount(); - if (nAuto > 0) + if (nAuto > 0 && GetOemInt("OEM") == 0) { for (size_t i = 0; i < nAuto; i++) StartProcess(arr[i]);