HyperDbg Debugger
Loading...
Searching...
No Matches
ScriptEngineEval.c File Reference

Shared Headers for Script engine. More...

#include "pch.h"
#include "..\script-eval\header\ScriptEngineInternalHeader.h"

Functions

UINT64 GetPseudoRegValue (PSYMBOL Symbol, PACTION_BUFFER ActionBuffer)
 Get the Pseudo reg value.
 
UINT64 GetValue (PGUEST_REGS GuestRegs, PACTION_BUFFER ActionBuffer, PSCRIPT_ENGINE_VARIABLES_LIST VariablesList, PSYMBOL Symbol, BOOLEAN ReturnReference, SYMBOL_BUFFER *StackBuffer, UINT64 *StackIndx, UINT64 *StackBaseIndx, UINT64 *ReturnValue)
 Get the Value (reg, peseudo-reg, etc.)
 
VOID SetValue (PGUEST_REGS GuestRegs, SCRIPT_ENGINE_VARIABLES_LIST *VariablesList, PSYMBOL Symbol, UINT64 Value, SYMBOL_BUFFER *StackBuffer, UINT64 *StackIndx, UINT64 *StackBaseIndx, UINT64 *ReturnValue)
 Set the value.
 
VOID ScriptEngineGetOperatorName (PSYMBOL OperatorSymbol, CHAR *BufferForName)
 Get the operator name.
 
BOOL ScriptEngineExecute (PGUEST_REGS GuestRegs, ACTION_BUFFER *ActionDetail, SCRIPT_ENGINE_VARIABLES_LIST *VariablesList, SYMBOL_BUFFER *CodeBuffer, UINT64 *Indx, SYMBOL_BUFFER *StackBuffer, UINT64 *StackIndx, UINT64 *StackBaseIndx, SYMBOL *ErrorOperator, UINT64 *ReturnValue)
 Execute the script buffer.
 

Detailed Description

Shared Headers for Script engine.

Author
M.H. Gholamrezaei (mh@hy.nosp@m.perd.nosp@m.bg.or.nosp@m.g)
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.1
Date
2020-10-22

Function Documentation

◆ GetPseudoRegValue()

UINT64 GetPseudoRegValue ( PSYMBOL Symbol,
PACTION_BUFFER ActionBuffer )

Get the Pseudo reg value.

Parameters
Symbol
ActionBuffer
Returns
UINT64
25{
26 switch (Symbol->Value)
27 {
47 if (ActionBuffer->CurrentAction != (UINT64)NULL)
48 {
50 (UINT64 *)ActionBuffer->CurrentAction);
51 }
52 else
53 {
54 return (UINT64)NULL;
55 }
57 return ActionBuffer->Context;
59 return ScriptEnginePseudoRegGetEventTag(ActionBuffer);
61 return ScriptEnginePseudoRegGetEventId(ActionBuffer);
63 return ScriptEnginePseudoRegGetEventStage(ActionBuffer);
68 case INVALID:
69#ifdef SCRIPT_ENGINE_USER_MODE
70 ShowMessages("error in reading regesiter");
71#endif // SCRIPT_ENGINE_USER_MODE
72 return INVALID;
73 default:
74#ifdef SCRIPT_ENGINE_USER_MODE
75 ShowMessages("unknown pseudo-register");
76#endif // SCRIPT_ENGINE_USER_MODE
77 return INVALID;
78 }
79}
unsigned __int64 UINT64
Definition BasicTypes.h:21
UINT64 ScriptEnginePseudoRegGetProc()
Implementation of $proc pseudo-register.
Definition PseudoRegisters.c:125
CHAR * ScriptEnginePseudoRegGetPname()
Implementation of $pname pseudo-register.
Definition PseudoRegisters.c:76
UINT64 ScriptEnginePseudoRegGetThread()
Implementation of $thread pseudo-register.
Definition PseudoRegisters.c:142
UINT64 ScriptEnginePseudoRegGetCore()
Implementation of $core pseudo-register.
Definition PseudoRegisters.c:42
UINT64 ScriptEnginePseudoRegGetDate()
Implementation of date pseudo-register.
Definition PseudoRegisters.c:422
UINT64 ScriptEnginePseudoRegGetTime()
Implementation of time pseudo-register.
Definition PseudoRegisters.c:401
UINT64 ScriptEnginePseudoRegGetEventStage(PACTION_BUFFER ActionBuffer)
Implementation of stage pseudo-register.
Definition PseudoRegisters.c:384
UINT64 ScriptEnginePseudoRegGetIp()
Implementation of $ip pseudo-register.
Definition PseudoRegisters.c:306
UINT64 ScriptEnginePseudoRegGetPeb()
Implementation of $peb pseudo-register.
Definition PseudoRegisters.c:159
UINT64 ScriptEnginePseudoRegGetBuffer(UINT64 *CorrespondingAction)
Implementation of $buffer pseudo-register.
Definition PseudoRegisters.c:327
UINT64 ScriptEnginePseudoRegGetTeb()
Implementation of $teb pseudo-register.
Definition PseudoRegisters.c:289
UINT64 ScriptEnginePseudoRegGetTid()
Implementation of $tid pseudo-register.
Definition PseudoRegisters.c:25
UINT64 ScriptEnginePseudoRegGetPid()
Implementation of $pid pseudo-register.
Definition PseudoRegisters.c:59
UINT64 ScriptEnginePseudoRegGetEventTag(PACTION_BUFFER ActionBuffer)
Implementation of $tag pseudo-register.
Definition PseudoRegisters.c:348
UINT64 ScriptEnginePseudoRegGetEventId(PACTION_BUFFER ActionBuffer)
Implementation of $id pseudo-register.
Definition PseudoRegisters.c:366
#define PSEUDO_REGISTER_IP
Definition ScriptEngineCommonDefinitions.h:463
#define PSEUDO_REGISTER_CONTEXT
Definition ScriptEngineCommonDefinitions.h:465
#define PSEUDO_REGISTER_DATE
Definition ScriptEngineCommonDefinitions.h:469
#define PSEUDO_REGISTER_THREAD
Definition ScriptEngineCommonDefinitions.h:460
#define PSEUDO_REGISTER_PROC
Definition ScriptEngineCommonDefinitions.h:459
#define PSEUDO_REGISTER_PNAME
Definition ScriptEngineCommonDefinitions.h:457
#define PSEUDO_REGISTER_CORE
Definition ScriptEngineCommonDefinitions.h:458
#define PSEUDO_REGISTER_EVENT_TAG
Definition ScriptEngineCommonDefinitions.h:466
#define PSEUDO_REGISTER_PEB
Definition ScriptEngineCommonDefinitions.h:461
#define PSEUDO_REGISTER_TEB
Definition ScriptEngineCommonDefinitions.h:462
#define PSEUDO_REGISTER_EVENT_ID
Definition ScriptEngineCommonDefinitions.h:467
#define PSEUDO_REGISTER_BUFFER
Definition ScriptEngineCommonDefinitions.h:464
#define PSEUDO_REGISTER_PID
Definition ScriptEngineCommonDefinitions.h:455
#define INVALID
Definition ScriptEngineCommonDefinitions.h:96
#define PSEUDO_REGISTER_EVENT_STAGE
Definition ScriptEngineCommonDefinitions.h:468
#define PSEUDO_REGISTER_TID
Definition ScriptEngineCommonDefinitions.h:456
#define PSEUDO_REGISTER_TIME
Definition ScriptEngineCommonDefinitions.h:470
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
NULL()
Definition test-case-generator.py:530
long long unsigned Context
Definition ScriptEngineCommonDefinitions.h:38
long long unsigned CurrentAction
Definition ScriptEngineCommonDefinitions.h:36
long long unsigned Value
Definition ScriptEngineCommonDefinitions.h:10

◆ GetValue()

UINT64 GetValue ( PGUEST_REGS GuestRegs,
PACTION_BUFFER ActionBuffer,
PSCRIPT_ENGINE_VARIABLES_LIST VariablesList,
PSYMBOL Symbol,
BOOLEAN ReturnReference,
SYMBOL_BUFFER * StackBuffer,
UINT64 * StackIndx,
UINT64 * StackBaseIndx,
UINT64 * ReturnValue )

Get the Value (reg, peseudo-reg, etc.)

