ReactOS  0.4.15-dev-1150-g593bcce
dbghelp.c File Reference
#include <unistd.h>
#include "dbghelp_private.h"
#include "winternl.h"
#include "winerror.h"
#include "psapi.h"
#include "wine/debug.h"
#include "wdbgexts.h"
#include "winnls.h"
Include dependency graph for dbghelp.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (dbghelp)
 
BOOL WINAPI DllMain (HINSTANCE instance, DWORD reason, LPVOID reserved)
 
struct processprocess_find_by_handle (HANDLE hProcess)
 
BOOL validate_addr64 (DWORD64 addr)
 
voidfetch_buffer (struct process *pcs, unsigned size)
 
const charwine_dbgstr_addr (const ADDRESS64 *addr)
 
struct cpucpu_find (DWORD machine)
 
BOOL WINAPI SymSetSearchPathW (HANDLE hProcess, PCWSTR searchPath)
 
BOOL WINAPI SymSetSearchPath (HANDLE hProcess, PCSTR searchPath)
 
BOOL WINAPI SymGetSearchPathW (HANDLE hProcess, PWSTR szSearchPath, DWORD SearchPathLength)
 
BOOL WINAPI SymGetSearchPath (HANDLE hProcess, PSTR szSearchPath, DWORD SearchPathLength)
 
static BOOL WINAPI process_invade_cb (PCWSTR name, ULONG64 base, ULONG size, PVOID user)
 
const WCHARprocess_getenv (const struct process *process, const WCHAR *name)
 
static BOOL check_live_target (struct process *pcs)
 
BOOL WINAPI SymInitializeW (HANDLE hProcess, PCWSTR UserSearchPath, BOOL fInvadeProcess)
 
BOOL WINAPI SymInitialize (HANDLE hProcess, PCSTR UserSearchPath, BOOL fInvadeProcess)
 
BOOL WINAPI SymCleanup (HANDLE hProcess)
 
DWORD WINAPI SymSetOptions (DWORD opts)
 
DWORD WINAPI SymGetOptions (void)
 
BOOL WINAPI SymSetExtendedOption (IMAGEHLP_EXTENDED_OPTIONS option, BOOL value)
 
BOOL WINAPI SymGetExtendedOption (IMAGEHLP_EXTENDED_OPTIONS option)
 
BOOL WINAPI SymSetParentWindow (HWND hwnd)
 
BOOL WINAPI SymSetContext (HANDLE hProcess, PIMAGEHLP_STACK_FRAME StackFrame, PIMAGEHLP_CONTEXT Context)
 
static BOOL CALLBACK reg_cb64to32 (HANDLE hProcess, ULONG action, ULONG64 data, ULONG64 user)
 
BOOL pcs_callback (const struct process *pcs, ULONG action, void *data)
 
static BOOL sym_register_cb (HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 cb, PSYMBOL_REGISTERED_CALLBACK cb32, DWORD64 user, BOOL unicode)
 
BOOL WINAPI SymRegisterCallback (HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK CallbackFunction, PVOID UserContext)
 
BOOL WINAPI SymRegisterCallback64 (HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ULONG64 UserContext)
 
BOOL WINAPI SymRegisterCallbackW64 (HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 CallbackFunction, ULONG64 UserContext)
 
LPAPI_VERSION WINAPI ImagehlpApiVersion (VOID)
 
LPAPI_VERSION WINAPI ImagehlpApiVersionEx (LPAPI_VERSION AppVersion)
 
LPEXT_API_VERSION WINAPI ExtensionApiVersion (void)
 
void WINAPI WinDbgExtensionDllInit (PWINDBG_EXTENSION_APIS lpExtensionApis, unsigned short major, unsigned short minor)
 
DWORD calc_crc32 (HANDLE handle)
 

Variables

unsigned dbghelp_options = SYMOPT_UNDNAME
 
BOOL dbghelp_opt_native = FALSE
 
SYSTEM_INFO sysinfo
 
static struct processprocess_first
 
struct cpu cpu_i386 cpu_x86_64 cpu_arm cpu_arm64
 
static struct cpudbghelp_cpus [] = {&cpu_i386, &cpu_x86_64, &cpu_arm, &cpu_arm64, NULL}
 
struct cpudbghelp_current_cpu =
 
static API_VERSION api_version = { 4, 0, 2, 0 }
 

Function Documentation

◆ calc_crc32()

DWORD calc_crc32 ( HANDLE  handle)

Definition at line 848 of file dbghelp.c.

849 {
850  BYTE buffer[8192];
851  DWORD crc = 0;
852  DWORD len;
853 
855  while (ReadFile(handle, buffer, sizeof(buffer), &len, NULL) && len)
856  crc = RtlComputeCrc32(crc, buffer, len);
857  return crc;
858 }
GLuint buffer
Definition: glext.h:5915
#define FILE_BEGIN
Definition: compat.h:509
smooth NULL
Definition: ftsmooth.c:416
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: xxhash.c:193
#define RtlComputeCrc32
Definition: compat.h:558
#define ReadFile(a, b, c, d, e)
Definition: compat.h:490
#define SetFilePointer
Definition: compat.h:491

Referenced by elf_fetch_file_info(), elf_load_file_from_fmap(), image_check_debug_link(), macho_fetch_file_info(), and macho_load_file().

◆ check_live_target()

static BOOL check_live_target ( struct process pcs)
static

Definition at line 306 of file dbghelp.c.

