Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/trunk@15912 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2007-12-18 16:15:06 +00:00
parent b9a3a8c10e
commit 46473e871f

View File

@ -105,7 +105,7 @@ protected:
//metodi di interfaccia con Windows
bool CreateIcon(unsigned int csidl, const wxFileName& strExeFile, const wxString& strLinkName) const;
bool CreateAutostartMode(const int iSrvAutostartMode, const wxString& strPath);
bool CreateAutostartMode(const LurchMode iSrvAutostartMode, const wxString& strPath);
void AssociateExtension(const wxFileName& strExeFile, const wxString strExt);
//metodi di interfaccia con il registry di Windows
@ -223,29 +223,30 @@ void CampoSetup::AssociateExtension(const wxFileName& strExeFile, const wxString
WriteRootRegistryKey(wxT("Campo\\shell\\open\\command"), str);
}
bool CampoSetup::CreateAutostartMode(const int iSrvAutostartMode, const wxString& strPath)
bool CampoSetup::CreateAutostartMode(const LurchMode iSrvAutostartMode, const wxString& strPath)
{
//creazione dei filenames e dei path necessari in giro per la funzione
//filename (con path quindi) di Lurch.exe
wxFileName strExe(strPath, wxT("lurch.exe"));
strExe.AppendDir("servers");
//stringa path della cartella Servers in base alle scelte dell'utente
const wxString strSrvPath = strPath + "\\servers";
const wxString strSrvPath = strExe.GetPath();
//Eliminatore di precedenti servers installati come servizi
//cerca se non esiste per caso gia' da una precedente installazione..
//..non serve piu' a un cazzo ma si e' tenuto come prova in debug di lettura del registry!
wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application");
//elimina un eventuale servizio precedente (senno' col cavolo che lo riesce a modificare!)
//utilizza il programma instsrv.exe dentro la cartella servers installata
wxString strRemove = strSrvPath + "\\instsrv Lurch REMOVE";
const long lRemove = wxExecute(strRemove, wxEXEC_SYNC);
switch (iSrvAutostartMode)
{
//esecuzione server come servizi (magia!)
case 0:
case lm_service:
{
//cerca se non esiste per caso gia' da una precedente installazione..
//..non serve piu' a un cazzo ma si e' tenuto come prova in debug di lettura del registry!
wxString strValue = ReadLocalMachineRegistryKey("SYSTEM\\CurrentControlSet\\Services\\Lurch\\Parameters\\Application");
//elimina un eventuale servizio precedente (senno' col cavolo che lo riesce a modificare!)
//utilizza il programma instsrv.exe dentro la cartella servers installata
wxString strRemove = strSrvPath + "\\instsrv Lurch REMOVE";
const long lRemove = wxExecute(strRemove, wxEXEC_SYNC);
//aggiunge la voce ai servizi di windows (dentro strumenti di amministrazione)
//utilizza i programmi instrv.exe e srvany.exe dentro la cartella servers installata
wxString strCreateService = strSrvPath + "\\instsrv Lurch ";
@ -270,7 +271,7 @@ bool CampoSetup::CreateAutostartMode(const int iSrvAutostartMode, const wxString
}
break;
//link nella cartella esecuzione automatica
case 1:
case lm_autostart:
{
CreateIcon(CSIDL_COMMON_STARTUP, strExe, "lurch");
}
@ -295,16 +296,31 @@ bool CampoSetup::CreateIcon(unsigned int csidl, const wxFileName& strExeFile, co
IShellLink* psl;
HRESULT hres = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER, IID_IShellLink, (void**)&psl);
if (SUCCEEDED(hres))
{
IPersistFile* ppf;
{
// Set the path to the shortcut target and add the description.
psl->SetPath(strExeFile.GetFullPath());
psl->SetWorkingDirectory(strExeFile.GetPath());
psl->SetDescription(APPNAME);
psl->SetDescription(APPNAME);
//sceglie l'icona da quelle possibili legate al .exe in base al tipo di installazione
const InstallationType uInstallationType = m_pWizard->GetInstallationType();
if (uInstallationType == it_server || uInstallationType == it_client)
{
wxString strPath = m_pWizard->GetPrgLocPath();
strPath += "/res/";
switch (uInstallationType)
{
case it_server: strPath += "CampoSrv.ico"; break;
case it_client: strPath += "CampoCln.ico"; break;
default: strPath += "Campo.ico"; break;
}
psl->SetIconLocation(strPath, 0);
}
// Query IShellLink for the IPersistFile interface for saving the
// shortcut in persistent storage.
// shortcut in persistent storage.
IPersistFile* ppf;
hres = psl->QueryInterface(IID_IPersistFile, (void**)&ppf);
if (SUCCEEDED(hres))
@ -1005,7 +1021,7 @@ void CampoSetup::NormalSetup()
//------------------------------------------------
//solo se sta installando campo in postazione server e deve installare un gestore di servizi..
//..avvia la procedura della creazione dell'autostart(un casino)
const int iSrvAutostartMode = m_pWizard->GetSrvAutostartMode();
const LurchMode iSrvAutostartMode = m_pWizard->GetSrvAutostartMode();
if (iSrvAutostartMode != lm_none)
{
CreateAutostartMode(iSrvAutostartMode, strPrgLocPath);
@ -1116,28 +1132,6 @@ void CampoSetup::OnTimer(wxTimerEvent& WXUNUSED(e))
}
wxFileName strPath(argv[0]);
/*
//panegirico all'apparenza inutile ma in realta' decisivo per reperire i veri path assoluti dove funzionano...
//..setup, ba0, ba1. NON cancellare!!!
wxString strIni = "../install.ini";
wxFileName strPath;
if (wxFileName::FileExists(strIni))
{
strPath = "setup";
}
else
{
strIni.insert(0, "../");
if (wxFileName::FileExists(strIni))
strPath = ".";
else
{
m_pMainFrame->Destroy();
return;
}
}
*/
strPath.MakeAbsolute();
strPath.SetCwd();
//path del programma setup.exe in esecuzione; serve in seguito in quanto alcuni metodi (tipo la GetAllFiles)..