All pastes #329087 Raw Edit

Untitled

public text v1 · immutable
#329087 ·published 2007-01-26 11:55 UTC
rendered paste body
static gpointer
w32_find_symbol (gpointer module, const gchar *symbol_name)
{
	HMODULE *modules;
	HMODULE *main_module;
	DWORD buffer_size = sizeof (HMODULE) * 1024;
	DWORD needed, i;
	gpointer proc = NULL;

        /* HACK: re-check whether the main module should be searched for symbols */

	main_module = GetModuleHandle (NULL);

	/* get the symbol directly from the specified module */
	if (module != main_module)
		return GetProcAddress (module, symbol_name);

	/* get the symbol from the main module */
	proc = GetProcAddress (main_module, symbol_name);
	if (proc != NULL)
		return proc;

....