90 lines
2.2 KiB
C++
90 lines
2.2 KiB
C++
/*++
|
|
|
|
Copyright (c) 1992 Microsoft Corporation
|
|
|
|
Module Name:
|
|
|
|
ntsdextp.h
|
|
|
|
Abstract:
|
|
|
|
Common header file for NTSDEXTS component source files.
|
|
|
|
Author:
|
|
|
|
Steve Wood (stevewo) 21-Feb-1995
|
|
|
|
Revision History:
|
|
|
|
--*/
|
|
|
|
#include <ntos.h>
|
|
#include <ntrtl.h>
|
|
#include <nturtl.h>
|
|
#include <windows.h>
|
|
#include <ntsdexts.h>
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <wchar.h>
|
|
#include <heap.h>
|
|
#include <atom.h>
|
|
#include <stktrace.h>
|
|
#include <winsock2.h>
|
|
|
|
#include <ntcsrsrv.h>
|
|
#include "unasm.h"
|
|
|
|
#define move(dst, src)\
|
|
try {\
|
|
ReadMemory((LPVOID) (src), &(dst), sizeof(dst), NULL);\
|
|
} except (EXCEPTION_EXECUTE_HANDLER) {\
|
|
return;\
|
|
}
|
|
#define moveBlock(dst, src, size)\
|
|
try {\
|
|
ReadMemory((LPVOID) (src), &(dst), (size), NULL);\
|
|
} except (EXCEPTION_EXECUTE_HANDLER) {\
|
|
return;\
|
|
}
|
|
|
|
#ifdef __cplusplus
|
|
#define CPPMOD extern "C"
|
|
#else
|
|
#define CPPMOD
|
|
#endif
|
|
|
|
#define DECLARE_API(s) \
|
|
CPPMOD VOID \
|
|
s( \
|
|
HANDLE hCurrentProcess, \
|
|
HANDLE hCurrentThread, \
|
|
DWORD dwCurrentPc, \
|
|
PNTSD_EXTENSION_APIS lpExtensionApis, \
|
|
LPSTR lpArgumentString \
|
|
)
|
|
|
|
#define INIT_API() { \
|
|
ExtensionApis = *lpExtensionApis; \
|
|
ExtensionCurrentProcess = hCurrentProcess; \
|
|
}
|
|
|
|
#define dprintf (ExtensionApis.lpOutputRoutine)
|
|
#define GetExpression (ExtensionApis.lpGetExpressionRoutine)
|
|
#define GetSymbol (ExtensionApis.lpGetSymbolRoutine)
|
|
#define Disassm (ExtensionApis.lpDisasmRoutine)
|
|
#define CheckControlC (ExtensionApis.lpCheckControlCRoutine)
|
|
#define ReadMemory(a,b,c,d) ReadProcessMemory( ExtensionCurrentProcess, (LPCVOID)(a), (b), (c), (d) )
|
|
#define WriteMemory(a,b,c,d) WriteProcessMemory( ExtensionCurrentProcess, (LPVOID)(a), (LPVOID)(b), (c), (d) )
|
|
|
|
#ifndef malloc
|
|
#define malloc( n ) HeapAlloc( GetProcessHeap(), 0, (n) )
|
|
#endif
|
|
#ifndef free
|
|
#define free( p ) HeapFree( GetProcessHeap(), 0, (p) )
|
|
#endif
|
|
|
|
extern NTSD_EXTENSION_APIS ExtensionApis;
|
|
extern HANDLE ExtensionCurrentProcess;
|
|
|