The problem isn't that it is v1 code, but that it is bad code.
0x0001L*1 would ordinarily produce an empty string on v1, because
0x0001L is not purely numeric and therefore is treated as a variable name, the variable is not defined, and multiplying an empty string by anything will produce an empty string.
For DllCall, it would be the same as passing 0. If tank's code ever worked verbatim, you could just replace
0x0001L*1 with
0.
The constant 0x0001L would probably have been copied from the Windows SDK, a C/C++ header file, or similar. In C, the L suffix denotes a "long integer" (32-bit on Windows). So you could replace
0x0001L*1 with
1.
Multiplying 0 by 0 is obviously unnecessary, so
*0 can be removed.
Edit: You should probably also close the handle.
If the function succeeds, the return value is a handle to the desktop that receives user input. When you are finished using the handle, call the CloseDesktop function to close it.
Code: Select all
CanOpenInputDesktop() {
if !h := DllCall("User32\OpenInputDesktop","int",0,"int",0,"int",1,"ptr")
return false
DllCall("User32\CloseDesktop","ptr",h)
return true
}
Use it like