powerbass4

WINAPI GetLogicalProcessorInformation

12 posts in this topic

Hi, I need the help of some "C++ Pros" of you....

The "WINAPI GetLogicalProcessorInformation" function does not exists in the AutoIt Includes, so I decided to build it on my own ....no success so far.
I adapted easy functions, but this one seems to be odd and unfamiliar.

I hope somebody can help me.... and after that this function should be added to the Includes (WinAPISys.au3).

 

BOOL WINAPI GetLogicalProcessorInformation(
  _Out_   PSYSTEM_LOGICAL_PROCESSOR_INFORMATION Buffer,
  _Inout_ PDWORD                                ReturnLength
);

https://msdn.microsoft.com/en-us/library/windows/desktop/ms683194(v=vs.85).aspx

 

typedef struct _SYSTEM_LOGICAL_PROCESSOR_INFORMATION {
  ULONG_PTR                      ProcessorMask;
  LOGICAL_PROCESSOR_RELATIONSHIP Relationship;
  union {
    struct {
      BYTE Flags;
    } ProcessorCore;
    struct {
      DWORD NodeNumber;
    } NumaNode;
    CACHE_DESCRIPTOR Cache;
    ULONGLONG        Reserved[2];
  };
} SYSTEM_LOGICAL_PROCESSOR_INFORMATION, *PSYSTEM_LOGICAL_PROCESSOR_INFORMATION;

https://msdn.microsoft.com/en-us/library/windows/desktop/ms686694(v=vs.85).aspx

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

maybe there is a better way to "translate" the union

#include <Array.au3>
#include <WinAPI.au3>
#include <array.au3>

#AutoIt3Wrapper_UseX64=n

;variablen zuordnen
Enum $RelationProcessorCore, _
        $RelationNumaNode, _
        $RelationCache, _
        $RelationProcessorPackage, _
        $RelationGroup, _
        $RelationAll


Global $processorCoreCount = 0, _
        $logicalProcessorCount = 0, _
        $processorPackageCount = 0, _
        $numaNodeCount = 0, _
        $L1CacheCount = 0, _
        $L2CacheCount = 0, _
        $L3CacheCount = 0, _
        $L1CacheSize = 0, _
        $L2CacheSize = 0, _
        $L3CacheSize = 0




