23#define NONAMELESSUNION
24#define NONAMELESSSTRUCT
27#define WIN32_NO_STATUS
44 ULONG buf_size = 0x1000;
46 void* pcs_buffer =
NULL;
52 pcs_buffer, buf_size,
NULL);
55 if (!pcs_buffer)
return FALSE;
67 dc->num_threads = spi->dwThreadCount;
69 dc->num_threads *
sizeof(
dc->threads[0]));
70 if (!
dc->threads)
goto failed;
71 for (
i = 0;
i <
dc->num_threads;
i++)
74 dc->threads[
i].prio_class = spi->ti[
i].dwBasePriority;
75 dc->threads[
i].curr_prio = spi->ti[
i].dwCurrentPriority;
140 mdThd->
Priority =
dc->threads[thd_idx].curr_prio;
168 if (
except->ClientPointers)
173 &ep,
sizeof(ep),
NULL);
175 &lctx,
sizeof(lctx),
NULL);
178 else pctx =
except->ExceptionPointers->ContextRecord;
201 dc->alloc_modules = 32;
203 dc->alloc_modules *
sizeof(*
dc->modules));
205 else if(
dc->num_modules >=
dc->alloc_modules)
207 dc->alloc_modules *= 2;
209 dc->alloc_modules *
sizeof(*
dc->modules));
213 dc->alloc_modules =
dc->num_modules = 0;
218 dc->modules[
dc->num_modules].name,
222 dc->modules[
dc->num_modules].base =
base;
223 dc->modules[
dc->num_modules].size =
size;
226 dc->modules[
dc->num_modules].is_elf = is_elf;
275 dc->alloc_mem64 = 32;
278 else if (
dc->num_mem64 >=
dc->alloc_mem64)
280 dc->alloc_mem64 *= 2;
282 dc->alloc_mem64 *
sizeof(*
dc->mem64));
286 dc->mem64[
dc->num_mem64].base =
base;
287 dc->mem64[
dc->num_mem64].size =
size;
290 else dc->num_mem64 =
dc->alloc_mem64 = 0;
331 memset(ffi, 0,
sizeof(*ffi));
362 else if (
dc->num_mem >=
dc->alloc_mem)
366 dc->alloc_mem *
sizeof(*
dc->mem));
372 dc->mem[
dc->num_mem].rva =
rva;
375 else dc->num_mem =
dc->alloc_mem = 0;
418 if (
except->ClientPointers)
423 except->ExceptionPointers, &ep,
sizeof(ep),
NULL);
433 prec =
except->ExceptionPointers->ExceptionRecord;
434 pctx =
except->ExceptionPointers->ContextRecord;
447 append(
dc, &mdExcpt,
sizeof(mdExcpt));
449 return sizeof(mdExcpt);
468 for (
i = nmod = 0;
i <
dc->num_modules;
i++)
470 if ((
dc->modules[
i].is_elf && dump_elf) ||
471 (!
dc->modules[
i].is_elf && !dump_elf))
488 for (
i = 0;
i <
dc->num_modules;
i++)
490 if ((
dc->modules[
i].is_elf && !dump_elf) ||
491 (!
dc->modules[
i].is_elf && dump_elf))
503 FIXME(
"Buffer overflow!!!\n");
527 if (!
dc->cb->CallbackRoutine(
dc->cb->CallbackParam, &cbin, &cbout))
568 "movl 12(%esp),%eax\n\t"
569 "movl 16(%esp),%esi\n\t"
571 "movl %eax,(%esi)\n\t"
572 "movl %ebx,4(%esi)\n\t"
573 "movl %ecx,8(%esi)\n\t"
574 "movl %edx,12(%esi)\n\t"
583 "xorl $0x00200000,(%esp)\
n\
t"
589 "andl $0x00200000,%
eax\
n\
t"
609 return (((CallerFlags ^
Flags) >> 21) & 1) ^ 1;
635 DWORD wine_extra = 0;
637 const char *(
CDECL *wine_get_build_id)(
void);
638 void (
CDECL *wine_get_host_version)(
const char **sysname,
const char **release);
639 const char* build_id =
NULL;
640 const char* sys_name =
NULL;
641 const char* release_name =
NULL;
649 if (wine_get_build_id && wine_get_host_version)
652 wine_extra = 4 + 4 *
sizeof(slen);
653 build_id = wine_get_build_id();
654 wine_get_host_version(&sys_name, &release_name);
674 unsigned regs0[4], regs1[4];
684 if (regs0[1] == 0x68747541 &&
685 regs0[3] == 0x69746e65 &&
686 regs0[2] == 0x444d4163 )
689 if (regs1[0] >= 0x80000001)
708 append(
dc, &mdSysInfo,
sizeof(mdSysInfo));
713 static const char code[] = {
'W',
'I',
'N',
'E'};
720 slen = 4 *
sizeof(
DWORD);
722 slen +=
strlen(build_id) + 1;
724 slen +=
strlen(sys_name) + 1;
729 dc->rva += wine_extra;
737 dc->rva +=
sizeof(
ULONG) + slen;
739 return sizeof(mdSysInfo);
762 for (
i = 0;
i <
dc->num_threads;
i++)
790 if (!
dc->cb->CallbackRoutine(
dc->cb->CallbackParam, &cbin, &cbout))
813 &mdThd,
sizeof(mdThd));
847 for (
i = 0;
i <
dc->num_mem;
i++)
853 for (
pos = 0;
pos <
dc->mem[
i].size;
pos +=
sizeof(tmp))
860 writeat(
dc, rva_base +
i *
sizeof(mdMem), &mdMem,
sizeof(mdMem));
888 dc->num_mem64 *
sizeof(mdMem64);
899 dc->rva +=
dc->num_mem64 *
sizeof(mdMem64);
904 for (
i = 0;
i <
dc->num_mem64;
i++)
909 for (
pos = 0;
pos <
dc->mem64[
i].size;
pos +=
sizeof(tmp))
916 writeat(
dc, rva_base +
i *
sizeof(mdMem64), &mdMem64,
sizeof(mdMem64));
959 WARN(
"failed to initialize process\n");
969 dc.alloc_modules = 0;
972 dc.cb = CallbackParam;
986 nStreams = 6 + (ExceptionParam ? 1 : 0) +
993 FIXME(
"NIY MiniDumpWithDataSegs\n");
995 FIXME(
"NIY MiniDumpWithHandleData\n");
997 FIXME(
"NIY MiniDumpFilterMemory\n");
999 FIXME(
"NIY MiniDumpScanMemory\n");
1009 append(&
dc, &mdHead,
sizeof(mdHead));
1022 &mdDir,
sizeof(mdDir));
1028 &mdDir,
sizeof(mdDir));
1034 &mdDir,
sizeof(mdDir));
1040 &mdDir,
sizeof(mdDir));
1049 &mdDir,
sizeof(mdDir));
1056 &mdDir,
sizeof(mdDir));
1065 &mdDir,
sizeof(mdDir));
1069 if (UserStreamParam)
1077 &mdDir,
sizeof(mdDir));
1092 &mdDir,
sizeof(mdDir));
1100 if (sym_initialized)
1130 if (
dir->StreamType == str_idx)
1132 if (pdir) *pdir =
dir;
ACPI_SIZE strlen(const char *String)
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
void user(int argc, const char *argv[])
#define MINIDUMP_SIGNATURE
#define MINIDUMP_MISC1_PROCESS_ID
static BOOL read_process_memory(const struct process *process, UINT64 addr, void *buf, size_t size)
BOOL pe_load_nt_header(HANDLE hProc, DWORD64 base, IMAGE_NT_HEADERS *nth) DECLSPEC_HIDDEN
static const WCHAR backslashW[]
static cab_ULONG checksum(const cab_UBYTE *data, cab_UWORD bytes, cab_ULONG csum)
#define ReadProcessMemory(a, b, c, d, e)
#define ERROR_INVALID_PARAMETER
#define GetModuleFileNameExW(w, x, y, z)
enum _MINIDUMP_TYPE MINIDUMP_TYPE
BOOL WINAPI SymCleanup(HANDLE hProcess)
#define GetProcAddress(x, y)
#define HeapFree(x, y, z)
@ ThreadWriteInstructionWindow
@ MiniDumpWithProcessThreadData
BOOL WINAPI SymInitializeW(HANDLE hProcess, PCWSTR UserSearchPath, BOOL fInvadeProcess)
BOOL validate_addr64(DWORD64 addr)
struct process * process_find_by_handle(HANDLE hProcess)
struct cpu * dbghelp_current_cpu
BOOL WINAPI EnumerateLoadedModulesW64(HANDLE hProcess, PENUMLOADED_MODULES_CALLBACKW64 EnumLoadedModulesCallback, PVOID UserContext)
BOOL WINAPI SetFilePointerEx(HANDLE hFile, LARGE_INTEGER liDistanceToMove, PLARGE_INTEGER lpNewFilePointer, DWORD dwMoveMethod)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
HMODULE WINAPI DECLSPEC_HOTPATCH GetModuleHandleA(LPCSTR lpModuleName)
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
BOOL WINAPI IsProcessorFeaturePresent(IN DWORD ProcessorFeature)
DWORD WINAPI ResumeThread(IN HANDLE hThread)
DWORD WINAPI SuspendThread(IN HANDLE hThread)
HANDLE WINAPI OpenThread(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwThreadId)
BOOL WINAPI GetThreadContext(IN HANDLE hThread, OUT LPCONTEXT lpContext)
BOOL WINAPI GetVersionExW(IN LPOSVERSIONINFOW lpVersionInformation)
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
@ SystemProcessInformation
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLenum const GLvoid * addr
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
PPC_QUAL void __cpuid(int CPUInfo[], const int InfoType)
__INTRIN_INLINE void __writeeflags(uintptr_t Value)
__INTRIN_INLINE uintptr_t __readeflags(void)
_In_ BOOL _In_ HANDLE hProcess
static BOOL fetch_host_module_info_cb(const WCHAR *name, ULONG_PTR base, void *user)
static unsigned dump_memory64_info(struct dump_context *dc)
void minidump_add_memory_block(struct dump_context *dc, ULONG64 base, ULONG size, ULONG rva)
static unsigned dump_misc_info(struct dump_context *dc)
BOOL WINAPI MiniDumpReadDumpStream(PVOID base, ULONG str_idx, PMINIDUMP_DIRECTORY *pdir, PVOID *stream, ULONG *size)
static void fetch_modules_info(struct dump_context *dc)
static void writeat(struct dump_context *dc, RVA rva, const void *data, unsigned size)
static BOOL fetch_process_info(struct dump_context *dc)
static BOOL add_module(struct dump_context *dc, const WCHAR *name, DWORD64 base, DWORD size, DWORD timestamp, DWORD checksum, BOOL is_elf)
static unsigned dump_threads(struct dump_context *dc, const MINIDUMP_EXCEPTION_INFORMATION *except)
static void fetch_module_versioninfo(LPCWSTR filename, VS_FIXEDFILEINFO *ffi)
static unsigned dump_modules(struct dump_context *dc, BOOL dump_elf)
BOOL WINAPI MiniDumpWriteDump(HANDLE hProcess, DWORD pid, HANDLE hFile, MINIDUMP_TYPE DumpType, PMINIDUMP_EXCEPTION_INFORMATION ExceptionParam, PMINIDUMP_USER_STREAM_INFORMATION UserStreamParam, PMINIDUMP_CALLBACK_INFORMATION CallbackParam)
static void minidump_add_memory64_block(struct dump_context *dc, ULONG64 base, ULONG64 size)
static BOOL WINAPI fetch_pe_module_info_cb(PCWSTR name, DWORD64 base, ULONG size, PVOID user)
static BOOL fetch_thread_info(struct dump_context *dc, int thd_idx, const MINIDUMP_EXCEPTION_INFORMATION *except, MINIDUMP_THREAD *mdThd, CONTEXT *ctx)
static void fetch_thread_stack(struct dump_context *dc, const void *teb_addr, const CONTEXT *ctx, MINIDUMP_MEMORY_DESCRIPTOR *mmd)
static unsigned dump_exception_info(struct dump_context *dc, const MINIDUMP_EXCEPTION_INFORMATION *except)
static void fetch_memory64_info(struct dump_context *dc)
static void append(struct dump_context *dc, const void *data, unsigned size)
static void do_x86cpuid(unsigned int ax, unsigned int *p)
static int have_x86cpuid(void)
static unsigned dump_system_info(struct dump_context *dc)
static unsigned dump_memory_info(struct dump_context *dc)
#define memcpy(s1, s2, n)
#define __ASM_GLOBAL_FUNC(name, code)
#define THREAD_ALL_ACCESS
#define VER_SUITE_TERMINAL
NTSTATUS NTAPI NtQueryInformationThread(IN HANDLE ThreadHandle, IN THREADINFOCLASS ThreadInformationClass, OUT PVOID ThreadInformation, IN ULONG ThreadInformationLength, OUT PULONG ReturnLength OPTIONAL)
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
MINIDUMP_LOCATION_DESCRIPTOR ThreadContext
MINIDUMP_EXCEPTION ExceptionRecord
PEXCEPTION_RECORD ExceptionRecord
struct _EXCEPTION_RECORD * ExceptionRecord
ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
MINIDUMP_LOCATION_DESCRIPTOR Location
ULONG64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS]
ULONG64 NumberOfMemoryRanges
ULONG64 StartOfMemoryRange
ULONG64 StartOfMemoryRange
MINIDUMP_LOCATION_DESCRIPTOR Memory
ULONG NumberOfMemoryRanges
VS_FIXEDFILEINFO VersionInfo
union _MINIDUMP_SYSTEM_INFO::_CPU_INFORMATION Cpu
USHORT ProcessorArchitecture
MINIDUMP_LOCATION_DESCRIPTOR ThreadContext
MINIDUMP_MEMORY_DESCRIPTOR Stack
ULONG dwOSVersionInfoSize
DWORD dwNumberOfProcessors
WORD wProcessorArchitecture
VOID DumpType(DWORD dwTypeIndex, PENUMINFO pei, INT indent, BOOL bMembers)
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl edx movl TEMP incl eax andl eax ecx incl ebx testl eax jnz xchgl ecx incl TEMP esp ecx subl ebx pushl ecx ecx edx ecx shrl ecx mm0 mm4 mm0 mm4 mm1 mm5 mm1 mm5 mm2 mm6 mm2 mm6 mm3 mm7 mm3 mm7 paddd mm0 paddd mm4 paddd mm0 paddd mm4 paddd mm0 paddd mm4 movq mm1 movq mm5 psrlq mm1 psrlq mm5 paddd mm0 paddd mm4 psrad mm0 psrad mm4 packssdw mm0 packssdw mm4 mm1 punpckldq mm0 pand mm1 pand mm0 por mm1 movq edi esi edx edi decl ecx jnz popl ecx andl ecx jecxz mm0 mm0 mm1 mm1 mm2 mm2 mm3 mm3 paddd mm0 paddd mm0 paddd mm0 movq mm1 psrlq mm1 paddd mm0 psrad mm0 packssdw mm0 movd eax movw ax
ecx edi movl ebx edx edi decl ecx esi eax jecxz decl eax andl eax esi movl eax
#define FIELD_OFFSET(t, f)
#define STATUS_INFO_LENGTH_MISMATCH
_In_ WDFREQUEST _In_ PIO_STACK_LOCATION Stack
SIZE_T NTAPI VirtualQueryEx(IN HANDLE hProcess, IN LPCVOID lpAddress, OUT PMEMORY_BASIC_INFORMATION lpBuffer, IN SIZE_T dwLength)
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetCurrentThreadId(void)
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
_Must_inspect_result_ _In_ ULONG Flags
#define VER_NT_WORKSTATION