#include <psapi.h>
#ifdef __CYGWIN__
#include <sys/cygwin.h>
+#include <cygwin/version.h>
#endif
#include <signal.h>
#define DebugBreakProcess dyn_DebugBreakProcess
#define DebugSetProcessKillOnExit dyn_DebugSetProcessKillOnExit
#define EnumProcessModules dyn_EnumProcessModules
-#ifndef __CYGWIN__
-#define GetModuleFileNameExA dyn_GetModuleFileNameExA
-#else
-#define GetModuleFileNameExW dyn_GetModuleFileNameExW
-#endif
#define GetModuleInformation dyn_GetModuleInformation
#define LookupPrivilegeValueA dyn_LookupPrivilegeValueA
#define OpenProcessToken dyn_OpenProcessToken
+#define GetConsoleFontSize dyn_GetConsoleFontSize
+#define GetCurrentConsoleFont dyn_GetCurrentConsoleFont
static BOOL WINAPI (*AdjustTokenPrivileges)(HANDLE, BOOL, PTOKEN_PRIVILEGES,
DWORD, PTOKEN_PRIVILEGES, PDWORD);
static BOOL WINAPI (*DebugSetProcessKillOnExit) (BOOL);
static BOOL WINAPI (*EnumProcessModules) (HANDLE, HMODULE *, DWORD,
LPDWORD);
-#ifndef __CYGWIN__
-static DWORD WINAPI (*GetModuleFileNameExA) (HANDLE, HMODULE, LPSTR,
- DWORD);
-#else
-static DWORD WINAPI (*GetModuleFileNameExW) (HANDLE, HMODULE, LPWSTR,
- DWORD);
-#endif
static BOOL WINAPI (*GetModuleInformation) (HANDLE, HMODULE, LPMODULEINFO,
DWORD);
static BOOL WINAPI (*LookupPrivilegeValueA)(LPCSTR, LPCSTR, PLUID);
static BOOL WINAPI (*OpenProcessToken)(HANDLE, DWORD, PHANDLE);
+static BOOL WINAPI (*GetCurrentConsoleFont) (HANDLE, BOOL, CONSOLE_FONT_INFO *);
+static COORD WINAPI (*GetConsoleFontSize) (HANDLE, DWORD);
static struct target_ops windows_ops;
-#ifdef __CYGWIN__
+#undef STARTUPINFO
+#undef CreateProcess
+#undef GetModuleFileNameEx
+
+#ifndef __CYGWIN__
+# define __PMAX (MAX_PATH + 1)
+ static DWORD WINAPI (*GetModuleFileNameEx) (HANDLE, HMODULE, LPSTR, DWORD);
+# define STARTUPINFO STARTUPINFOA
+# define CreateProcess CreateProcessA
+# define GetModuleFileNameEx_name "GetModuleFileNameExA"
+# define bad_GetModuleFileNameEx bad_GetModuleFileNameExA
+#else
+# define __PMAX PATH_MAX
/* The starting and ending address of the cygwin1.dll text segment. */
-static CORE_ADDR cygwin_load_start;
-static CORE_ADDR cygwin_load_end;
+ static CORE_ADDR cygwin_load_start;
+ static CORE_ADDR cygwin_load_end;
+# if CYGWIN_VERSION_DLL_MAKE_COMBINED(CYGWIN_VERSION_API_MAJOR,CYGWIN_VERSION_API_MINOR) >= 181
+# define __USEWIDE
+ typedef wchar_t cygwin_buf_t;
+ static DWORD WINAPI (*GetModuleFileNameEx) (HANDLE, HMODULE, LPWSTR, DWORD);
+# define STARTUPINFO STARTUPINFOW
+# define CreateProcess CreateProcessW
+# define GetModuleFileNameEx_name "GetModuleFileNameExW"
+# define bad_GetModuleFileNameEx bad_GetModuleFileNameExW
+# else
+# define CCP_POSIX_TO_WIN_W 1
+# define CCP_WIN_W_TO_POSIX 3
+# define cygwin_conv_path(op, from, to, size) \
+ (op == CCP_WIN_W_TO_POSIX) ? \
+ cygwin_conv_to_full_posix_path (from, to) : \
+ cygwin_conv_to_win32_path (from, to)
+ typedef char cygwin_buf_t;
+ static DWORD WINAPI (*GetModuleFileNameEx) (HANDLE, HMODULE, LPSTR, DWORD);
+# define STARTUPINFO STARTUPINFOA
+# define CreateProcess CreateProcessA
+# define GetModuleFileNameEx_name "GetModuleFileNameExA"
+# define bad_GetModuleFileNameEx bad_GetModuleFileNameExA
+# define CW_SET_DOS_FILE_WARNING -1 /* no-op this for older Cygwin */
+# endif
#endif
static int have_saved_context; /* True if we've saved context from a cygwin signal. */
struct thread_info_struct *next;
DWORD id;
HANDLE h;
+ CORE_ADDR thread_local_base;
char *name;
int suspended;
int reload_context;
/* Add a thread to the thread list. */
static thread_info *
-windows_add_thread (ptid_t ptid, HANDLE h)
+windows_add_thread (ptid_t ptid, HANDLE h, void *tlb)
{
thread_info *th;
DWORD id;
th = XZALLOC (thread_info);
th->id = id;
th->h = h;
+ th->thread_local_base = (CORE_ADDR) (uintptr_t) tlb;
th->next = thread_head.next;
thread_head.next = th;
add_thread (ptid);
HMODULE *DllHandle = dh_buf; /* Set to temporary storage for initial query */
DWORD cbNeeded;
#ifdef __CYGWIN__
- wchar_t pathbuf[PATH_MAX]; /* Temporary storage prior to converting to
- posix form. PATH_MAX is always enough
+ cygwin_buf_t pathbuf[__PMAX]; /* Temporary storage prior to converting to
+ posix form. __PMAX is always enough
as long as SO_NAME_MAX_PATH_SIZE is defined
as 512. */
#endif
/* Try to find the name of the given module */
#ifdef __CYGWIN__
/* Cygwin prefers that the path be in /x/y/z format */
- len = GetModuleFileNameExW (current_process_handle,
- DllHandle[i], pathbuf, PATH_MAX);
+ len = GetModuleFileNameEx (current_process_handle,
+ DllHandle[i], pathbuf, __PMAX);
if (len == 0)
error (_("Error getting dll name: %lu."), GetLastError ());
if (cygwin_conv_path (CCP_WIN_W_TO_POSIX, pathbuf, dll_name_ret,
- PATH_MAX) < 0)
+ __PMAX) < 0)
error (_("Error converting dll name to POSIX: %d."), errno);
#else
- len = GetModuleFileNameExA (current_process_handle,
- DllHandle[i], dll_name_ret, MAX_PATH);
+ len = GetModuleFileNameEx (current_process_handle,
+ DllHandle[i], dll_name_ret, __PMAX);
if (len == 0)
error (_("Error getting dll name: %u."), (unsigned) GetLastError ());
#endif
struct so_list *so;
char *p;
#ifndef __CYGWIN__
- char buf[MAX_PATH + 1];
- char cwd[MAX_PATH + 1];
+ char buf[__PMAX];
+ char cwd[__PMAX];
WIN32_FIND_DATA w32_fd;
HANDLE h = FindFirstFile(name, &w32_fd);
strcat (buf, "\\ntdll.dll");
}
#else
- wchar_t buf[PATH_MAX];
+ cygwin_buf_t buf[__PMAX];
- buf[0] = L'\0';
+ buf[0] = 0;
if (access (name, F_OK) != 0)
{
if (strcasecmp (name, "ntdll.dll") == 0)
+#ifdef __USEWIDE
{
GetSystemDirectoryW (buf, sizeof (buf) / sizeof (wchar_t));
wcscat (buf, L"\\ntdll.dll");
}
+#else
+ {
+ GetSystemDirectoryA (buf, sizeof (buf) / sizeof (wchar_t));
+ strcat (buf, "\\ntdll.dll");
+ }
+#endif
}
#endif
so = XZALLOC (struct so_list);
SO_NAME_MAX_PATH_SIZE);
else
{
- char *rname = canonicalize_file_name (name);
+ char *rname = realpath (name, NULL);
if (rname && strlen (rname) < SO_NAME_MAX_PATH_SIZE)
{
strcpy (so->so_name, rname);
get_image_name (HANDLE h, void *address, int unicode)
{
#ifdef __CYGWIN__
- static char buf[PATH_MAX];
+ static char buf[__PMAX];
#else
- static char buf[(2 * MAX_PATH) + 1];
+ static char buf[(2 * __PMAX) + 1];
#endif
DWORD size = unicode ? sizeof (WCHAR) : sizeof (char);
char *address_ptr;
ReadProcessMemory (h, address_ptr, unicode_address, len * sizeof (WCHAR),
&done);
#ifdef __CYGWIN__
- wcstombs (buf, unicode_address, PATH_MAX);
+ wcstombs (buf, unicode_address, __PMAX);
#else
WideCharToMultiByte (CP_ACP, 0, unicode_address, len, buf, sizeof buf,
0, 0);
handle_load_dll (void *dummy)
{
LOAD_DLL_DEBUG_INFO *event = ¤t_event.u.LoadDll;
-#ifdef __CYGWIN__
- char dll_buf[PATH_MAX];
-#else
- char dll_buf[MAX_PATH + 1];
-#endif
+ char dll_buf[__PMAX];
char *dll_name = NULL;
dll_buf[0] = dll_buf[sizeof (dll_buf) - 1] = '\0';
}
else
{
- printf_filtered ("Invalid selector 0x%lx.\n",sel);
+ DWORD err = GetLastError ();
+ if (err == ERROR_NOT_SUPPORTED)
+ printf_filtered ("Function not supported\n");
+ else
+ printf_filtered ("Invalid selector 0x%lx.\n",sel);
return 0;
}
}
}
}
-static struct cmd_list_element *info_w32_cmdlist = NULL;
-
-static void
-info_w32_command (char *args, int from_tty)
-{
- help_list (info_w32_cmdlist, "info w32 ", class_info, gdb_stdout);
-}
-
-
#define DEBUG_EXCEPTION_SIMPLE(x) if (debug_exceptions) \
printf_unfiltered ("gdb: Target exception %s at %s\n", x, \
host_address_to_string (\
/* We can not debug anything in that case. */
}
main_thread_id = current_event.dwThreadId;
- current_thread = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
- current_event.dwThreadId),
- current_event.u.CreateThread.hThread);
+ current_thread = windows_add_thread (
+ ptid_build (current_event.dwProcessId, 0,
+ current_event.dwThreadId),
+ current_event.u.CreateThread.hThread,
+ current_event.u.CreateThread.lpThreadLocalBase);
return main_thread_id;
}
retval = current_event.dwThreadId;
th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
current_event.dwThreadId),
- current_event.u.CreateThread.hThread);
+ current_event.u.CreateThread.hThread,
+ current_event.u.CreateThread.lpThreadLocalBase);
+
break;
case EXIT_THREAD_DEBUG_EVENT:
(unsigned) current_event.dwProcessId,
(unsigned) current_event.dwThreadId,
"EXIT_THREAD_DEBUG_EVENT"));
+
if (current_event.dwThreadId != main_thread_id)
{
windows_delete_thread (ptid_build (current_event.dwProcessId, 0,
/* Add the main thread */
th = windows_add_thread (ptid_build (current_event.dwProcessId, 0,
current_event.dwThreadId),
- current_event.u.CreateProcessInfo.hThread);
+ current_event.u.CreateProcessInfo.hThread,
+ current_event.u.CreateProcessInfo.lpThreadLocalBase);
retval = current_event.dwThreadId;
break;
target_terminal_inferior ();
windows_initialization_done = 0;
- inf->stop_soon = STOP_QUIETLY;
+ inf->control.stop_soon = STOP_QUIETLY;
while (1)
{
stop_after_trap = 1;
wait_for_inferior (0);
tp = inferior_thread ();
- if (tp->stop_signal != TARGET_SIGNAL_TRAP)
- resume (0, tp->stop_signal);
+ if (tp->suspend.stop_signal != TARGET_SIGNAL_TRAP)
+ resume (0, tp->suspend.stop_signal);
else
break;
}
windows_initialization_done = 1;
- inf->stop_soon = NO_STOP_QUIETLY;
+ inf->control.stop_soon = NO_STOP_QUIETLY;
stop_after_trap = 0;
return;
}
static char *
windows_pid_to_exec_file (int pid)
{
+ static char path[__PMAX];
#ifdef __CYGWIN__
- static char path[PATH_MAX];
-
/* Try to find exe name as symlink target of /proc/<pid>/exe */
int nchars;
char procexe[sizeof ("/proc/4294967295/exe")];
path[nchars] = '\0'; /* Got it */
return path;
}
-#else
- static char path[MAX_PATH + 1];
#endif
/* If we get here then either Cygwin is hosed, this isn't a Cygwin version
error (_("Use the \"run\" command to start a Unix child process."));
}
+/* Modify CreateProcess parameters for use of a new separate console.
+ Parameters are:
+ *FLAGS: DWORD parameter for general process creation flags.
+ *SI: STARTUPINFO structure, for which the console window size and
+ console buffer size is filled in if GDB is running in a console.
+ to create the new console.
+ The size of the used font is not available on all versions of
+ Windows OS. Furthermore, the current font might not be the default
+ font, but this is still better than before.
+ If the windows and buffer sizes are computed,
+ SI->DWFLAGS is changed so that this information is used
+ by CreateProcess function. */
+
+static void
+windows_set_console_info (STARTUPINFO *si, DWORD *flags)
+{
+ HANDLE hconsole = CreateFile ("CONOUT$", GENERIC_READ | GENERIC_WRITE,
+ FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0);
+
+ if (hconsole != INVALID_HANDLE_VALUE)
+ {
+ CONSOLE_SCREEN_BUFFER_INFO sbinfo;
+ COORD font_size;
+ CONSOLE_FONT_INFO cfi;
+
+ GetCurrentConsoleFont (hconsole, FALSE, &cfi);
+ font_size = GetConsoleFontSize (hconsole, cfi.nFont);
+ GetConsoleScreenBufferInfo(hconsole, &sbinfo);
+ si->dwXSize = sbinfo.srWindow.Right - sbinfo.srWindow.Left + 1;
+ si->dwYSize = sbinfo.srWindow.Bottom - sbinfo.srWindow.Top + 1;
+ if (font_size.X)
+ si->dwXSize *= font_size.X;
+ else
+ si->dwXSize *= 8;
+ if (font_size.Y)
+ si->dwYSize *= font_size.Y;
+ else
+ si->dwYSize *= 12;
+ si->dwXCountChars = sbinfo.dwSize.X;
+ si->dwYCountChars = sbinfo.dwSize.Y;
+ si->dwFlags |= STARTF_USESIZE | STARTF_USECOUNTCHARS;
+ }
+ *flags |= CREATE_NEW_CONSOLE;
+}
+
/* Start an inferior windows child process and sets inferior_ptid to its pid.
EXEC_FILE is the file to run.
ALLARGS is a string containing the arguments to the program.
windows_create_inferior (struct target_ops *ops, char *exec_file,
char *allargs, char **in_env, int from_tty)
{
+ STARTUPINFO si;
#ifdef __CYGWIN__
- STARTUPINFOW si;
- wchar_t real_path[PATH_MAX];
- wchar_t shell[PATH_MAX]; /* Path to shell */
+ cygwin_buf_t real_path[__PMAX];
+ cygwin_buf_t shell[__PMAX]; /* Path to shell */
const char *sh;
- wchar_t *toexec;
- wchar_t *cygallargs;
- wchar_t *args;
+ cygwin_buf_t *toexec;
+ cygwin_buf_t *cygallargs;
+ cygwin_buf_t *args;
size_t len;
int tty;
int ostdin, ostdout, ostderr;
#else
- STARTUPINFOA si;
- char real_path[PATH_MAX];
- char shell[MAX_PATH + 1]; /* Path to shell */
+ char real_path[__PMAX];
+ char shell[__PMAX]; /* Path to shell */
char *toexec;
char *args;
HANDLE tty;
flags |= CREATE_NEW_PROCESS_GROUP;
if (new_console)
- flags |= CREATE_NEW_CONSOLE;
+ windows_set_console_info (&si, &flags);
#ifdef __CYGWIN__
if (!useshell)
{
flags |= DEBUG_ONLY_THIS_PROCESS;
if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, exec_file, real_path,
- PATH_MAX * sizeof (wchar_t)) < 0)
+ __PMAX * sizeof (cygwin_buf_t)) < 0)
error (_("Error starting executable: %d"), errno);
toexec = real_path;
+#ifdef __USEWIDE
len = mbstowcs (NULL, allargs, 0) + 1;
if (len == (size_t) -1)
error (_("Error starting executable: %d"), errno);
cygallargs = (wchar_t *) alloca (len * sizeof (wchar_t));
mbstowcs (cygallargs, allargs, len);
+#else
+ cygallargs = allargs;
+#endif
}
else
{
sh = getenv ("SHELL");
if (!sh)
sh = "/bin/sh";
- if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, sh, shell, PATH_MAX) < 0)
+ if (cygwin_conv_path (CCP_POSIX_TO_WIN_W, sh, shell, __PMAX) < 0)
error (_("Error starting executable via shell: %d"), errno);
+#ifdef __USEWIDE
len = sizeof (L" -c 'exec '") + mbstowcs (NULL, exec_file, 0)
+ mbstowcs (NULL, allargs, 0) + 2;
cygallargs = (wchar_t *) alloca (len * sizeof (wchar_t));
swprintf (cygallargs, len, L" -c 'exec %s %s'", exec_file, allargs);
+#else
+ cygallargs = (char *) alloca (sizeof (" -c 'exec '") + strlen (exec_file)
+ + strlen (allargs) + 2);
+ sprintf (cygallargs, " -c 'exec %s %s'", exec_file, allargs);
+#endif
toexec = shell;
flags |= DEBUG_PROCESS;
}
- args = (wchar_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
- * sizeof (wchar_t));
+
+#ifdef __USEWIDE
+ args = (cygwin_buf_t *) alloca ((wcslen (toexec) + wcslen (cygallargs) + 2)
+ * sizeof (wchar_t));
wcscpy (args, toexec);
wcscat (args, L" ");
wcscat (args, cygallargs);
+#else
+ args = (cygwin_buf_t *) alloca (strlen (toexec) + strlen (cygallargs) + 2);
+ strcpy (args, toexec);
+ strcat (args, " ");
+ strcat (args, cygallargs);
+#endif
+
/* Prepare the environment vars for CreateProcess. */
cygwin_internal (CW_SYNC_WINENV);
}
windows_init_thread_list ();
- ret = CreateProcessW (0,
- args, /* command line */
- NULL, /* Security */
- NULL, /* thread */
- TRUE, /* inherit handles */
- flags, /* start flags */
- NULL, /* environment */
- NULL, /* current directory */
- &si,
- &pi);
+ ret = CreateProcess (0,
+ args, /* command line */
+ NULL, /* Security */
+ NULL, /* thread */
+ TRUE, /* inherit handles */
+ flags, /* start flags */
+ NULL, /* environment */
+ NULL, /* current directory */
+ &si,
+ &pi);
if (tty >= 0)
{
close (tty);
close (ostderr);
}
#else
+ toexec = exec_file;
args = alloca (strlen (toexec) + strlen (allargs) + 2);
strcpy (args, toexec);
strcat (args, " ");
strcat (args, allargs);
- toexec = exec_file;
flags |= DEBUG_ONLY_THIS_PROCESS;
if (!inferior_io_terminal)
}
}
+/* Provide thread local base, i.e. Thread Information Block address.
+ Returns 1 if ptid is found and sets *ADDR to thread_local_base. */
+
+static int
+windows_get_tib_address (ptid_t ptid, CORE_ADDR *addr)
+{
+ thread_info *th;
+
+ th = thread_rec (ptid_get_tid (ptid), 0);
+ if (th == NULL)
+ return 0;
+
+ if (addr != NULL)
+ *addr = th->thread_local_base;
+
+ return 1;
+}
+
static ptid_t
windows_get_ada_task_ptid (long lwp, long thread)
{
windows_ops.to_has_execution = default_child_has_execution;
windows_ops.to_pid_to_exec_file = windows_pid_to_exec_file;
windows_ops.to_get_ada_task_ptid = windows_get_ada_task_ptid;
+ windows_ops.to_get_tib_address = windows_get_tib_address;
i386_use_watchpoints (&windows_ops);
NULL, /* FIXME: i18n: */
&setlist, &showlist);
- add_prefix_cmd ("w32", class_info, info_w32_command,
- _("Print information specific to Win32 debugging."),
- &info_w32_cmdlist, "info w32 ", 0, &infolist);
+ init_w32_command_list ();
add_cmd ("selector", class_info, display_selectors,
_("Display selectors infos."),
{
return FALSE;
}
-#ifndef __CYGWIN__
+
+#ifdef __USEWIDE
static DWORD WINAPI
-bad_GetModuleFileNameExA (HANDLE w, HMODULE x, LPSTR y, DWORD z)
+bad_GetModuleFileNameExW (HANDLE w, HMODULE x, LPWSTR y, DWORD z)
{
return 0;
}
#else
static DWORD WINAPI
-bad_GetModuleFileNameExW (HANDLE w, HMODULE x, LPWSTR y, DWORD z)
+bad_GetModuleFileNameExA (HANDLE w, HMODULE x, LPSTR y, DWORD z)
{
return 0;
}
#endif
+
static BOOL WINAPI
bad_GetModuleInformation (HANDLE w, HMODULE x, LPMODULEINFO y, DWORD z)
{
return FALSE;
}
+static BOOL WINAPI
+bad_GetCurrentConsoleFont (HANDLE w, BOOL bMaxWindow, CONSOLE_FONT_INFO *f)
+{
+ f->nFont = 0;
+ return 1;
+}
+static COORD WINAPI
+bad_GetConsoleFontSize (HANDLE w, DWORD nFont)
+{
+ COORD size;
+ size.X = 8;
+ size.Y = 12;
+ return size;
+}
+
/* Load any functions which may not be available in ancient versions
of Windows. */
void
hm = LoadLibrary ("kernel32.dll");
if (hm)
{
- dyn_DebugActiveProcessStop = (void *)
+ DebugActiveProcessStop = (void *)
GetProcAddress (hm, "DebugActiveProcessStop");
- dyn_DebugBreakProcess = (void *)
+ DebugBreakProcess = (void *)
GetProcAddress (hm, "DebugBreakProcess");
- dyn_DebugSetProcessKillOnExit = (void *)
+ DebugSetProcessKillOnExit = (void *)
GetProcAddress (hm, "DebugSetProcessKillOnExit");
+ GetConsoleFontSize = (void *)
+ GetProcAddress (hm, "GetConsoleFontSize");
+ GetCurrentConsoleFont = (void *)
+ GetProcAddress (hm, "GetCurrentConsoleFont");
}
/* Set variables to dummy versions of these processes if the function
wasn't found in kernel32.dll. */
- if (!dyn_DebugBreakProcess)
- dyn_DebugBreakProcess = bad_DebugBreakProcess;
- if (!dyn_DebugActiveProcessStop || !dyn_DebugSetProcessKillOnExit)
+ if (!DebugBreakProcess)
+ DebugBreakProcess = bad_DebugBreakProcess;
+ if (!DebugActiveProcessStop || !DebugSetProcessKillOnExit)
{
- dyn_DebugActiveProcessStop = bad_DebugActiveProcessStop;
- dyn_DebugSetProcessKillOnExit = bad_DebugSetProcessKillOnExit;
+ DebugActiveProcessStop = bad_DebugActiveProcessStop;
+ DebugSetProcessKillOnExit = bad_DebugSetProcessKillOnExit;
}
+ if (!GetConsoleFontSize)
+ GetConsoleFontSize = bad_GetConsoleFontSize;
+ if (!GetCurrentConsoleFont)
+ GetCurrentConsoleFont = bad_GetCurrentConsoleFont;
/* Load optional functions used for retrieving filename information
associated with the currently debugged process or its dlls. */
hm = LoadLibrary ("psapi.dll");
if (hm)
{
- dyn_EnumProcessModules = (void *)
+ EnumProcessModules = (void *)
GetProcAddress (hm, "EnumProcessModules");
- dyn_GetModuleInformation = (void *)
+ GetModuleInformation = (void *)
GetProcAddress (hm, "GetModuleInformation");
-#ifndef __CYGWIN__
- dyn_GetModuleFileNameExA = (void *)
- GetProcAddress (hm, "GetModuleFileNameExA");
-#else
- dyn_GetModuleFileNameExW = (void *)
- GetProcAddress (hm, "GetModuleFileNameExW");
-#endif
+ GetModuleFileNameEx = (void *)
+ GetProcAddress (hm, GetModuleFileNameEx_name);
}
- if (!dyn_EnumProcessModules || !dyn_GetModuleInformation
-#ifndef __CYGWIN__
- || !dyn_GetModuleFileNameExA
-#else
- || !dyn_GetModuleFileNameExW
-#endif
- )
+ if (!EnumProcessModules || !GetModuleInformation || !GetModuleFileNameEx)
{
/* Set variables to dummy versions of these processes if the function
wasn't found in psapi.dll. */
- dyn_EnumProcessModules = bad_EnumProcessModules;
- dyn_GetModuleInformation = bad_GetModuleInformation;
-#ifndef __CYGWIN__
- dyn_GetModuleFileNameExA = bad_GetModuleFileNameExA;
-#else
- dyn_GetModuleFileNameExW = bad_GetModuleFileNameExW;
-#endif
+ EnumProcessModules = bad_EnumProcessModules;
+ GetModuleInformation = bad_GetModuleInformation;
+ GetModuleFileNameEx = bad_GetModuleFileNameEx;
/* This will probably fail on Windows 9x/Me. Let the user know that we're
missing some functionality. */
warning(_("cannot automatically find executable file or library to read symbols.\nUse \"file\" or \"dll\" command to load executable/libraries directly."));
hm = LoadLibrary ("advapi32.dll");
if (hm)
{
- dyn_OpenProcessToken = (void *)
- GetProcAddress (hm, "OpenProcessToken");
- dyn_LookupPrivilegeValueA = (void *)
+ OpenProcessToken = (void *) GetProcAddress (hm, "OpenProcessToken");
+ LookupPrivilegeValueA = (void *)
GetProcAddress (hm, "LookupPrivilegeValueA");
- dyn_AdjustTokenPrivileges = (void *)
+ AdjustTokenPrivileges = (void *)
GetProcAddress (hm, "AdjustTokenPrivileges");
/* Only need to set one of these since if OpenProcessToken fails nothing
else is needed. */
- if (!dyn_OpenProcessToken || !dyn_LookupPrivilegeValueA || !dyn_AdjustTokenPrivileges)
- dyn_OpenProcessToken = bad_OpenProcessToken;
+ if (!OpenProcessToken || !LookupPrivilegeValueA || !AdjustTokenPrivileges)
+ OpenProcessToken = bad_OpenProcessToken;
}
}