If you return a non-zero value from your test function, the program will stop.
#include <windows.h>
int main(int argc, char* argv[])
{
MessageBox(NULL, TEXT("Main Function"),
TEXT("main"), 0);
return 0;
}
int StartupFn(void)
{
MessageBox(NULL, TEXT("Startup Function"),
TEXT("StartupFn"), 0);
return 0; // Change to 1 to terminate the program
}
int ShutdownFn(void)
{
MessageBox(NULL, TEXT("Shutdown Function"),
TEXT("ShutdownFn"), 0);
return 0;
}
typedef int FnPtr(void);
#pragma data_seg(".CRT$XIU")
static FnPtr *autostart[] = { StartupFn };
#pragma data_seg(".CRT$XPU")
static FnPtr *autoexit[] = { ShutdownFn };
#pragma data_seg()