read byte via DllCall

Get help with using AutoHotkey and its commands and hotkeys
User avatar
jeeswg
Posts: 5555
Joined: 19 Dec 2016, 01:58
Location: UK

read byte via DllCall

29 Nov 2018, 19:15

- I was curious as to whether there was a Winapi function that simply returns the value of a byte/a stream of bytes.
- I was looking at recreating NumGet and NumPut via DllCall.
- This function uses *, the dereference operator, to do NumGet, although that operator won't be available in AHK v2.
Choose naming and syntax for built-in Extract/InsertInteger - Page 2 - Suggestions - AutoHotkey Community
https://autohotkey.com/board/topic/1807 ... ntry118402
- Here's a bit of test code.

Code: Select all

q:: ;recreate NumPut
vText := "abc"
if A_IsUnicode
	DllCall("ntdll\RtlFillMemory", Ptr,&vText+2, UPtr,1, UChar,Ord("B"))
	, DllCall("ntdll\RtlFillMemory", Ptr,&vText+3, UPtr,1, UChar,0)
else
	DllCall("ntdll\RtlFillMemory", Ptr,&vText+1, UPtr,1, UChar,Ord("B"))
MsgBox, % vText
return

w:: ;recreate NumGet (without using the dereference operator *)
vText := "abc"
VarSetCapacity(vData, 4, 0)
DllCall("kernel32\RtlMoveMemory", Ptr,&vData, Ptr,&vText, UPtr,1)
MsgBox, % Ord(vData)
return

e:: ;recreate NumGet (without using the dereference operator *)
vText := "abc"
MsgBox, % Ord(StrGet(&vText, "CP0"))
MsgBox, % Ord(StrGet(&vText+1, "CP0"))
return
Helgef
Posts: 3418
Joined: 17 Jul 2016, 01:02
Contact:

Re: read byte via DllCall

30 Nov 2018, 09:04

Hello, I made this a puzzle.

Cheers.

Return to “Ask For Help”

Who is online

Users browsing this forum: AHKStudent, Bing [Bot], Gangass, nisha, steffn54 and 48 guests