307 {
309  ULONG_PTR base = 0, env = 0;
310 
311  if (!GetProcessId(pcs->handle)) return FALSE;
312  if (GetEnvironmentVariableA("DBGHELP_NOLIVE", NULL, 0)) return FALSE;
313 
315  &pbi, sizeof(pbi), NULL ))
316  return FALSE;
317 
318  if (!pcs->is_64bit)
319  {
320  DWORD env32;
321  PEB32 peb32;
322  C_ASSERT(sizeof(void*) != 4 || FIELD_OFFSET(RTL_USER_PROCESS_PARAMETERS, Environment) == 0x48);
323  if (!ReadProcessMemory(pcs->handle, pbi.PebBaseAddress, &peb32, sizeof(peb32), NULL)) return FALSE;
324  base = peb32.Reserved[0];
325  if (read_process_memory(pcs, peb32.ProcessParameters + 0x48, &env32, sizeof(env32))) env = env32;
326  }
327  else
328  {
329  PEB peb;
330  if (!ReadProcessMemory(pcs->handle, pbi.PebBaseAddress, &peb, sizeof(peb), NULL)) return FALSE;
331  base = peb.Reserved[0];
333  }
334 
335 #ifdef __REACTOS__
336  /* Wine store their loader base address in peb.reserved[0] and load its symbol from there.
337  * ReactOS does not care about it, we are just happy if we managed to read the value */
338  base = 1;
339 #endif
340 
341  /* read debuggee environment block */
342  if (env)
343  {
344  size_t buf_size = 0, i, last_null = -1;
345  WCHAR *buf = NULL;
346 
347  do
348  {
349  size_t read_size = sysinfo.dwAllocationGranularity - (env & (sysinfo.dwAllocationGranularity - 1));
350  if (buf)
351  {
352  WCHAR *new_buf;
353  if (!(new_buf = realloc(buf, buf_size + read_size))) break;
354  buf = new_buf;
355  }
356  else if(!(buf = malloc(read_size))) break;
357 
358  if (!read_process_memory(pcs, env, (char*)buf + buf_size, read_size)) break;
359  for (i = buf_size / sizeof(WCHAR); i < (buf_size + read_size) / sizeof(WCHAR); i++)
360  {
361  if (buf[i]) continue;
362  if (last_null + 1 == i)
363  {
364  pcs->environment = realloc(buf, (i + 1) * sizeof(WCHAR));
365  buf = NULL;
366  break;
367  }
368  last_null = i;
369  }
370  env += read_size;
371  buf_size += read_size;
372  }
373  while (buf);
374  free(buf);
375  }
376 
377  if (!base) return FALSE;
378 
379  TRACE("got debug info address %#lx from PEB %p\n", base, pbi.PebBaseAddress);
380 #ifndef __REACTOS__
382  WARN("couldn't load process debug info at %#lx\n", base);
383 #endif
384  return TRUE;
385 }
#define realloc
Definition: debug_ros.c:6
PVOID PVOID PWCHAR PVOID Environment
Definition: env.c:45
DWORD dwAllocationGranularity
Definition: winbase.h:1145
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define TRUE
Definition: types.h:120
#define free
Definition: debug_ros.c:5
#define WARN(fmt,...)
Definition: debug.h:112
NTSTATUS NTAPI NtQueryInformationProcess(IN HANDLE ProcessHandle, IN PROCESSINFOCLASS ProcessInformationClass, OUT PVOID ProcessInformation, IN ULONG ProcessInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: query.c:59
#define ReadProcessMemory(a, b, c, d, e)
Definition: compat.h:506
PRTL_USER_PROCESS_PARAMETERS ProcessParameters
Definition: btrfs_drv.h:1959
uint32_t ULONG_PTR
Definition: typedefs.h:65
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
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
WCHAR * environment
smooth NULL
Definition: ftsmooth.c:416
_Inout_ PERBANDINFO * pbi
Definition: winddi.h:3917
#define C_ASSERT(e)
Definition: intsafe.h:71
#define TRACE(s)
Definition: solgame.cpp:4
#define GetEnvironmentVariableA(x, y, z)
Definition: compat.h:502
__wchar_t WCHAR
Definition: xmlstorage.h:180
SYSTEM_INFO sysinfo
Definition: dbghelp.c:76
unsigned long DWORD
Definition: ntddk_ex.h:95
ULONG Reserved[2]
ULONG Reserved[2]
Definition: winternl.h:310
#define FIELD_OFFSET(t, f)
Definition: typedefs.h:255
static LPCWSTR LPCWSTR LPCWSTR env
Definition: db.cpp:168
HANDLE handle
BOOL macho_read_wine_loader_dbg_info(struct process *pcs, ULONG_PTR addr) DECLSPEC_HIDDEN
#define malloc
Definition: debug_ros.c:4
DWORD ProcessParameters
DWORD WINAPI GetProcessId(IN HANDLE Process)
Definition: proc.c:1200
static BOOL read_process_memory(const struct process *process, UINT64 addr, void *buf, size_t size)
BOOL elf_read_wine_loader_dbg_info(struct process *pcs, ULONG_PTR addr) DECLSPEC_HIDDEN
Definition: elf_module.c:1753

Referenced by SymInitializeW().

◆ cpu_find()

struct cpu* cpu_find ( DWORD  machine)

Definition at line 183 of file dbghelp.c.

184 {
185  struct cpu** cpu;
186 
187  for (cpu = dbghelp_cpus ; *cpu; cpu++)
188  {
189  if (cpu[0]->machine == machine) return cpu[0];
190  }
191  return NULL;
192 }
smooth NULL
Definition: ftsmooth.c:416
static const char machine[]
Definition: profile.c:104
static struct cpu * dbghelp_cpus[]
Definition: dbghelp.c:164

Referenced by StackWalk(), and StackWalk64().

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  instance,
DWORD  reason,
LPVOID  reserved 
)

