In the description to GetStdHandle:
But there is nothing in there that says anything about GetLastError.If the function fails, the return value is INVALID_HANDLE_VALUE. To get extended error information, call GetLastError.
If an application does not have associated standard handles, such as a service running on an interactive desktop, and has not redirected them, the return value is NULL.
In fact GetLastError returns null for me:
Code: Select all
fHandle := DllCall("GetStdHandle", "int", -10, "ptr")
Msgbox fHandle " " A_LastError ;add % for v1 its the same result
Code: Select all
aResultToken.SetExitResult(g_script.ThrowWin32Exception(GetLastError()));
Im not sure how that results in a different error message than yours on my PC though.