示例#1
0
bool findFile( const std::string& moduleName, const std::string& fileName, std::string& filePath )
{
	std::string modulePath( moduleName );
	OS::convertDotsToDirSeps( modulePath );
	return OS::searchFile3( getPaths(),
				Range<const std::string>( &modulePath, 1 ),
				Range<const std::string>( &fileName, 1 ),
				filePath );
}
示例#2
0
void DirectoryModuleLoader::resolve(QFile& file, const std::string& module)
{
    QString modulePath(module.c_str());
    if (!_prefix.empty()) {
        if (!modulePath.startsWith(_prefix.c_str())) {
            return;
        }
        modulePath = modulePath.mid(_prefix.length());
    }
    file.setFileName(_root.filePath(modulePath + ".lua"));
}
std::string getBootstrap()
{
	std::string modulePath(BrowserManager::Instance()->GetModulePath());
	std::string parentPath(modulePath.substr(0,
			modulePath.find_last_of('/') + 1));
#ifdef _WIN32	
	return parentPath + "/cef-bootstrap.exe";
#else
	return parentPath + "/cef-bootstrap";
#endif
}
static bool MinidumpCallback(const wchar_t *minidump_folder, const wchar_t *minidump_id, void *context, EXCEPTION_POINTERS*, MDRawAssertionInfo*, bool) {
	ExceptionManager* this_ptr = reinterpret_cast<ExceptionManager*>(context);
	report_info("Detected crash...");

	std::string minidump_path = utf8::cvt<std::string>(minidump_folder) + "\\" + utf8::cvt<std::string>(minidump_id) + ".dmp";
	if (minidump_path.length() >= MAX_PATH) {
		report_error("Path to long");
		return false;
	}
	if (!boost::filesystem::is_regular(minidump_path)) {
		report_error("Failed to create mini dump please check that you have a proper version of dbghlp.dll");
		return false;
	}

	std::string path = modulePath() + "\\reporter.exe";
	if (path.length() >= MAX_PATH) {
		report_error("Path to long");
		return false;
	}

	if (!boost::filesystem::is_regular(path)) {
		report_error("Failed to find reporter.exe");
		return false;
	}
	if (this_ptr->is_archive()) {
		run_command(this_ptr, path, "archive", minidump_path, this_ptr->target());
	}
	if (this_ptr->is_send()) {
		if (this_ptr->is_send_ui())
			run_command(this_ptr, path, "send-gui", minidump_path, this_ptr->target());
		else
			run_command(this_ptr, path, "send", minidump_path, this_ptr->target());
	}

#ifdef WIN32
	if (this_ptr->is_restart()) {
		std::vector<std::string> commands;
		try {
			if (!serviceControll::isStarted(utf8::cvt<std::wstring>(this_ptr->service()))) {
				report_error("Service not started, not restarting...");
				return true;
			}
		} catch (...) {
			report_error("Failed to check service state");
		}
		commands.push_back(path);
		commands.push_back("restart");
		commands.push_back(this_ptr->service());
		run_proc(build_commandline(commands));
	}
#endif
	return true;
}
示例#5
0
    void *
    LoadModule(LLDBServices *services, const char *moduleName)
    {
        std::string modulePath(g_coreclrDirectory);
        modulePath.append(moduleName);

        void *moduleHandle = dlopen(modulePath.c_str(), RTLD_NOW);
        if (moduleHandle == NULL)
        {
            services->Output(DEBUG_OUTPUT_ERROR, "dlopen(%s) failed %s\n", modulePath.c_str(), dlerror());
        }

        return moduleHandle;
    }
示例#6
0
文件: FileIO.cpp 项目: jjf28/Chkdraft
bool GetModuleDirectory(std::string &outModuleDirectory)
{
    char cModulePath[MAX_PATH] = {};
    if ( GetModuleFileName(NULL, cModulePath, MAX_PATH) != MAX_PATH )
    {
        std::string modulePath(cModulePath);
        auto lastBackslashPos = modulePath.find_last_of('\\');
        if ( lastBackslashPos != std::string::npos && lastBackslashPos < modulePath.size() )
        {
            outModuleDirectory = modulePath.substr(0, lastBackslashPos);
            return true;
        }
    }
    return false;
}
CString
CArchPluginWindows::getModuleDir()
{
	TCHAR c_modulePath[MAX_PATH];
	if (GetModuleFileName(NULL, c_modulePath, MAX_PATH) == 0) {
		throw XArch(new XArchEvalWindows);
	}

	CString modulePath(c_modulePath);
	size_t lastSlash = modulePath.find_last_of("\\");

	if (lastSlash != CString::npos) {
		return modulePath.substr(0, lastSlash);
	}

	throw XArch("could not get module path.");
}
bool LiveBrowserMgrWin::IsChromeWindow(HWND hwnd)
{
    if( !hwnd ) {
        return false;
    }

    //Find the path that opened this window
    DWORD processId = 0;
    ::GetWindowThreadProcessId(hwnd, &processId);

    HANDLE processHandle = ::OpenProcess( PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, processId);
    if( !processHandle ) { 
        return false;
    }

    DWORD modulePathBufSize = _MAX_PATH+1;
    WCHAR modulePathBuf[_MAX_PATH+1];
    DWORD modulePathSize = ::GetModuleFileNameEx(processHandle, NULL, modulePathBuf, modulePathBufSize );
    ::CloseHandle(processHandle);
    processHandle = NULL;

    std::wstring modulePath(modulePathBuf, modulePathSize);

    //See if this path is the same as what we want to launch
    std::wstring appPath = GetPathToLiveBrowser();

    if( !ConvertToShortPathName(modulePath) || !ConvertToShortPathName(appPath) ) {
        return false;
    }

    if(0 != _wcsicmp(appPath.c_str(), modulePath.c_str()) ){
        return false;
    }

    //looks good
    return true;
}