// /// Constructor. Saves the name of the help file and creates the global context /// table. // THelpFileManager::THelpFileManager(const tstring& helpFileName) : #if !defined(NO_HTMLHELP) UseHTMLHelp(false), WinToHTML(true), #endif HelpCursor(0), ContextHelp(false), HelpState(false), LastParent(0) { SetHelpFile(helpFileName); ContextTable = new TContextList; }
BOOL CTortoiseSIProcApp::InitInstance() { CTraceToOutputDebugString::Instance()(_T(__FUNCTION__) _T(": InitInstance()\n")); // Set the visual manage that is used to redraw the application CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows)); // Specifies that the style of the button border corresponds to the current Windows theme CMFCButton::EnableWindowsTheming(); // Initialize Windows GDI+ (must be called before any GDI+ call) Gdiplus::GdiplusStartupInput gdiplusStartupInput; Gdiplus::GdiplusStartup(&m_gdiplusToken, &gdiplusStartupInput, NULL); LoadLanguageDLL(); SetHelpFile(); setlocale(LC_ALL, ""); // TODO: Check that TortoiseSI exists? For now we assume it does // TODO: Check that we have the minimum required version of TortoiseSI InitializeUIComponents(); CWinAppEx::InitInstance(); // Application settings to be stored in registry instead of INI files. // This also sets m_pszRegistryKey SetRegistryKey(_T("TortoiseSIProc")); /* * Create a named mutex to limit application to a single instance. * TODO: Create a randomly named mutex and store the name so that it can only be obtained * by an authorized user to prevent a malicious application from creating the * named mutex before us and purposely preventing our application from running. * Alternatively, create a locked file in the users profile directory. */ CAutoGeneralHandle TGitMutex = ::CreateMutex(NULL, FALSE, _T("TortoiseSIProc.exe")); /* Establish Integrity server connection */ int port = getIntegrationPort(); if (port > 0 && port <= std::numeric_limits<unsigned short>::max()) { EventLog::writeInformation(L"TortoiseSIProcApp connecting to Integrity client via localhost:" + std::to_wstring(port)); m_integritySession = std::unique_ptr<IntegritySession>(new IntegritySession("localhost", port)); } else { EventLog::writeInformation(L"TortoiseSIProcApp connecting to Integrity client via localintegration point"); m_integritySession = std::unique_ptr<IntegritySession>(new IntegritySession()); } m_serverConnectionsCache = std::unique_ptr<ServerConnections>(new ServerConnections(*m_integritySession)); if (!m_serverConnectionsCache->isOnline()) { EventLog::writeInformation(L"TortoiseSIProcApp::InitInstance() bailing out, unable to connected to server"); return FALSE; } if (!ProcessCommandLine()) { return FALSE; } return TRUE; }