Lua Alien - Defined variables in the Win32 API WaitForSingleObject function
lua, lua-alien, winapi
Solution
The thought crossed my mind to just open a C++ application and print out these values, so I did just that:
#include <windows.h>
#include <process.h>
#include <iostream>
int main()
{
std::cout << INFINITE;
std::cout << WAIT_OBJECT_0;
std::cout << WAIT_ABANDONED;
std::cout << WAIT_TIMEOUT;
std::cout << WAIT_FAILED;
system("pause");
return 0;
}
The final Lua results based off my findings is:
local INFINITE = 4294967295
local WAIT_OBJECT_0 = 0
local WAIT_ABANDONED = 128
local WAIT_TIMEOUT = 258
local WAIT_FAILED = 4294967295
Problem
I am using Alien for Lua to reference the WaitForSingleObject function in the Windows Kernel32.dll. I am pretty new to Windows programming, so the question I have is about the following #defined variables referenced by the WaitForSingleObject documentation: If dwMilliseconds is INFINITE, the function will return only when the object is signaled. What is the INFINITE value? I would naturally assume it to be `-1`, but I cannot find this to be documented anywhere. Also, with the following table, it mentions the return values in hexadecimal, but I am confused as to why they have an `L` character after the last digit. Could this be something as simple as casting it to a Long? The reason I ask is because Lua uses a Number data type, so I am not sure if I should be checking for this return value via Hex digits (0-F) or decimal digits (0-9)?