Definition at line 82 of file dbghelp.c.

83 {
84  switch (reason)
85  {
86  case DLL_PROCESS_ATTACH:
89  break;
90  }
91  return TRUE;
92 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
SYSTEM_INFO sysinfo
Definition: dbghelp.c:76
static WCHAR reason[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1904
static HINSTANCE instance
Definition: main.c:40
VOID WINAPI GetSystemInfo(IN LPSYSTEM_INFO lpSystemInfo)
Definition: sysinfo.c:142

◆ ExtensionApiVersion()

LPEXT_API_VERSION WINAPI ExtensionApiVersion ( void  )

Definition at line 834 of file dbghelp.c.

835 {
836  static EXT_API_VERSION eav = {5, 5, 5, 0};
837  return &eav;
838 }

◆ fetch_buffer()

void* fetch_buffer ( struct process pcs,
unsigned  size 
)

Definition at line 128 of file dbghelp.c.

129 {
130  if (size > pcs->buffer_size)
131  {
132  if (pcs->buffer)
133  pcs->buffer = HeapReAlloc(GetProcessHeap(), 0, pcs->buffer, size);
134  else
135  pcs->buffer = HeapAlloc(GetProcessHeap(), 0, size);
136  pcs->buffer_size = (pcs->buffer) ? size : 0;
137  }
138  return pcs->buffer;
139 }
unsigned buffer_size
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
void * buffer
#define HeapReAlloc
Definition: compat.h:482

Referenced by copy_line_W64_from_64(), and symt_fill_func_line_info().

◆ ImagehlpApiVersion()

LPAPI_VERSION WINAPI ImagehlpApiVersion ( VOID  )

Definition at line 811 of file dbghelp.c.

812 {
813  return &api_version;
814 }
static API_VERSION api_version
Definition: dbghelp.c:806

Referenced by init_dbghelp_version().

◆ ImagehlpApiVersionEx()

LPAPI_VERSION WINAPI ImagehlpApiVersionEx ( LPAPI_VERSION  AppVersion)

Definition at line 819 of file dbghelp.c.

820 {
821  if (!AppVersion) return NULL;
822 
823  AppVersion->MajorVersion = api_version.MajorVersion;
824  AppVersion->MinorVersion = api_version.MinorVersion;
825  AppVersion->Revision = api_version.Revision;
826  AppVersion->Reserved = api_version.Reserved;
827 
828  return AppVersion;
829 }
USHORT MajorVersion
Definition: compat.h:1319
USHORT MinorVersion
Definition: compat.h:1320
static API_VERSION api_version
Definition: dbghelp.c:806
USHORT Revision
Definition: compat.h:1321
smooth NULL
Definition: ftsmooth.c:416
USHORT Reserved
Definition: compat.h:1322

◆ pcs_callback()

BOOL pcs_callback ( const struct process pcs,
ULONG  action,
void data 
)

Definition at line 705 of file dbghelp.c.

706 {
708 
709  TRACE("%p %u %p\n", pcs, action, data);
710 
711  if (!pcs->reg_cb) return FALSE;
712  if (!pcs->reg_is_unicode)
713  {
715 
716  switch (action)
717  {
718  case CBA_DEBUG_INFO:
720  case CBA_SET_OPTIONS:
722  break;
727  idslW = data;
728  idsl.SizeOfStruct = sizeof(idsl);
729  idsl.BaseOfImage = idslW->BaseOfImage;
730  idsl.CheckSum = idslW->CheckSum;
731  idsl.TimeDateStamp = idslW->TimeDateStamp;
732  WideCharToMultiByte(CP_ACP, 0, idslW->FileName, -1,
733  idsl.FileName, sizeof(idsl.FileName), NULL, NULL);
734  idsl.Reparse = idslW->Reparse;
735  data = &idsl;
736  break;
738  case CBA_EVENT:
739  case CBA_READ_MEMORY:
740  default:
741  FIXME("No mapping for action %u\n", action);
742  return FALSE;
743  }
744  }
745  return pcs->reg_cb(pcs->handle, action, (ULONG64)(DWORD_PTR)data, pcs->reg_user);
746 }
#define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE
Definition: compat.h:725
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
#define CBA_EVENT
Definition: compat.h:732
WCHAR FileName[MAX_PATH+1]
Definition: compat.h:915
#define CBA_READ_MEMORY
Definition: compat.h:729
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
#define CBA_DEFERRED_SYMBOL_LOAD_FAILURE
Definition: compat.h:726
#define CBA_SYMBOLS_UNLOADED
Definition: compat.h:727
DWORD64 reg_user
#define TRACE(s)
Definition: solgame.cpp:4
PSYMBOL_REGISTERED_CALLBACK64 reg_cb
#define CBA_DEBUG_INFO
Definition: compat.h:734
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned __int64 ULONG64
Definition: imports.h:198
#define CBA_DUPLICATE_SYMBOL
Definition: compat.h:728
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL
Definition: compat.h:733
const WCHAR * action
Definition: action.c:7783
#define CBA_DEFERRED_SYMBOL_LOAD_START
Definition: compat.h:724
#define CBA_SET_OPTIONS
Definition: compat.h:731
HANDLE handle
#define CBA_DEFERRED_SYMBOL_LOAD_CANCEL
Definition: compat.h:730
BOOL reg_is_unicode

Referenced by module_get_debug(), and SymSetOptions().

◆ process_find_by_handle()

◆ process_getenv()

const WCHAR* process_getenv ( const struct process process,
const WCHAR name 
)

Definition at line 285 of file dbghelp.c.

286 {
287  size_t name_len;
288  const WCHAR *iter;
289 
290  if (!process->environment) return NULL;
291  name_len = lstrlenW(name);
292 
293  for (iter = process->environment; *iter; iter += lstrlenW(iter) + 1)
294  {
295  if (!wcsnicmp(iter, name, name_len) && iter[name_len] == '=')
296  return iter + name_len + 1;
297  }
298 
299  return NULL;
300 }
#define lstrlenW
Definition: compat.h:498
WCHAR * environment
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define wcsnicmp
Definition: compat.h:14
Definition: name.c:38

Referenced by elf_search_and_load_file(), macho_search_and_load_file(), and search_dll_path().

◆ process_invade_cb()

static BOOL WINAPI process_invade_cb ( PCWSTR  name,
ULONG64  base,
ULONG  size,
PVOID  user 
)
static

Definition at line 273 of file dbghelp.c.

274 {
275  WCHAR tmp[MAX_PATH];
276  HANDLE hProcess = user;
277 
279  lstrcpynW(tmp, name, ARRAY_SIZE(tmp));
280 
281  SymLoadModuleExW(hProcess, 0, tmp, name, base, size, NULL, 0);
282  return TRUE;
283 }
DWORD64 WINAPI SymLoadModuleExW(HANDLE, HANDLE, PCWSTR, PCWSTR, DWORD64, DWORD, PMODLOAD_DATA, DWORD)
Definition: module.c:796
#define TRUE
Definition: types.h:120
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define lstrcpynW
Definition: compat.h:486
#define GetModuleFileNameExW(w, x, y, z)
Definition: compat.h:670
smooth NULL
Definition: ftsmooth.c:416
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:34
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define ARRAY_SIZE(a)
Definition: main.h:24
Definition: name.c:38
void user(int argc, const char *argv[])
Definition: cmds.c:1350

Referenced by SymInitializeW().

◆ reg_cb64to32()

static BOOL CALLBACK reg_cb64to32 ( HANDLE  hProcess,
ULONG  action,
ULONG64  data,
ULONG64  user 
)
static

Definition at line 661 of file dbghelp.c.

662 {
663  struct process* pcs = process_find_by_handle(hProcess);
664  void* data32;
667 
668  if (!pcs) return FALSE;
669  switch (action)
670  {
671  case CBA_DEBUG_INFO:
673  case CBA_SET_OPTIONS:
675  data32 = (void*)(DWORD_PTR)data;
676  break;
682  if (!validate_addr64(idsl64->BaseOfImage))
683  return FALSE;
684  idsl.SizeOfStruct = sizeof(idsl);
685  idsl.BaseOfImage = (DWORD)idsl64->BaseOfImage;
686  idsl.CheckSum = idsl64->CheckSum;
687  idsl.TimeDateStamp = idsl64->TimeDateStamp;
688  memcpy(idsl.FileName, idsl64->FileName, sizeof(idsl.FileName));
689  idsl.Reparse = idsl64->Reparse;
690  data32 = &idsl;
691  break;
693  case CBA_EVENT:
694  case CBA_READ_MEMORY:
695  default:
696  FIXME("No mapping for action %u\n", action);
697  return FALSE;
698  }
699  return pcs->reg_cb32(hProcess, action, data32, (PVOID)(DWORD_PTR)user);
700 }
#define CBA_DEFERRED_SYMBOL_LOAD_COMPLETE
Definition: compat.h:725
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
BOOL validate_addr64(DWORD64 addr)
Definition: dbghelp.c:112
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define CBA_EVENT
Definition: compat.h:732
#define DWORD
Definition: nt_native.h:44
#define CBA_READ_MEMORY
Definition: compat.h:729
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
PSYMBOL_REGISTERED_CALLBACK reg_cb32
#define CBA_DEFERRED_SYMBOL_LOAD_FAILURE
Definition: compat.h:726
#define CBA_SYMBOLS_UNLOADED
Definition: compat.h:727
#define CBA_DEBUG_INFO
Definition: compat.h:734
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define CBA_DUPLICATE_SYMBOL
Definition: compat.h:728
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
uint32_t DWORD_PTR
Definition: typedefs.h:65
#define CBA_DEFERRED_SYMBOL_LOAD_PARTIAL
Definition: compat.h:733
const WCHAR * action
Definition: action.c:7783
static BYTE data32[]
Definition: misc.c:535
#define CBA_DEFERRED_SYMBOL_LOAD_START
Definition: compat.h:724
#define CBA_SET_OPTIONS
Definition: compat.h:731
#define CBA_DEFERRED_SYMBOL_LOAD_CANCEL
Definition: compat.h:730
void user(int argc, const char *argv[])
Definition: cmds.c:1350

Referenced by SymRegisterCallback().

◆ sym_register_cb()

static BOOL sym_register_cb ( HANDLE  hProcess,
PSYMBOL_REGISTERED_CALLBACK64  cb,
PSYMBOL_REGISTERED_CALLBACK  cb32,
DWORD64  user,
BOOL  unicode 
)
static

Definition at line 753 of file dbghelp.c.

757 {
758  struct process* pcs = process_find_by_handle(hProcess);
759 
760  if (!pcs) return FALSE;
761  pcs->reg_cb = cb;
762  pcs->reg_cb32 = cb32;
763  pcs->reg_is_unicode = unicode;
764  pcs->reg_user = user;
765 
766  return TRUE;
767 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
PSYMBOL_REGISTERED_CALLBACK reg_cb32
DWORD64 reg_user
PSYMBOL_REGISTERED_CALLBACK64 reg_cb
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
void user(int argc, const char *argv[])
Definition: cmds.c:1350
BOOL reg_is_unicode

Referenced by SymRegisterCallback(), SymRegisterCallback64(), and SymRegisterCallbackW64().

◆ SymCleanup()

BOOL WINAPI SymCleanup ( HANDLE  hProcess)

Definition at line 531 of file dbghelp.c.

532 {
533  struct process** ppcs;
534  struct process* next;
535 
536  for (ppcs = &process_first; *ppcs; ppcs = &(*ppcs)->next)
537  {
538  if ((*ppcs)->handle == hProcess)
539  {
540  while ((*ppcs)->lmodules) module_remove(*ppcs, (*ppcs)->lmodules);
541 
542  HeapFree(GetProcessHeap(), 0, (*ppcs)->search_path);
543  free((*ppcs)->environment);
544  next = (*ppcs)->next;
545  HeapFree(GetProcessHeap(), 0, *ppcs);
546  *ppcs = next;
547  return TRUE;
548  }
549  }
550 
551  ERR("this process has not had SymInitialize() called for it!\n");
552  return FALSE;
553 }
#define TRUE
Definition: types.h:120
#define free
Definition: debug_ros.c:5
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:484
static struct process * process_first
Definition: dbghelp.c:79
#define ERR(fmt,...)
Definition: debug.h:110
static unsigned __int64 next
Definition: rand_nt.c:6
struct process * next
BOOL module_remove(struct process *pcs, struct module *module) DECLSPEC_HIDDEN
Definition: module.c:885
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by deinit_sym(), EndStackBacktrace(), main(), MiniDumpWriteDump(), START_TEST(), and SymInitializeW().

◆ SymGetExtendedOption()

BOOL WINAPI SymGetExtendedOption ( IMAGEHLP_EXTENDED_OPTIONS  option)

Definition at line 604 of file dbghelp.c.

605 {
606  switch(option)
607  {
609  return dbghelp_opt_native;
610  default:
611  FIXME("Unsupported option %d\n", option);
612  }
613 
614  return FALSE;
615 }
BOOL dbghelp_opt_native
Definition: dbghelp.c:74
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: getopt.h:108

◆ SymGetOptions()

DWORD WINAPI SymGetOptions ( void  )

Definition at line 574 of file dbghelp.c.

575 {
576  return dbghelp_options;
577 }
unsigned dbghelp_options
Definition: dbghelp.c:73

Referenced by BeginStackBacktrace(), InitDbgHelp(), and START_TEST().

◆ SymGetSearchPath()

BOOL WINAPI SymGetSearchPath ( HANDLE  hProcess,
PSTR  szSearchPath,
DWORD  SearchPathLength 
)

Definition at line 249 of file dbghelp.c.

251 {
252  WCHAR* buffer = HeapAlloc(GetProcessHeap(), 0, SearchPathLength * sizeof(WCHAR));
253  BOOL ret = FALSE;
254 
255  if (buffer)
256  {
257  ret = SymGetSearchPathW(hProcess, buffer, SearchPathLength);
258  if (ret)
259  WideCharToMultiByte(CP_ACP, 0, buffer, SearchPathLength,
260  szSearchPath, SearchPathLength, NULL, NULL);
262  }
263  return ret;
264 }
#define WideCharToMultiByte
Definition: compat.h:111
#define CP_ACP
Definition: compat.h:109
GLuint buffer
Definition: glext.h:5915
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SymGetSearchPathW(HANDLE hProcess, PWSTR szSearchPath, DWORD SearchPathLength)
Definition: dbghelp.c:236
int ret
#define HeapFree(x, y, z)
Definition: compat.h:483

◆ SymGetSearchPathW()

BOOL WINAPI SymGetSearchPathW ( HANDLE  hProcess,
PWSTR  szSearchPath,
DWORD  SearchPathLength 
)

Definition at line 236 of file dbghelp.c.

238 {
239  struct process* pcs = process_find_by_handle(hProcess);
240  if (!pcs) return FALSE;
241 
242  lstrcpynW(szSearchPath, pcs->search_path, SearchPathLength);
243  return TRUE;
244 }
WCHAR * search_path
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define lstrcpynW
Definition: compat.h:486
#define FALSE
Definition: types.h:117

Referenced by SymGetSearchPath().

◆ SymInitialize()

BOOL WINAPI SymInitialize ( HANDLE  hProcess,
PCSTR  UserSearchPath,
BOOL  fInvadeProcess 
)

Definition at line 508 of file dbghelp.c.

509 {
510  WCHAR* sp = NULL;
511  BOOL ret;
512 
513  if (UserSearchPath)
514  {
515  unsigned len;
516 
517  len = MultiByteToWideChar(CP_ACP, 0, UserSearchPath, -1, NULL, 0);
518  sp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
519  MultiByteToWideChar(CP_ACP, 0, UserSearchPath, -1, sp, len);
520  }
521 
522  ret = SymInitializeW(hProcess, sp, fInvadeProcess);
523  HeapFree(GetProcessHeap(), 0, sp);
524  return ret;
525 }
#define CP_ACP
Definition: compat.h:109
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:110
static const WCHAR sp[]
Definition: suminfo.c:288
BOOL WINAPI SymInitializeW(HANDLE hProcess, PCWSTR UserSearchPath, BOOL fInvadeProcess)
Definition: dbghelp.c:414
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by BeginStackBacktrace(), init_sym_imp(), InitDbgHelp(), main(), and START_TEST().

◆ SymInitializeW()

BOOL WINAPI SymInitializeW ( HANDLE  hProcess,
PCWSTR  UserSearchPath,
BOOL  fInvadeProcess 
)

Definition at line 414 of file dbghelp.c.

415 {
416  struct process* pcs;
417  BOOL wow64, child_wow64;
418 
419  TRACE("(%p %s %u)\n", hProcess, debugstr_w(UserSearchPath), fInvadeProcess);
420 
422  {
423  WARN("the symbols for this process have already been initialized!\n");
424 
425  /* MSDN says to only call this function once unless SymCleanup() has been called since the last call.
426  It also says to call SymRefreshModuleList() instead if you just want the module list refreshed.
427  Native still returns TRUE even if the process has already been initialized. */
428  return TRUE;
429  }
430 
432 
433  if (GetProcessId(hProcess) && !IsWow64Process(hProcess, &child_wow64))
434  return FALSE;
435 
436  pcs = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*pcs));
437  if (!pcs) return FALSE;
438 
439  pcs->handle = hProcess;
440  pcs->is_64bit = (sizeof(void *) == 8 || wow64) && !child_wow64;
441  pcs->loader = &no_loader_ops; /* platform-specific initialization will override it if loader debug info can be found */
442 
443  if (UserSearchPath)
444  {
446  (lstrlenW(UserSearchPath) + 1) * sizeof(WCHAR)),
447  UserSearchPath);
448  }
449  else
450  {
451  unsigned size;
452  unsigned len;
453  static const WCHAR sym_path[] = {'_','N','T','_','S','Y','M','B','O','L','_','P','A','T','H',0};
454  static const WCHAR alt_sym_path[] = {'_','N','T','_','A','L','T','E','R','N','A','T','E','_','S','Y','M','B','O','L','_','P','A','T','H',0};
455 
456  pcs->search_path = HeapAlloc(GetProcessHeap(), 0, (len = MAX_PATH) * sizeof(WCHAR));
457  while ((size = GetCurrentDirectoryW(len, pcs->search_path)) >= len)
458  pcs->search_path = HeapReAlloc(GetProcessHeap(), 0, pcs->search_path, (len *= 2) * sizeof(WCHAR));
459  pcs->search_path = HeapReAlloc(GetProcessHeap(), 0, pcs->search_path, (size + 1) * sizeof(WCHAR));
460 
461  len = GetEnvironmentVariableW(sym_path, NULL, 0);
462  if (len)
463  {
464  pcs->search_path = HeapReAlloc(GetProcessHeap(), 0, pcs->search_path, (size + 1 + len + 1) * sizeof(WCHAR));
465  pcs->search_path[size] = ';';
466  GetEnvironmentVariableW(sym_path, pcs->search_path + size + 1, len);
467  size += 1 + len;
468  }
469  len = GetEnvironmentVariableW(alt_sym_path, NULL, 0);
470  if (len)
471  {
472  pcs->search_path = HeapReAlloc(GetProcessHeap(), 0, pcs->search_path, (size + 1 + len + 1) * sizeof(WCHAR));
473  pcs->search_path[size] = ';';
474  GetEnvironmentVariableW(alt_sym_path, pcs->search_path + size + 1, len);
475  }
476  }
477 
478  pcs->lmodules = NULL;
479  pcs->dbg_hdr_addr = 0;
480  pcs->next = process_first;
481  process_first = pcs;
482 
483 #ifndef DBGHELP_STATIC_LIB
484  if (check_live_target(pcs))
485  {
486  if (fInvadeProcess)
488  if (pcs->loader) pcs->loader->synchronize_module_list(pcs);
489  }
490  else if (fInvadeProcess)
491 #else
492  if (fInvadeProcess)
493 #endif
494  {
497  return FALSE;
498  }
499 
500  return TRUE;
501 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
WCHAR * search_path
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
#define WARN(fmt,...)
Definition: debug.h:112
#define GetCurrentDirectoryW(x, y)
Definition: compat.h:504
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define lstrlenW
Definition: compat.h:498
static BOOL wow64
Definition: psapi_main.c:44
#define FALSE
Definition: types.h:117
struct module * lmodules
ULONG_PTR dbg_hdr_addr
static BOOL check_live_target(struct process *pcs)
Definition: dbghelp.c:306
unsigned int BOOL
Definition: ntddk_ex.h:94
BOOL WINAPI SymCleanup(HANDLE hProcess)
Definition: dbghelp.c:531
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI EnumerateLoadedModulesW64(HANDLE hProcess, PENUMLOADED_MODULES_CALLBACKW64 EnumLoadedModulesCallback, PVOID UserContext)
Definition: module.c:1108
BOOL WINAPI IsWow64Process(IN HANDLE hProcess, OUT PBOOL Wow64Process)
Definition: proc.c:1976
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
static struct process * process_first
Definition: dbghelp.c:79
__wchar_t WCHAR
Definition: xmlstorage.h:180
const struct loader_ops * loader
#define MAX_PATH
Definition: compat.h:34
#define SetLastError(x)
Definition: compat.h:500
static BOOL WINAPI process_invade_cb(PCWSTR name, ULONG64 base, ULONG size, PVOID user)
Definition: dbghelp.c:273
GLenum GLsizei len
Definition: glext.h:6722
#define GetCurrentProcess()
Definition: compat.h:507
const struct loader_ops no_loader_ops
Definition: module.c:1405
struct process * next
#define lstrcpyW
Definition: compat.h:497
#define HeapReAlloc
Definition: compat.h:482
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
HANDLE handle
#define GetEnvironmentVariableW(x, y, z)
Definition: compat.h:503
DWORD WINAPI GetProcessId(IN HANDLE Process)
Definition: proc.c:1200