Parameters
GuestRegs
ActionBuffer
VariablesList
Symbol
ReturnReference
Returns
UINT64
101{
102 switch (Symbol->Type)
103 {
105
106 if (ReturnReference)
107 return ((UINT64)(&VariablesList->GlobalVariablesList[Symbol->Value]));
108 else
109 return VariablesList->GlobalVariablesList[Symbol->Value];
110
112
113 if (ReturnReference)
114 return ((UINT64)(&VariablesList->LocalVariablesList[Symbol->Value]));
115 else
116 return VariablesList->LocalVariablesList[Symbol->Value];
117
118 case SYMBOL_NUM_TYPE:
119
120 if (ReturnReference)
121 return ((UINT64)&Symbol->Value);
122 else
123 return Symbol->Value;
124
126
127 if (ReturnReference)
128 return (UINT64)NULL; // Not reasonable, you should not dereference a register!
129 else
130 return GetRegValue(GuestRegs, (REGS_ENUM)Symbol->Value);
131
133
134 if (ReturnReference)
135 return (UINT64)NULL; // Not reasonable, you should not dereference a pseudo-register!
136 else
137 return GetPseudoRegValue(Symbol, ActionBuffer);
138
139 case SYMBOL_TEMP_TYPE:
140 if (ReturnReference)
141 return ((UINT64)&VariablesList->TempList[Symbol->Value]);
142 else
143 return VariablesList->TempList[Symbol->Value];
144
146 return *StackIndx;
147
149 return *StackBaseIndx;
150
152 return *ReturnValue;
153
155 {
156 PSYMBOL StackSymbol = (PSYMBOL)((unsigned long long)StackBuffer->Head +
157 (unsigned long long)((*StackBaseIndx + Symbol->Value) * sizeof(SYMBOL)));
158 return StackSymbol->Value;
159 }
161 {
162 PSYMBOL StackSymbol = (PSYMBOL)((unsigned long long)StackBuffer->Head +
163 (unsigned long long)((*StackBaseIndx - 3 - Symbol->Value) * sizeof(SYMBOL)));
164 return StackSymbol->Value;
165 }
166 }
167
168 //
169 // Shouldn't reach here
170 //
171 return NULL64_ZERO;
172}
#define NULL64_ZERO
Definition BasicTypes.h:52
UINT64 GetRegValue(PGUEST_REGS GuestRegs, REGS_ENUM RegId)
Get the register value.
Definition Regs.c:23
#define SYMBOL_STACK_INDEX_TYPE
Definition ScriptEngineCommonDefinitions.h:69
#define SYMBOL_REGISTER_TYPE
Definition ScriptEngineCommonDefinitions.h:57
#define SYMBOL_STACK_TEMP_TYPE
Definition ScriptEngineCommonDefinitions.h:67
REGS_ENUM
Definition ScriptEngineCommonDefinitions.h:313
#define SYMBOL_TEMP_TYPE
Definition ScriptEngineCommonDefinitions.h:60
#define SYMBOL_GLOBAL_ID_TYPE
Definition ScriptEngineCommonDefinitions.h:54
#define SYMBOL_LOCAL_ID_TYPE
Definition ScriptEngineCommonDefinitions.h:55
struct SYMBOL * PSYMBOL
#define SYMBOL_FUNCTION_PARAMETER_ID_TYPE
Definition ScriptEngineCommonDefinitions.h:65
#define SYMBOL_STACK_BASE_INDEX_TYPE
Definition ScriptEngineCommonDefinitions.h:70
struct SYMBOL SYMBOL
#define SYMBOL_PSEUDO_REG_TYPE
Definition ScriptEngineCommonDefinitions.h:58
#define SYMBOL_RETURN_VALUE_TYPE
Definition ScriptEngineCommonDefinitions.h:71
#define SYMBOL_NUM_TYPE
Definition ScriptEngineCommonDefinitions.h:56
UINT64 GetPseudoRegValue(PSYMBOL Symbol, PACTION_BUFFER ActionBuffer)
Get the Pseudo reg value.
Definition ScriptEngineEval.c:24
UINT64 * GlobalVariablesList
Definition BasicTypes.h:120
UINT64 * LocalVariablesList
Definition BasicTypes.h:121
UINT64 * TempList
Definition BasicTypes.h:119
PSYMBOL Head
Definition ScriptEngineCommonDefinitions.h:22
Definition ScriptEngineCommonDefinitions.h:6
long long unsigned Type
Definition ScriptEngineCommonDefinitions.h:7

◆ ScriptEngineExecute()

BOOL ScriptEngineExecute ( PGUEST_REGS GuestRegs,
ACTION_BUFFER * ActionDetail,
SCRIPT_ENGINE_VARIABLES_LIST * VariablesList,
SYMBOL_BUFFER * CodeBuffer,
UINT64 * Indx,
SYMBOL_BUFFER * StackBuffer,
UINT64 * StackIndx,
UINT64 * StackBaseIndx,
SYMBOL * ErrorOperator,
UINT64 * ReturnValue )

Execute the script buffer.

