core/MemoryUtils.h
author Phong Dang <teame06@gmail.com>
Wed Aug 01 04:17:36 2007 +0000 (2007-08-01)
changeset 1235 88bb46f9731e
parent 1231 17badaf66ce4
child 1330 ab94316bb52b
permissions -rw-r--r--
Implemented requested amb603. Added voice natives.
ds@700
     1
/**
ds@700
     2
 * vim: set ts=4 :
dvander@1231
     3
 * ================================================================
dvander@1231
     4
 * SourceMod
dvander@1231
     5
 * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
dvander@1231
     6
 * ================================================================
ds@700
     7
 *
dvander@1231
     8
 * This program is free software; you can redistribute it and/or 
dvander@1231
     9
 * modify it under the terms of the GNU General Public License, 
dvander@1231
    10
 * version 3.0, as published by the Free Software Foundation.
dvander@1231
    11
 * 
dvander@1231
    12
 * This program is distributed in the hope that it will be useful,
dvander@1231
    13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
dvander@1231
    14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dvander@1231
    15
 * GNU General Public License for more details.
dvander@1231
    16
 *
dvander@1231
    17
 * You should have received a copy of the GNU General Public License
dvander@1231
    18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1231
    19
 *
dvander@1231
    20
 * As a special exception, AlliedModders LLC gives you permission to 
dvander@1231
    21
 * link the code of this program (as well as its derivative works) to 
dvander@1231
    22
 * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any 
dvander@1231
    23
 * Game MODs that run on software by the Valve Corporation.  You must 
dvander@1231
    24
 * obey the GNU General Public License in all respects for all other 
dvander@1231
    25
 * code used. Additionally, AlliedModders LLC grants this exception 
dvander@1231
    26
 * to all derivative works. AlliedModders LLC defines further 
dvander@1231
    27
 * exceptions, found in LICENSE.txt (as of this writing, version 
dvander@1231
    28
 * JULY-31-2007), or <http://www.sourcemod.net/license.php>.
ds@700
    29
 *
ds@700
    30
 * Version: $Id$
ds@700
    31
 */
ds@700
    32
ds@700
    33
#ifndef _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
ds@700
    34
#define _INCLUDE_SOURCEMOD_MEMORYUTILS_H_
ds@700
    35
ds@700
    36
#include <IMemoryUtils.h>
ds@702
    37
#include "sm_globals.h"
ds@700
    38
ds@700
    39
using namespace SourceMod;
ds@700
    40
ds@700
    41
struct DynLibInfo
ds@700
    42
{
ds@700
    43
	void *baseAddress;
ds@700
    44
	size_t memorySize;
ds@700
    45
};
ds@700
    46
ds@702
    47
class MemoryUtils : 
ds@702
    48
	public IMemoryUtils,
ds@702
    49
	public SMGlobalClass
ds@700
    50
{
ds@702
    51
public: // SMGlobalClass
ds@702
    52
	void OnSourceModAllInitialized();
ds@702
    53
public: // IMemoryUtils
ds@701
    54
	void *FindPattern(const void *libPtr, const char *pattern, size_t len);
ds@700
    55
private:
ds@701
    56
	bool GetLibraryInfo(const void *libPtr, DynLibInfo &lib);
ds@700
    57
};
ds@700
    58
ds@700
    59
extern MemoryUtils g_MemUtils;
ds@700
    60
ds@700
    61
#endif // _INCLUDE_SOURCEMOD_MEMORYUTILS_H_