$dll = DllOpen("kernel32.dll")
ConsoleWrite('- Debug(' & @ScriptLineNumber & ') : $dll = ' & $dll & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
ConsoleWrite('- : $dll = ' & $dll & @CRLF)               ;### Debug Console

;adresse holen
$procaddress = DllCall($dll, "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("kernel32.dll"), "str", "GetLogicalProcessorInformation")
ConsoleWrite('- : $ret = ' & $procaddress[0] & @CRLF)    ;### Debug Console

;Funktion callen, um buffer größe zu erhalten
$return_length = 0
$ret = DllCallAddress("uint", $procaddress[0], "dword", 0, "uint*", $return_length)
;~ ConsoleWrite('- : $ret = ' & $ret & @CRLF ) ;### Debug Console
$return_length = $ret[2]
;~ ConsoleWrite('- : $return_length = ' & $return_length & @CRLF ) ;### Debug Console
;~ _arraydisplay($ret)


$struct_bytes = DllStructCreate("byte [" & $return_length & "]")
$ptr = DllStructGetPtr($struct_bytes)
;~ ConsoleWrite('- : $ptr = ' & $ptr & @CRLF ) ;### Debug Console


;Funktion callen, um bufferpointer  zu übergeben und buffer zu füllen
$ret = DllCallAddress("uint", $procaddress[0], "ptr", $ptr, "uint*", $return_length)
;~ ConsoleWrite('- : $ret = ' & $ret[0] & @CRLF ) ;### Debug Console
;~ _arraydisplay($ret)

;zeig´s mir baby!!!
$ret = DllStructGetData($struct_bytes, 1)
ConsoleWrite('- : $ret = ' & ($ret) & @CRLF)             ;### Debug Console
For $i = 3 To $return_length * 2 Step 48
    $a = StringMid($ret, $i, 48)
    ConsoleWrite("    " & $a & @CRLF)
Next


ConsoleWrite(@CRLF & @CRLF & "+ Ergebnisse:" & @CRLF & @CRLF)

;zuordnen

For $i = 0 To $return_length - 24 Step 24

    $a = StringMid($ret, 3 + $i * 2, 48)
    ConsoleWrite($a & @CRLF)

;~ ;PLPI = PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
    $struct_PLPI = DllStructCreate("dword ProcessorMask;" & _
            "dword Relationship;" & _
            "byte [16];", $ptr + $i)

    ;die "union" nachbasteln....alle
    $struct_Processorcore = DllStructCreate("byte Flags", DllStructGetPtr($struct_PLPI) + 8)

    $struct_NumaNode = DllStructCreate("dword NodeNumber", DllStructGetPtr($struct_PLPI) + 8)

    $struct_CACHE_DESCRIPTOR = DllStructCreate("byte Level;" & _
            "byte Associativity;" & _
            "word Linesize;" & _
            "dword Size;" & _
            "dword Type", DllStructGetPtr($struct_PLPI) + 8)



;~     $structsize = DllStructGetSize($struct_PLPI)
;~     ConsoleWrite('- : $structsize = ' & $structsize & @CRLF ) ;### Debug Console




    ;Daten auslesen
    $ProcessorMask = DllStructGetData($struct_PLPI, "ProcessorMask")
    ConsoleWrite('> $ProcessorMask = ' & $ProcessorMask & @CRLF)
    $Relationship = DllStructGetData($struct_PLPI, "Relationship")
    ConsoleWrite('> $Relationship  = ' & $Relationship)


    $Relationship = Int(DllStructGetData($struct_PLPI, "Relationship"))

    Switch $Relationship

        Case $RelationProcessorCore                      ;0 es werden Prozessor daten abgefragt
            ConsoleWrite("  ProcessorCore" & @CRLF)
            $ProcessorCore = DllStructGetData($struct_Processorcore, "Flags")
            ConsoleWrite('- : $ProcessorCore = ' & $ProcessorCore & @CRLF) ;### Debug Console

            $processorCoreCount += 1

            $logicalProcessorCount += CountSetBits($ProcessorMask)

        Case $RelationNumaNode
            ConsoleWrite("  NumaNode" & @CRLF)
            $NodeNumber = DllStructGetData($struct_NumaNode, "NodeNumber")
            ConsoleWrite('- : $NodeNumber = ' & $NodeNumber & @CRLF) ;### Debug Console

            $numaNodeCount += 1

        Case $RelationCache
            ConsoleWrite("  RelationCache" & @CRLF)
            $Level = DllStructGetData($struct_CACHE_DESCRIPTOR, "Level")
            ConsoleWrite('- : $Level = ' & $Level & @CRLF) ;### Debug Console
            $Associativity = DllStructGetData($struct_CACHE_DESCRIPTOR, "Associativity")
            ConsoleWrite('- : $Associativity = ' & $Associativity & @CRLF) ;### Debug Console
            $Linesize = DllStructGetData($struct_CACHE_DESCRIPTOR, "Linesize")
            ConsoleWrite('- : $Linesize = ' & $Linesize & @CRLF) ;### Debug Console
            $Size = DllStructGetData($struct_CACHE_DESCRIPTOR, "Size")
            ConsoleWrite('- : $Size = ' & $Size & @CRLF) ;### Debug Console
            $Type = DllStructGetData($struct_CACHE_DESCRIPTOR, "Type")
            ConsoleWrite('- : $Type = ' & $Type & @CRLF) ;### Debug Console

            Switch $Level
                Case 1
                    $L1CacheCount += 1
                    $L1CacheSize += $Size
                Case 2
                    $L2CacheCount += 1
                    $L2CacheSize += $Size
                Case 3
                    $L3CacheCount += 1
                    $L3CacheSize += $Size
            EndSwitch




        Case $RelationProcessorPackage
            ConsoleWrite("  ProcessorPackage" & @CRLF)
            $processorPackageCount += 1

        Case $RelationGroup
            ConsoleWrite("  Group" & @CRLF)



    EndSwitch






    ConsoleWrite(@CRLF & @CRLF)

Next



$returnstring = "GetLogicalProcessorInformation:" & @CRLF & @CRLF & _
        StringFormat("Number %-30s = %u", "Processorcores", $processorCoreCount) & @CRLF & _
        StringFormat("Number %-30s = %u", "NumaNodes", $numaNodeCount) & @CRLF & _
        StringFormat("Number %-30s = %u", "logicalProcessorCount", $logicalProcessorCount) & @CRLF & _
        StringFormat("Number %-30s = %u", "processorPackageCount", $processorPackageCount) & @CRLF & _
        StringFormat("Number %-30s = %u/%u/%u", "Level1/2/3-Caches", $L1CacheCount, $L2CacheCount, $L3CacheCount) & @CRLF & _
        StringFormat("Number %-30s = %u/%u/%u", "L1/L2/L3 cache sizes (kB)", $L1CacheSize / 1024, $L2CacheSize / 1024, $L3CacheSize / 1024) & @CRLF & _
        ""

ConsoleWrite($returnstring & @CRLF)

MsgBox(0, "GetLogicalProcessorInformation", $returnstring)



Func CountSetBits($uint)                                 ;zählt gesetzte bits
    $anz = 0
    For $i = 0 To 31
        If BitAND(2 ^ $i, $uint) Then $anz += 1
    Next
    Return $anz
EndFunc                                                  ;==>CountSetBits

 

Edited by AndyG

Share this post


Link to post
Share on other sites

Thanks again Andy !

 

Maybe someone will optimize it and give it to the AutoIt devs....:thumbsup:

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

@AndyG: Hi! Please, can you be so kind to explain me these two issues:

Quote
For $i = 0 To $return_length - 48 Step 24

 

Why do you exclude last 48 bytes?

Quote
$a = StringMid($ret, 3 + $i * 2, 48)

 

Why do you exclude first 3 bytes and $i is multiplied by 2?

 

Edited by j0kky

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

@j0kky,

Because I can not program (only "read" a little bit) C(++)-code, i had to examine those "UNION"-stuff.

The "showing" of the bytes in several "lines" helped me to understand the structure, so i converted the bytes to chars to have a better "view" into the data!

The SYSTEM_LOGICAL_PROCESSOR_INFORMATION - struct has a lenght of 24bytes. In HEX-representation, the length is 48 chars....the length of the entire string is 2 (chars/bytes) for the "0x" and X*48(chars/bytes). The data starts at the third character, the first 2 are the "0x".

Imagine, that the 24Byte-SYSTEM_LOGICAL_PROCESSOR_INFORMATION - struct is a "Window"  to show only 24Bytes in the memory from all the bytes given back from the GetLogicalProcessorInformation-Function-call.

The start-address for every "24-bytes-Window" is the pointer to the memory plus 24 Bytes....

If you reach the end, the last "24-bytes-Window" is the region/area 24 bytes in front of the last byte....in HEX-reperesentation 48 chars. The last "address" for stringmid() to show the next(last) 48 chars is (endaddress-48).

I hope that i could clarify a little bit and that my explanations were useful. If not, ask again and surely someone with a much better phrasing/mode of expression than me will help you!

 

[OT]What should I do without google translate:>[OT]

 

code for 32/64Bit

#include <Array.au3>
#include <WinAPI.au3>


#AutoIt3Wrapper_UseX64=y                                 ;für 32/64Bit

;variablen zuordnen
Enum $RelationProcessorCore, _
        $RelationNumaNode, _
        $RelationCache, _
        $RelationProcessorPackage, _
        $RelationGroup, _
        $RelationAll


Global $processorCoreCount = 0, _
        $logicalProcessorCount = 0, _
        $processorPackageCount = 0, _
        $numaNodeCount = 0, _
        $L1CacheCount = 0, _
        $L2CacheCount = 0, _
        $L3CacheCount = 0, _
        $L1CacheSize = 0, _
        $L2CacheSize = 0, _
        $L3CacheSize = 0


If @AutoItX64 Then
    $32_64 = 32
    $sSize = 16
Else
    $32_64 = 24
    $sSize = 8
EndIf



$dll = DllOpen("kernel32.dll")
;~ ConsoleWrite('- Debug(' & @ScriptLineNumber & ') : $dll = ' & $dll & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console
;~ ConsoleWrite('- : $dll = ' & $dll & @CRLF)               ;### Debug Console

;adresse holen
$procaddress = DllCall($dll, "ptr", "GetProcAddress", "ptr", _WinAPI_GetModuleHandle("kernel32.dll"), "str", "GetLogicalProcessorInformation")
;~ ConsoleWrite('- : $ret = ' & $procaddress[0] & @CRLF)    ;### Debug Console

;Funktion callen, um buffer größe zu erhalten
$return_length = 0
$ret = DllCallAddress("uint", $procaddress[0], "dword", 0, "uint*", $return_length)
;~ ConsoleWrite('- : $ret = ' & $ret & @CRLF ) ;### Debug Console
$return_length = $ret[2]
;~ ConsoleWrite('- : $return_length = ' & $return_length & @CRLF ) ;### Debug Console
;~ _ArrayDisplay($ret)


$struct_bytes = DllStructCreate("byte [" & $return_length & "]")
$ptr = DllStructGetPtr($struct_bytes)
;~ ConsoleWrite('- : $ptr = ' & $ptr & @CRLF ) ;### Debug Console


;Funktion callen, um bufferpointer  zu übergeben und buffer zu füllen
$ret = DllCallAddress("uint", $procaddress[0], "ptr", $ptr, "uint*", $return_length)
;~ ConsoleWrite('- : $ret = ' & $ret[0] & @CRLF ) ;### Debug Console
;~ _arraydisplay($ret)

;zeig´s mir baby!!!
$ret = DllStructGetData($struct_bytes, 1)
ConsoleWrite('- : $ret = ' & ($ret) & @CRLF)             ;### Debug Console
For $i = 3 To $return_length * 2 Step $32_64 * 2
    $a = StringMid($ret, $i, $32_64 * 2)
    ConsoleWrite("    " & $a & @CRLF)
Next


ConsoleWrite(@CRLF & @CRLF & "+ Ergebnisse:" & @CRLF & @CRLF)

;zuordnen

For $i = 0 To $return_length - $32_64 Step $32_64

    $a = StringMid($ret, 3 + $i * 2, $32_64 * 2)
    ConsoleWrite($a & @CRLF)

;~ ;PLPI = PSYSTEM_LOGICAL_PROCESSOR_INFORMATION
    $struct_PLPI = DllStructCreate("uint_ptr ProcessorMask;" & _
            "uint_ptr Relationship;" & _
            "byte [" & $32_64 - 16 & "]", $ptr + $i)

    ;die "union" nachbasteln....alle
    $struct_Processorcore = DllStructCreate("byte Flags", DllStructGetPtr($struct_PLPI) + $sSize)

    $struct_NumaNode = DllStructCreate("dword NodeNumber", DllStructGetPtr($struct_PLPI) + $sSize)

    $struct_CACHE_DESCRIPTOR = DllStructCreate("byte Level;" & _
            "byte Associativity;" & _
            "word Linesize;" & _
            "dword Size;" & _
            "dword Type", DllStructGetPtr($struct_PLPI) + $sSize)



;~     $structsize = DllStructGetSize($struct_PLPI)
;~     ConsoleWrite('- : $structsize = ' & $structsize & @CRLF ) ;### Debug Console




    ;Daten auslesen
    $ProcessorMask = DllStructGetData($struct_PLPI, "ProcessorMask")
    ConsoleWrite('> $ProcessorMask = ' & $ProcessorMask & @CRLF)
    $Relationship = DllStructGetData($struct_PLPI, "Relationship")
    ConsoleWrite('> $Relationship  = ' & $Relationship)


    $Relationship = Int(DllStructGetData($struct_PLPI, "Relationship"))

    Switch $Relationship

        Case $RelationProcessorCore                      ;0 es werden Prozessor daten abgefragt
            ConsoleWrite("  ProcessorCore" & @CRLF)
            $ProcessorCore = DllStructGetData($struct_Processorcore, "Flags")
            ConsoleWrite('- : $ProcessorCore = ' & $ProcessorCore & @CRLF) ;### Debug Console

            $processorCoreCount += 1

            $logicalProcessorCount += CountSetBits($ProcessorMask)

        Case $RelationNumaNode
            ConsoleWrite("  NumaNode" & @CRLF)
            $NodeNumber = DllStructGetData($struct_NumaNode, "NodeNumber")
            ConsoleWrite('- : $NodeNumber = ' & $NodeNumber & @CRLF) ;### Debug Console

            $numaNodeCount += 1

        Case $RelationCache
            ConsoleWrite("  RelationCache" & @CRLF)
            $Level = DllStructGetData($struct_CACHE_DESCRIPTOR, "Level")
            ConsoleWrite('- : $Level = ' & $Level & @CRLF) ;### Debug Console
            $Associativity = DllStructGetData($struct_CACHE_DESCRIPTOR, "Associativity")
            ConsoleWrite('- : $Associativity = ' & $Associativity & @CRLF) ;### Debug Console
            $Linesize = DllStructGetData($struct_CACHE_DESCRIPTOR, "Linesize")
            ConsoleWrite('- : $Linesize = ' & $Linesize & @CRLF) ;### Debug Console
            $Size = DllStructGetData($struct_CACHE_DESCRIPTOR, "Size")
            ConsoleWrite('- : $Size = ' & $Size & @CRLF) ;### Debug Console
            $Type = DllStructGetData($struct_CACHE_DESCRIPTOR, "Type")
            ConsoleWrite('- : $Type = ' & $Type & @CRLF) ;### Debug Console

            Switch $Level
                Case 1
                    $L1CacheCount += 1
                    $L1CacheSize += $Size
                Case 2
                    $L2CacheCount += 1
                    $L2CacheSize += $Size
                Case 3
                    $L3CacheCount += 1
                    $L3CacheSize += $Size
            EndSwitch




        Case $RelationProcessorPackage
            ConsoleWrite("  ProcessorPackage" & @CRLF)
            $processorPackageCount += 1

        Case $RelationGroup
            ConsoleWrite("  Group" & @CRLF)



    EndSwitch






    ConsoleWrite(@CRLF & @CRLF)

Next



$returnstring = "GetLogicalProcessorInformation: " & 32 * (1 + @AutoItX64) & "Bit" & @CRLF & @CRLF & _
        StringFormat("Number %-30s = %u", "Processorcores", $processorCoreCount) & @CRLF & _
        StringFormat("Number %-30s = %u", "NumaNodes", $numaNodeCount) & @CRLF & _
        StringFormat("Number %-30s = %u", "logicalProcessorCount", $logicalProcessorCount) & @CRLF & _
        StringFormat("Number %-30s = %u", "processorPackageCount", $processorPackageCount) & @CRLF & _
        StringFormat("Number %-30s = %u/%u/%u", "Level1/2/3-Caches", $L1CacheCount, $L2CacheCount, $L3CacheCount) & @CRLF & _
        StringFormat("Number %-30s = %u/%u/%u", "L1/L2/L3 cache sizes (kB)", $L1CacheSize / 1024, $L2CacheSize / 1024, $L3CacheSize / 1024) & @CRLF & _
        ""

ConsoleWrite($returnstring & @CRLF)

MsgBox(0, "GetLogicalProcessorInformation", $returnstring)



Func CountSetBits($uint)                                 ;zählt gesetzte bits
    $anz = 0
    For $i = 0 To 31
        If BitAND(2 ^ $i, $uint) Then $anz += 1
    Next
    Return $anz
EndFunc                                                  ;==>CountSetBits

 

 

 

Edited by AndyG

Share this post


Link to post
Share on other sites

You have been extremely clear, my mistake was not to consider what DllStructGetData does to binary data (it multiplies by 2 the final lenght and adds 2 characters "0x" at the start) :D

Thank you very much!

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

@Andy G: On second thought I'm quite sure in first script it should be:

For $i = 0 To $return_length - 24 Step 24

In fact, in my system, if you exclude 48 bytes instead of 24, you don't count a NumaNode!

Edited by j0kky

Share this post


Link to post
Share on other sites

You are right, thank you very much!:thumbsup:

I´ll edit the scripts...

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

2 hours ago, j0kky said:

I don't know if GetProcAddress involvement is really necessary!

No, it´s not!

"Stolen" from chesstiger´s not fully working try :bye::

$hDll = DllOpen("Kernel32.dll")
    $tBufferSize = DllStructCreate("dword size;")
    DllCall($hDll, "bool", "GetLogicalProcessorInformation", "struct*", 0, "DWORD_PTR", DllStructGetPtr($tBufferSize, "size"))
    $hMem = _MemGlobalAlloc($tBufferSize.size, $GPTR) ;Nötig, da sonst nach Verlassen der Funktion der Speicherbereich freigegeben wird...
    $tBuffer = DllStructCreate("byte[" & $tBufferSize.size & "]", $hMem)
    DllCall($hDll, "bool", "GetLogicalProcessorInformation", "struct*", DllStructGetPtr($tBuffer), "DWORD_PTR", DllStructGetPtr($tBufferSize, "size"))

this and the use of something like an OO-Style (to get the content of the structs by their name like $buffer.item ) should lead to a good result. Have fun!

Edited by AndyG

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • j0kky
      _WinApi_GetLogicalProcessorInformation
      By j0kky
      Hi guys,
      thanks to this request, I wrote my version of GetLogicalProcessorInformation UDF for x86 e x64:
      ; #FUNCTION# ======================================================================================================================== ; Name...........: _WinAPI_GetLogicalProcessorInformation ; Description ...: Retrieves information about logical processors and related hardware. ; Syntax.........: _WinAPI_GetLogicalProcessorInformation() ; Return values .: On success it returns a bidimensional array: on rows there is the list of processor sets, these are the columns: ; |[0] - A logical processor affinity mask, which indicates the logical processors that the information applies to. ; |[1] - If setted, then the specified logical processors share a single processor core. ; |[2] - How many active processors that share functional units are in the relationship ; (it is setted only if the previous element is setted too) ; |[3] - If setted, it identifies the NUMA node (it can be 0). ; |[4] - If setted, the specified logical processors share a physical package. ; |[5] - A bidimensional array: on rows there is the cache list, these are the columns: ; |[0] - The cache level ; |[1] - The cache associativity ; |[2] - The cache line size, in bytes ; |[3] - The cache size, in bytes ; |[4] - The cache type ; On failure it returns -1 and sets @error to non zero: ; |-1 - internal error ; |-2 - missing DLL (Ws2_32.dll) ; Remarks .......: Search GetLogicalProcessorInformation in MSDN Library. ; Author ........: j0kky ; Modified ......: 1.0.0 ; Links .........: https://msdn.microsoft.com/it-it/library/windows/desktop/ms683194(v=vs.85).aspx ; ==================================================================================================================================== Func _WinAPI_GetLogicalProcessorInformation() Local $hDll = DllOpen("kernel32.dll") If @error Then Return SetError(-2, 0, -1) Local Const $ERROR_INSUFFICIENT_BUFFER = 122 Local $aRet = DllCall($hDll, "BOOL", "GetLogicalProcessorInformation", "ptr", Null, "dword*", 0) If @error Or Not (DllCall($hDll, "DWORD", "GetLastError")[0] = $ERROR_INSUFFICIENT_BUFFER) Then DllClose($hDll) Return SetError(-1, 0, -1) EndIf Local $nReturnLength = $aRet[2] Local $tBuffer = DllStructCreate("byte[" & $nReturnLength & "]") Local $pBuffer = DllStructGetPtr($tBuffer) $aRet = DllCall($hDll, "BOOL", "GetLogicalProcessorInformation", "ptr", $pBuffer, "dword*", $nReturnLength) If @error Or Not $aRet[0] Then DllClose($hDll) Return SetError(-1, 0, -1) EndIf Local Const $tagSYSTEM_LOGICAL_PROCESSOR_INFORMATION = "ULONG_PTR ProcessorMask; INT_PTR Relationship; BYTE UnionBuffer[16]" Local $tSYSTEM_LOGICAL_PROCESSOR_INFORMATION = DllStructCreate($tagSYSTEM_LOGICAL_PROCESSOR_INFORMATION, $pBuffer) Local $nSize = DllStructGetSize($tSYSTEM_LOGICAL_PROCESSOR_INFORMATION), $tCACHE_DESCRIPTOR, _ $aResult[1][6], _ ;mask, core, logical, numa, package, cache $aCacheModel[0][5], _ ;level, associativity, line size, size, processor cache type $nOffset = 0, $nArraySize, $aCache, $vProcessor, $nProcessorMask $aResult[0][0] = $tSYSTEM_LOGICAL_PROCESSOR_INFORMATION.ProcessorMask $aResult[0][5] = $aCacheModel Do $tSYSTEM_LOGICAL_PROCESSOR_INFORMATION = DllStructCreate($tagSYSTEM_LOGICAL_PROCESSOR_INFORMATION, $pBuffer + $nOffset) $nProcessorMask = $tSYSTEM_LOGICAL_PROCESSOR_INFORMATION.ProcessorMask $nArraySize = UBound($aResult) For $i = 0 To ($nArraySize - 1) If $aResult[$i][0] = $nProcessorMask Then $vProcessor = $i ExitLoop EndIf Next If $vProcessor = Null Then ReDim $aResult[$nArraySize + 1][6] $aResult[$nArraySize][0] = $nProcessorMask $aResult[$nArraySize][5] = $aCacheModel $vProcessor = $nArraySize EndIf Switch $tSYSTEM_LOGICAL_PROCESSOR_INFORMATION.Relationship Case 0 ;RelationProcessorCore $aResult[$vProcessor][1] += 1 If (DllStructCreate("byte Flags", DllStructGetPtr($tSYSTEM_LOGICAL_PROCESSOR_INFORMATION, "UnionBuffer")).Flags) = 1 Then For $i = 1 To (($nSize = 24) ? 32 : 64) $aResult[$vProcessor][2] += (Mod($nProcessorMask, 2) ? 1 : 0) $nProcessorMask = Floor($nProcessorMask / 2) Next EndIf Case 1 ;RelationNumaNode $aResult[$vProcessor][3] = DllStructCreate("dword NodeNumber", DllStructGetPtr($tSYSTEM_LOGICAL_PROCESSOR_INFORMATION, "UnionBuffer")).NodeNumber Case 2 ;RelationCache $tCACHE_DESCRIPTOR = DllStructCreate("byte Level; byte Associativity; word LineSize; dword Size; INT Type", _ DllStructGetPtr($tSYSTEM_LOGICAL_PROCESSOR_INFORMATION, "UnionBuffer")) $aCache = $aResult[$vProcessor][5] $nArraySize = UBound($aCache) ReDim $aCache[$nArraySize + 1][5] $aCache[$nArraySize][0] = $tCACHE_DESCRIPTOR.Level $aCache[$nArraySize][1] = $tCACHE_DESCRIPTOR.Associativity $aCache[$nArraySize][2] = $tCACHE_DESCRIPTOR.LineSize $aCache[$nArraySize][3] = $tCACHE_DESCRIPTOR.Size $aCache[$nArraySize][4] = $tCACHE_DESCRIPTOR.Type $aResult[$vProcessor][5] = $aCache Case 3 ;RelationProcessorPackage $aResult[$vProcessor][4] += 1 EndSwitch $nOffset += $nSize $vProcessor = Null Until $nOffset = $nReturnLength DllClose($hDll) Return $aResult EndFunc ;==>_WinAPI_GetLogicalProcessorInformation Usage example:
      #include <array.au3> $array = _WinAPI_GetLogicalProcessorInformation() _ArrayDisplay($array, "Processor set list:") For $i = 0 To UBound($array) - 1 _ArrayDisplay($array[$i][5], "Processor set " & $i + 1 & " cache:") Next
    • corgano
      Help / Reading usb controller with _WinAPI_RegisterRawInputDevices
      By corgano
      Edit: If you already read this post, I updated it to better fit the scope of what I want to do.

      My goal is to be able to read the raw output from a usb type controller (or mouse or keyboard, don't want it to be controller-only) so i can see how / what changes when i hit buttons. I've gotten as far as finding HID page documentation and documentation for the device Struct, but I don't know where to go from here
      How do I tell what and Useage to use for any given controller / Keyboard / Mouse? How do I get a list of all HID devices connected and their UsagePage / Usage? How do I register multiple devices / get raw input from multiple devices at once? Here is the modified example script i am using:
      #include <APISysConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WinAPIGdi.au3> #include <WinAPIMisc.au3> #include <WinAPISys.au3> #include <WindowsConstants.au3> Opt('TrayAutoPause', 0) Global $iFlagsOld = 0, $iDataOld = 0 ; Create GUI Global $g_hForm = GUICreate('Test ' & StringReplace(@ScriptName, '.au3', '()'), 160, 212, @DesktopWidth - 179, @DesktopHeight - 283, BitOR($WS_CAPTION, $WS_POPUP, $WS_SYSMENU), $WS_EX_TOPMOST) ; To obtain the values of "UsagePage" and "Usage" members of this structure read HID Usage Tables documentation ; http://www.usb.org/developers/devclass_docs/HID1_11.pdf ; Disregaurd that, official USB documention = useless. Here is a human/normal-person friendly list ; http://www.freebsddiary.org/APC/usb_hid_usages.php ; Information on the Struct (eg what Flags and hTarget do) can be found here ; https://msdn.microsoft.com/en-us/library/ms645565(v=vs.85).aspx Local $tRID = DllStructCreate($tagRAWINPUTDEVICE) DllStructSetData($tRID, 'UsagePage', 0x01) ; Generic Desktop Controls DllStructSetData($tRID, 'Usage', 0x06) ; Mouse DllStructSetData($tRID, 'Flags', $RIDEV_INPUTSINK) ; This flag makes window hTarget accept input even when it's not active. MUST define hTarget DllStructSetData($tRID, 'hTarget', $g_hForm) ; The target window that will be sent events, used with some Flags ; Register HID input to obtain row input _WinAPI_RegisterRawInputDevices($tRID) ; Register WM_INPUT message GUIRegisterMsg($WM_INPUT, 'WM_INPUT') ;~ GUISetState(@SW_SHOW) Do Until GUIGetMsg() = $GUI_EVENT_CLOSE Func WM_INPUT($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg, $wParam Switch $hWnd Case $g_hForm Local $tRIM = DllStructCreate($tagRAWINPUTMOUSE) If _WinAPI_GetRawInputData($lParam, $tRIM, DllStructGetSize($tRIM), $RID_INPUT) Then Local $iFlags = DllStructGetData($tRIM, 'Flags') Local $sFlag = "", $sData = "" $iFlags = DllStructGetData($tRIM, 'ButtonFlags') If $iFlags <> $iFlagsOld Then $sFlag = $iFlags $iFlagsOld = $iFlags EndIf $iData = DllStructGetData($tRIM, 'ButtonData') If $iData <> $iDataOld Then $sData = $iData $iDataOld = $iData EndIf If $sFlag&$sData <> "" Then ConsoleWrite($sFlag&" "&$sData&@CRLF) EndIf EndIf EndSwitch Return $GUI_RUNDEFMSG EndFunc ;==>WM_INPUT
      Old post:
       
    • argumentum
      voidtools' everything file search engine IPC
      By argumentum
      The nice ppl of voidtools created Everything Search Engine ( " Locate files and folders by name instantly. " )  
      And made a CLI program to search from the command line. They also gave the source code, and reading it, I see the IPC quite familiar.
      // // // source for CLI.H // Everything IPC test // revision 2: // fixed command line interpreting '-' as a switch inside text. // revision 3: // convert unicode to same code page as console. // revision 4: // removed write console because it has no support for piping. // revision 5: // added ChangeWindowMessageFilterEx (if available) for admin/user support. // compiler options #pragma warning(disable : 4311) // type cast void * to unsigned int #pragma warning(disable : 4312) // type cast unsigned int to void * #pragma warning(disable : 4244) // warning C4244: 'argument' : conversion from 'LONG_PTR' to 'LONG', possible loss of data #pragma warning(disable : 4996) // deprecation #include <windows.h> #include <stdio.h> #include "everything_ipc.h" #define COPYDATA_IPCTEST_QUERYCOMPLETEW 0 #define MSGFLT_RESET 0 #define MSGFLT_ALLOW 1 #define MSGFLT_DISALLOW 2 typedef struct tagCHANGEFILTERSTRUCT { DWORD cbSize; DWORD ExtStatus; } CHANGEFILTERSTRUCT, *PCHANGEFILTERSTRUCT; static void write(wchar_t *text); static void write_DWORD(DWORD value); static int wstring_to_int(const wchar_t *s); int sort = 0; EVERYTHING_IPC_LIST *sort_list; HMODULE user32_hdll = 0; BOOL (WINAPI *pChangeWindowMessageFilterEx)(HWND hWnd,UINT message,DWORD action,PCHANGEFILTERSTRUCT pChangeFilterStruct) = 0; int wstring_length(const wchar_t *s) { const wchar_t *p; p = s; while(*p) { p++; } return (int)(p - s); } // query everything with search string int sendquery(HWND hwnd,DWORD num,WCHAR *search_string,int regex,int match_case,int match_whole_word,int match_path) { EVERYTHING_IPC_QUERY *query; int len; int size; HWND everything_hwnd; COPYDATASTRUCT cds; everything_hwnd = FindWindow(EVERYTHING_IPC_WNDCLASS,0); if (everything_hwnd) { len = wstring_length(search_string); size = sizeof(EVERYTHING_IPC_QUERY) - sizeof(WCHAR) + len*sizeof(WCHAR) + sizeof(WCHAR); query = (EVERYTHING_IPC_QUERY *)HeapAlloc(GetProcessHeap(),0,size); if (query) { query->max_results = num; query->offset = 0; query->reply_copydata_message = COPYDATA_IPCTEST_QUERYCOMPLETEW; query->search_flags = (regex?EVERYTHING_IPC_REGEX:0) | (match_case?EVERYTHING_IPC_MATCHCASE:0) | (match_whole_word?EVERYTHING_IPC_MATCHWHOLEWORD:0) | (match_path?EVERYTHING_IPC_MATCHPATH:0); query->reply_hwnd = hwnd; CopyMemory(query->search_string,search_string,(len+1)*sizeof(WCHAR)); cds.cbData = size; cds.dwData = EVERYTHING_IPC_COPYDATAQUERY; cds.lpData = query; if (SendMessage(everything_hwnd,WM_COPYDATA,(WPARAM)hwnd,(LPARAM)&cds) == TRUE) { HeapFree(GetProcessHeap(),0,query); return 1; } else { write(L"Everything IPC service not running.\n"); } HeapFree(GetProcessHeap(),0,query); } else { write(L"failed to allocate "); write_DWORD(size); write(L" bytes for IPC query.\n"); } } else { // the everything window was not found. // we can optionally RegisterWindowMessage("EVERYTHING_IPC_CREATED") and // wait for Everything to post this message to all top level windows when its up and running. write(L"Everything IPC window not found, IPC unavailable.\n"); } return 0; } int compare_list_items(const void *a,const void *b) { int i; i = wcsicmp(EVERYTHING_IPC_ITEMPATH(sort_list,a),EVERYTHING_IPC_ITEMPATH(sort_list,b)); if (!i) { return wcsicmp(EVERYTHING_IPC_ITEMFILENAME(sort_list,a),EVERYTHING_IPC_ITEMFILENAME(sort_list,b)); } else if (i > 0) { return 1; } else { return -1; } } static void write(wchar_t *text) { DWORD mode; int wlen; DWORD numwritten; HANDLE output_handle; output_handle = GetStdHandle(STD_OUTPUT_HANDLE); wlen = wstring_length(text); if (GetConsoleMode(output_handle,&mode)) { WriteConsoleW(output_handle,text,wlen,&numwritten,0); } else { char *buf; int len; len = WideCharToMultiByte(GetConsoleCP(),0,text,wlen,0,0,0,0); if (len) { buf = HeapAlloc(GetProcessHeap(),0,len); if (buf) { WideCharToMultiByte(GetConsoleCP(),0,text,wlen,buf,len,0,0); WriteFile(output_handle,buf,len,&numwritten,0); HeapFree(GetProcessHeap(),0,buf); } } } } static void write_DWORD(DWORD value) { wchar_t buf[256]; wchar_t *d; d = buf + 256; *--d = 0; if (value) { DWORD i; i = value; while(i) { *--d = '0' + (i % 10); i /= 10; } } else { *--d = '0'; } write(d); } void listresultsW(EVERYTHING_IPC_LIST *list) { DWORD i; if (sort) { sort_list = list; qsort(list->items,list->numitems,sizeof(EVERYTHING_IPC_ITEM),compare_list_items); } for(i=0;i<list->numitems;i++) { if (list->items[i].flags & EVERYTHING_IPC_DRIVE) { write(EVERYTHING_IPC_ITEMFILENAME(list,&list->items[i])); write(L"\r\n"); } else { write(EVERYTHING_IPC_ITEMPATH(list,&list->items[i])); write(L"\\"); write(EVERYTHING_IPC_ITEMFILENAME(list,&list->items[i])); write(L"\r\n"); } } PostQuitMessage(0); } // custom window proc LRESULT __stdcall window_proc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) { switch(msg) { case WM_COPYDATA: { COPYDATASTRUCT *cds = (COPYDATASTRUCT *)lParam; switch(cds->dwData) { case COPYDATA_IPCTEST_QUERYCOMPLETEW: listresultsW((EVERYTHING_IPC_LIST *)cds->lpData); return TRUE; } break; } } return DefWindowProc(hwnd,msg,wParam,lParam); } void help(void) { write(L"-r Search the database using a basic POSIX regular expression.\n"); write(L"-i Does a case sensitive search.\n"); write(L"-w Does a whole word search.\n"); write(L"-p Does a full path search.\n"); write(L"-h --help Display this help.\n"); write(L"-n <num> Limit the amount of results shown to <num>.\n"); write(L"-s Sort by full path.\n"); } // main entry int main(int argc,char **argv) { WNDCLASSEX wcex; HWND hwnd; MSG msg; int ret; int q; wchar_t *search; wchar_t *d; wchar_t *e; wchar_t *s; int match_whole_word = 0; int match_path = 0; int regex = 0; int match_case = 0; int wasexename = 0; int matchpath = 0; int i; int wargc; wchar_t **wargv; DWORD num = EVERYTHING_IPC_ALLRESULTS; ZeroMemory(&wcex,sizeof(wcex)); wcex.cbSize = sizeof(wcex); if (!GetClassInfoEx(GetModuleHandle(0),TEXT("IPCTEST"),&wcex)) { ZeroMemory(&wcex,sizeof(wcex)); wcex.cbSize = sizeof(wcex); wcex.hInstance = GetModuleHandle(0); wcex.lpfnWndProc = window_proc; wcex.lpszClassName = TEXT("IPCTEST"); if (!RegisterClassEx(&wcex)) { write(L"failed to register IPCTEST window class\n"); return 1; } } if (!(hwnd = CreateWindow( TEXT("IPCTEST"), TEXT(""), 0, 0,0,0,0, 0,0,GetModuleHandle(0),0))) { write(L"failed to create IPCTEST window\n"); return 1; } // allow the everything window to send a reply. user32_hdll = LoadLibrary(L"user32.dll"); if (user32_hdll) { pChangeWindowMessageFilterEx = (BOOL (WINAPI *)(HWND hWnd,UINT message,DWORD action,PCHANGEFILTERSTRUCT pChangeFilterStruct))GetProcAddress(user32_hdll,"ChangeWindowMessageFilterEx"); if (pChangeWindowMessageFilterEx) { pChangeWindowMessageFilterEx(hwnd,WM_COPYDATA,MSGFLT_ALLOW,0); } } wargv = CommandLineToArgvW(GetCommandLineW(),&wargc); search = HeapAlloc(GetProcessHeap(),0,65536); if (!search) { write(L"failed to allocate "); write_DWORD(65536); write(L" bytes for search buffer.\n"); if (user32_hdll) { FreeLibrary(user32_hdll); } return 1; } d = search; // allow room for null terminator e = search + (65536 / sizeof(wchar_t)) - 1; wargc--; i = 0; for(;;) { if (i >= wargc) break; if (wcsicmp(wargv[i+1],L"-r") == 0) { regex = 1; } else if (wcsicmp(wargv[i+1],L"-i") == 0) { match_case = 1; } else if (wcsicmp(wargv[i+1],L"-w") == 0) { match_whole_word = 1; } else if (wcsicmp(wargv[i+1],L"-p") == 0) { match_path = 1; } else if (wcsicmp(wargv[i+1],L"-s") == 0) { sort = 1; } else if ((wcsicmp(wargv[i+1],L"-n") == 0) && (i + 1 < wargc)) { i++; num = wstring_to_int(wargv[i+1]); } else if (wargv[i+1][0] == '-') { // unknwon command help(); HeapFree(GetProcessHeap(),0,search); if (user32_hdll) { FreeLibrary(user32_hdll); } return 1; } else { // keep quotes ? q = 0; s = wargv[i+1]; while(*s) { if ((*s == ' ') || (*s == '\t') || (*s == '\r') || (*s == '\n')) { q = 1; break; } s++; } if ((d != search) && (d < e)) *d++ = ' '; if (q) { if (d < e) *d++ = '"'; } // copy append to search s = wargv[i+1]; while(*s) { if (d < e) *d++ = *s; s++; } if (q) { if (d < e) *d++ = '"'; } } i++; } // null terminate *d = 0; if (!sendquery(hwnd,num,search,regex,match_case,match_whole_word,match_path)) { // send query reports error HeapFree(GetProcessHeap(),0,search); if (user32_hdll) { FreeLibrary(user32_hdll); } return 1; } HeapFree(GetProcessHeap(),0,search); // message pump loop: // update windows if (PeekMessage(&msg,NULL,0,0,0)) { ret = (int)GetMessage(&msg,0,0,0); if (ret <= 0) goto exit; // let windows handle it. TranslateMessage(&msg); DispatchMessage(&msg); } else { WaitMessage(); } goto loop; exit: if (user32_hdll) { FreeLibrary(user32_hdll); } return 0; } static int wstring_to_int(const wchar_t *s) { const wchar_t *p; int value; p = s; value = 0; while(*p) { if (!((*p >= '0') && (*p <= '9'))) { break; } value *= 10; value += *p - '0'; p++; } return value; } // // // source for everything_ipc.h // Everything IPC #ifndef _EVERYTHING_IPC_H_ #define _EVERYTHING_IPC_H_ // C #ifdef __cplusplus extern "C" { #endif // 1 byte packing for our varible sized structs #pragma pack(push, 1) // WM_USER (send to the taskbar notification window) // SendMessage(FindWindow(EVERYTHING_IPC_WNDCLASS,0),WM_USER,EVERYTHING_IPC_*,lParam) // version format: major.minor.revision.build // example: 1.1.4.309 #define EVERYTHING_IPC_GET_MAJOR_VERSION 0 // int major_version = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_MAJOR_VERSION,0); #define EVERYTHING_IPC_GET_MINOR_VERSION 1 // int minor_version = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_MINOR_VERSION,0); #define EVERYTHING_IPC_GET_REVISION 2 // int revision = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_REVISION,0); #define EVERYTHING_IPC_GET_BUILD_NUMBER 3 // int build = (int)SendMessage(hwnd,WM_USER,EVERYTHING_IPC_GET_BUILD,0); // find the everything window #define EVERYTHING_IPC_WNDCLASS TEXT("EVERYTHING_TASKBAR_NOTIFICATION") // find a everything search window #define EVERYTHING_IPC_SEARCH_WNDCLASS TEXT("EVERYTHING") // this global window message is sent to all top level windows when everything starts. #define EVERYTHING_IPC_CREATED TEXT("EVERYTHING_IPC_CREATED") // search flags for querys #define EVERYTHING_IPC_MATCHCASE 0x00000001 // match case #define EVERYTHING_IPC_MATCHWHOLEWORD 0x00000002 // match whole word #define EVERYTHING_IPC_MATCHPATH 0x00000004 // include paths in search #define EVERYTHING_IPC_REGEX 0x00000008 // enable regex // item flags #define EVERYTHING_IPC_FOLDER 0x00000001 // The item is a folder. (its a file if not set) #define EVERYTHING_IPC_DRIVE 0x00000002 // The folder is a drive. Path will be an empty string. // (will also have the folder bit set) // the WM_COPYDATA message for a query. #define EVERYTHING_IPC_COPYDATAQUERYA 1 #define EVERYTHING_IPC_COPYDATAQUERYW 2 // all results #define EVERYTHING_IPC_ALLRESULTS 0xFFFFFFFF // all results // macro to get the filename of an item #define EVERYTHING_IPC_ITEMFILENAMEA(list,item) (CHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMA *)(item))->filename_offset) #define EVERYTHING_IPC_ITEMFILENAMEW(list,item) (WCHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMW *)(item))->filename_offset) // macro to get the path of an item #define EVERYTHING_IPC_ITEMPATHA(list,item) (CHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMW *)(item))->path_offset) #define EVERYTHING_IPC_ITEMPATHW(list,item) (WCHAR *)((CHAR *)(list) + ((EVERYTHING_IPC_ITEMW *)(item))->path_offset) // // Varible sized query struct sent to everything. // // sent in the form of a WM_COPYDAYA message with EVERYTHING_IPC_COPYDATAQUERY as the // dwData member in the COPYDATASTRUCT struct. // set the lpData member of the COPYDATASTRUCT struct to point to your EVERYTHING_IPC_QUERY struct. // set the cbData member of the COPYDATASTRUCT struct to the size of the // EVERYTHING_IPC_QUERY struct minus the size of a CHAR plus the length of the search string in bytes plus // one CHAR for the null terminator. // // NOTE: to determine the size of this structure use // ASCII: sizeof(EVERYTHING_IPC_QUERYA) - sizeof(CHAR) + strlen(search_string)*sizeof(CHAR) + sizeof(CHAR) // UNICODE: sizeof(EVERYTHING_IPC_QUERYW) - sizeof(WCHAR) + wcslen(search_string)*sizeof(WCHAR) + sizeof(WCHAR) // // NOTE: Everything will only do one query per window. // Sending another query when a query has not completed // will cancel the old query and start the new one. // // Everything will send the results to the reply_hwnd in the form of a // WM_COPYDAYA message with the dwData value you specify. // // Everything will return TRUE if successful. // returns FALSE if not supported. // // If you query with EVERYTHING_IPC_COPYDATAQUERYW, the results sent from Everything will be Unicode. // typedef struct EVERYTHING_IPC_QUERYW { // the window that will receive the new results. HWND reply_hwnd; // the value to set the dwData member in the COPYDATASTRUCT struct // sent by Everything when the query is complete. ULONG_PTR reply_copydata_message; // search flags (see EVERYTHING_MATCHCASE | EVERYTHING_MATCHWHOLEWORD | EVERYTHING_MATCHPATH) DWORD search_flags; // only return results after 'offset' results (0 to return the first result) // useful for scrollable lists DWORD offset; // the number of results to return // zero to return no results // EVERYTHING_IPC_ALLRESULTS to return ALL results DWORD max_results; // null terminated string. arbitrary sized search_string buffer. WCHAR search_string[1]; }EVERYTHING_IPC_QUERYW; // ASCII version typedef struct EVERYTHING_IPC_QUERYA { // the window that will receive the new results. HWND reply_hwnd; // the value to set the dwData member in the COPYDATASTRUCT struct // sent by Everything when the query is complete. ULONG_PTR reply_copydata_message; // search flags (see EVERYTHING_MATCHCASE | EVERYTHING_MATCHWHOLEWORD | EVERYTHING_MATCHPATH) DWORD search_flags; // only return results after 'offset' results (0 to return the first result) // useful for scrollable lists DWORD offset; // the number of results to return // zero to return no results // EVERYTHING_IPC_ALLRESULTS to return ALL results DWORD max_results; // null terminated string. arbitrary sized search_string buffer. CHAR search_string[1]; }EVERYTHING_IPC_QUERYA; // // Varible sized result list struct received from Everything. // // Sent in the form of a WM_COPYDATA message to the hwnd specifed in the // EVERYTHING_IPC_QUERY struct. // the dwData member of the COPYDATASTRUCT struct will match the sent // reply_copydata_message member in the EVERYTHING_IPC_QUERY struct. // // make a copy of the data before returning. // // return TRUE if you processed the WM_COPYDATA message. // typedef struct EVERYTHING_IPC_ITEMW { // item flags DWORD flags; // The offset of the filename from the beginning of the list structure. // (wchar_t *)((char *)everything_list + everythinglist->name_offset) DWORD filename_offset; // The offset of the filename from the beginning of the list structure. // (wchar_t *)((char *)everything_list + everythinglist->path_offset) DWORD path_offset; }EVERYTHING_IPC_ITEMW; typedef struct EVERYTHING_IPC_ITEMA { // item flags DWORD flags; // The offset of the filename from the beginning of the list structure. // (char *)((char *)everything_list + everythinglist->name_offset) DWORD filename_offset; // The offset of the filename from the beginning of the list structure. // (char *)((char *)everything_list + everythinglist->path_offset) DWORD path_offset; }EVERYTHING_IPC_ITEMA; typedef struct EVERYTHING_IPC_LISTW { // the total number of folders found. DWORD totfolders; // the total number of files found. DWORD totfiles; // totfolders + totfiles DWORD totitems; // the number of folders available. DWORD numfolders; // the number of files available. DWORD numfiles; // the number of items available. DWORD numitems; // index offset of the first result in the item list. DWORD offset; // arbitrary sized item list. // use numitems to determine the actual number of items available. EVERYTHING_IPC_ITEMW items[1]; }EVERYTHING_IPC_LISTW; typedef struct EVERYTHING_IPC_LISTA { // the total number of folders found. DWORD totfolders; // the total number of files found. DWORD totfiles; // totfolders + totfiles DWORD totitems; // the number of folders available. DWORD numfolders; // the number of files available. DWORD numfiles; // the number of items available. DWORD numitems; // index offset of the first result in the item list. DWORD offset; // arbitrary sized item list. // use numitems to determine the actual number of items available. EVERYTHING_IPC_ITEMA items[1]; }EVERYTHING_IPC_LISTA; #ifdef UNICODE #define EVERYTHING_IPC_COPYDATAQUERY EVERYTHING_IPC_COPYDATAQUERYW #define EVERYTHING_IPC_ITEMFILENAME EVERYTHING_IPC_ITEMFILENAMEW #define EVERYTHING_IPC_ITEMPATH EVERYTHING_IPC_ITEMPATHW #define EVERYTHING_IPC_QUERY EVERYTHING_IPC_QUERYW #define EVERYTHING_IPC_ITEM EVERYTHING_IPC_ITEMW #define EVERYTHING_IPC_LIST EVERYTHING_IPC_LISTW #else #define EVERYTHING_IPC_COPYDATAQUERY EVERYTHING_IPC_COPYDATAQUERYA #define EVERYTHING_IPC_ITEMFILENAME EVERYTHING_IPC_ITEMFILENAMEA #define EVERYTHING_IPC_ITEMPATH EVERYTHING_IPC_ITEMPATHA #define EVERYTHING_IPC_QUERY EVERYTHING_IPC_QUERYA #define EVERYTHING_IPC_ITEM EVERYTHING_IPC_ITEMA #define EVERYTHING_IPC_LIST EVERYTHING_IPC_LISTA #endif // restore packing #pragma pack(pop) // end extern C #ifdef __cplusplus } #endif #endif // _EVERYTHING_H_ so, the reason for this posting is: it can be implemented in AutoIt3 
      I personally can run es.exe and get the results from the command line, that is I, with my knowing, now, some of you can make a beautiful UDF ( and I say some of you, because, I would not know where to start  )
      I use everything for everything, very handy tool. If you ever get to see it work, you'll see how handy it is, mostly if you have many terabytes of files ( or just plain can't remember where a file is at )
    • scintilla4evr
      _WinAPI_DwmEnableBlurBehindWindow for Windows 10
      By scintilla4evr
      Function for enabling Aero-like blur effect in Windows 10.
    • scintilla4evr
      _WinAPI_DwmEnableBlurBehindWindow in Windows 10
      By scintilla4evr
      Hello! As some of you probably know, _WinAPI_DwmEnableBlurBehindWindow does not work as you'd like it to work in Windows 10. It doesn't add Aero-like blur, as seen in the new Start menu or Notification Center. I looked for a solution and found "the most elegant" one:

      The blur only affects the inside of the window and it is not colored. It can be enabled via an undocumented SetWindowCompositionAttribute function in user32.dll.
      _WinAPI_DwmEnableBlurBehindWindow for Windows 10 - this archive contains both the UDF and the example.