diff --git a/programs/winedbg/Makefile.in b/programs/winedbg/Makefile.in index de2de3cbcf3..4e6d90df728 100644 --- a/programs/winedbg/Makefile.in +++ b/programs/winedbg/Makefile.in @@ -2,7 +2,7 @@ MODULE = winedbg.exe IMPORTS = dbghelp advapi32 DELAYIMPORTS = comdlg32 shell32 comctl32 user32 gdi32 ws2_32 -EXTRADLLFLAGS = -mconsole -mcygwin +EXTRADLLFLAGS = -mconsole C_SRCS = \ be_arm.c \ diff --git a/programs/winedbg/break.c b/programs/winedbg/break.c index 2896c179067..e5458c34bf9 100644 --- a/programs/winedbg/break.c +++ b/programs/winedbg/break.c @@ -20,7 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" #include "debugger.h" #include "wine/debug.h" diff --git a/programs/winedbg/crashdlg.c b/programs/winedbg/crashdlg.c index cda2642dfc9..1d32749c1a8 100644 --- a/programs/winedbg/crashdlg.c +++ b/programs/winedbg/crashdlg.c @@ -26,8 +26,6 @@ #include "shellapi.h" #include "psapi.h" -#include "wine/unicode.h" - #include "resource.h" #define MAX_PROGRAM_NAME_LENGTH 80 @@ -79,7 +77,7 @@ static WCHAR *get_program_name(HANDLE hProcess) return unidentified; } - programname = strrchrW(image_name, '\\'); + programname = wcsrchr(image_name, '\\'); if (programname != NULL) programname++; else @@ -89,7 +87,7 @@ static WCHAR *get_program_name(HANDLE hProcess) * user-friendly program name */ /* don't display a too long string to the user */ - if (strlenW(programname) >= MAX_PROGRAM_NAME_LENGTH) + if (lstrlenW(programname) >= MAX_PROGRAM_NAME_LENGTH) { programname[MAX_PROGRAM_NAME_LENGTH - 4] = '.'; programname[MAX_PROGRAM_NAME_LENGTH - 3] = '.'; @@ -382,7 +380,7 @@ int display_crash_dialog(void) hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, dbg_curr_pid); g_ProgramName = get_program_name(hProcess); CloseHandle(hProcess); - if (!strcmpW( g_ProgramName, winedeviceW )) return TRUE; + if (!wcscmp( g_ProgramName, winedeviceW )) return TRUE; InitCommonControlsEx( &init ); return DialogBoxW(GetModuleHandleW(NULL), MAKEINTRESOURCEW(IDD_CRASH_DLG), NULL, crash_dlg_proc); } diff --git a/programs/winedbg/db_disasm64.c b/programs/winedbg/db_disasm64.c index 3b93197d5ac..07faed0d146 100644 --- a/programs/winedbg/db_disasm64.c +++ b/programs/winedbg/db_disasm64.c @@ -33,12 +33,12 @@ #include "debugger.h" #if defined(__GNUC__) && (__GNUC__ >= 3) -static int (*db_printf)(const char* format, ...) __attribute__((format (printf,1,2))); +static int WINAPIV (*db_printf)(const char* format, ...) __attribute__((format (printf,1,2))); #else -static int (*db_printf)(const char* format, ...); +static int WINAPIV (*db_printf)(const char* format, ...); #endif -static int no_printf(const char* format, ...) {return 0;} +static int WINAPIV no_printf(const char* format, ...) {return 0;} typedef DWORD_PTR db_addr_t; typedef BOOL boolean_t; diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index ac76b5baf8a..8e9bda6c4fd 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -21,9 +21,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include diff --git a/programs/winedbg/debug.l b/programs/winedbg/debug.l index 79cb8ccd3a8..b841048360f 100644 --- a/programs/winedbg/debug.l +++ b/programs/winedbg/debug.l @@ -22,7 +22,6 @@ %option noinput nounput always-interactive 8bit prefix="dbg_" %{ -#include "config.h" #include #include #include diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index e244ff43120..0b2d7c50738 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -447,9 +447,9 @@ extern struct dbg_type types_find_type(DWORD64 linear, const char* name, enum S extern void dbg_outputW(const WCHAR* buffer, int len); extern const char* dbg_W2A(const WCHAR* buffer, unsigned len); #ifdef __GNUC__ -extern int dbg_printf(const char* format, ...) __attribute__((format (printf,1,2))); +extern int WINAPIV dbg_printf(const char* format, ...) __attribute__((format (printf,1,2))); #else -extern int dbg_printf(const char* format, ...); +extern int WINAPIV dbg_printf(const char* format, ...); #endif extern const struct dbg_internal_var* dbg_get_internal_var(const char*); extern BOOL dbg_interrupt_debuggee(void); diff --git a/programs/winedbg/expr.c b/programs/winedbg/expr.c index 029c86f67f3..e58d394be35 100644 --- a/programs/winedbg/expr.c +++ b/programs/winedbg/expr.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include diff --git a/programs/winedbg/gdbproxy.c b/programs/winedbg/gdbproxy.c index eadb2c78a19..d018a715aa7 100644 --- a/programs/winedbg/gdbproxy.c +++ b/programs/winedbg/gdbproxy.c @@ -24,27 +24,20 @@ * http://sources.redhat.com/gdb/onlinedocs/gdb/Maintenance-Commands.html */ -#include "config.h" - #define NONAMELESSUNION #define NONAMELESSSTRUCT -#include "ntstatus.h" -#define WIN32_NO_STATUS -#include "winsock2.h" #include #include #include #include #include -#ifdef HAVE_UNISTD_H -# include -#endif #include "debugger.h" #include "windef.h" #include "winbase.h" +#include "winsock2.h" #include "tlhelp32.h" #include "wine/exception.h" #include "wine/debug.h" @@ -1283,15 +1276,15 @@ static enum packet_return packet_read_register(struct gdb_context* gdbctx) if (!backend->get_context(thread->handle, &ctx)) return packet_error; - if (sscanf(gdbctx->in_packet, "%zx", ®) != 1) + if (sscanf(gdbctx->in_packet, "%Ix", ®) != 1) return packet_error; if (reg >= backend->gdb_num_regs) { - WARN("Unhandled register %zu\n", reg); + WARN("Unhandled register %Iu\n", reg); return packet_error; } - TRACE("%zu => %s\n", reg, wine_dbgstr_longlong(cpu_register(gdbctx, &ctx, reg))); + TRACE("%Iu => %s\n", reg, wine_dbgstr_longlong(cpu_register(gdbctx, &ctx, reg))); packet_reply_open(gdbctx); packet_reply_register_hex_to(gdbctx, &ctx, reg); @@ -1318,18 +1311,18 @@ static enum packet_return packet_write_register(struct gdb_context* gdbctx) return packet_error; *ptr++ = '\0'; - if (sscanf(gdbctx->in_packet, "%zx", ®) != 1) + if (sscanf(gdbctx->in_packet, "%Ix", ®) != 1) return packet_error; if (reg >= backend->gdb_num_regs) { /* FIXME: if just the reg is above cpu_num_regs, don't tell gdb * it wouldn't matter too much, and it fakes our support for all regs */ - WARN("Unhandled register %zu\n", reg); + WARN("Unhandled register %Iu\n", reg); return packet_ok; } - TRACE("%zu <= %s\n", reg, debugstr_an(ptr, (int)(gdbctx->in_packet_len - (ptr - gdbctx->in_packet)))); + TRACE("%Iu <= %s\n", reg, debugstr_an(ptr, (int)(gdbctx->in_packet_len - (ptr - gdbctx->in_packet)))); cpu_register_hex_from(gdbctx, &ctx, reg, (const char**)&ptr); if (!backend->set_context(thread->handle, &ctx)) @@ -1747,7 +1740,7 @@ static void packet_query_target_xml(struct gdb_context* gdbctx, struct backend_c ""); } - snprintf(buffer, ARRAY_SIZE(buffer), "gdb_register_map[i].name, 8 * cpu->gdb_register_map[i].length); packet_reply_add(gdbctx, buffer); @@ -2111,19 +2104,17 @@ static int fetch_data(struct gdb_context* gdbctx) static BOOL gdb_exec(unsigned port, unsigned flags) { - char buf[MAX_PATH]; - int fd; - const char *gdb_path, *tmp_path; - FILE* f; + WCHAR tmp[MAX_PATH], buf[MAX_PATH]; const char *argv[6]; + char *unix_tmp; + const char *gdb_path; + FILE* f; if (!(gdb_path = getenv("WINE_GDB"))) gdb_path = "gdb"; - if (!(tmp_path = getenv("TMPDIR"))) tmp_path = "/tmp"; - strcpy(buf, tmp_path); - strcat(buf, "/winegdb.XXXXXX"); - fd = mkstemps(buf, 0); - if (fd == -1) return FALSE; - if ((f = fdopen(fd, "w+")) == NULL) return FALSE; + GetTempPathW( MAX_PATH, buf ); + GetTempFileNameW( buf, L"gdb", 0, tmp ); + if ((f = _wfopen( tmp, L"w+" )) == NULL) return FALSE; + unix_tmp = wine_get_unix_file_name( tmp ); fprintf(f, "target remote localhost:%d\n", ntohs(port)); fprintf(f, "set prompt Wine-gdb>\\ \n"); /* gdb 5.1 seems to require it, won't hurt anyway */ @@ -2137,18 +2128,19 @@ static BOOL gdb_exec(unsigned port, unsigned flags) */ fprintf(f, "set step-mode on\n"); /* tell gdb to delete this file when done handling it... */ - fprintf(f, "shell rm -f \"%s\"\n", buf); + fprintf(f, "shell rm -f \"%s\"\n", unix_tmp); fclose(f); argv[0] = "xterm"; argv[1] = "-e"; argv[2] = gdb_path; argv[3] = "-x"; - argv[4] = buf; + argv[4] = unix_tmp; argv[5] = NULL; if (flags & FLAG_WITH_XTERM) __wine_unix_spawnvp( (char **)argv, FALSE ); else __wine_unix_spawnvp( (char **)argv + 2, FALSE ); + HeapFree( GetProcessHeap(), 0, unix_tmp ); return TRUE; } diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c index 36da71c4713..f334aa3576d 100644 --- a/programs/winedbg/info.c +++ b/programs/winedbg/info.c @@ -19,8 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include @@ -177,7 +175,7 @@ static void module_print_info(const struct info_module *module, BOOL is_embedded is_embedded ? "\\" : get_symtype_str(&module->mi), module->name); } -static int module_compare(const void* p1, const void* p2) +static int __cdecl module_compare(const void* p1, const void* p2) { struct info_module *left = (struct info_module *)p1; struct info_module *right = (struct info_module *)p2; diff --git a/programs/winedbg/memory.c b/programs/winedbg/memory.c index ab8b2eb49b8..3d6534a973f 100644 --- a/programs/winedbg/memory.c +++ b/programs/winedbg/memory.c @@ -20,16 +20,12 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include #include "debugger.h" #include "wine/debug.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(winedbg); diff --git a/programs/winedbg/source.c b/programs/winedbg/source.c index cabb75f1813..363cf2bf654 100644 --- a/programs/winedbg/source.c +++ b/programs/winedbg/source.c @@ -18,7 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" #include #include diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index f76996d11b7..1aa681bf7a6 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -20,8 +20,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include diff --git a/programs/winedbg/symbol.c b/programs/winedbg/symbol.c index bd36f64ac5e..b0ef59e49f0 100644 --- a/programs/winedbg/symbol.c +++ b/programs/winedbg/symbol.c @@ -19,7 +19,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" #include #include #include diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 508e1c58040..4aaa10fa720 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include @@ -31,7 +29,6 @@ #include "winternl.h" #include "wine/debug.h" #include "wine/exception.h" -#include "wine/unicode.h" WINE_DEFAULT_DEBUG_CHANNEL(winedbg); @@ -308,11 +305,11 @@ void fetch_module_name(void* name_addr, void* mod_addr, WCHAR* buffer, size_t bu /* FIXME: proper NT->Dos conversion */ static const WCHAR nt_prefixW[] = {'\\','?','?','\\'}; - if (!strncmpW( buffer, nt_prefixW, 4 )) + if (!wcsncmp( buffer, nt_prefixW, 4 )) memmove( buffer, buffer + 4, (lstrlenW(buffer + 4) + 1) * sizeof(WCHAR) ); } else - snprintfW(buffer, bufsz, dlladdr, (ULONG_PTR)mod_addr); + swprintf(buffer, bufsz, dlladdr, (ULONG_PTR)mod_addr); } } @@ -376,7 +373,7 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de) if (!QueryFullProcessImageNameW( dbg_curr_process->handle, 0, u.buffer, &size )) { static const WCHAR pcspid[] = {'P','r','o','c','e','s','s','_','%','0','8','x',0}; - snprintfW( u.buffer, ARRAY_SIZE(u.buffer), pcspid, dbg_curr_pid); + swprintf( u.buffer, ARRAY_SIZE(u.buffer), pcspid, dbg_curr_pid); } WINE_TRACE("%04x:%04x: create process '%s'/%p @%p (%u<%u>)\n", diff --git a/programs/winedbg/tgt_minidump.c b/programs/winedbg/tgt_minidump.c index 95af7a601e5..ab695371f17 100644 --- a/programs/winedbg/tgt_minidump.c +++ b/programs/winedbg/tgt_minidump.c @@ -21,9 +21,6 @@ #define NONAMELESSUNION #define NONAMELESSSTRUCT -#include "config.h" -#include "wine/port.h" - #include #include #include diff --git a/programs/winedbg/tgt_module.c b/programs/winedbg/tgt_module.c index 2fdebc94ed1..63fab9a238e 100644 --- a/programs/winedbg/tgt_module.c +++ b/programs/winedbg/tgt_module.c @@ -18,8 +18,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" - #include #include #include diff --git a/programs/winedbg/types.c b/programs/winedbg/types.c index 20b21345aad..1fd40932557 100644 --- a/programs/winedbg/types.c +++ b/programs/winedbg/types.c @@ -21,7 +21,6 @@ * upon which full support for datatype handling will eventually be built. */ -#include "config.h" #include #include "debugger.h" diff --git a/programs/winedbg/winedbg.c b/programs/winedbg/winedbg.c index 35b7642b733..e7cdaff67d3 100644 --- a/programs/winedbg/winedbg.c +++ b/programs/winedbg/winedbg.c @@ -17,9 +17,6 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ -#include "config.h" -#include "wine/port.h" - #include #include #include @@ -149,15 +146,15 @@ void dbg_outputW(const WCHAR* buffer, int len) /* FIXME: should CP_ACP be GetConsoleCP()? */ } -int dbg_printf(const char* format, ...) +int WINAPIV dbg_printf(const char* format, ...) { static char buf[4*1024]; - va_list valist; + __ms_va_list valist; int len; - va_start(valist, format); + __ms_va_start(valist, format); len = vsnprintf(buf, sizeof(buf), format, valist); - va_end(valist); + __ms_va_end(valist); if (len <= -1 || len >= sizeof(buf)) {