Parameters
GuestRegsGeneral purpose registers
ActionDetailDetail of the specific action
VariablesListList of core specific (and global) variable holders
CodeBufferThe script buffer to be executed
IndxScript Buffer index
ErrorOperatorError in operator
Returns
BOOL
299{
300 PSYMBOL Operator;
301 PSYMBOL Src0;
302 PSYMBOL Src1;
303 PSYMBOL Src2;
304
305 PSYMBOL Des;
306 UINT64 SrcVal0;
307 UINT64 SrcVal1;
308 UINT64 SrcVal2;
309
310 UINT64 DesVal;
311 BOOL HasError = FALSE;
312
313 Operator = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
314 (unsigned long long)(*Indx * sizeof(SYMBOL)));
315
316 *ErrorOperator = *Operator;
317
318 *Indx = *Indx + 1;
319
320 if (Operator->Type != SYMBOL_SEMANTIC_RULE_TYPE)
321 {
322#ifdef SCRIPT_ENGINE_USER_MODE
323 ShowMessages("err, expecting operator type\n");
324 return HasError;
325#endif // SCRIPT_ENGINE_USER_MODE
326 };
327
328 switch (Operator->Value)
329 {
330 case FUNC_ED:
331
332 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
333 (unsigned long long)(*Indx * sizeof(SYMBOL)));
334
335 *Indx = *Indx + 1;
336
337 SrcVal0 =
338 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
339
340 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
341 (unsigned long long)(*Indx * sizeof(SYMBOL)));
342
343 *Indx = *Indx + 1;
344
345 SrcVal1 =
346 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
347
348 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
349 (unsigned long long)(*Indx * sizeof(SYMBOL)));
350
351 *Indx = *Indx + 1;
352
353 DesVal = ScriptEngineFunctionEd(SrcVal1, (DWORD)SrcVal0, &HasError);
354
355 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
356
357 break;
358
359 case FUNC_EB:
360
361 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
362 (unsigned long long)(*Indx * sizeof(SYMBOL)));
363
364 *Indx = *Indx + 1;
365
366 SrcVal0 =
367 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
368
369 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
370 (unsigned long long)(*Indx * sizeof(SYMBOL)));
371
372 *Indx = *Indx + 1;
373
374 SrcVal1 =
375 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
376
377 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
378 (unsigned long long)(*Indx * sizeof(SYMBOL)));
379
380 *Indx = *Indx + 1;
381
382 DesVal = ScriptEngineFunctionEb(SrcVal1, (BYTE)SrcVal0, &HasError);
383
384 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
385
386 break;
387
388 case FUNC_EQ:
389
390 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
391 (unsigned long long)(*Indx * sizeof(SYMBOL)));
392 *Indx = *Indx + 1;
393
394 SrcVal0 =
395 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
396
397 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
398 (unsigned long long)(*Indx * sizeof(SYMBOL)));
399
400 *Indx = *Indx + 1;
401
402 SrcVal1 =
403 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
404
405 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
406 (unsigned long long)(*Indx * sizeof(SYMBOL)));
407
408 *Indx = *Indx + 1;
409
410 DesVal = ScriptEngineFunctionEq(SrcVal1, SrcVal0, &HasError);
411
412 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
413
414 break;
415
417
418 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
419 (unsigned long long)(*Indx * sizeof(SYMBOL)));
420
421 *Indx = *Indx + 1;
422
423 SrcVal0 =
424 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
425
426 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
427 (unsigned long long)(*Indx * sizeof(SYMBOL)));
428
429 *Indx = *Indx + 1;
430
431 SrcVal1 =
432 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
433
434 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
435 (unsigned long long)(*Indx * sizeof(SYMBOL)));
436 *Indx = *Indx + 1;
437
438 DesVal = ScriptEngineFunctionInterlockedExchange((volatile long long *)SrcVal1, SrcVal0, &HasError);
439
440 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
441
442 break;
443
445
446 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
447 (unsigned long long)(*Indx * sizeof(SYMBOL)));
448
449 *Indx = *Indx + 1;
450
451 SrcVal0 =
452 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
453
454 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
455 (unsigned long long)(*Indx * sizeof(SYMBOL)));
456
457 *Indx = *Indx + 1;
458
459 SrcVal1 =
460 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
461
462 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
463 (unsigned long long)(*Indx * sizeof(SYMBOL)));
464
465 *Indx = *Indx + 1;
466
467 DesVal = ScriptEngineFunctionInterlockedExchangeAdd((volatile long long *)SrcVal1, SrcVal0, &HasError);
468
469 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
470
471 break;
472
474
475 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
476 (unsigned long long)(*Indx * sizeof(SYMBOL)));
477
478 *Indx = *Indx + 1;
479
480 SrcVal0 =
481 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
482
483 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
484 (unsigned long long)(*Indx * sizeof(SYMBOL)));
485 *Indx = *Indx + 1;
486
487 SrcVal1 =
488 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
489
490 Src2 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
491 (unsigned long long)(*Indx * sizeof(SYMBOL)));
492
493 *Indx = *Indx + 1;
494
495 SrcVal2 =
496 GetValue(GuestRegs, ActionDetail, VariablesList, Src2, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
497
498 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
499 (unsigned long long)(*Indx * sizeof(SYMBOL)));
500 *Indx = *Indx + 1;
501
502 DesVal = ScriptEngineFunctionInterlockedCompareExchange((volatile long long *)SrcVal2, SrcVal1, SrcVal0, &HasError);
503
504 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
505
506 break;
507
509
510 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
511 (unsigned long long)(*Indx * sizeof(SYMBOL)));
512
513 *Indx = *Indx + 1;
514
515 SrcVal0 =
516 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
517
518 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
519 (unsigned long long)(*Indx * sizeof(SYMBOL)));
520 *Indx = *Indx + 1;
521
522 SrcVal1 =
523 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
524
525 Src2 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
526 (unsigned long long)(*Indx * sizeof(SYMBOL)));
527
528 *Indx = *Indx + 1;
529
530 SrcVal2 =
531 GetValue(GuestRegs, ActionDetail, VariablesList, Src2, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
532
533 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
534 (unsigned long long)(*Indx * sizeof(SYMBOL)));
535 *Indx = *Indx + 1;
536
537 ScriptEngineFunctionEventInjectErrorCode((UINT32)SrcVal2, (UINT32)SrcVal1, (UINT32)SrcVal0, &HasError);
538
539 break;
540
541 case FUNC_MEMCPY:
542
543 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
544 (unsigned long long)(*Indx * sizeof(SYMBOL)));
545
546 *Indx = *Indx + 1;
547
548 SrcVal0 =
549 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
550
551 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
552 (unsigned long long)(*Indx * sizeof(SYMBOL)));
553 *Indx = *Indx + 1;
554
555 SrcVal1 =
556 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
557
558 Src2 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
559 (unsigned long long)(*Indx * sizeof(SYMBOL)));
560
561 *Indx = *Indx + 1;
562
563 SrcVal2 =
564 GetValue(GuestRegs, ActionDetail, VariablesList, Src2, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
565
566 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
567 (unsigned long long)(*Indx * sizeof(SYMBOL)));
568 *Indx = *Indx + 1;
569
570 ScriptEngineFunctionMemcpy(SrcVal2, SrcVal1, (UINT32)SrcVal0, &HasError);
571
572 break;
573
575
576 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
577 (unsigned long long)(*Indx * sizeof(SYMBOL)));
578
579 *Indx = *Indx + 1;
580
581 SrcVal0 =
582 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
583
584 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
585 (unsigned long long)(*Indx * sizeof(SYMBOL)));
586
587 *Indx = *Indx + 1;
588
589 SrcVal1 =
590 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
591
592 ScriptEngineFunctionSpinlockLockCustomWait((volatile long *)SrcVal1, (UINT32)SrcVal0, &HasError);
593
594 break;
595
597
598 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
599 (unsigned long long)(*Indx * sizeof(SYMBOL)));
600
601 *Indx = *Indx + 1;
602
603 SrcVal0 =
604 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
605
606 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
607 (unsigned long long)(*Indx * sizeof(SYMBOL)));
608
609 *Indx = *Indx + 1;
610
611 SrcVal1 =
612 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
613
614 ScriptEngineFunctionEventInject((UINT32)SrcVal1, (UINT32)SrcVal0, &HasError);
615
616 break;
617
618 case FUNC_PAUSE:
619
620 ScriptEngineFunctionPause(ActionDetail,
621 GuestRegs);
622 break;
623
624 case FUNC_FLUSH:
625
627
628 break;
629
632
634
635 break;
636
639
641
642 break;
643
645
646 //
647 // To be implemented!
648 //
649
650 break;
651
652 case FUNC_EVENT_SC:
653
654 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
655 (unsigned long long)(*Indx * sizeof(SYMBOL)));
656 *Indx = *Indx + 1;
657
658 SrcVal0 =
659 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
660
661 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
662 (unsigned long long)(*Indx * sizeof(SYMBOL)));
663 *Indx = *Indx + 1;
664
665 ScriptEngineFunctionShortCircuitingEvent(SrcVal0, ActionDetail);
666
667 break;
668
669 case FUNC_OR:
670
671 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
672 (unsigned long long)(*Indx * sizeof(SYMBOL)));
673
674 *Indx = *Indx + 1;
675
676 SrcVal0 =
677 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
678
679 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
680 (unsigned long long)(*Indx * sizeof(SYMBOL)));
681
682 *Indx = *Indx + 1;
683
684 SrcVal1 =
685 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
686
687 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
688 (unsigned long long)(*Indx * sizeof(SYMBOL)));
689
690 *Indx = *Indx + 1;
691
692 DesVal = SrcVal1 | SrcVal0;
693
694 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
695
696 break;
697
698 case FUNC_INC:
699
700 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
701 (unsigned long long)(*Indx * sizeof(SYMBOL)));
702 *Indx = *Indx + 1;
703
704 SrcVal0 =
705 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
706
707 DesVal = SrcVal0 + 1;
708
709 Des = Src0;
710
711 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
712
713 break;
714
715 case FUNC_DEC:
716
717 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
718 (unsigned long long)(*Indx * sizeof(SYMBOL)));
719 *Indx = *Indx + 1;
720
721 SrcVal0 =
722 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
723
724 DesVal = SrcVal0 - 1;
725
726 Des = Src0;
727
728 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
729
730 break;
731
732 case FUNC_XOR:
733
734 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
735 (unsigned long long)(*Indx * sizeof(SYMBOL)));
736 *Indx = *Indx + 1;
737
738 SrcVal0 =
739 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
740
741 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
742 (unsigned long long)(*Indx * sizeof(SYMBOL)));
743
744 *Indx = *Indx + 1;
745
746 SrcVal1 =
747 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
748
749 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
750 (unsigned long long)(*Indx * sizeof(SYMBOL)));
751 *Indx = *Indx + 1;
752
753 DesVal = SrcVal1 ^ SrcVal0;
754
755 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
756
757 break;
758
759 case FUNC_AND:
760
761 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
762 (unsigned long long)(*Indx * sizeof(SYMBOL)));
763 *Indx = *Indx + 1;
764
765 SrcVal0 =
766 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
767
768 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
769 (unsigned long long)(*Indx * sizeof(SYMBOL)));
770 *Indx = *Indx + 1;
771
772 SrcVal1 =
773 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
774
775 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
776 (unsigned long long)(*Indx * sizeof(SYMBOL)));
777 *Indx = *Indx + 1;
778
779 DesVal = SrcVal1 & SrcVal0;
780
781 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
782
783 break;
784
785 case FUNC_ASR:
786
787 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
788 (unsigned long long)(*Indx * sizeof(SYMBOL)));
789 *Indx = *Indx + 1;
790
791 SrcVal0 =
792 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
793
794 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
795 (unsigned long long)(*Indx * sizeof(SYMBOL)));
796 *Indx = *Indx + 1;
797
798 SrcVal1 =
799 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
800
801 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
802 (unsigned long long)(*Indx * sizeof(SYMBOL)));
803 *Indx = *Indx + 1;
804
805 DesVal = SrcVal1 >> SrcVal0;
806
807 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
808
809 break;
810
811 case FUNC_ASL:
812
813 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
814 (unsigned long long)(*Indx * sizeof(SYMBOL)));
815 *Indx = *Indx + 1;
816
817 SrcVal0 =
818 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
819
820 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
821 (unsigned long long)(*Indx * sizeof(SYMBOL)));
822
823 *Indx = *Indx + 1;
824
825 SrcVal1 =
826 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
827
828 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
829 (unsigned long long)(*Indx * sizeof(SYMBOL)));
830
831 *Indx = *Indx + 1;
832
833 DesVal = SrcVal1 << SrcVal0;
834
835 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
836
837 break;
838
839 case FUNC_ADD:
840
841 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
842 (unsigned long long)(*Indx * sizeof(SYMBOL)));
843 *Indx = *Indx + 1;
844
845 SrcVal0 =
846 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
847
848 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
849 (unsigned long long)(*Indx * sizeof(SYMBOL)));
850 *Indx = *Indx + 1;
851
852 SrcVal1 =
853 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
854
855 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
856 (unsigned long long)(*Indx * sizeof(SYMBOL)));
857 *Indx = *Indx + 1;
858
859 DesVal = SrcVal1 + SrcVal0;
860
861 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
862
863 break;
864
865 case FUNC_SUB:
866
867 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
868 (unsigned long long)(*Indx * sizeof(SYMBOL)));
869
870 *Indx = *Indx + 1;
871
872 SrcVal0 =
873 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
874
875 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
876 (unsigned long long)(*Indx * sizeof(SYMBOL)));
877
878 *Indx = *Indx + 1;
879
880 SrcVal1 =
881 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
882
883 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
884 (unsigned long long)(*Indx * sizeof(SYMBOL)));
885 *Indx = *Indx + 1;
886
887 DesVal = SrcVal1 - SrcVal0;
888
889 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
890
891 break;
892
893 case FUNC_MUL:
894
895 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
896 (unsigned long long)(*Indx * sizeof(SYMBOL)));
897 *Indx = *Indx + 1;
898
899 SrcVal0 =
900 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
901
902 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
903 (unsigned long long)(*Indx * sizeof(SYMBOL)));
904 *Indx = *Indx + 1;
905
906 SrcVal1 =
907 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
908
909 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
910 (unsigned long long)(*Indx * sizeof(SYMBOL)));
911 *Indx = *Indx + 1;
912
913 DesVal = SrcVal1 * SrcVal0;
914
915 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
916
917 break;
918
919 case FUNC_DIV:
920
921 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
922 (unsigned long long)(*Indx * sizeof(SYMBOL)));
923 *Indx = *Indx + 1;
924
925 SrcVal0 =
926 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
927
928 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
929 (unsigned long long)(*Indx * sizeof(SYMBOL)));
930 *Indx = *Indx + 1;
931
932 SrcVal1 =
933 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
934
935 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
936 (unsigned long long)(*Indx * sizeof(SYMBOL)));
937
938 *Indx = *Indx + 1;
939
940 if (SrcVal0 == 0)
941 {
942 HasError = TRUE;
943 break;
944 }
945
946 DesVal = SrcVal1 / SrcVal0;
947
948 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
949
950 break;
951
952 case FUNC_MOD:
953
954 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
955 (unsigned long long)(*Indx * sizeof(SYMBOL)));
956 *Indx = *Indx + 1;
957
958 SrcVal0 =
959 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
960
961 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
962 (unsigned long long)(*Indx * sizeof(SYMBOL)));
963 *Indx = *Indx + 1;
964
965 SrcVal1 =
966 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
967
968 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
969 (unsigned long long)(*Indx * sizeof(SYMBOL)));
970 *Indx = *Indx + 1;
971
972 if (SrcVal0 == 0)
973 {
974 HasError = TRUE;
975 break;
976 }
977
978 DesVal = SrcVal1 % SrcVal0;
979
980 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
981
982 break;
983
984 case FUNC_GT:
985
986 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
987 (unsigned long long)(*Indx * sizeof(SYMBOL)));
988 *Indx = *Indx + 1;
989
990 SrcVal0 =
991 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
992
993 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
994 (unsigned long long)(*Indx * sizeof(SYMBOL)));
995 *Indx = *Indx + 1;
996
997 SrcVal1 =
998 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
999
1000 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1001 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1002 *Indx = *Indx + 1;
1003
1004 DesVal = (INT64)SrcVal1 > (INT64)SrcVal0;
1005
1006 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1007
1008 break;
1009
1010 case FUNC_LT:
1011
1012 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1013 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1014 *Indx = *Indx + 1;
1015
1016 SrcVal0 =
1017 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1018
1019 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1020 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1021 *Indx = *Indx + 1;
1022
1023 SrcVal1 =
1024 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1025
1026 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1027 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1028 *Indx = *Indx + 1;
1029
1030 DesVal = (INT64)SrcVal1 < (INT64)SrcVal0;
1031
1032 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1033
1034 break;
1035
1036 case FUNC_EGT:
1037
1038 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1039 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1040 *Indx = *Indx + 1;
1041
1042 SrcVal0 =
1043 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1044
1045 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1046 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1047 *Indx = *Indx + 1;
1048
1049 SrcVal1 =
1050 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1051
1052 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1053 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1054 *Indx = *Indx + 1;
1055
1056 DesVal = (INT64)SrcVal1 >= (INT64)SrcVal0;
1057
1058 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1059
1060 break;
1061
1062 case FUNC_ELT:
1063
1064 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1065 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1066 *Indx = *Indx + 1;
1067
1068 SrcVal0 =
1069 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1070
1071 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1072 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1073 *Indx = *Indx + 1;
1074
1075 SrcVal1 =
1076 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1077
1078 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1079 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1080
1081 *Indx = *Indx + 1;
1082
1083 DesVal = (INT64)SrcVal1 <= (INT64)SrcVal0;
1084
1085 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1086
1087 break;
1088
1089 case FUNC_EQUAL:
1090
1091 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1092 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1093 *Indx = *Indx + 1;
1094
1095 SrcVal0 =
1096 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1097
1098 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1099 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1100
1101 *Indx = *Indx + 1;
1102
1103 SrcVal1 =
1104 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1105
1106 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1107 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1108 *Indx = *Indx + 1;
1109
1110 DesVal = SrcVal1 == SrcVal0;
1111
1112 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1113
1114 break;
1115
1116 case FUNC_NEQ:
1117
1118 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1119 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1120
1121 *Indx = *Indx + 1;
1122
1123 SrcVal0 =
1124 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1125
1126 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1127 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1128
1129 *Indx = *Indx + 1;
1130
1131 SrcVal1 =
1132 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1133
1134 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1135 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1136 *Indx = *Indx + 1;
1137
1138 DesVal = SrcVal1 != SrcVal0;
1139
1140 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1141
1142 break;
1143
1144 case FUNC_POI:
1145
1146 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1147 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1148 *Indx = *Indx + 1;
1149
1150 SrcVal0 =
1151 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1152
1153 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1154 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1155
1156 *Indx = *Indx + 1;
1157
1158 DesVal = ScriptEngineKeywordPoi((PUINT64)GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue),
1159 &HasError);
1160 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1161
1162 break;
1163
1164 case FUNC_DB:
1165
1166 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1167 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1168 *Indx = *Indx + 1;
1169
1170 SrcVal0 =
1171 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1172
1173 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1174 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1175 *Indx = *Indx + 1;
1176
1177 DesVal = ScriptEngineKeywordDb((PUINT64)GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue),
1178 &HasError);
1179 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1180
1181 break;
1182
1183 case FUNC_DD:
1184
1185 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1186 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1187 *Indx = *Indx + 1;
1188
1189 SrcVal0 =
1190 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1191
1192 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1193 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1194 *Indx = *Indx + 1;
1195
1196 DesVal = ScriptEngineKeywordDd((PUINT64)GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue),
1197 &HasError);
1198
1199 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1200
1201 break;
1202
1203 case FUNC_DW:
1204
1205 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1206 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1207
1208 *Indx = *Indx + 1;
1209
1210 SrcVal0 =
1211 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1212
1213 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1214 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1215
1216 *Indx = *Indx + 1;
1217
1218 DesVal = ScriptEngineKeywordDw((PUINT64)GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue),
1219 &HasError);
1220 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1221
1222 break;
1223
1224 case FUNC_DQ:
1225
1226 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1227 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1228 *Indx = *Indx + 1;
1229
1230 SrcVal0 =
1231 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1232
1233 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1234 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1235
1236 *Indx = *Indx + 1;
1237
1238 DesVal = ScriptEngineKeywordDq((PUINT64)GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue),
1239 &HasError);
1240 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1241
1242 break;
1243
1244 case FUNC_NOT:
1245
1246 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1247 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1248 *Indx = *Indx + 1;
1249
1250 SrcVal0 =
1251 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1252
1253 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1254 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1255
1256 *Indx = *Indx + 1;
1257
1258 DesVal = ~SrcVal0;
1259
1260 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1261
1262 break;
1263
1264 case FUNC_REFERENCE:
1265
1266 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1267 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1268
1269 *Indx = *Indx + 1;
1270
1271 //
1272 // It's reference, we need an address
1273 //
1274 SrcVal0 = GetValue(GuestRegs, ActionDetail, VariablesList, Src0, TRUE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1275
1276 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1277 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1278 *Indx = *Indx + 1;
1279
1280 DesVal = SrcVal0;
1281
1282 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1283
1284 break;
1285
1287
1288 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1289 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1290 *Indx = *Indx + 1;
1291
1292 SrcVal0 =
1293 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1294
1295 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1296 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1297 *Indx = *Indx + 1;
1298
1299 DesVal = ScriptEngineFunctionPhysicalToVirtual(GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue));
1300
1301 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1302
1303 break;
1304
1306
1307 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1308 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1309 *Indx = *Indx + 1;
1310
1311 SrcVal0 =
1312 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1313
1314 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1315 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1316 *Indx = *Indx + 1;
1317
1318 DesVal = ScriptEngineFunctionVirtualToPhysical(GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue));
1319
1320 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1321
1322 break;
1323
1324 case FUNC_CHECK_ADDRESS:
1325
1326 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1327 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1328 *Indx = *Indx + 1;
1329
1330 SrcVal0 =
1331 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1332
1333 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1334 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1335 *Indx = *Indx + 1;
1336
1337 if (ScriptEngineFunctionCheckAddress(SrcVal0, sizeof(BYTE)))
1338 DesVal = 1; // TRUE
1339 else
1340 DesVal = 0; // FALSE
1341
1342 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1343
1344 break;
1345
1346 case FUNC_STRLEN:
1347
1348 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1349 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1350 *Indx = *Indx + 1;
1351
1352 if (Src0->Type == SYMBOL_STRING_TYPE)
1353 {
1354 *Indx =
1355 *Indx + ((3 * sizeof(unsigned long long) + Src0->Len) /
1356 sizeof(SYMBOL));
1357 SrcVal0 = (UINT64)&Src0->Value;
1358 }
1359 else
1360 {
1361 SrcVal0 =
1362 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1363 }
1364
1365 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1366 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1367 *Indx = *Indx + 1;
1368
1369 DesVal = ScriptEngineFunctionStrlen((const char *)SrcVal0);
1370
1371 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1372
1373 break;
1374
1377
1378 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1379 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1380 *Indx = *Indx + 1;
1381
1382 SrcVal0 =
1383 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1384
1385 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1386 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1387 *Indx = *Indx + 1;
1388
1389 DesVal = ScriptEngineFunctionDisassembleLen((PVOID)SrcVal0, FALSE);
1390
1391 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1392
1393 break;
1394
1396
1397 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1398 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1399 *Indx = *Indx + 1;
1400
1401 SrcVal0 =
1402 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1403
1404 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1405 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1406 *Indx = *Indx + 1;
1407
1408 DesVal = ScriptEngineFunctionDisassembleLen((PVOID)SrcVal0, TRUE);
1409
1410 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1411
1412 break;
1413
1414 case FUNC_WCSLEN:
1415
1416 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1417 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1418 *Indx = *Indx + 1;
1419
1420 if (Src0->Type == SYMBOL_WSTRING_TYPE)
1421 {
1422 *Indx =
1423 *Indx + ((3 * sizeof(unsigned long long) + Src0->Len) /
1424 sizeof(SYMBOL));
1425 SrcVal0 = (UINT64)&Src0->Value;
1426 }
1427 else
1428 {
1429 SrcVal0 =
1430 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1431 }
1432
1433 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1434 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1435 *Indx = *Indx + 1;
1436
1437 DesVal = ScriptEngineFunctionWcslen((const wchar_t *)SrcVal0);
1438
1439 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1440
1441 break;
1442
1444
1445 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1446 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1447 *Indx = *Indx + 1;
1448
1449 SrcVal0 =
1450 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1451
1452 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1453 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1454
1455 *Indx = *Indx + 1;
1456
1457 DesVal = ScriptEngineFunctionInterlockedIncrement((volatile long long *)SrcVal0, &HasError);
1458
1459 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1460
1461 break;
1462
1464
1465 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1466 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1467 *Indx = *Indx + 1;
1468
1469 SrcVal0 =
1470 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1471
1472 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1473 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1474 *Indx = *Indx + 1;
1475
1476 DesVal = ScriptEngineFunctionInterlockedDecrement((volatile long long *)SrcVal0, &HasError);
1477
1478 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1479
1480 break;
1481
1482 case FUNC_NEG:
1483
1484 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1485 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1486
1487 *Indx = *Indx + 1;
1488
1489 SrcVal0 =
1490 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1491
1492 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1493 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1494 *Indx = *Indx + 1;
1495
1496 DesVal = -(INT64)SrcVal0;
1497
1498 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1499
1500 break;
1501
1502 case FUNC_HI:
1503
1504 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1505 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1506 *Indx = *Indx + 1;
1507
1508 SrcVal0 =
1509 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1510
1511 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1512 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1513 *Indx = *Indx + 1;
1514
1515 DesVal = ScriptEngineKeywordHi((PUINT64)GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue),
1516 &HasError);
1517 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1518
1519 break;
1520
1521 case FUNC_LOW:
1522
1523 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1524 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1525
1526 *Indx = *Indx + 1;
1527
1528 SrcVal0 =
1529 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1530
1531 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1532 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1533
1534 *Indx = *Indx + 1;
1535
1536 DesVal = ScriptEngineKeywordLow((PUINT64)GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue),
1537 &HasError);
1538 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1539
1540 break;
1541
1542 case FUNC_MOV:
1543
1544 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1545 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1546 *Indx = *Indx + 1;
1547
1548 SrcVal0 =
1549 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1550
1551 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1552 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1553 *Indx = *Indx + 1;
1554
1555 DesVal = SrcVal0;
1556
1557 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1558
1559 break;
1560
1561 case FUNC_PRINT:
1562
1563 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1564 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1565
1566 *Indx = *Indx + 1;
1567
1568 SrcVal0 =
1569 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1570
1571 //
1572 // Call the target function
1573 //
1574 ScriptEngineFunctionPrint(ActionDetail->Tag,
1575 ActionDetail->ImmediatelySendTheResults,
1576 SrcVal0);
1577 break;
1578
1580 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1581 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1582 *Indx = *Indx + 1;
1583 SrcVal0 =
1584 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1585
1586 //
1587 // Call the target function
1588 //
1590 ActionDetail->ImmediatelySendTheResults,
1591 SrcVal0);
1592 break;
1593
1594 case FUNC_SPINLOCK_LOCK:
1595 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1596 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1597 *Indx = *Indx + 1;
1598
1599 SrcVal0 =
1600 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1601
1602 //
1603 // Call the target function
1604 //
1605 ScriptEngineFunctionSpinlockLock((volatile LONG *)SrcVal0, &HasError);
1606
1607 break;
1608
1610 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1611 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1612 *Indx = *Indx + 1;
1613 SrcVal0 =
1614 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1615
1616 //
1617 // Call the target function
1618 //
1619 ScriptEngineFunctionSpinlockUnlock((volatile LONG *)SrcVal0, &HasError);
1620
1621 break;
1622
1623 case FUNC_EVENT_ENABLE:
1624
1625 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1626 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1627 *Indx = *Indx + 1;
1628 SrcVal0 =
1629 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1630
1632
1633 break;
1634
1635 case FUNC_EVENT_DISABLE:
1636
1637 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1638 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1639 *Indx = *Indx + 1;
1640 SrcVal0 =
1641 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1642
1644
1645 break;
1646
1647 case FUNC_EVENT_CLEAR:
1648
1649 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1650 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1651 *Indx = *Indx + 1;
1652 SrcVal0 =
1653 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1654
1656
1657 break;
1658
1659 case FUNC_FORMATS:
1660
1661 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1662 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1663 *Indx = *Indx + 1;
1664 SrcVal0 =
1665 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1666
1667 //
1668 // Call the target function
1669 //
1671 ActionDetail->Tag,
1672 ActionDetail->ImmediatelySendTheResults,
1673 SrcVal0);
1674
1675 break;
1676
1677 case FUNC_JZ:
1678
1679 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1680 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1681 *Indx = *Indx + 1;
1682 SrcVal0 =
1683 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1684
1685 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1686 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1687 *Indx = *Indx + 1;
1688
1689 SrcVal1 =
1690 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1691
1692 if (SrcVal1 == 0)
1693 *Indx = SrcVal0;
1694
1695 break;
1696
1697 case FUNC_JNZ:
1698
1699 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1700 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1701
1702 *Indx = *Indx + 1;
1703 SrcVal0 =
1704 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1705
1706 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1707 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1708
1709 *Indx = *Indx + 1;
1710 SrcVal1 =
1711 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1712
1713 if (SrcVal1 != 0)
1714 *Indx = SrcVal0;
1715
1716 break;
1717
1718 case FUNC_JMP:
1719
1720 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1721 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1722 *Indx = *Indx + 1;
1723 SrcVal0 =
1724 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1725
1726 *Indx = SrcVal0;
1727
1728 break;
1729
1730 case FUNC_PUSH:
1731 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1732 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1733 *Indx = *Indx + 1;
1734
1735 SrcVal0 =
1736 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1737
1738 Des = (PSYMBOL)((unsigned long long)StackBuffer->Head +
1739 (unsigned long long)(*StackIndx * sizeof(SYMBOL)));
1740 *StackIndx = *StackIndx + 1;
1741
1742 Des->Len = 0;
1743 Des->Type = 0;
1744 Des->Value = SrcVal0;
1745 Des->VariableType = 0;
1746
1747 break;
1748
1749 case FUNC_POP:
1750 *StackIndx = *StackIndx - 1;
1751 Src0 = (PSYMBOL)((unsigned long long)StackBuffer->Head +
1752 (unsigned long long)(*StackIndx * sizeof(SYMBOL)));
1753
1754 Des =
1755 (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1756 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1757 *Indx = *Indx + 1;
1758 SetValue(GuestRegs, VariablesList, Des, Src0->Value, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1759
1760 break;
1761
1762 case FUNC_CALL:
1763 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1764 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1765 SrcVal0 =
1766 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1767
1768 *Indx = *Indx + 1;
1769
1770 Des = (PSYMBOL)((unsigned long long)StackBuffer->Head +
1771 (unsigned long long)(*StackIndx * sizeof(SYMBOL)));
1772 *StackIndx = *StackIndx + 1;
1773
1774 Des->Len = 0;
1776 Des->Value = *Indx;
1777 Des->VariableType = 0;
1778
1779 *Indx = SrcVal0;
1780 break;
1781
1782 case FUNC_RET:
1783 *StackIndx = *StackIndx - 1;
1784 Src0 = (PSYMBOL)((unsigned long long)StackBuffer->Head +
1785 (unsigned long long)(*StackIndx * sizeof(SYMBOL)));
1786 *Indx = Src0->Value;
1787 break;
1788 case FUNC_STRCMP:
1789
1790 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1791 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1792
1793 *Indx = *Indx + 1;
1794
1795 if (Src0->Type == SYMBOL_STRING_TYPE)
1796 {
1797 *Indx =
1798 *Indx + ((3 * sizeof(unsigned long long) + Src0->Len) /
1799 sizeof(SYMBOL));
1800 SrcVal0 = (UINT64)&Src0->Value;
1801 }
1802 else
1803 {
1804 SrcVal0 =
1805 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1806 }
1807
1808 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1809 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1810
1811 *Indx = *Indx + 1;
1812
1813 if (Src1->Type == SYMBOL_STRING_TYPE)
1814 {
1815 *Indx =
1816 *Indx + ((3 * sizeof(unsigned long long) + Src1->Len) /
1817 sizeof(SYMBOL));
1818 SrcVal1 = (UINT64)&Src1->Value;
1819 }
1820 else
1821 {
1822 SrcVal1 =
1823 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1824 }
1825
1826 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1827 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1828
1829 *Indx = *Indx + 1;
1830
1831 DesVal = ScriptEngineFunctionStrcmp((const char *)SrcVal1, (const char *)SrcVal0);
1832
1833 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1834
1835 break;
1836
1837 case FUNC_WCSCMP:
1838
1839 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1840 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1841
1842 *Indx = *Indx + 1;
1843
1844 if (Src0->Type == SYMBOL_WSTRING_TYPE)
1845 {
1846 *Indx =
1847 *Indx + ((3 * sizeof(unsigned long long) + Src0->Len) /
1848 sizeof(SYMBOL));
1849 SrcVal0 = (UINT64)&Src0->Value;
1850 }
1851 else
1852 {
1853 SrcVal0 =
1854 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1855 }
1856
1857 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1858 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1859
1860 *Indx = *Indx + 1;
1861
1862 if (Src1->Type == SYMBOL_WSTRING_TYPE)
1863 {
1864 *Indx =
1865 *Indx + ((3 * sizeof(unsigned long long) + Src1->Len) /
1866 sizeof(SYMBOL));
1867 SrcVal1 = (UINT64)&Src1->Value;
1868 }
1869 else
1870 {
1871 SrcVal1 =
1872 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1873 }
1874
1875 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1876 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1877
1878 *Indx = *Indx + 1;
1879
1880 DesVal = ScriptEngineFunctionWcscmp((const wchar_t *)SrcVal1, (const wchar_t *)SrcVal0);
1881
1882 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1883
1884 break;
1885
1886 case FUNC_MEMCMP:
1887
1888 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1889 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1890
1891 *Indx = *Indx + 1;
1892
1893 SrcVal0 =
1894 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1895
1896 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1897 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1898
1899 *Indx = *Indx + 1;
1900
1901 if (Src1->Type == SYMBOL_STRING_TYPE)
1902 {
1903 *Indx =
1904 *Indx + ((3 * sizeof(unsigned long long) + Src1->Len) /
1905 sizeof(SYMBOL));
1906 SrcVal1 = (UINT64)&Src1->Value;
1907 }
1908 else
1909 {
1910 SrcVal1 =
1911 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1912 }
1913
1914 Src2 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1915 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1916
1917 *Indx = *Indx + 1;
1918
1919 if (Src2->Type == SYMBOL_STRING_TYPE)
1920 {
1921 *Indx =
1922 *Indx + ((3 * sizeof(unsigned long long) + Src2->Len) /
1923 sizeof(SYMBOL));
1924 SrcVal2 = (UINT64)&Src2->Value;
1925 }
1926 else
1927 {
1928 SrcVal2 =
1929 GetValue(GuestRegs, ActionDetail, VariablesList, Src2, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1930 }
1931
1932 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1933 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1934
1935 *Indx = *Indx + 1;
1936
1937 DesVal = ScriptEngineFunctionMemcmp((const char *)SrcVal2, (const char *)SrcVal1, SrcVal0);
1938
1939 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1940
1941 break;
1942
1943 case FUNC_STRNCMP:
1944
1945 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1946 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1947
1948 *Indx = *Indx + 1;
1949
1950 SrcVal0 =
1951 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1952
1953 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1954 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1955
1956 *Indx = *Indx + 1;
1957
1958 if (Src1->Type == SYMBOL_STRING_TYPE)
1959 {
1960 *Indx =
1961 *Indx + ((3 * sizeof(unsigned long long) + Src1->Len) /
1962 sizeof(SYMBOL));
1963 SrcVal1 = (UINT64)&Src1->Value;
1964 }
1965 else
1966 {
1967 SrcVal1 =
1968 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1969 }
1970
1971 Src2 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1972 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1973
1974 *Indx = *Indx + 1;
1975
1976 if (Src2->Type == SYMBOL_STRING_TYPE)
1977 {
1978 *Indx =
1979 *Indx + ((3 * sizeof(unsigned long long) + Src2->Len) /
1980 sizeof(SYMBOL));
1981 SrcVal2 = (UINT64)&Src2->Value;
1982 }
1983 else
1984 {
1985 SrcVal2 =
1986 GetValue(GuestRegs, ActionDetail, VariablesList, Src2, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1987 }
1988
1989 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
1990 (unsigned long long)(*Indx * sizeof(SYMBOL)));
1991
1992 *Indx = *Indx + 1;
1993
1994 DesVal = ScriptEngineFunctionStrncmp((const char *)SrcVal2, (const char *)SrcVal1, SrcVal0);
1995
1996 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
1997
1998 break;
1999
2000 case FUNC_WCSNCMP:
2001
2002 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
2003 (unsigned long long)(*Indx * sizeof(SYMBOL)));
2004
2005 *Indx = *Indx + 1;
2006
2007 SrcVal0 =
2008 GetValue(GuestRegs, ActionDetail, VariablesList, Src0, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
2009
2010 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
2011 (unsigned long long)(*Indx * sizeof(SYMBOL)));
2012
2013 *Indx = *Indx + 1;
2014
2015 if (Src1->Type == SYMBOL_WSTRING_TYPE)
2016 {
2017 *Indx =
2018 *Indx + ((3 * sizeof(unsigned long long) + Src1->Len) /
2019 sizeof(SYMBOL));
2020 SrcVal1 = (UINT64)&Src1->Value;
2021 }
2022 else
2023 {
2024 SrcVal1 =
2025 GetValue(GuestRegs, ActionDetail, VariablesList, Src1, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
2026 }
2027
2028 Src2 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
2029 (unsigned long long)(*Indx * sizeof(SYMBOL)));
2030
2031 *Indx = *Indx + 1;
2032
2033 if (Src2->Type == SYMBOL_WSTRING_TYPE)
2034 {
2035 *Indx =
2036 *Indx + ((3 * sizeof(unsigned long long) + Src2->Len) /
2037 sizeof(SYMBOL));
2038 SrcVal2 = (UINT64)&Src2->Value;
2039 }
2040 else
2041 {
2042 SrcVal2 =
2043 GetValue(GuestRegs, ActionDetail, VariablesList, Src2, FALSE, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
2044 }
2045
2046 Des = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
2047 (unsigned long long)(*Indx * sizeof(SYMBOL)));
2048
2049 *Indx = *Indx + 1;
2050
2051 DesVal = ScriptEngineFunctionWcsncmp((const wchar_t *)SrcVal2, (const wchar_t *)SrcVal1, SrcVal0);
2052
2053 SetValue(GuestRegs, VariablesList, Des, DesVal, StackBuffer, StackIndx, StackBaseIndx, ReturnValue);
2054
2055 break;
2056
2057 case FUNC_PRINTF:
2058
2059 Src0 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
2060 (unsigned long long)(*Indx * sizeof(SYMBOL)));
2061 *Indx = *Indx + 1;
2062
2063 //
2064 // Call the target function
2065 //
2066
2067 *Indx =
2068 *Indx + ((3 * sizeof(unsigned long long) + Src0->Len) /
2069 sizeof(SYMBOL));
2070
2071 Src1 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
2072 (unsigned long long)(*Indx * sizeof(SYMBOL)));
2073
2074 *Indx = *Indx + 1;
2075
2076 Src2 = NULL;
2077
2078 if (Src1->Value > 0)
2079 {
2080 Src2 = (PSYMBOL)((unsigned long long)CodeBuffer->Head +
2081 (unsigned long long)(*Indx * sizeof(SYMBOL)));
2082
2083 *Indx = *Indx + Src1->Value;
2084 }
2085
2087 GuestRegs,
2088 ActionDetail,
2089 VariablesList,
2090 ActionDetail->Tag,
2091 ActionDetail->ImmediatelySendTheResults,
2092 (char *)&Src0->Value,
2093 Src1->Value,
2094 Src2,
2095 (BOOLEAN *)&HasError,
2096 StackBuffer,
2097 StackIndx,
2098 StackBaseIndx,
2099 ReturnValue);
2100
2101 break;
2102 }
2103
2104 //
2105 // Return the result of whether error detected or not
2106 //
2107 return HasError;
2108}
int BOOL
Definition BasicTypes.h:23
UCHAR BOOLEAN
Definition BasicTypes.h:39
unsigned char BYTE
Definition BasicTypes.h:24
signed __int64 INT64
Definition BasicTypes.h:45
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54
unsigned long DWORD
Definition BasicTypes.h:22
unsigned __int64 * PUINT64
Definition BasicTypes.h:21
unsigned int UINT32
Definition BasicTypes.h:48
long long ScriptEngineFunctionInterlockedIncrement(long long volatile *Addend, BOOL *HasError)
Implementation of interlocked_exchange_increment function.
Definition Functions.c:628
VOID ScriptEngineFunctionEventTraceInstrumentationStep()
Implementation of event_trace_instrumentation_step function.
Definition Functions.c:1693
VOID ScriptEngineFunctionSpinlockUnlock(volatile LONG *Lock, BOOL *HasError)
Implementation of spinlock_unlock function.
Definition Functions.c:443
VOID ScriptEngineFunctionEventInjectErrorCode(UINT32 InterruptionType, UINT32 Vector, UINT32 ErrorCode, BOOL *HasError)
Implementation of event_inject_error_code function.
Definition Functions.c:1542
long long ScriptEngineFunctionInterlockedDecrement(long long volatile *Addend, BOOL *HasError)
Implementation of interlocked_exchange_decrement function.
Definition Functions.c:656
BOOLEAN ScriptEngineFunctionEd(UINT64 Address, DWORD Value, BOOL *HasError)
Implementation of ed function.
Definition Functions.c:91
UINT64 ScriptEngineFunctionPhysicalToVirtual(UINT64 Address)
Convert physical address to virtual address.
Definition Functions.c:338
VOID ScriptEngineFunctionShortCircuitingEvent(UINT64 State, ACTION_BUFFER *ActionDetail)
Implementation of event_ignore function.
Definition Functions.c:891
VOID ScriptEngineFunctionSpinlockLock(volatile LONG *Lock, BOOL *HasError)
Implementation of spinlock_lock function.
Definition Functions.c:414
VOID ScriptEngineFunctionPause(ACTION_BUFFER *ActionDetail, PGUEST_REGS GuestRegs)
Implementation of pause function.
Definition Functions.c:792
UINT64 ScriptEngineFunctionStrcmp(const char *Address1, const char *Address2)
Implementation of strcmp function.
Definition Functions.c:1579
BOOLEAN ScriptEngineFunctionCheckAddress(UINT64 Address, UINT32 Length)
Check whether the address is valid or not.
Definition Functions.c:168
UINT64 ScriptEngineFunctionWcscmp(const wchar_t *Address1, const wchar_t *Address2)
Implementation of wcscmp function.
Definition Functions.c:1626
long long ScriptEngineFunctionInterlockedExchange(long long volatile *Target, long long Value, BOOL *HasError)
Implementation of interlocked_exchange function.
Definition Functions.c:569
UINT64 ScriptEngineFunctionVirtualToPhysical(UINT64 Address)
Definition Functions.c:314
UINT64 ScriptEngineFunctionWcsncmp(const wchar_t *Address1, const wchar_t *Address2, size_t Num)
Implementation of wcsncmp function.
Definition Functions.c:1650
VOID ScriptEngineFunctionPrintf(PGUEST_REGS GuestRegs, ACTION_BUFFER *ActionDetail, SCRIPT_ENGINE_VARIABLES_LIST *VariablesList, UINT64 Tag, BOOLEAN ImmediateMessagePassing, char *Format, UINT64 ArgCount, PSYMBOL FirstArg, BOOLEAN *HasError, SYMBOL_BUFFER *StackBuffer, UINT64 *StackIndx, UINT64 *StackBaseIndx, UINT64 *ReturnValue)
Implementation of printf function.
Definition Functions.c:1270
VOID ScriptEngineFunctionSpinlockLockCustomWait(volatile long *Lock, unsigned MaxWait, BOOL *HasError)
Implementation of spinlock_lock_custom_wait function.
Definition Functions.c:473
VOID ScriptEngineFunctionEventDisable(UINT64 EventId)
Implementation of event_disable function.
Definition Functions.c:739
VOID ScriptEngineFunctionEventEnable(UINT64 EventId)
Implementation of event_enable function.
Definition Functions.c:717
UINT64 ScriptEngineFunctionDisassembleLen(PVOID Address, BOOLEAN Is32Bit)
Implementation of disassemble_len function.
Definition Functions.c:524
UINT64 ScriptEngineFunctionStrlen(const char *Address)
Implementation of strlen function.
Definition Functions.c:501
long long ScriptEngineFunctionInterlockedCompareExchange(long long volatile *Destination, long long ExChange, long long Comperand, BOOL *HasError)
Implementation of interlocked_compare_exchange function.
Definition Functions.c:686
BOOLEAN ScriptEngineFunctionEq(UINT64 Address, QWORD Value, BOOL *HasError)
Implementation of eq function.
Definition Functions.c:52
VOID ScriptEngineFunctionFlush()
Implementation of flush function.
Definition Functions.c:866
UINT64 ScriptEngineFunctionMemcmp(const char *Address1, const char *Address2, size_t Count)
Implementation of memcmp function.
Definition Functions.c:1673
UINT64 ScriptEngineFunctionWcslen(const wchar_t *Address)
Implementation of wcslen function.
Definition Functions.c:545
VOID ScriptEngineFunctionPrint(UINT64 Tag, BOOLEAN ImmediateMessagePassing, UINT64 Value)
Implementation of print function.
Definition Functions.c:364
VOID ScriptEngineFunctionEventInject(UINT32 InterruptionType, UINT32 Vector, BOOL *HasError)
Implementation of event_inject function.
Definition Functions.c:1504
VOID ScriptEngineFunctionEventClear(UINT64 EventId)
Implementation of event_clear function.
Definition Functions.c:761
VOID ScriptEngineFunctionEventTraceStepIn()
Implementation of event_trace_step_in function.
Definition Functions.c:1717
BOOLEAN ScriptEngineFunctionEb(UINT64 Address, BYTE Value, BOOL *HasError)
Implementation of eb function.
Definition Functions.c:130
VOID ScriptEngineFunctionTestStatement(UINT64 Tag, BOOLEAN ImmediateMessagePassing, UINT64 Value)
Implementation of test_statement function.
Definition Functions.c:392
UINT64 ScriptEngineFunctionStrncmp(const char *Address1, const char *Address2, size_t Num)
Implementation of strcmp function.
Definition Functions.c:1603
long long ScriptEngineFunctionInterlockedExchangeAdd(long long volatile *Addend, long long Value, BOOL *HasError)
Implementation of interlocked_exchange_add function.
Definition Functions.c:599
VOID ScriptEngineFunctionFormats(UINT64 Tag, BOOLEAN ImmediateMessagePassing, UINT64 Value)
Implementation of formats function.
Definition Functions.c:929
VOID ScriptEngineFunctionMemcpy(UINT64 Destination, UINT64 Source, UINT32 Num, BOOL *HasError)
A VMX-compatible equivalent of memcpy function in C.
Definition Functions.c:201
WORD ScriptEngineKeywordDw(PUINT64 Address, BOOL *HasError)
Implementation of dw keyword.
Definition Keywords.c:197
BYTE ScriptEngineKeywordDb(PUINT64 Address, BOOL *HasError)
Implementation of db keyword.
Definition Keywords.c:129
WORD ScriptEngineKeywordLow(PUINT64 Address, BOOL *HasError)
Implementation of low keyword.
Definition Keywords.c:95
UINT64 ScriptEngineKeywordPoi(PUINT64 Address, BOOL *HasError)
Implementation of poi keyword.
Definition Keywords.c:27
WORD ScriptEngineKeywordHi(PUINT64 Address, BOOL *HasError)
Implementation of hi keyword.
Definition Keywords.c:61
DWORD ScriptEngineKeywordDd(PUINT64 Address, BOOL *HasError)
Implementation of dd keyword.
Definition Keywords.c:163
QWORD ScriptEngineKeywordDq(PUINT64 Address, BOOL *HasError)
Implementation of dq keyword.
Definition Keywords.c:231
#define FUNC_DQ
Definition ScriptEngineCommonDefinitions.h:177
#define FUNC_EQ
Definition ScriptEngineCommonDefinitions.h:192
#define FUNC_DD
Definition ScriptEngineCommonDefinitions.h:175
#define FUNC_EVENT_CLEAR
Definition ScriptEngineCommonDefinitions.h:158
#define FUNC_MUL
Definition ScriptEngineCommonDefinitions.h:113
#define FUNC_CALL
Definition ScriptEngineCommonDefinitions.h:142
#define SYMBOL_WSTRING_TYPE
Definition ScriptEngineCommonDefinitions.h:64
#define FUNC_EVENT_TRACE_STEP_OUT
Definition ScriptEngineCommonDefinitions.h:168
#define FUNC_EVENT_DISABLE
Definition ScriptEngineCommonDefinitions.h:157
#define FUNC_INTERLOCKED_EXCHANGE_ADD
Definition ScriptEngineCommonDefinitions.h:194
#define FUNC_HI
Definition ScriptEngineCommonDefinitions.h:179
#define FUNC_STRCMP
Definition ScriptEngineCommonDefinitions.h:197
#define FUNC_DISASSEMBLE_LEN32
Definition ScriptEngineCommonDefinitions.h:184
#define FUNC_JMP
Definition ScriptEngineCommonDefinitions.h:123
#define FUNC_GT
Definition ScriptEngineCommonDefinitions.h:116
#define FUNC_MOV
Definition ScriptEngineCommonDefinitions.h:131
#define FUNC_MEMCPY
Definition ScriptEngineCommonDefinitions.h:203
#define FUNC_EVENT_SC
Definition ScriptEngineCommonDefinitions.h:162
#define FUNC_EGT
Definition ScriptEngineCommonDefinitions.h:118
#define FUNC_STRLEN
Definition ScriptEngineCommonDefinitions.h:196
#define FUNC_SUB
Definition ScriptEngineCommonDefinitions.h:112
#define FUNC_PRINTF
Definition ScriptEngineCommonDefinitions.h:163
#define FUNC_POP
Definition ScriptEngineCommonDefinitions.h:141
#define FUNC_EVENT_INJECT_ERROR_CODE
Definition ScriptEngineCommonDefinitions.h:202
#define FUNC_FORMATS
Definition ScriptEngineCommonDefinitions.h:155
#define FUNC_INC
Definition ScriptEngineCommonDefinitions.h:102
#define FUNC_SPINLOCK_UNLOCK
Definition ScriptEngineCommonDefinitions.h:161
#define FUNC_CHECK_ADDRESS
Definition ScriptEngineCommonDefinitions.h:182
#define FUNC_INTERLOCKED_INCREMENT
Definition ScriptEngineCommonDefinitions.h:186
#define FUNC_ASR
Definition ScriptEngineCommonDefinitions.h:109
#define FUNC_DB
Definition ScriptEngineCommonDefinitions.h:174
#define FUNC_WCSCMP
Definition ScriptEngineCommonDefinitions.h:201
#define FUNC_ASL
Definition ScriptEngineCommonDefinitions.h:110
#define FUNC_VIRTUAL_TO_PHYSICAL
Definition ScriptEngineCommonDefinitions.h:189
#define FUNC_PRINT
Definition ScriptEngineCommonDefinitions.h:154
#define FUNC_FLUSH
Definition ScriptEngineCommonDefinitions.h:165
#define FUNC_PAUSE
Definition ScriptEngineCommonDefinitions.h:164
#define FUNC_RET
Definition ScriptEngineCommonDefinitions.h:143
#define FUNC_LOW
Definition ScriptEngineCommonDefinitions.h:180
#define FUNC_INTERLOCKED_DECREMENT
Definition ScriptEngineCommonDefinitions.h:187
#define FUNC_EVENT_TRACE_STEP
Definition ScriptEngineCommonDefinitions.h:166
#define FUNC_DISASSEMBLE_LEN64
Definition ScriptEngineCommonDefinitions.h:185
#define FUNC_ELT
Definition ScriptEngineCommonDefinitions.h:119
#define FUNC_POI
Definition ScriptEngineCommonDefinitions.h:173
#define FUNC_OR
Definition ScriptEngineCommonDefinitions.h:106
#define FUNC_DW
Definition ScriptEngineCommonDefinitions.h:176
#define FUNC_XOR
Definition ScriptEngineCommonDefinitions.h:107
#define FUNC_PHYSICAL_TO_VIRTUAL
Definition ScriptEngineCommonDefinitions.h:188
#define FUNC_MEMCMP
Definition ScriptEngineCommonDefinitions.h:198
#define FUNC_SPINLOCK_LOCK
Definition ScriptEngineCommonDefinitions.h:160
#define FUNC_DISASSEMBLE_LEN
Definition ScriptEngineCommonDefinitions.h:183
#define FUNC_EVENT_INJECT
Definition ScriptEngineCommonDefinitions.h:172
#define FUNC_PUSH
Definition ScriptEngineCommonDefinitions.h:140
#define FUNC_REFERENCE
Definition ScriptEngineCommonDefinitions.h:104
#define FUNC_ADD
Definition ScriptEngineCommonDefinitions.h:111
#define FUNC_NEQ
Definition ScriptEngineCommonDefinitions.h:121
#define FUNC_NEG
Definition ScriptEngineCommonDefinitions.h:178
#define FUNC_WCSNCMP
Definition ScriptEngineCommonDefinitions.h:204
#define FUNC_EVENT_TRACE_INSTRUMENTATION_STEP_IN
Definition ScriptEngineCommonDefinitions.h:170
#define SYMBOL_STRING_TYPE
Definition ScriptEngineCommonDefinitions.h:61
#define SYMBOL_RETURN_ADDRESS_TYPE
Definition ScriptEngineCommonDefinitions.h:66
#define FUNC_JZ
Definition ScriptEngineCommonDefinitions.h:124
#define FUNC_EQUAL
Definition ScriptEngineCommonDefinitions.h:120
#define FUNC_EVENT_TRACE_INSTRUMENTATION_STEP
Definition ScriptEngineCommonDefinitions.h:169
#define FUNC_LT
Definition ScriptEngineCommonDefinitions.h:117
#define SYMBOL_SEMANTIC_RULE_TYPE
Definition ScriptEngineCommonDefinitions.h:59
#define FUNC_DIV
Definition ScriptEngineCommonDefinitions.h:114
#define FUNC_EVENT_ENABLE
Definition ScriptEngineCommonDefinitions.h:156
#define FUNC_TEST_STATEMENT
Definition ScriptEngineCommonDefinitions.h:159
#define FUNC_AND
Definition ScriptEngineCommonDefinitions.h:108
#define FUNC_NOT
Definition ScriptEngineCommonDefinitions.h:181
#define FUNC_ED
Definition ScriptEngineCommonDefinitions.h:190
#define FUNC_INTERLOCKED_EXCHANGE
Definition ScriptEngineCommonDefinitions.h:193
#define FUNC_WCSLEN
Definition ScriptEngineCommonDefinitions.h:200
#define FUNC_DEC
Definition ScriptEngineCommonDefinitions.h:103
#define FUNC_EVENT_TRACE_STEP_IN
Definition ScriptEngineCommonDefinitions.h:167
#define FUNC_MOD
Definition ScriptEngineCommonDefinitions.h:115
#define FUNC_EB
Definition ScriptEngineCommonDefinitions.h:191
#define FUNC_STRNCMP
Definition ScriptEngineCommonDefinitions.h:199
#define FUNC_SPINLOCK_LOCK_CUSTOM_WAIT
Definition ScriptEngineCommonDefinitions.h:171
#define FUNC_JNZ
Definition ScriptEngineCommonDefinitions.h:125
#define FUNC_INTERLOCKED_COMPARE_EXCHANGE
Definition ScriptEngineCommonDefinitions.h:195
VOID SetValue(PGUEST_REGS GuestRegs, SCRIPT_ENGINE_VARIABLES_LIST *VariablesList, PSYMBOL Symbol, UINT64 Value, SYMBOL_BUFFER *StackBuffer, UINT64 *StackIndx, UINT64 *StackBaseIndx, UINT64 *ReturnValue)
Set the value.
Definition ScriptEngineEval.c:184
UINT64 GetValue(PGUEST_REGS GuestRegs, PACTION_BUFFER ActionBuffer, PSCRIPT_ENGINE_VARIABLES_LIST VariablesList, PSYMBOL Symbol, BOOLEAN ReturnReference, SYMBOL_BUFFER *StackBuffer, UINT64 *StackIndx, UINT64 *StackBaseIndx, UINT64 *ReturnValue)
Get the Value (reg, peseudo-reg, etc.)
Definition ScriptEngineEval.c:92
long long unsigned Tag
Definition ScriptEngineCommonDefinitions.h:35
char ImmediatelySendTheResults
Definition ScriptEngineCommonDefinitions.h:37
long long unsigned VariableType
Definition ScriptEngineCommonDefinitions.h:9
long long unsigned Len
Definition ScriptEngineCommonDefinitions.h:8

