[AHK_H v2] how to use ObjDump/Load(to disk) with password? Topic is solved

Ask for help, how to use AHK_H, etc.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

[AHK_H v2] how to use ObjDump/Load(to disk) with password?

20 Feb 2019, 04:53

Code: Select all

; _h v2 w64

Obj := {msg: 'hello world'}
PASS := 'MyPassword'
PATH := 'C:\DumpedObj.bin'

FileDelete(PATH)

; ObjDump: all modes + password
; ObjLoad: no size, no password
MsgBox '[Dump] Mode: blank + password'
MsgBox 'size: ' size := ObjDump(PATH, Obj, , PASS)
MsgBox 'msg: ' ObjLoad(PATH).msg ; reads key, but shouldnt
FileDelete(PATH)

MsgBox '[Dump] Mode: 0 + password'
MsgBox 'size: ' size := ObjDump(PATH, Obj, 0, PASS)
MsgBox 'msg: ' ObjLoad(PATH).msg ; reads key, but shouldnt
FileDelete(PATH)

MsgBox '[Dump] Mode: 1 + password'
MsgBox 'size: ' size := ObjDump(PATH, Obj, 1, PASS)
MsgBox 'msg: ' ObjLoad(PATH).msg ; reads key, but shouldnt
FileDelete(PATH)

; MsgBox '[Dump] Mode: 2 + password'
; MsgBox 'size: ' size := ObjDump(PATH, Obj, 2, PASS)
; MsgBox 'msg: ' ObjLoad(PATH).msg ; exception Out of Memory
; FileDelete(PATH)

; MsgBox '[Dump] Mode: 3 + password'
; MsgBox 'size: ' size := ObjDump(PATH, Obj, 3, PASS)
; MsgBox 'msg: ' ObjLoad(PATH).msg ; exception Out of Memory
; FileDelete(PATH)

MsgBox '[Load] different params'
MsgBox 'size: ' size := ObjDump(PATH, Obj, , PASS)
; MsgBox 'msg: ' ObjLoad(PATH, size, PASS).msg ; exception, Too Many Parameters Passed to Function
; MsgBox 'msg: ' ObjLoad(PATH, , PASS).msg ; exception, Too Many Parameters Passed to Function
MsgBox 'msg: ' ObjLoad(PATH, size).msg ; reads key, but shouldnt
can u show how this function is to be used?
if u dump with modes '', 0, 1, the object can be loaded anyway, without supplying a password. it is my understanding that this shouldnt be allowed
modes 2, 3 dont permit this, although the error message is a bit peculiar

if u try to ObjLoad() according to the signature in the docs:
OutputVar := ObjLoad(AddressOrPath , Size, Password)
u get "Too Many Parameters Passed to Function"

i think the error is in ObjRawLoad towards the end, when u do aObject->Invoke(....
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: [AHK_H v2] how to use ObjDump/Load(to disk) with password?

22 Feb 2019, 03:01

i think i had tried ObjLoad() with just the password and it didnt work

anyway, it still doesnt appear to be working now either:

Code: Select all

global Obj := {msg: 'hello world'}
global PASS := 'MyPassword'
global PATH := 'C:\DumpedObj.bin'

FileDelete(PATH)

MsgBox '[Dump] Mode: 2 + password'
MsgBox 'size: ' size := ObjDump(PATH, Obj, 2, PASS)
MsgBox 'msg: ' ObjLoad(PATH, PASS).msg ; exception Out of Memory
FileDelete(PATH)

MsgBox '[Dump] Mode: 3 + password'
MsgBox 'size: ' size := ObjDump(PATH, Obj, 3, PASS)
MsgBox 'msg: ' ObjLoad(PATH, PASS).msg ; exception Out of Memory
FileDelete(PATH)
ive updated _h v2 to d2865c6 (5 hrs ago)
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: [AHK_H v2] how to use ObjDump/Load(to disk) with password?

23 Feb 2019, 14:17

by the way, the last example works fine for loading the object back in, provided a correct password has been supplied.

if u give it the wrong password, though, sometimes it will throw "Out of Memory", sometimes it wont and just wont return an object. i havent been able to exactly pinpoint when either of those events are to occur.

what is the intended behavior when giving it wrong passwords?

Return to “Ask for Help”

Who is online

Users browsing this forum: No registered users and 16 guests