public/IMemoryUtils.h
author David Anderson <dvander@alliedmods.net>
Fri Aug 10 05:59:03 2007 +0000 (2007-08-10)
changeset 1300 2c6b22445149
parent 1226 478550a4d5ec
child 1330 ab94316bb52b
permissions -rw-r--r--
fixed per-group command overrides not working
ds@700
     1
/**
ds@700
     2
 * vim: set ts=4 :
dvander@1226
     3
 * ================================================================
dvander@1226
     4
 * SourceMod
dvander@1226
     5
 * Copyright (C) 2004-2007 AlliedModders LLC.  All rights reserved.
dvander@1226
     6
 * ================================================================
ds@700
     7
 *
dvander@1226
     8
 * This program is free software; you can redistribute it and/or 
dvander@1226
     9
 * modify it under the terms of the GNU General Public License, 
dvander@1226
    10
 * version 3.0, as published by the Free Software Foundation.
ds@700
    11
 * 
dvander@1226
    12
 * This program is distributed in the hope that it will be useful,
dvander@1226
    13
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
dvander@1226
    14
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
dvander@1226
    15
 * GNU General Public License for more details.
dvander@1226
    16
 *
dvander@1226
    17
 * You should have received a copy of the GNU General Public License
dvander@1226
    18
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
dvander@1226
    19
 *
dvander@1226
    20
 * As a special exception, AlliedModders LLC gives you permission to 
dvander@1226
    21
 * link the code of this program (as well as its derivative works) to 
dvander@1226
    22
 * "Half-Life 2," the "Source Engine," the "SourcePawn JIT," and any 
dvander@1226
    23
 * Game MODs that run on software by the Valve Corporation.  You must 
dvander@1226
    24
 * obey the GNU General Public License in all respects for all other 
dvander@1226
    25
 * code used. Additionally, AlliedModders LLC grants this exception 
dvander@1226
    26
 * to all derivative works. AlliedModders LLC defines further 
dvander@1226
    27
 * exceptions, found in LICENSE.txt (as of this writing, version 
dvander@1226
    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_INTERFACE_BINARYUTILS_H_
ds@700
    34
#define _INCLUDE_SOURCEMOD_INTERFACE_BINARYUTILS_H_
ds@700
    35
ds@700
    36
#include <IShareSys.h>
ds@700
    37
ds@700
    38
#define SMINTERFACE_MEMORYUTILS_NAME		"IMemoryUtils"
ds@700
    39
#define SMINTERFACE_MEMORYUTILS_VERSION		1
ds@700
    40
ds@700
    41
namespace SourceMod
ds@700
    42
{
ds@700
    43
	class IMemoryUtils : public SMInterface
ds@700
    44
	{
ds@700
    45
	public:
ds@700
    46
		const char *GetInterfaceName()
ds@700
    47
		{
ds@700
    48
			return SMINTERFACE_MEMORYUTILS_NAME;
ds@700
    49
		}
ds@700
    50
		unsigned int GetInterfaceVersion()
ds@700
    51
		{
ds@700
    52
			return SMINTERFACE_MEMORYUTILS_VERSION;
ds@700
    53
		}
ds@700
    54
	public:
ds@700
    55
		/**
ds@700
    56
		 * @brief Searches for a pattern of bytes within the memory of a dynamic library.
ds@700
    57
		 *
ds@700
    58
		 * @param libPtr	Pointer to any chunk of memory that resides in the dynamic library.
ds@700
    59
		 * @param pattern	Pattern of bytes to search for. 0x2A can be used as a wildcard.
ds@700
    60
		 * @param len		Size of the pattern in bytes.
ds@700
    61
		 * @return			Pointer to pattern found in memory, NULL if not found.
ds@700
    62
		 */
ds@701
    63
		virtual void *FindPattern(const void *libPtr, const char *pattern, size_t len) =0;
ds@700
    64
	};
ds@700
    65
}
ds@700
    66
ds@700
    67
#endif // _INCLUDE_SOURCEMOD_INTERFACE_MEMORYUTILS_H_