How to add MINIDUMP_IO_CALLBACK to MINIDUMP_CALLBACK_INPUT
AndyCyberSec opened this issue · comments
Andrea Bruschi commented
File: winim\inc\imagehlp.nim
Hello, I have a project where I am using MINIDUMP_CALLBACK_INPUT
MINIDUMP_CALLBACK_INPUT* {.pure, packed.} = object
ProcessId*: ULONG
ProcessHandle*: HANDLE
CallbackType*: ULONG
union1*: MINIDUMP_CALLBACK_INPUT_UNION1
Below the union
MINIDUMP_CALLBACK_INPUT_UNION1* {.pure, union.} = object
Thread*: MINIDUMP_THREAD_CALLBACK
ThreadEx*: MINIDUMP_THREAD_EX_CALLBACK
Module*: MINIDUMP_MODULE_CALLBACK
IncludeThread*: MINIDUMP_INCLUDE_THREAD_CALLBACK
IncludeModule*: MINIDUMP_INCLUDE_MODULE_CALLBACK
I am missing some stuff like MINIDUMP_IO_CALLBACK Io; the code below comes from microsoft documentation
typedef struct _MINIDUMP_CALLBACK_INPUT {
ULONG ProcessId;
HANDLE ProcessHandle;
ULONG CallbackType;
union {
HRESULT Status;
MINIDUMP_THREAD_CALLBACK Thread;
MINIDUMP_THREAD_EX_CALLBACK ThreadEx;
MINIDUMP_MODULE_CALLBACK Module;
MINIDUMP_INCLUDE_THREAD_CALLBACK IncludeThread;
MINIDUMP_INCLUDE_MODULE_CALLBACK IncludeModule;
MINIDUMP_IO_CALLBACK Io;
MINIDUMP_READ_MEMORY_FAILURE_CALLBACK ReadMemoryFailure;
ULONG SecondaryFlags;
MINIDUMP_VM_QUERY_CALLBACK VmQuery;
MINIDUMP_VM_PRE_READ_CALLBACK VmPreRead;
MINIDUMP_VM_POST_READ_CALLBACK VmPostRead;
};
} MINIDUMP_CALLBACK_INPUT, *PMINIDUMP_CALLBACK_INPUT;
How can I add the support to MINIDUMP_IO_CALLBACK?
thanks for your time
Ward commented
Here's how you can get it working:
import winim/[lean, inc/imagehlp]
type
MINIDUMP_IO_CALLBACK = object
Handle: HANDLE
Offset: ULONG64
Buffer: PVOID
BufferBytes: ULONG
PMINIDUMP_IO_CALLBACK = ptr MINIDUMP_IO_CALLBACK
var mci: MINIDUMP_CALLBACK_INPUT
doAssert(sizeof(mci.union1) > sizeof(MINIDUMP_IO_CALLBACK))
echo cast[PMINIDUMP_IO_CALLBACK](addr mci.union1)[]