Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Crypt HexString To Binary
#1
Using Windows API in QM is convenient. I would like to convert the following AutoHotKey (AHK) code into QM code.

However, the function names include a path(crypt32\CryptStringToBinaryW), and I am unsure how to handle it.

Additionally, Is there simpler QM built-in function that can achieve the same functionality as the AHK code?

Thanks any suggestions and help in advance.
David
 
Code:
Copy      Help
CryptHexStringToBinary(hexString, &binary){
    DllCall("crypt32\CryptStringToBinaryW", "str", hexString, "uint", len := StrLen(hexString), "uint", 4, "ptr", 0, "uint*", &bytes := 0, "ptr", 0, "ptr", 0)
    return DllCall("crypt32\CryptStringToBinaryW", "str", hexString, "uint", len, "uint", 4, "ptr", binary := binary ?? Buffer(bytes), "uint*", bytes, "ptr", 0, "ptr", 0)
}
CryptHexStringToBinary("48B80000000000000000FFD0C3", &resBinary)
#2
looks like it uses this 
Code:
Copy      Help
WINAPI2.CryptStringToBinaryW

for more information on that function see
https://learn.microsoft.com/en-us/window...gtobinaryw

for winap2 see here
https://www.libreautomate.com/forum/show...21#pid5721
#3
kevin Thank you very much, this is exactly what I was looking for.

QM is much more concise and efficient than AHK in using Windows API.


Forum Jump:


Users browsing this thread: 1 Guest(s)