35 #define WIN32_LEAN_AND_MEAN
36 #define _WIN32_WINNT 0x0501
43 dll_loader_load(
char *name,
char *arg)
49 handle = LoadLibrary(name);
52 debug_printf(
"dll_loader_load: loading failed: %d\n", GetLastError());
57 p = GetProcAddress(handle,
"autostart_processes");
59 debug_printf(
"dll_loader_load: could not find symbol 'autostart_processes'\n");
64 debug_printf(
"Starting '%s'\n", (**(
struct process ***)&p)->name);
71 dll_loader_unload(
void *addr)
74 QueueUserAPC((PAPCFUNC)dll_loader_unload_dsc, GetCurrentThread(), (ULONG_PTR)addr);
78 dll_loader_load_dsc(
char *name)
84 handle = LoadLibrary(name);
87 debug_printf(
"dll_loader_load_dsc: loading failed: %d\n", GetLastError());
92 *strchr(symbol,
'.') =
'_';
94 d = GetProcAddress(handle, symbol);
96 debug_printf(
"dll_loader_load_dsc: could not find symbol '%s'\n", symbol);
100 return *(
struct dsc **)&d;
104 dll_loader_unload_dsc(
void *addr)
108 GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS |
109 GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT, addr, &handle);
#define LOADER_OK
No error.
#define NULL
The null pointer.
#define LOADER_ERR_READ
Read error.
The DSC program description structure.
#define LOADER_ERR_OPEN
Could not open file.
void process_start(struct process *p, process_data_t data)
Start a process.