1 (изменено: MandarinKa02, 2017-12-21 19:46:49)

Тема: AHK: бинарная строка

Привет форум. Помогите пожалуйста с бинарной строкой. Не могу её впихнуть в bData с offset'oм 24.
Может не правильно перекодирую, точно не знаю.


sText := "{hi}{im info:)}"
aSockets%i%_iPackets  := 1337
iLength := StrPut(sText, &bText, "CP0")
msgbox % iLength
VarSetCapacity(bData, 24 + iLength, 0)
NumPut(aSockets%i%_iPackets, bData, 0, "int64")
NumPut(1, bData, 8, "int64")
NumPut(iLength, bData, 16, "int64")


CopyBinData(&bText, &bData + 24, iLength)
Msgbox % NumGet(bData, 0, "int64") "`n" NumGet(bData, 8, "int64") "`n" NumGet(bData, 16, "int64") "`n" StrGet(&bData, "UTF-16")
Msgbox End
Reload


CopyBinData(ptrSource, ptrDestination, iLength) {
	If iLength ;Only do it if there's anything to copy
		DllCall("RtlMoveMemory", "Ptr", ptrDestination, "Ptr", ptrSource, "UInt", iLength)
}

2

Re: AHK: бинарная строка

А в какой кодировке вам нужно поместить строку?

Разработка AHK-скриптов:
e-mail dfiveg@mail.ru
Telegram jollycoder

3

Re: AHK: бинарная строка


sText := "{hi}{im info:)}"
aSockets%i%_iPackets  := 1337
iLength := StrPut(sText, "CP0")
msgbox % iLength
VarSetCapacity(bText, iLength, 0)
StrPut(sText, &bText, "CP0")
VarSetCapacity(bData, 24 + iLength, 0)
NumPut(aSockets%i%_iPackets, bData, 0, "int64")
NumPut(1, bData, 8, "int64")
NumPut(iLength, bData, 16, "int64")

CopyBinData(&bText, &bData + 24, iLength)
Msgbox % NumGet(bData, 0, "int64") "`n" NumGet(bData, 8, "int64") "`n" NumGet(bData, 16, "int64") "`n" StrGet(&bData + 24, "CP0")
Msgbox End
Reload


CopyBinData(ptrSource, ptrDestination, iLength) {
    If iLength ;Only do it if there's anything to copy
        DllCall("RtlMoveMemory", "Ptr", ptrDestination, "Ptr", ptrSource, "UInt", iLength)
}

4 (изменено: ypppu, 2017-12-21 19:05:28)

Re: AHK: бинарная строка

YMP, Спасибо!

5 (изменено: MandarinKa02, 2017-12-21 19:46:37)

Re: AHK: бинарная строка

teadrinker, уже ответили. А вообще мне все равно в какой, мне лишь бы пример показать, а дальше и сам разберусь. Спасибо.