debug.cpp: bugfix in cat_atow
lib: add EXTERN_C win: move get_module_filename here, add to sysdep wdll: use EXTERN_C This was SVN commit r2356.
This commit is contained in:
parent
b0ceae0393
commit
e2552b8341
@ -73,7 +73,7 @@ static void cat_atow(FILE* out, const char* in_filename)
|
||||
FILE* in = fopen(in_filename, "rb");
|
||||
if(!in)
|
||||
{
|
||||
fwprintf(in, L"(unavailable)");
|
||||
fwprintf(out, L"(unavailable)");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,13 @@ scope
|
||||
#include "sysdep/sysdep.h"
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN_C extern "C"
|
||||
#else
|
||||
#define EXTERN_C extern
|
||||
#endif
|
||||
|
||||
|
||||
// tell STL not to generate exceptions, if compiling without exceptions
|
||||
// (usually done for performance reasons).
|
||||
#ifdef CONFIG_DISABLE_EXCEPTIONS
|
||||
|
@ -37,6 +37,11 @@ extern int clipboard_free(wchar_t* copy);
|
||||
|
||||
extern int get_executable_name(char* n_path, size_t buf_size);
|
||||
|
||||
// return filename of the module which contains address <addr>,
|
||||
// or L"" on failure. path holds the string and must be >= MAX_PATH chars.
|
||||
wchar_t* get_module_filename(void* addr, wchar_t* path);
|
||||
|
||||
|
||||
extern int pick_directory(char* n_path, size_t buf_size);
|
||||
|
||||
|
||||
|
@ -9,11 +9,6 @@
|
||||
|
||||
#define _DELAY_IMP_VER 2
|
||||
|
||||
#if defined(__cplusplus)
|
||||
#define ExternC extern "C"
|
||||
#else
|
||||
#define ExternC extern
|
||||
#endif
|
||||
|
||||
typedef IMAGE_THUNK_DATA * PImgThunkData;
|
||||
typedef const IMAGE_THUNK_DATA * PCImgThunkData;
|
||||
@ -86,14 +81,14 @@ typedef FARPROC (WINAPI *PfnDliHook)(unsigned dliNotify, PDelayLoadInfo pdli);
|
||||
|
||||
// routine definition; takes a pointer to a name to unload
|
||||
//
|
||||
ExternC
|
||||
EXTERN_C
|
||||
BOOL WINAPI
|
||||
__FUnloadDelayLoadedDLL2(LPCSTR szDll);
|
||||
|
||||
//
|
||||
// Snap load support
|
||||
//
|
||||
ExternC
|
||||
EXTERN_C
|
||||
HRESULT WINAPI
|
||||
__HrLoadAllImportsForDll(LPCSTR szDll);
|
||||
|
||||
@ -119,11 +114,11 @@ __HrLoadAllImportsForDll(LPCSTR szDll);
|
||||
// dliNoteEndProcessing}
|
||||
// on this call.
|
||||
//
|
||||
ExternC
|
||||
EXTERN_C
|
||||
PfnDliHook __pfnDliNotifyHook2;
|
||||
|
||||
// This is the failure hook, dliNotify = {dliFailLoadLib|dliFailGetProc}
|
||||
ExternC
|
||||
EXTERN_C
|
||||
PfnDliHook __pfnDliFailureHook2;
|
||||
|
||||
|
||||
@ -612,7 +607,7 @@ static FARPROC WINAPI notify_hook(unsigned dliNotify, PDelayLoadInfo pdli)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ExternC PfnDliHook __pfnDliNotifyHook2 = notify_hook;
|
||||
ExternC PfnDliHook __pfnDliFailureHook2 = 0;
|
||||
EXTERN_C PfnDliHook __pfnDliNotifyHook2 = notify_hook;
|
||||
EXTERN_C PfnDliHook __pfnDliFailureHook2 = 0;
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
// Windows-specific code and program entry point
|
||||
h// Windows-specific code and program entry point
|
||||
// Copyright (c) 2003 Jan Wassenberg
|
||||
//
|
||||
// This program is free software; you can redistribute it and/or
|
||||
@ -86,6 +86,27 @@ inline int get_executable_name(char* n_path, size_t buf_size)
|
||||
}
|
||||
|
||||
|
||||
// return filename of the module which contains address <addr>,
|
||||
// or L"" on failure. path holds the string and must be >= MAX_PATH chars.
|
||||
wchar_t* get_module_filename(void* addr, wchar_t* path)
|
||||
{
|
||||
path[0] = '\0'; // in case either API call below fails
|
||||
wchar_t* module_filename = path;
|
||||
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
if(VirtualQuery(addr, &mbi, sizeof(mbi)))
|
||||
{
|
||||
HMODULE hModule = (HMODULE)mbi.AllocationBase;
|
||||
if(GetModuleFileNameW(hModule, path, MAX_PATH))
|
||||
module_filename = wcsrchr(path, '\\')+1;
|
||||
// note: GetModuleFileName returns full path => a '\\' exists
|
||||
}
|
||||
|
||||
return module_filename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static int CALLBACK browse_cb(HWND hWnd, unsigned int msg, LPARAM lParam, LPARAM ldata)
|
||||
{
|
||||
UNUSED(lParam);
|
||||
|
Loading…
Reference in New Issue
Block a user