Supporto per nuova dll sicurezza

git-svn-id: svn://10.65.10.50/branches/R_10_00@22731 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
guy 2012-09-18 12:46:25 +00:00
parent e1a988050f
commit 8e2a048d2d
3 changed files with 1526 additions and 1472 deletions

View File

@ -668,8 +668,42 @@ static BOOL CALLBACK EnumCampoMenuChildrenProc(HWND hwnd, LPARAM lParam)
return TRUE; // Continua a cercare return TRUE; // Continua a cercare
} }
#include <psapi.h>
#include <tlhelp32.h>
unsigned int OsWin32_FindMenuContainer() unsigned int OsWin32_FindMenuContainer()
{ {
wxString strApp;
wxFileName::SplitPath(wxTheApp->argv[0], NULL, &strApp, NULL);
strApp.MakeLower();
if (strApp == "ba0" || strApp == "ba1" || strApp == "ba7")
return 0; // Special programs that can't be hosted by ba0
const DWORD pid = ::GetCurrentProcessId();
HANDLE h = ::CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
PROCESSENTRY32 pe = { 0 }; pe.dwSize = sizeof(PROCESSENTRY32);
DWORD ppid = 0;
for(BOOL ok = ::Process32First(h, &pe); ok; ok = ::Process32Next(h, &pe))
{
if (pe.th32ProcessID == pid)
{
ppid = pe.th32ParentProcessID;
break;
}
}
::CloseHandle(h);
char strParentPath[_MAX_PATH] = "";
HMODULE m = (HMODULE)::OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, ppid);
::GetModuleFileNameEx(m, 0, strParentPath, sizeof(strParentPath) - 1);
::CloseHandle(m);
wxFileName::SplitPath(strParentPath, NULL, &strApp, NULL);
strApp.MakeLower();
if (strApp != "ba0")
return 0; // Parent process is not ba0
TFindWindowInfo w; TFindWindowInfo w;
w._file = "__CAMPO_HOST_WINDOW__"; w._file = "__CAMPO_HOST_WINDOW__";
::EnumWindows(EnumCampoMenuChildrenProc, LPARAM(&w)); ::EnumWindows(EnumCampoMenuChildrenProc, LPARAM(&w));

View File

@ -25,6 +25,27 @@ static const char* xvt_dongle_sa_id()
return id; return id;
} }
static const char* xvt_dongle_sa_product()
{
static const char* product = NULL;
if (product == NULL)
{
const char* const products[] = { "CAMPO", "Campo", "campo", NULL };
for (int i = 0; products[i]; i++)
{
if (SSA_Login(xvt_dongle_sa_id(), products[i]) == 0)
{
product = products[i];
break;
}
}
if (product == NULL)
product = products[0];
}
return product;
}
static BOOLEAN xvt_dongle_sa_is_remote_ba0() static BOOLEAN xvt_dongle_sa_is_remote_ba0()
{ {
BOOLEAN yes = FALSE; BOOLEAN yes = FALSE;
@ -76,11 +97,10 @@ int xvt_dongle_sa_login(const char* module)
{ {
if (_ssa_serial < 0) if (_ssa_serial < 0)
{ {
err = SSA_Login(xvt_dongle_sa_id(), "Campo"); err = SSA_Login(xvt_dongle_sa_id(), xvt_dongle_sa_product());
if (err == 0) if (err == 0)
{ {
err = _ssa_serial = SSA_NumeroSerie("Campo"); err = _ssa_serial = SSA_NumeroSerie(xvt_dongle_sa_product());
if (_ssa_timer == NULL && xvt_dongle_sa_is_remote_ba0()) if (_ssa_timer == NULL && xvt_dongle_sa_is_remote_ba0())
_ssa_timer = new TSSA_Pinger; _ssa_timer = new TSSA_Pinger;
} }
@ -131,7 +151,7 @@ int xvt_dongle_sa_logout(const char* module)
} }
else else
{ {
err = SSA_Logout(xvt_dongle_sa_id(), "Campo"); err = SSA_Logout(xvt_dongle_sa_id(), xvt_dongle_sa_product());
if (err == 0) if (err == 0)
{ {
_ssa_serial = SSA_UTENTE_NON_LOGGATO; _ssa_serial = SSA_UTENTE_NON_LOGGATO;