Synchronize with trunk revision 59636 (just before Alex's CreateProcess revamp).
[reactos.git] / dll / win32 / dbghelp / dbghelp_private.h
index 0e2aae7..19db405 100644 (file)
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
  */
 
+#define WIN32_NO_STATUS
+#define _INC_WINDOWS
+#define COM_NO_WINDOWS_H
+
 #include <stdarg.h>
-#include "windef.h"
-#include "winbase.h"
-#include "winver.h"
-#include "dbghelp.h"
-#include "objbase.h"
-#include "oaidl.h"
-#include "winnls.h"
-#include "wine/list.h"
-#include "wine/unicode.h"
-#include "wine/rbtree.h"
-
-#include "cvconst.h"
+
+#ifndef DBGHELP_STATIC_LIB
+#include <windef.h>
+#include <winbase.h>
+#include <winver.h>
+#include <dbghelp.h>
+#include <objbase.h>
+#include <cvconst.h>
+#include <wine/unicode.h>
+#else
+#include <string.h>
+#include "compat.h"
+#endif
+
+//#include "oaidl.h"
+//#include "winnls.h"
+#include <wine/list.h>
+#include <wine/rbtree.h>
+
 
 /* #define USE_STATS */
 
@@ -357,8 +368,6 @@ struct module
 {
     struct process*             process;
     IMAGEHLP_MODULEW64          module;
-    /* ANSI copy of module.ModuleName for efficiency */
-    char                        module_name[MAX_PATH];
     struct module*              next;
     enum module_type           type : 16;
     unsigned short              is_virtual : 1;
@@ -465,6 +474,55 @@ struct cpu_stack_walk
     } u;
 };
 
+struct dump_memory
+{
+    ULONG64                             base;
+    ULONG                               size;
+    ULONG                               rva;
+};
+
+struct dump_module
+{
+    unsigned                            is_elf;
+    ULONG64                             base;
+    ULONG                               size;
+    DWORD                               timestamp;
+    DWORD                               checksum;
+    WCHAR                               name[MAX_PATH];
+};
+
+struct dump_thread
+{
+    ULONG                               tid;
+    ULONG                               prio_class;
+    ULONG                               curr_prio;
+};
+
+struct dump_context
+{
+    /* process & thread information */
+    HANDLE                              hProcess;
+    DWORD                               pid;
+    unsigned                            flags_out;
+    /* thread information */
+    struct dump_thread*                 threads;
+    unsigned                            num_threads;
+    /* module information */
+    struct dump_module*                 modules;
+    unsigned                            num_modules;
+    unsigned                            alloc_modules;
+    /* exception information */
+    /* output information */
+    MINIDUMP_TYPE                       type;
+    HANDLE                              hFile;
+    RVA                                 rva;
+    struct dump_memory*                 mem;
+    unsigned                            num_mem;
+    unsigned                            alloc_mem;
+    /* callback information */
+    MINIDUMP_CALLBACK_INFORMATION*      cb;
+};
+
 enum cpu_addr {cpu_addr_pc, cpu_addr_stack, cpu_addr_frame};
 struct cpu
 {
@@ -488,6 +546,10 @@ struct cpu
     /* context related manipulation */
     void*       (*fetch_context_reg)(CONTEXT* context, unsigned regno, unsigned* size);
     const char* (*fetch_regname)(unsigned regno);
+
+    /* minidump per CPU extension */
+    BOOL        (*fetch_minidump_thread)(struct dump_context* dc, unsigned index, unsigned flags, const CONTEXT* ctx);
+    BOOL        (*fetch_minidump_module)(struct dump_context* dc, unsigned index, unsigned flags);
 };
 
 extern struct cpu*      dbghelp_current_cpu DECLSPEC_HIDDEN;
@@ -529,13 +591,16 @@ extern struct module*
 extern BOOL         macho_read_wine_loader_dbg_info(struct process* pcs) DECLSPEC_HIDDEN;
 extern BOOL         macho_synchronize_module_list(struct process* pcs) DECLSPEC_HIDDEN;
 
+/* minidump.c */
+void minidump_add_memory_block(struct dump_context* dc, ULONG64 base, ULONG size, ULONG rva);
+
 /* module.c */
 extern const WCHAR      S_ElfW[] DECLSPEC_HIDDEN;
 extern const WCHAR      S_WineLoaderW[] DECLSPEC_HIDDEN;
 extern const WCHAR      S_SlashW[] DECLSPEC_HIDDEN;
 
 extern struct module*
-                    module_find_by_addr(const struct process* pcs, unsigned long addr,
+                    module_find_by_addr(const struct process* pcs, DWORD64 addr,
                                         enum module_type type) DECLSPEC_HIDDEN;
 extern struct module*
                     module_find_by_nameW(const struct process* pcs,
@@ -617,13 +682,16 @@ extern BOOL         dwarf2_virtual_unwind(struct cpu_stack_walk* csw, DWORD_PTR
                                           CONTEXT* context, ULONG_PTR* cfa) DECLSPEC_HIDDEN;
 
 /* stack.c */
+#ifndef DBGHELP_STATIC_LIB
 extern BOOL         sw_read_mem(struct cpu_stack_walk* csw, DWORD64 addr, void* ptr, DWORD sz) DECLSPEC_HIDDEN;
+#endif
 extern DWORD64      sw_xlat_addr(struct cpu_stack_walk* csw, ADDRESS64* addr) DECLSPEC_HIDDEN;
 extern void*        sw_table_access(struct cpu_stack_walk* csw, DWORD64 addr) DECLSPEC_HIDDEN;
 extern DWORD64      sw_module_base(struct cpu_stack_walk* csw, DWORD64 addr) DECLSPEC_HIDDEN;
 
 /* symbol.c */
 extern const char*  symt_get_name(const struct symt* sym) DECLSPEC_HIDDEN;
+extern WCHAR*       symt_get_nameW(const struct symt* sym) DECLSPEC_HIDDEN;
 extern BOOL         symt_get_address(const struct symt* type, ULONG64* addr) DECLSPEC_HIDDEN;
 extern int          symt_cmp_addr(const void* p1, const void* p2) DECLSPEC_HIDDEN;
 extern void         copy_symbolW(SYMBOL_INFOW* siw, const SYMBOL_INFO* si) DECLSPEC_HIDDEN;