◆ ScriptEngineGetOperatorName()

VOID ScriptEngineGetOperatorName ( PSYMBOL OperatorSymbol,
CHAR * BufferForName )

Get the operator name.

Parameters
OperatorSymbol
BufferForName
Returns
VOID
246{
247 switch (OperatorSymbol->Value)
248 {
249 case FUNC_POI:
250 memcpy(BufferForName, "poi", 3);
251 break;
252 case FUNC_DB:
253 memcpy(BufferForName, "db", 2);
254 break;
255 case FUNC_DD:
256 memcpy(BufferForName, "dd", 2);
257 break;
258 case FUNC_DW:
259 memcpy(BufferForName, "dw", 2);
260 break;
261 case FUNC_DQ:
262 memcpy(BufferForName, "dq", 2);
263 break;
264 case FUNC_HI:
265 memcpy(BufferForName, "hi", 2);
266 break;
267 case FUNC_LOW:
268 memcpy(BufferForName, "low", 3);
269 break;
270 default:
271 memcpy(BufferForName, "error", 5);
272 break;
273 }
274}

◆ SetValue()

VOID SetValue ( PGUEST_REGS GuestRegs,
SCRIPT_ENGINE_VARIABLES_LIST * VariablesList,
PSYMBOL Symbol,
UINT64 Value,
SYMBOL_BUFFER * StackBuffer,
UINT64 * StackIndx,
UINT64 * StackBaseIndx,
UINT64 * ReturnValue )

