36 #define WIN32_LEAN_AND_MEAN
37 #define _WIN32_WINNT 0x0501
44 dll_loader_load(
char *name,
char *arg)
50 handle = LoadLibrary(name);
53 debug_printf(
"dll_loader_load: loading failed: %d\n", GetLastError());
58 p = GetProcAddress(handle,
"autostart_processes");
60 debug_printf(
"dll_loader_load: could not find symbol 'autostart_processes'\n");
65 debug_printf(
"Starting '%s'\n", (**(
struct process ***)&p)->name);
72 dll_loader_unload(
void *addr)
75 QueueUserAPC((PAPCFUNC)dll_loader_unload_dsc, GetCurrentThread(), (ULONG_PTR)addr);
79 dll_loader_load_dsc(
char *name)
85 handle = LoadLibrary(name);
88 debug_printf(
"dll_loader_load_dsc: loading failed: %d\n", GetLastError());
93 *strchr(symbol,
'.') =
'_';
95 d = GetProcAddress(handle, symbol);
97 debug_printf(
"dll_loader_load_dsc: could not find symbol '%s'\n", symbol);
101 return *(
struct dsc **)&d;
105 dll_loader_unload_dsc(
void *addr)
109 GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
110 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, addr, &handle);