Referenced by MiniDumpWriteDump(), and SymInitialize().

◆ SymRegisterCallback()

BOOL WINAPI SymRegisterCallback ( HANDLE  hProcess,
PSYMBOL_REGISTERED_CALLBACK  CallbackFunction,
PVOID  UserContext 
)

Definition at line 772 of file dbghelp.c.

775 {
776  TRACE("(%p, %p, %p)\n",
777  hProcess, CallbackFunction, UserContext);
779 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static BOOL sym_register_cb(HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 cb, PSYMBOL_REGISTERED_CALLBACK cb32, DWORD64 user, BOOL unicode)
Definition: dbghelp.c:753
_In_ PCALLBACK_FUNCTION CallbackFunction
Definition: exfuncs.h:1034
#define FALSE
Definition: types.h:117
#define TRACE(s)
Definition: solgame.cpp:4
static BOOL CALLBACK reg_cb64to32(HANDLE hProcess, ULONG action, ULONG64 data, ULONG64 user)
Definition: dbghelp.c:661
uint32_t DWORD_PTR
Definition: typedefs.h:65

◆ SymRegisterCallback64()

BOOL WINAPI SymRegisterCallback64 ( HANDLE  hProcess,
PSYMBOL_REGISTERED_CALLBACK64  CallbackFunction,
ULONG64  UserContext 
)

Definition at line 784 of file dbghelp.c.

787 {
788  TRACE("(%p, %p, %s)\n",
790  return sym_register_cb(hProcess, CallbackFunction, NULL, UserContext, FALSE);
791 }
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static BOOL sym_register_cb(HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 cb, PSYMBOL_REGISTERED_CALLBACK cb32, DWORD64 user, BOOL unicode)
Definition: dbghelp.c:753
_In_ PCALLBACK_FUNCTION CallbackFunction
Definition: exfuncs.h:1034
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

Referenced by test_SymRegCallback().

◆ SymRegisterCallbackW64()

BOOL WINAPI SymRegisterCallbackW64 ( HANDLE  hProcess,
PSYMBOL_REGISTERED_CALLBACK64  CallbackFunction,
ULONG64  UserContext 
)

Definition at line 796 of file dbghelp.c.

799 {
800  TRACE("(%p, %p, %s)\n",
802  return sym_register_cb(hProcess, CallbackFunction, NULL, UserContext, TRUE);
803 }
#define TRUE
Definition: types.h:120
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
static BOOL sym_register_cb(HANDLE hProcess, PSYMBOL_REGISTERED_CALLBACK64 cb, PSYMBOL_REGISTERED_CALLBACK cb32, DWORD64 user, BOOL unicode)
Definition: dbghelp.c:753
_In_ PCALLBACK_FUNCTION CallbackFunction
Definition: exfuncs.h:1034
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

Referenced by test_SymRegCallback().

◆ SymSetContext()

BOOL WINAPI SymSetContext ( HANDLE  hProcess,
PIMAGEHLP_STACK_FRAME  StackFrame,
PIMAGEHLP_CONTEXT  Context 
)

Definition at line 632 of file dbghelp.c.

634 {
635  struct process* pcs = process_find_by_handle(hProcess);
636  if (!pcs) return FALSE;
637 
638  if (pcs->ctx_frame.ReturnOffset == StackFrame->ReturnOffset &&
639  pcs->ctx_frame.FrameOffset == StackFrame->FrameOffset &&
640  pcs->ctx_frame.StackOffset == StackFrame->StackOffset)
641  {
642  TRACE("Setting same frame {rtn=%s frm=%s stk=%s}\n",
646  pcs->ctx_frame.InstructionOffset = StackFrame->InstructionOffset;
647  SetLastError(ERROR_ACCESS_DENIED); /* latest MSDN says ERROR_SUCCESS */
648  return FALSE;
649  }
650 
651  pcs->ctx_frame = *StackFrame;
652  /* MSDN states that Context is not (no longer?) used */
653  return TRUE;
654 }
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
IMAGEHLP_STACK_FRAME ctx_frame
#define FALSE
Definition: types.h:117
#define ERROR_ACCESS_DENIED
Definition: compat.h:97
#define TRACE(s)
Definition: solgame.cpp:4
#define SetLastError(x)
Definition: compat.h:500
ULONG64 InstructionOffset
Definition: compat.h:1124
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49
ULONG64 ReturnOffset
Definition: compat.h:1125

Referenced by DumpParams(), and ParseImageSymbols().

◆ SymSetExtendedOption()

BOOL WINAPI SymSetExtendedOption ( IMAGEHLP_EXTENDED_OPTIONS  option,
BOOL  value 
)

Definition at line 583 of file dbghelp.c.

584 {
585  BOOL old = FALSE;
586 
587  switch(option)
588  {
590  old = dbghelp_opt_native;
592  break;
593  default:
594  FIXME("Unsupported option %d with value %d\n", option, value);
595  }
596 
597  return old;
598 }
BOOL dbghelp_opt_native
Definition: dbghelp.c:74
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: getopt.h:108
GLsizei const GLfloat * value
Definition: glext.h:6069

Referenced by main().

◆ SymSetOptions()

DWORD WINAPI SymSetOptions ( DWORD  opts)

Definition at line 559 of file dbghelp.c.

560 {
561  struct process* pcs;
562 
563  for (pcs = process_first; pcs; pcs = pcs->next)
564  {
565  pcs_callback(pcs, CBA_SET_OPTIONS, &opts);
566  }
567  return dbghelp_options = opts;
568 }
BOOL pcs_callback(const struct process *pcs, ULONG action, void *data)
Definition: dbghelp.c:705
static struct process * process_first
Definition: dbghelp.c:79
struct process * next
unsigned dbghelp_options
Definition: dbghelp.c:73
#define CBA_SET_OPTIONS
Definition: compat.h:731

Referenced by BeginStackBacktrace(), InitDbgHelp(), main(), and START_TEST().

◆ SymSetParentWindow()

BOOL WINAPI SymSetParentWindow ( HWND  hwnd)

Definition at line 621 of file dbghelp.c.

622 {
623  /* Save hwnd so it can be used as parent window */
624  FIXME("(%p): stub\n", hwnd);
625  return TRUE;
626 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
#define TRUE
Definition: types.h:120
#define FIXME(fmt,...)
Definition: debug.h:111

◆ SymSetSearchPath()

BOOL WINAPI SymSetSearchPath ( HANDLE  hProcess,
PCSTR  searchPath 
)

Definition at line 216 of file dbghelp.c.

217 {
218  BOOL ret = FALSE;
219  unsigned len;
220  WCHAR* sp;
221 
222  len = MultiByteToWideChar(CP_ACP, 0, searchPath, -1, NULL, 0);
223  if ((sp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR))))
224  {
225  MultiByteToWideChar(CP_ACP, 0, searchPath, -1, sp, len);
226 
228  HeapFree(GetProcessHeap(), 0, sp);
229  }
230  return ret;
231 }
#define CP_ACP
Definition: compat.h:109
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define FALSE
Definition: types.h:117
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
BOOL WINAPI SymSetSearchPathW(HANDLE hProcess, PCWSTR searchPath)
Definition: dbghelp.c:198
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:110
static const WCHAR sp[]
Definition: suminfo.c:288
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by InitDbgHelp().

◆ SymSetSearchPathW()

BOOL WINAPI SymSetSearchPathW ( HANDLE  hProcess,
PCWSTR  searchPath 
)

Definition at line 198 of file dbghelp.c.

199 {
200  struct process* pcs = process_find_by_handle(hProcess);
201 
202  if (!pcs) return FALSE;
203  if (!searchPath) return FALSE;
204 
205  HeapFree(GetProcessHeap(), 0, pcs->search_path);
207  (lstrlenW(searchPath) + 1) * sizeof(WCHAR)),
208  searchPath);
209  return TRUE;
210 }
WCHAR * search_path
#define TRUE
Definition: types.h:120
struct process * process_find_by_handle(HANDLE hProcess)
Definition: dbghelp.c:99
_In_ BOOL _In_ HANDLE hProcess
Definition: mapping.h:70
#define lstrlenW
Definition: compat.h:498
#define FALSE
Definition: types.h:117
#define GetProcessHeap()
Definition: compat.h:484
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define lstrcpyW
Definition: compat.h:497
#define HeapFree(x, y, z)
Definition: compat.h:483

Referenced by SymSetSearchPath().

◆ validate_addr64()

BOOL validate_addr64 ( DWORD64  addr)

Definition at line 112 of file dbghelp.c.

113 {
114  if (sizeof(void*) == sizeof(int) && (addr >> 32))
115  {
116  FIXME("Unsupported address %s\n", wine_dbgstr_longlong(addr));
118  return FALSE;
119  }
120  return TRUE;
121 }
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
#define SetLastError(x)
Definition: compat.h:500
GLenum const GLvoid * addr
Definition: glext.h:9621
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

Referenced by fetch_pe_module_info_cb(), reg_cb64to32(), SymGetModuleBase(), SymLoadModuleExW(), and SymUnloadModule64().

◆ WinDbgExtensionDllInit()

void WINAPI WinDbgExtensionDllInit ( PWINDBG_EXTENSION_APIS  lpExtensionApis,
unsigned short  major,
unsigned short  minor 
)

Definition at line 843 of file dbghelp.c.

845 {
846 }

◆ wine_dbgstr_addr()

const char* wine_dbgstr_addr ( const ADDRESS64 addr)

Definition at line 142 of file dbghelp.c.

143 {
144  if (!addr) return "(null)";
145  switch (addr->Mode)
146  {
147  case AddrModeFlat:
148  return wine_dbg_sprintf("flat<%s>", wine_dbgstr_longlong(addr->Offset));
149  case AddrMode1616:
150  return wine_dbg_sprintf("1616<%04x:%04x>", addr->Segment, (DWORD)addr->Offset);
151  case AddrMode1632:
152  return wine_dbg_sprintf("1632<%04x:%08x>", addr->Segment, (DWORD)addr->Offset);
153  case AddrModeReal:
154  return wine_dbg_sprintf("real<%04x:%04x>", addr->Segment, (DWORD)addr->Offset);
155  default:
156  return "unknown";
157  }
158 }
const char * wine_dbg_sprintf(const char *format,...)
Definition: compat.c:296
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum const GLvoid * addr
Definition: glext.h:9621
static __inline const char * wine_dbgstr_longlong(ULONGLONG ll)
Definition: compat.h:49

Referenced by i386_stack_walk().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( dbghelp  )

Variable Documentation

◆ api_version

API_VERSION api_version = { 4, 0, 2, 0 }
static

Definition at line 806 of file dbghelp.c.

Referenced by ImagehlpApiVersion(), and ImagehlpApiVersionEx().

◆ cpu_arm64

Definition at line 283 of file cpu_arm64.c.

◆ dbghelp_cpus

struct cpu* dbghelp_cpus[] = {&cpu_i386, &cpu_x86_64, &cpu_arm, &cpu_arm64, NULL}
static

Definition at line 164 of file dbghelp.c.

Referenced by cpu_find().

◆ dbghelp_current_cpu

◆ dbghelp_opt_native

◆ dbghelp_options

◆ process_first

struct process* process_first
static

Definition at line 79 of file dbghelp.c.

Referenced by process_find_by_handle(), SymCleanup(), SymInitializeW(), and SymSetOptions().

◆ sysinfo