tukangusil7 Posted March 28, 2018 Share Posted March 28, 2018 Consider the following C struct as an example: typedef struct _KEY_VIRTUALIZATION_INFORMATION { ULONG VirtualizationCandidate :1; ULONG VirtualizationEnabled :1; ULONG VirtualTarget :1; ULONG VirtualStore :1; ULONG VirtualSource :1; ULONG Reserved :27; } KEY_VIRTUALIZATION_INFORMATION, *PKEY_VIRTUALIZATION_INFORMATION; What is the AutoIt equivalent to the above C struct? I create the following template to things easier for answerers. $tagKEY_VIRTUALIZATION_INFORMATION = "ULONG VirtualizationCandidate;" & _ "ULONG VirtualizationEnabled;" & _ "ULONG VirtualTarget;" & _ "ULONG VirtualStore;" & _ "ULONG VirtualSource;" & _ "ULONG Reserved" $tKEY_VIRTUALIZATION_INFORMATION = DllStructCreate($tagKEY_VIRTUALIZATION_INFORMATION) Thanks in advance. Link to comment Share on other sites More sharing options...
tukangusil7 Posted March 28, 2018 Author Share Posted March 28, 2018 How to edit this post? There is a trivial typo in that post. I'm a newbie in this forum. Link to comment Share on other sites More sharing options...
Earthshine Posted March 28, 2018 Share Posted March 28, 2018 you may not be able to edit yet because your post count is very low. it looks good, I am sure one of the experts will be along with your answer. My resources are limited. You must ask the right questions Link to comment Share on other sites More sharing options...
Bilgus Posted March 28, 2018 Share Posted March 28, 2018 (edited) I don't think there is a direct way to do that in autoit but it is a 32-bit data struct no matter what the function it is passed to treats it as so DllStructCreate("ULONG") would work DllStructCreate("USHORT;USHORT") or even DllStructCreate("BYTE;BYTE;BYTE;BYTE") whatever you pass it to isn't going to care but for you the first will probably be the easiest since to set or retrieve the data it has to be done as a chunk Local $bVirtualizationCandidate, $bVirtualizationEnabled, $bVirtualSource Local $aBits = [1,2,4,8,16] Local $tData = DllStructCreate("ULONG") Somecallthat_changes($tData) $iVal = DllStructGetData($tData, 1) If BitAnd($iVal, $aBits[0]) Then $bVirtualizationCandidate = True If BitAnd($iVal, $aBits[1]) Then $bVirtualizationEnabled = True If BitAnd($iVal, $aBits[4]) Then $bVirtualSource = True ConsoleWrite("$bVirtualizationCandidate = " & ($bVirtualizationCandidate ? "True" : "False") & _ " $bVirtualizationEnabled = " & ($bVirtualizationEnabled ? "True" : "False") & _ " $bVirtualSource = " & ($bVirtualSource ? "True" : "False") &@CRLF) Func SomeCallthat_changes(Byref $tD) Local $iVal = BitOR($aBits[0],$aBits[4]) DllStructsetData($tD, 1, $iVal) EndFunc You don't necessarily need $aBits[] but it makes it easier to grok Also pay attention to the Endian Edited March 28, 2018 by Bilgus tukangusil7 1 Link to comment Share on other sites More sharing options...
tukangusil7 Posted March 29, 2018 Author Share Posted March 29, 2018 Bilgus, thank you very much. I believe your're correct. I will try it. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now