DllCall - diff between "Ptr" &var and "Ptr*" var
Posted: 12 Aug 2014, 12:25
According to the documentation on DllCall, Ptr* passes _an address_ [of the string buffer] of the variable instead of the 'contents' of the variable. If that's the case then why those two calls produce different results? The type of the second argument is PVOID.
Code: Select all
SystemInformationClass := 16
VarSetCapacity(SystemInformation, SystemInformationLength := 0x100000)
VarSetCapacity(ReturnLength, 4)
status := DllCall("ntdll.dll\NtQuerySystemInformation"
, "UInt", SystemInformationClass
;, "Ptr", &SystemInformation ; works
, "Ptr*", SystemInformation ; fails
, "UInt", SystemInformationLength
, "UInt*", ReturnLength
, "Int")
SetFormat, IntegerFast, Hex
status &= 0xFFFFFFFF, status .= ""
setformat, IntegerFast, Dec
MsgBox % status ; 0xC0000005