MCPcopy Create free account
hub / github.com/HyperDbg/HyperDbg / ScriptEngineExecute

Function ScriptEngineExecute

hyperdbg/script-eval/code/ScriptEngineEval.c:296–2410  ·  view source on GitHub ↗

* @brief Execute the script buffer * * @param GuestRegs General purpose registers * @param ActionDetail Detail of the specific action * @param ScriptGeneralRegisters of core specific (and global) variable holders * @param CodeBuffer The script buffer to be executed * @param Indx Script Buffer index * @param ErrorOperator Error in operator * @return BOOL */

Source from the content-addressed store, hash-verified

294 * @return BOOL
295 */
296BOOL
297ScriptEngineExecute(PGUEST_REGS GuestRegs,
298 ACTION_BUFFER * ActionDetail,
299 PSCRIPT_ENGINE_GENERAL_REGISTERS ScriptGeneralRegisters,
300 SYMBOL_BUFFER * CodeBuffer,
301 UINT64 * Indx,
302 SYMBOL * ErrorOperator)
303{
304 PSYMBOL Operator;
305 PSYMBOL Src0;
306 PSYMBOL Src1;
307 PSYMBOL Src2;
308
309 PSYMBOL Des;
310 UINT64 SrcVal0;
311 UINT64 SrcVal1;
312 UINT64 SrcVal2;
313
314 UINT64 DesVal;
315 BOOL HasError = FALSE;
316
317 Operator = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
318 (unsigned long long)(*Indx * sizeof(SYMBOL)));
319
320 *ErrorOperator = *Operator;
321
322 *Indx = *Indx + 1;
323
324 if (Operator->Type != SYMBOL_SEMANTIC_RULE_TYPE)
325 {
326#ifdef SCRIPT_ENGINE_USER_MODE
327 ShowMessages("err, expecting operator type\n");
328 return HasError;
329#endif // SCRIPT_ENGINE_USER_MODE
330 };
331
332 switch (Operator->Value)
333 {
334 case FUNC_ED:
335
336 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
337 (unsigned long long)(*Indx * sizeof(SYMBOL)));
338
339 *Indx = *Indx + 1;
340
341 SrcVal0 =
342 GetValue(GuestRegs, ActionDetail, ScriptGeneralRegisters, Src0, FALSE);
343
344 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
345 (unsigned long long)(*Indx * sizeof(SYMBOL)));
346
347 *Indx = *Indx + 1;
348
349 SrcVal1 =
350 GetValue(GuestRegs, ActionDetail, ScriptGeneralRegisters, Src1, FALSE);
351
352 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
353 (unsigned long long)(*Indx * sizeof(SYMBOL)));

Callers 2

DebuggerPerformRunScriptFunction · 0.85
ScriptEngineEvalWrapperFunction · 0.85

Tested by

no test coverage detected