Add more argument checks to RegisterWaitForSingleObject