core/MemoryUtils.h
changeset 2863 d740d9cdf53a
parent 2806 686c283b08fc
child 2992 affc67b319f4
     1.1 --- a/core/MemoryUtils.h	Wed Nov 04 13:52:12 2009 -0500
     1.2 +++ b/core/MemoryUtils.h	Fri Nov 06 16:24:40 2009 -0600
     1.3 @@ -1,8 +1,8 @@
     1.4  /**
     1.5 - * vim: set ts=4 :
     1.6 + * vim: set ts=4 sw=4 tw=99 noet :
     1.7   * =============================================================================
     1.8   * SourceMod
     1.9 - * Copyright (C) 2004-2008 AlliedModders LLC.  All rights reserved.
    1.10 + * Copyright (C) 2004-2000 AlliedModders LLC.  All rights reserved.
    1.11   * =============================================================================
    1.12   *
    1.13   * This program is free software; you can redistribute it and/or modify it under
    1.14 @@ -25,8 +25,6 @@
    1.15   * this exception to all derivative works.  AlliedModders LLC defines further
    1.16   * exceptions, found in LICENSE.txt (as of this writing, version JULY-31-2007),
    1.17   * or <http://www.sourcemod.net/license.php>.
    1.18 - *
    1.19 - * Version: $Id$
    1.20   */
    1.21  
    1.22  #ifndef _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
    1.23 @@ -34,6 +32,12 @@
    1.24  
    1.25  #include <IMemoryUtils.h>
    1.26  #include "sm_globals.h"
    1.27 +#ifdef PLATFORM_LINUX
    1.28 +#include <sh_vector.h>
    1.29 +#include "sm_symtable.h"
    1.30 +
    1.31 +using namespace SourceHook;
    1.32 +#endif
    1.33  
    1.34  using namespace SourceMod;
    1.35  
    1.36 @@ -43,16 +47,34 @@
    1.37  	size_t memorySize;
    1.38  };
    1.39  
    1.40 +#ifdef PLATFORM_LINUX
    1.41 +typedef uint32_t Elf32_Addr;
    1.42 +
    1.43 +struct LibSymbolTable
    1.44 +{
    1.45 +	SymbolTable table;
    1.46 +	Elf32_Addr lib_base;
    1.47 +	uint32_t last_pos;
    1.48 +};
    1.49 +#endif
    1.50 +
    1.51  class MemoryUtils : 
    1.52  	public IMemoryUtils,
    1.53  	public SMGlobalClass
    1.54  {
    1.55 +public:
    1.56 +	~MemoryUtils();
    1.57  public: // SMGlobalClass
    1.58  	void OnSourceModAllInitialized();
    1.59  public: // IMemoryUtils
    1.60  	void *FindPattern(const void *libPtr, const char *pattern, size_t len);
    1.61 +	void *ResolveSymbol(void *handle, const char *symbol);
    1.62  public:
    1.63  	bool GetLibraryInfo(const void *libPtr, DynLibInfo &lib);
    1.64 +#ifdef PLATFORM_LINUX
    1.65 +private:
    1.66 +	CVector<LibSymbolTable *> m_SymTables;
    1.67 +#endif
    1.68  };
    1.69  
    1.70  extern MemoryUtils g_MemUtils;