예제 #1
0
/* static */
BOOL
wxDbgHelpDLL::CallEnumerateLoadedModules(HANDLE handle,
                                         wxPENUMLOADED_MODULES_CALLBACK callback,
                                         PVOID callbackParam)
{
#ifdef UNICODE
    if ( EnumerateLoadedModulesW64 )
    {
#ifdef wxHAS_NON_CONST_MODULE_NAME
        // We need to pass by a bridge just to convert non-const module name to
        // the const one taken by our callback.
        wxEnumLoadedCallbackBridge br(callback, callbackParam);
        if ( EnumerateLoadedModulesW64(handle, &wxEnumLoadedW64Callback, &br) )
            return TRUE;
#else // new SDK
        // We can use our callback directly.
        if ( EnumerateLoadedModulesW64(handle, callback, callbackParam) )
            return TRUE;
#endif // old/new SDK
    }
#endif // UNICODE

    if ( EnumerateLoadedModules64 )
    {
        // We need a bridge if we need to convert to Unicode or if we're using
        // an older SDK with a non-const first argument, so just use it always
        // to avoid having too many complicated preprocessor checks.
        wxEnumLoadedCallbackBridge br(callback, callbackParam);
        if ( EnumerateLoadedModules64(handle, &wxEnumLoaded64Callback, &br) )
            return TRUE;
    }

    if ( EnumerateLoadedModules )
    {
        // With this function we need a bridge in any case because the type of
        // module base argument used by EnumerateLoadedModules() differs from
        // that used by EnumerateLoadedModules[W]64().
        wxEnumLoadedCallbackBridge br(callback, callbackParam);
        if ( EnumerateLoadedModules(handle, &wxEnumLoadedCallback, &br) )
            return TRUE;
    }

    return FALSE;
}
예제 #2
0
static void fetch_modules_info(struct dump_context* dc)
{
    EnumerateLoadedModulesW64(dc->hProcess, fetch_pe_module_info_cb, dc);
    /* Since we include ELF modules in a separate stream from the regular PE ones,
     * we can always include those ELF modules (they don't eat lots of space)
     * And it's always a good idea to have a trace of the loaded ELF modules for
     * a given application in a post mortem debugging condition.
     */
    elf_enum_modules(dc->hProcess, fetch_elf_module_info_cb, dc);
    macho_enum_modules(dc->hProcess, fetch_macho_module_info_cb, dc);
}
예제 #3
0
BOOL  WINAPI EnumerateLoadedModules(HANDLE hProcess,
                                    PENUMLOADED_MODULES_CALLBACK EnumLoadedModulesCallback,
                                    PVOID UserContext)
{
    struct enum_load_modW64_32  x;

    x.cb = EnumLoadedModulesCallback;
    x.user = UserContext;

    return EnumerateLoadedModulesW64(hProcess, enum_load_modW64_32, &x);
}
예제 #4
0
	std::set<wxString, wxStringOrdinalComparator> ProcessManager::GetModulesForProcessIdInternalV2(int processID, DWORD& resultCode)
	{
		unique_handle process(OpenProcess(PROCESS_ALL_ACCESS, false, processID));
		resultCode = ERROR_SUCCESS;
		if (process.get() == NULL)
		{
			resultCode = GetLastError();
			return set<wxString, wxStringOrdinalComparator>();
		}
		unique_ptr<set<wxString, wxStringOrdinalComparator>> result = unique_ptr<set<wxString, wxStringOrdinalComparator>>(
			new set<wxString, wxStringOrdinalComparator>);
		//result->push_back(L"DUMMY");
		EnumerateLoadedModulesW64(process.get(), (PENUMLOADED_MODULES_CALLBACKW64)EnumerateLoadedModulesProc64ProcManager, result.get());
		return *result;
	}