Set the value.

Parameters
GuestRegs
VariablesList
Symbol
Value
Returns
VOID
192{
193 switch (Symbol->Type)
194 {
196 VariablesList->GlobalVariablesList[Symbol->Value] = Value;
197 return;
199 VariablesList->LocalVariablesList[Symbol->Value] = Value;
200 return;
201 case SYMBOL_TEMP_TYPE:
202 VariablesList->TempList[Symbol->Value] = Value;
203 return;
205 SetRegValueUsingSymbol(GuestRegs, Symbol, Value);
206 return;
207
209 *StackIndx = Value;
210 return;
211
213 *StackBaseIndx = Value;
214 return;
215
217 *ReturnValue = Value;
218 return;
219
221 {
222 PSYMBOL StackSymbol = (PSYMBOL)((unsigned long long)StackBuffer->Head +
223 (unsigned long long)((*StackBaseIndx + Symbol->Value) * sizeof(SYMBOL)));
224 StackSymbol->Value = Value;
225 return;
226 }
228 {
229 PSYMBOL StackSymbol = (PSYMBOL)((unsigned long long)StackBuffer->Head +
230 (unsigned long long)((*StackBaseIndx - 3 - Symbol->Value) * sizeof(SYMBOL)));
231 StackSymbol->Value = Value;
232 return;
233 }
234 }
235}
BOOLEAN SetRegValueUsingSymbol(PGUEST_REGS GuestRegs, PSYMBOL Symbol, UINT64 Value)
Set the register value.
Definition Regs.c:1993
RequestedActionOfThePacket Value(0x1) 00000000