HyperDbg Debugger
Loading...
Searching...
No Matches
script-engine.h
Go to the documentation of this file.
1
13#pragma once
14#include "type.h"
15
16#ifndef SCRIPT_ENGINE_H
17# define SCRIPT_ENGINE_H
18
19//
20// *** export pdb wrapper as script engine function ***
21//
23 ScriptEngineConvertNameToAddress(const char * FunctionOrVariableName, PBOOLEAN WasFound);
24__declspec(dllexport) UINT32
25 ScriptEngineLoadFileSymbol(UINT64 BaseAddress, const char * PdbFileName, const char * CustomModuleName);
26__declspec(dllexport) UINT32
28__declspec(dllexport) UINT32
29 ScriptEngineUnloadModuleSymbol(char * ModuleName);
30__declspec(dllexport) UINT32
31 ScriptEngineSearchSymbolForMask(const char * SearchMask);
32__declspec(dllexport) BOOLEAN
34__declspec(dllexport) BOOLEAN
36__declspec(dllexport) BOOLEAN
37 ScriptEngineCreateSymbolTableForDisassembler(void * CallbackFunction);
38__declspec(dllexport) BOOLEAN
39 ScriptEngineConvertFileToPdbPath(const char * LocalFilePath, char * ResultPath);
40__declspec(dllexport) BOOLEAN
42__declspec(dllexport) BOOLEAN
44__declspec(dllexport) BOOLEAN
46__declspec(dllexport) VOID
48__declspec(dllexport) VOID
50
65
67NewSymbol(void);
68
71
74
75unsigned int
77
78void
79RemoveSymbol(PSYMBOL * Symbol);
80
81__declspec(dllexport) void PrintSymbol(PVOID Symbol);
82
84NewSymbolBuffer(void);
85
86__declspec(dllexport) void RemoveSymbolBuffer(PVOID SymbolBuffer);
87
89PushSymbol(PSYMBOL_BUFFER SymbolBuffer, const PSYMBOL Symbol);
90
91__declspec(dllexport) void PrintSymbolBuffer(const PVOID SymbolBuffer);
92
95
96__declspec(dllexport) PVOID
97 ScriptEngineParse(char * str);
98
99__declspec(dllexport) BOOLEAN
101
102__declspec(dllexport) BOOLEAN
104
105void
107 UINT64 BooleanExpressionSize,
108 PTOKEN FirstToken,
109 PTOKEN_LIST MatchedStack,
110 PUSER_DEFINED_FUNCTION_NODE * UserDefinedFunctionHead,
111 PSYMBOL_BUFFER CodeBuffer,
112 char * str,
113 char * c,
115
116UINT64
117BooleanExpressionExtractEnd(char * str, BOOL * WaitForWaitStatementBooleanExpression, PTOKEN CurrentIn);
118
119void
120CodeGen(
121 PTOKEN_LIST MatchedStack,
122 PUSER_DEFINED_FUNCTION_NODE * UserDefinedFunctionHead,
123 PSYMBOL_BUFFER CodeBuffer,
124 PTOKEN Operator,
126
127unsigned long long int
128RegisterToInt(char * str);
129
130unsigned long long int
131PseudoRegToInt(char * str);
132
133unsigned long long int
134SemanticRuleToInt(char * str);
135
136char *
137HandleError(PSCRIPT_ENGINE_ERROR_TYPE Error, char * str);
138
139int
141
142int
144
145int
147
148int
150
151int
152LalrGetRhsSize(int RuleId);
153
154BOOL
156
157int
159
160int
162
163#endif
int BOOL
Definition BasicTypes.h:23
UCHAR BOOLEAN
Definition BasicTypes.h:39
BOOLEAN * PBOOLEAN
Definition BasicTypes.h:40
#define VOID
Definition BasicTypes.h:33
unsigned __int64 UINT64
Definition BasicTypes.h:21
unsigned int UINT32
Definition BasicTypes.h:48
char CHAR
Definition BasicTypes.h:31
char * PdbFilePath
Definition HyperDbgScriptImports.h:63
CHAR * FieldName
Definition HyperDbgScriptImports.h:55
CHAR UINT32 * FieldOffset
Definition HyperDbgScriptImports.h:55
UINT64 BOOLEAN IsStruct
Definition HyperDbgScriptImports.h:67
UINT64 * TypeSize
Definition HyperDbgScriptImports.h:57
UINT64 Address
Definition HyperDbgScriptImports.h:67
UINT32 * NumberOfGetOperands
Definition HyperDbgScriptImports.h:33
UINT32 BOOLEAN const char * SymbolPath
Definition HyperDbgScriptImports.h:65
char char BOOLEAN Is32BitModule
Definition HyperDbgScriptImports.h:63
UINT32 BOOLEAN const char BOOLEAN IsSilentLoad
Definition HyperDbgScriptImports.h:65
UINT32 StoredLength
Definition HyperDbgScriptImports.h:65
const char const char * CustomModuleName
Definition HyperDbgScriptImports.h:47
const char * PdbFileName
Definition HyperDbgScriptImports.h:47
UINT64 BOOLEAN PVOID const char * AdditionalParameters
Definition HyperDbgScriptImports.h:67
UINT64 BOOLEAN PVOID BufferAddress
Definition HyperDbgScriptImports.h:67
UINT32 UINT32 * NumberOfSetOperands
Definition HyperDbgScriptImports.h:33
char * ResultPath
Definition HyperDbgScriptImports.h:61
UINT32 BOOLEAN DownloadIfAvailable
Definition HyperDbgScriptImports.h:65
PBOOLEAN WasFound
Definition HyperDbgScriptImports.h:45
char char * GuidAndAgeDetails
Definition HyperDbgScriptImports.h:63
BOOL LalrIsOperandType(PTOKEN PTOKEN)
Returns TRUE if the Token can be the operand of an operator.
Definition script-engine.c:3264
int LalrGetRhsSize(int RuleId)
Returns the size of Right Hand Side (RHS) of a rule.
Definition script-engine.c:3243
int GetFunctionParameterIdentifier(PTOKEN Token)
Definition script-engine.c:3222
PSYMBOL NewWstringSymbol(PTOKEN Token)
Allocates a new SYMBOL with wstring type and returns the reference to it.
Definition script-engine.c:2515
int NewLocalIdentifier(PTOKEN PTOKEN)
Allocates a new local variable and returns the integer assigned to it.
Definition script-engine.c:3194
UINT64 BooleanExpressionExtractEnd(char *str, BOOL *WaitForWaitStatementBooleanExpression, PTOKEN CurrentIn)
Computes the boolean expression length starting from the current input position.
Definition script-engine.c:2232
int NewGlobalIdentifier(PTOKEN PTOKEN)
Allocates a new global variable and returns the integer assigned to it.
Definition script-engine.c:3180
unsigned long long int RegisterToInt(char *str)
Converts register string to integer.
Definition script-engine.c:2888
PSYMBOL_BUFFER PushSymbol(PSYMBOL_BUFFER SymbolBuffer, const PSYMBOL Symbol)
Gets a symbol and push it into the symbol buffer.
Definition script-engine.c:2742
enum _SCRIPT_ENGINE_ERROR_TYPE SCRIPT_ENGINE_ERROR_TYPE
int GetGlobalIdentifierVal(PTOKEN PTOKEN)
Returns the integer assigned to global variable.
Definition script-engine.c:3138
unsigned long long int SemanticRuleToInt(char *str)
Converts a sematinc rule token to integer.
Definition script-engine.c:3008
PSYMBOL ToSymbol(PTOKEN PTOKEN, PSCRIPT_ENGINE_ERROR_TYPE Error)
Converts Token to Symbol and returns the reference to it.
Definition script-engine.c:2612
PSYMBOL NewSymbol(void)
Allocates a new SYMBOL and returns the reference to it.
Definition script-engine.c:2460
enum _SCRIPT_ENGINE_ERROR_TYPE * PSCRIPT_ENGINE_ERROR_TYPE
unsigned long long int PseudoRegToInt(char *str)
Converts pseudo register string to integer.
Definition script-engine.c:2989
void CodeGen(PTOKEN_LIST MatchedStack, PUSER_DEFINED_FUNCTION_NODE *UserDefinedFunctionHead, PSYMBOL_BUFFER CodeBuffer, PTOKEN Operator, PSCRIPT_ENGINE_ERROR_TYPE Error)
Script Engine code generator.
Definition script-engine.c:526
int NewFunctionParameterIdentifier(PTOKEN Token)
Definition script-engine.c:3208
int GetLocalIdentifierVal(PTOKEN PTOKEN)
Returns the integer assigned to local variable.
Definition script-engine.c:3159
__declspec(dllexport) UINT64 ScriptEngineConvertNameToAddress(const char *FunctionOrVariableName
unsigned int GetSymbolHeapSize(PSYMBOL Symbol)
Returns the number of SYMBOL objects (24 bytes) allocated by string or wstring sybmol.
Definition script-engine.c:2549
_SCRIPT_ENGINE_ERROR_TYPE
Definition script-engine.h:52
@ SCRIPT_ENGINE_ERROR_UNDEFINED_FUNCTION
Definition script-engine.h:59
@ SCRIPT_ENGINE_ERROR_UNRESOLVED_VARIABLE
Definition script-engine.h:56
@ SCRIPT_ENGINE_ERROR_UNKNOWN_TOKEN
Definition script-engine.h:55
@ SCRIPT_ENGINE_ERROR_NON_VOID_FUNCTION_NOT_RETURNING_VALUE
Definition script-engine.h:62
@ SCRIPT_ENGINE_ERROR_UNHANDLED_SEMANTIC_RULE
Definition script-engine.h:57
@ SCRIPT_ENGINE_ERROR_UNDEFINED_VARIABLE_TYPE
Definition script-engine.h:60
@ SCRIPT_ENGINE_ERROR_VOID_FUNCTION_RETURNING_VALUE
Definition script-engine.h:61
@ SCRIPT_ENGINE_ERROR_SYNTAX
Definition script-engine.h:54
@ SCRIPT_ENGINE_ERROR_FREE
Definition script-engine.h:53
@ SCRIPT_ENGINE_ERROR_TEMP_LIST_FULL
Definition script-engine.h:58
void RemoveSymbol(PSYMBOL *Symbol)
Frees the memory allocate by this Symbol.
Definition script-engine.c:2561
PSYMBOL_BUFFER NewSymbolBuffer(void)
allocates a new Symbol Buffer and returns the reference to it
Definition script-engine.c:2699
char * HandleError(PSCRIPT_ENGINE_ERROR_TYPE Error, char *str)
Prints some information about the error.
Definition script-engine.c:3028
PSYMBOL NewStringSymbol(PTOKEN Token)
Allocates a new SYMBOL with string type and returns the reference to it.
Definition script-engine.c:2487
void ScriptEngineBooleanExpresssionParse(UINT64 BooleanExpressionSize, PTOKEN FirstToken, PTOKEN_LIST MatchedStack, PUSER_DEFINED_FUNCTION_NODE *UserDefinedFunctionHead, PSYMBOL_BUFFER CodeBuffer, char *str, char *c, PSCRIPT_ENGINE_ERROR_TYPE Error)
LALR parser used for parsing boolean expression.
Definition script-engine.c:2283
void PrintSymbol(PVOID Symbol)
Prints symbol.
Definition script-engine.c:2574
BOOLEAN FuncGetNumberOfOperands(UINT64 FuncType, UINT32 *NumberOfGetOperands, UINT32 *NumberOfSetOperands)
Script Engine get number of operands.
Definition script-engine.c:3356
UINT32 ScriptEngineUnloadModuleSymbol(char *ModuleName)
Unload a special pdb.
Definition script-engine.c:94
UINT64 ScriptEngineConvertNameToAddress(const char *FunctionOrVariableName, PBOOLEAN WasFound)
Converts name to address.
Definition script-engine.c:33
BOOLEAN ScriptEngineGetFieldOffset(CHAR *TypeName, CHAR *FieldName, UINT32 *FieldOffset)
Get offset of a field from the structure.
Definition script-engine.c:126
BOOLEAN ScriptEngineCreateSymbolTableForDisassembler(void *CallbackFunction)
Create symbol table for disassembler.
Definition script-engine.c:157
UINT32 ScriptEngineLoadFileSymbol(UINT64 BaseAddress, const char *PdbFileName, const char *CustomModuleName)
Definition script-engine.c:53
void PrintSymbolBuffer(const PVOID SymbolBuffer)
Prints a symbol buffer.
Definition script-engine.c:2859
BOOLEAN ScriptEngineConvertFileToPdbFileAndGuidAndAgeDetails(const char *LocalFilePath, char *PdbFilePath, char *GuidAndAgeDetails, BOOLEAN Is32BitModule)
Convert file to pdb attributes for symbols.
Definition script-engine.c:252
PVOID ScriptEngineParse(char *str)
The entry point of script engine.
Definition script-engine.c:267
BOOLEAN ScriptEngineSetHwdbgInstanceInfo(HWDBG_INSTANCE_INFORMATION *InstancInfo)
Set hwdbg instance info for the script engine.
Definition script-engine.c:3332
BOOLEAN ScriptEngineGetDataTypeSize(CHAR *TypeName, UINT64 *TypeSize)
Get size of a data type (structure)
Definition script-engine.c:142
BOOLEAN ScriptEngineSymbolInitLoad(PVOID BufferToStoreDetails, UINT32 StoredLength, BOOLEAN DownloadIfAvailable, const char *SymbolPath, BOOLEAN IsSilentLoad)
Initial load of the symbols.
Definition script-engine.c:192
BOOLEAN ScriptEngineShowDataBasedOnSymbolTypes(const char *TypeName, UINT64 Address, BOOLEAN IsStruct, PVOID BufferAddress, const char *AdditionalParameters)
Show data based on symbol types.
Definition script-engine.c:215
void RemoveSymbolBuffer(PVOID SymbolBuffer)
Frees the memory allocated by SymbolBuffer.
Definition script-engine.c:2725
VOID ScriptEngineSetTextMessageCallback(PVOID Handler)
Set the message handler as an alternative to printf.
Definition script-engine.c:68
UINT32 ScriptEngineUnloadAllSymbols()
Unload all the previously loaded symbols.
Definition script-engine.c:79
UINT32 ScriptEngineSearchSymbolForMask(const char *SearchMask)
Search for a special mask.
Definition script-engine.c:109
VOID ScriptEngineSymbolAbortLoading()
Cancel loading.
Definition script-engine.c:233
BOOLEAN ScriptEngineConvertFileToPdbPath(const char *LocalFilePath, char *ResultPath)
Convert local file to pdb path.
Definition script-engine.c:173
The structure of script capabilities information in hwdbg.
Definition HardwareDebugger.h:91
this structure is a dynamic container of TOKENS
Definition common.h:83
read tokens from input stored in this structure
Definition common.h:72
Definition ScriptEngineCommonDefinitions.h:21
Definition ScriptEngineCommonDefinitions.h:6
Definition ScriptEngineCommonDefinitions.h:43