]> gitweb.factorcode.org Git - factor.git/blob - vm/main-windows.cpp
VM: attempt to cancel blocking system calls when ctrl-c is pressed
[factor.git] / vm / main-windows.cpp
1 #include "master.hpp"
2
3 VM_C_API int wmain(int argc, wchar_t** argv) {
4   HANDLE proc = GetCurrentProcess();
5   HANDLE thread = GetCurrentThread();
6   BOOL res = DuplicateHandle(proc, thread, proc,
7                              &factor::boot_thread, GENERIC_ALL, FALSE, 0);
8   if (!res) {
9     factor::fatal_error("DuplicateHandle() failed", GetLastError());
10     return 1;
11   }
12   factor::init_globals();
13   factor::start_standalone_factor(argc, argv);
14   return 0;
15 }
16
17 int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
18                    LPSTR lpCmdLine, int nCmdShow) {
19   int argc;
20   wchar_t** argv = CommandLineToArgvW(GetCommandLine(), &argc);
21   wmain(argc, argv);
22
23   return 0;
24 }