Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add MINIDUMP_IO_CALLBACK to MINIDUMP_CALLBACK_INPUT #102

Open
AndyCyberSec opened this issue Jul 14, 2023 · 1 comment
Open

How to add MINIDUMP_IO_CALLBACK to MINIDUMP_CALLBACK_INPUT #102

AndyCyberSec opened this issue Jul 14, 2023 · 1 comment

Comments

@AndyCyberSec
Copy link

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

@khchen
Copy link
Owner

khchen commented Aug 14, 2023

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)[]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants