Renamed core-1.4 to core-legacy.
1 /* ======== SourceMM ========
2 * Copyright (C) 2004-2008 Metamod:Source Development Team
3 * No warranties of any kind
7 * Author(s): David "BAILOPAN" Anderson
8 * ============================
12 * @brief Implements OS-dependant functions from oslink.h
22 #if defined __WIN32__ || defined _WIN32 || defined WIN32
25 static char buf[1024];
30 if (FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
33 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
39 _snprintf(buf, sizeof(buf), "unknown error %x", num);
52 extern "C" void __cxa_guard_acquire(void)
56 extern "C" void __cxa_guard_release(void)
61 bool GetFileOfAddress(void *pAddr, char *buffer, size_t maxlength)
63 #if defined WIN32 || defined _WIN32
64 MEMORY_BASIC_INFORMATION mem;
65 if (!VirtualQuery(pAddr, &mem, sizeof(mem)))
67 if (mem.AllocationBase == NULL)
69 HMODULE dll = (HMODULE)mem.AllocationBase;
70 GetModuleFileName(dll, (LPTSTR)buffer, maxlength);
71 #elif defined __linux__
73 if (!dladdr(pAddr, &info))
75 if (!info.dli_fbase || !info.dli_fname)
77 const char *dllpath = info.dli_fname;
78 snprintf(buffer, maxlength, "%s", dllpath);