ffi.cdef[[
typedef struct _STARTUPINFOA {
uint32_t cb;
void* lpReserved;
void* lpDesktop;
void* lpTitle;
uint32_t dwX;
uint32_t dwY;
uint32_t dwXSize;
uint32_t dwYSize;
uint32_t dwXCountChars;
uint32_t dwYCountChars;
uint32_t dwFillAttribute;
uint32_t dwFlags;
uint16_t wShowWindow;
uint16_t cbReserved2;
void* lpReserved2;
void** hStdInput;
void** hStdOutput;
void** hStdError;
} STARTUPINFOA, *LPSTARTUPINFOA;
typedef struct _PROCESS_INFORMATION {
void** hProcess;
void** hThread;
uint32_t dwProcessId;
uint32_t dwThreadId;
} PROCESS_INFORMATION, *LPPROCESS_INFORMATION;
uint32_t CreateProcessA(void*, const char* commandLine, void*, void*, uint32_t, uint32_t, void*, const char* currentDirectory, LPSTARTUPINFOA, LPPROCESS_INFORMATION);
uint32_t CloseHandle(void**);
]]
local startupinfo = ffi.new("STARTUPINFOA")
startupinfo.cb = ffi.sizeof(startupinfo)
local process_info = ffi.new("PROCESS_INFORMATION")
local process = ffi.C.CreateProcessA(nil, "path", nil, nil, 0, 0, nil, nil, startupinfo, process_info) ~= 0
if process then
ffi.C.CloseHandle(process_info.hProcess)
ffi.C.CloseHandle(process_info.hThread)
end