Attempted fix at DEP

This commit is contained in:
David Anderson 2005-08-21 19:30:27 +00:00
parent 24d9e3266e
commit 5693d2629e
3 changed files with 45 additions and 6 deletions

View File

@ -30,6 +30,9 @@
*/
#include <time.h>
#if defined WIN32
#include <direct.h>
#endif
#include "amxmodx.h"
#include "fakemeta.h"
#include "newmenus.h"
@ -1034,7 +1037,7 @@ C_DLLEXPORT int Meta_Query(char *ifvers, plugin_info_t **pPlugInfo, mutil_funcs_
g_NeedsP = true;
#endif
} else if (mminor == 11) {
} else if (mminor >= 11) {
g_IsNewMM = true;
} else if (pminor > mminor) {
LOG_ERROR(PLID, "metamod version is incompatible with this plugin; please find a newer version of this plugin");

View File

@ -406,7 +406,7 @@ int load_amxscript(AMX *amx, void **program, const char *filename, char error[64
{
//amx->base = (unsigned char FAR *)realloc( np, amx->code_size );
#ifndef __linux__
amx->base = new unsigned char[ amx->code_size ];
amx->base = (unsigned char *)VirtualAlloc(NULL, amx->code_size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
#else
//posix_memalign((void **)&(amx->base), sysconf(_SC_PAGESIZE), amx->code_size);
amx->base = (unsigned char *)memalign(sysconf(_SC_PAGESIZE), amx->code_size);
@ -593,15 +593,29 @@ int set_amxnatives(AMX* amx,char error[128])
int unload_amxscript(AMX* amx, void** program)
{
int flags = amx->flags;
amxx_FreeDebug(amx);
CList<CScript,AMX*>::iterator a = g_loadedscripts.find( amx );
if ( a ) a.remove();
char *prg = (char *)*program;
#if defined __linux__ && defined JIT && defined MEMORY_TEST
if (!prg)
return AMX_ERR_NONE;
#if defined JIT
#if defined __linux__ && defined MEMORY_TEST
#undef free
free(prg);
#define free(ptr) m_deallocator(__FILE__,__LINE__,__FUNCTION__,m_alloc_free,ptr)
#elif defined WIN32
if (flags & AMX_FLAG_DEBUG)
{
delete [] prg;
} else if (!VirtualFree((LPVOID)prg, 0, MEM_RELEASE)) {
AMXXLOG_Log("[AMXX] Could not free plugin memory, failure %d.", GetLastError());
return AMX_ERR_PARAMS;
}
#endif //OS support
#else
//delete normally
delete[] prg;
#endif
*program = 0;

View File

@ -112,11 +112,12 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib ..\JIT\natives-x86.obj"
OutputFile="release/amxmodx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
IgnoreDefaultLibraryNames="LIBC"
ModuleDefinitionFile=""
ProgramDatabaseFile=".\release/amxx_mm.pdb"
ImportLibrary=".\release/amxx_mm.lib"/>
@ -250,11 +251,12 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib"
AdditionalDependencies="odbc32.lib odbccp32.lib ..\zlib\zlib.lib ..\JIT\natives-x86.obj"
OutputFile="memtestrelease/amxmodx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
IgnoreDefaultLibraryNames="LIBC"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\memtestrelease/amxx_mm.pdb"
@ -464,11 +466,12 @@
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="..\zlib\zlib.lib ..\JIT\amxjitsn.obj ..\JIT\amxexecn.obj"
AdditionalDependencies="..\zlib\zlib.lib ..\JIT\amxjitsn.obj ..\JIT\amxexecn.obj ..\JIT\natives-x86.obj"
OutputFile="jitmemtestrelease/amxmodx_mm.dll"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
AdditionalLibraryDirectories="..\extra\lib_win32"
IgnoreDefaultLibraryNames="MSVCRT"
ModuleDefinitionFile=""
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\jitmemtestrelease/amxx_mm.pdb"
@ -839,6 +842,25 @@
RelativePath="..\version.rc">
</File>
</Filter>
<Filter
Name="Assembly"
Filter="">
<File
RelativePath="..\amxdefn.asm">
</File>
<File
RelativePath="..\amxexecn.asm">
</File>
<File
RelativePath="..\amxjitsn.asm">
</File>
<File
RelativePath="..\natives-amd64.asm">
</File>
<File
RelativePath="..\natives-x86.asm">
</File>
</Filter>
</Files>
<Globals>
</Globals>