HRESULT CInProcPlugHole::Shutdown() { // Presumably we only receive this once from one of the threads? // No we actually seem to get it from each, but only the first will be // acted upon. TRACE("%#x: Shutdown(%s)\n", GetCurrentThreadId(), GetImagePath()); IIPDolphinPtr piPeer; { ObjectLock lock(this); piPeer = GetPeerForCurrentThread(); if (piPeer != NULL) ReleasePeer(); else { TRACE("%#x: CInProcPlugHole(%s)::Shutdown() thread %#x: No peer available\n", GetCurrentThreadId(), GetImagePath()); return 0; } } _ASSERTE(piPeer != NULL); HRESULT hr = piPeer->OnShutdown(); TRACE("%#x: Shutdown() peer shutdown request returned %#x\n", GetCurrentThreadId(), hr); piPeer.Release(); DWORD dwExitCode = WaitForPeerToTerminate(); return dwExitCode * -1; }
CAssetPath CAsset_MapLayerTiles::GetValue(int ValueType, int PathInt, CAssetPath DefaultValue) const { switch(ValueType) { TU_ASSET_GET_FUNC_IMPL_VARIABLE(CAssetPath, IMAGEPATH, GetImagePath()); } TU_ASSET_GET_FUNC_IMPL_DEFAULT(CAssetPath) }
HRESULT CInProcPlugHole::CanUnloadNow() { TRACE("%#x: CanUnloadNow(%s) thread %#x\n", GetCurrentThreadId(), GetImagePath()); IIPDolphinPtr piPeer = GetPeerNoWait(); if (piPeer == NULL) { TRACE("%#x: CInProcPlugHole(%s)::CanUnloadNow() No peer available\n", GetCurrentThreadId(), GetImagePath()); return S_OK; } HRESULT hr = piPeer->CanUnloadNow(); TRACE("%#x: CanUnloadNow() request returned %d\n", GetCurrentThreadId(), hr); return hr; }
HRESULT CInProcPlugHole::GetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv) { TRACE("%#x: GetClassObject(%s) thread %#x\n", GetCurrentThreadId(), GetImagePath()); IIPDolphinPtr piPeer; HRESULT hr = GetPeer(&piPeer, rclsid); if (FAILED(hr)) { trace("%#x: CInProcPlugHole(%s)::GetClassObject() thread %#x: No peer available\n", GetCurrentThreadId(), GetImagePath()); return hr; } hr = piPeer->GetClassObject(rclsid, riid, ppv); TRACE("%#x: GetClassObject() request returned %d\n", GetCurrentThreadId(), hr); return hr; }
STDMETHODIMP CInProcPlugHole::put_Peer(/*IIPDolphin*/IUnknown* piPeer) { TRACE("%#x: CInProcPlugHole(%s)::put_Peer(%#x)\n", GetCurrentThreadId(), GetImagePath(), piPeer); ObjectLock lock(this); ReleasePeer(); HRESULT hr = S_OK; if (piPeer) { hr = ::CoMarshalInterThreadInterfaceInStream(__uuidof(IIPDolphin), piPeer, &m_piMarshalledPeer); // Signal the event to stop the wait loop, WHETHER OR NOT // peer interface is correct. SetEvent(m_hPeerAvailable); } return hr; }
//--------------------------------------------------------------------------------------- void Paths::log_paths() { LOMSE_LOG_INFO(to_std_string(wxString::Format("LENMUS_INSTALL_ROOT = [%s]", LENMUS_INSTALL_ROOT ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("SrcRoot = %s", GetSrcRootPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Bin = %s", GetBinPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Xrc = %s", GetXrcPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Temp = %s", GetTemporaryPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Img = %s", GetImagePath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Cursors = %s", GetCursorsPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Sounds = %s", GetSoundsPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Locale = %s", GetLocaleRootPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Scores = %s", GetScoresPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("TestScores = %s", GetTestScoresPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Samples = %s", GetSamplesPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Templates = %s", GetTemplatesPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Config = %s", GetConfigPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Log = %s", GetLogPath().wx_str() ))); LOMSE_LOG_INFO(to_std_string(wxString::Format("Fonts = %s\n", GetFontsPath().wx_str() ))); //DBG: For debugging code for home folder assignment -------------------------- #if (LENMUS_PLATFORM_UNIX == 1) char* homedir = getenv("HOME"); if (homedir == NULL) { struct passwd* pw = getpwuid(getuid()); homedir = pw->pw_dir; } string sHomedir(homedir); wxString sHome = to_wx_string(sHomedir); LOMSE_LOG_INFO(to_std_string(wxString::Format("homedir = %s", sHome.wx_str() ))); wxFileName oLogsHome; oLogsHome.AssignDir( sHome ); LOMSE_LOG_INFO(to_std_string(wxString::Format("initial oLogsHome = %s", oLogsHome.GetFullPath().wx_str() ))); oLogsHome.AppendDir(".config"); oLogsHome.AppendDir("lenmus"); LOMSE_LOG_INFO(to_std_string(wxString::Format("final oLogsHome = %s", oLogsHome.GetFullPath().wx_str() ))); //END_DBG ----------------------------------------------------------------------- #endif }
//--------------------------------------------------------------------------------------- string Paths::dump_paths() { stringstream s; s << "SrcRoot = " << to_std_string(GetSrcRootPath()) << endl; s << "Bin = " << to_std_string(GetBinPath()) << endl; s << "Xrc = " << to_std_string(GetXrcPath()) << endl; s << "Temp = " << to_std_string(GetTemporaryPath()) << endl; s << "Img = " << to_std_string(GetImagePath()) << endl; s << "Cursors = " << to_std_string(GetCursorsPath()) << endl; s << "Sounds = " << to_std_string(GetSoundsPath()) << endl; s << "Locale = " << to_std_string(GetLocaleRootPath()) << endl; s << "Scores = " << to_std_string(GetScoresPath()) << endl; s << "TestScores = " << to_std_string(GetTestScoresPath()) << endl; s << "Samples = " << to_std_string(GetSamplesPath()) << endl; s << "Templates = " << to_std_string(GetTemplatesPath()) << endl; s << "Config = " << to_std_string(GetConfigPath()) << endl; s << "Log = " << to_std_string(GetLogPath()) << endl; s << "Fonts = " << to_std_string(GetFontsPath()) << endl; return s.str(); }
HRESULT CInProcPlugHole::UnregisterServer() { TRACE("%#x: UnregisterServer(%s)\n", GetCurrentThreadId(), GetImagePath()); // Only attempt to unregister the image classes if bound to the stub if (m_pImageData == NULL) return S_OK; IIPDolphinPtr piPeer; HRESULT hr = GetPeer(&piPeer); if (FAILED(hr)) { trace("%#x: CInProcPlugHole(%s)::UnregisterServer() No peer available\n", GetCurrentThreadId(), GetImagePath()); return hr; } hr = piPeer->UnregisterServer(); TRACE("%#x: UnregisterServer() request returned %#x\n", GetCurrentThreadId(), hr); return hr; }
CInProcPlugHole::~CInProcPlugHole() { TRACE("%#x: ~CInProcPlugHole(%s)\n", GetCurrentThreadId(), GetImagePath()); ReleasePeer(); ::CloseHandle(m_hPeerAvailable); }
const std::string& GNC::GCS::IStudyContext::GetPathActiveImage() { return GetImagePath(ActiveFileIndex); }
HBITMAP GetImageHandle(CString &img) { CString appPath=GetImagePath(); appPath+=img; return GXLoadFile(appPath); }