HyperDbg Debugger
Loading...
Searching...
No Matches
ScriptEngineHeader.h File Reference

Headers for exported script engine headers. More...

Go to the source code of this file.

Functions

BOOLEAN SetRegValue (PGUEST_REGS GuestRegs, UINT32 RegisterId, UINT64 Value)
 Set the register value.
 
UINT64 GetRegValue (PGUEST_REGS GuestRegs, REGS_ENUM RegId)
 Get the register value.
 
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.
 
VOID ScriptEngineGetOperatorName (PSYMBOL OperatorSymbol, CHAR *BufferForName)
 Get the operator name.
 

Detailed Description

Headers for exported script engine headers.

Author
Sina Karvandi (sina@.nosp@m.hype.nosp@m.rdbg..nosp@m.org)
Version
0.2
Date
2022-06-28

Function Documentation

◆ GetRegValue()

UINT64 GetRegValue ( PGUEST_REGS GuestRegs,
REGS_ENUM RegId )

Get the register value.

Parameters
GuestRegs
RegId
Returns
UINT64
24{
25 switch (RegId)
26 {
27 case REGISTER_RAX:
28 return GuestRegs->rax;
29
30 break;
31
32 case REGISTER_EAX:
33 return (GuestRegs->rax & LOWER_32_BITS);
34
35 break;
36
37 case REGISTER_AX:
38 return (GuestRegs->rax & LOWER_16_BITS);
39
40 break;
41
42 case REGISTER_AH:
43 return (GuestRegs->rax & SECOND_LOWER_8_BITS) >> 8;
44
45 break;
46
47 case REGISTER_AL:
48 return (GuestRegs->rax & LOWER_8_BITS);
49
50 break;
51
52 case REGISTER_RCX:
53 return GuestRegs->rcx;
54
55 break;
56
57 case REGISTER_ECX:
58 return (GuestRegs->rcx & LOWER_32_BITS);
59
60 break;
61
62 case REGISTER_CX:
63 return (GuestRegs->rcx & LOWER_16_BITS);
64
65 break;
66
67 case REGISTER_CH:
68 return (GuestRegs->rcx & SECOND_LOWER_8_BITS) >> 8;
69
70 break;
71
72 case REGISTER_CL:
73 return (GuestRegs->rcx & LOWER_8_BITS);
74
75 break;
76
77 case REGISTER_RDX:
78 return GuestRegs->rdx;
79
80 break;
81
82 case REGISTER_EDX:
83 return (GuestRegs->rdx & LOWER_32_BITS);
84
85 break;
86
87 case REGISTER_DX:
88 return (GuestRegs->rdx & LOWER_16_BITS);
89
90 break;
91
92 case REGISTER_DH:
93 return (GuestRegs->rdx & SECOND_LOWER_8_BITS) >> 8;
94
95 break;
96
97 case REGISTER_DL:
98 return (GuestRegs->rdx & LOWER_8_BITS);
99
100 break;
101
102 case REGISTER_RBX:
103 return GuestRegs->rbx;
104
105 break;
106
107 case REGISTER_EBX:
108 return (GuestRegs->rbx & LOWER_32_BITS);
109
110 break;
111
112 case REGISTER_BX:
113 return (GuestRegs->rbx & LOWER_16_BITS);
114
115 break;
116
117 case REGISTER_BH:
118 return (GuestRegs->rbx & SECOND_LOWER_8_BITS) >> 8;
119
120 break;
121
122 case REGISTER_BL:
123 return (GuestRegs->rbx & LOWER_8_BITS);
124
125 break;
126
127 case REGISTER_RSP:
128 return GuestRegs->rsp;
129
130 break;
131
132 case REGISTER_ESP:
133 return (GuestRegs->rsp & LOWER_32_BITS);
134
135 break;
136
137 case REGISTER_SP:
138 return (GuestRegs->rsp & LOWER_16_BITS);
139
140 break;
141
142 case REGISTER_SPL:
143 return (GuestRegs->rsp & LOWER_8_BITS);
144
145 break;
146
147 case REGISTER_RBP:
148 return GuestRegs->rbp;
149
150 break;
151
152 case REGISTER_EBP:
153 return (GuestRegs->rbp & LOWER_32_BITS);
154
155 break;
156
157 case REGISTER_BP:
158 return (GuestRegs->rbp & LOWER_16_BITS);
159
160 break;
161 case REGISTER_BPL:
162 return (GuestRegs->rbp & LOWER_8_BITS);
163
164 break;
165
166 case REGISTER_RSI:
167 return GuestRegs->rsi;
168
169 break;
170
171 case REGISTER_ESI:
172 return (GuestRegs->rsi & LOWER_32_BITS);
173
174 break;
175
176 case REGISTER_SI:
177 return (GuestRegs->rsi & LOWER_16_BITS);
178
179 break;
180
181 case REGISTER_SIL:
182 return (GuestRegs->rsi & LOWER_8_BITS);
183
184 break;
185
186 case REGISTER_RDI:
187 return GuestRegs->rdi;
188
189 break;
190
191 case REGISTER_EDI:
192 return (GuestRegs->rdi & LOWER_32_BITS);
193
194 break;
195
196 case REGISTER_DI:
197 return (GuestRegs->rdi & LOWER_16_BITS);
198
199 break;
200
201 case REGISTER_DIL:
202 return (GuestRegs->rdi & LOWER_8_BITS);
203
204 break;
205
206 case REGISTER_R8:
207 return GuestRegs->r8;
208
209 break;
210
211 case REGISTER_R8D:
212 return (GuestRegs->r8 & LOWER_32_BITS);
213
214 break;
215
216 case REGISTER_R8W:
217 return (GuestRegs->r8 & LOWER_16_BITS);
218
219 break;
220
221 case REGISTER_R8H:
222 return (GuestRegs->r8 & SECOND_LOWER_8_BITS) >> 8;
223
224 break;
225
226 case REGISTER_R8L:
227 return (GuestRegs->r8 & LOWER_8_BITS);
228
229 break;
230 case REGISTER_R9:
231 return GuestRegs->r9;
232
233 break;
234
235 case REGISTER_R9D:
236 return (GuestRegs->r9 & LOWER_32_BITS);
237
238 break;
239
240 case REGISTER_R9W:
241 return (GuestRegs->r9 & LOWER_16_BITS);
242
243 break;
244
245 case REGISTER_R9H:
246 return (GuestRegs->r9 & SECOND_LOWER_8_BITS) >> 8;
247
248 break;
249
250 case REGISTER_R9L:
251 return (GuestRegs->r9 & LOWER_8_BITS);
252
253 break;
254
255 case REGISTER_R10:
256 return GuestRegs->r10;
257
258 break;
259
260 case REGISTER_R10D:
261 return (GuestRegs->r10 & LOWER_32_BITS);
262
263 break;
264
265 case REGISTER_R10W:
266 return (GuestRegs->r10 & LOWER_16_BITS);
267
268 break;
269
270 case REGISTER_R10H:
271 return (GuestRegs->r10 & SECOND_LOWER_8_BITS) >> 8;
272
273 break;
274
275 case REGISTER_R10L:
276 return (GuestRegs->r10 & LOWER_8_BITS);
277
278 break;
279
280 case REGISTER_R11:
281 return GuestRegs->r11;
282
283 break;
284
285 case REGISTER_R11D:
286 return (GuestRegs->r11 & LOWER_32_BITS);
287
288 break;
289
290 case REGISTER_R11W:
291 return (GuestRegs->r11 & LOWER_16_BITS);
292
293 break;
294
295 case REGISTER_R11H:
296 return (GuestRegs->r11 & SECOND_LOWER_8_BITS) >> 8;
297
298 break;
299
300 case REGISTER_R11L:
301 return (GuestRegs->r11 & LOWER_8_BITS);
302
303 break;
304
305 case REGISTER_R12:
306 return GuestRegs->r12;
307
308 break;
309
310 case REGISTER_R12D:
311 return (GuestRegs->r12 & LOWER_32_BITS);
312
313 break;
314
315 case REGISTER_R12W:
316 return (GuestRegs->r12 & LOWER_16_BITS);
317
318 break;
319
320 case REGISTER_R12H:
321 return (GuestRegs->r12 & SECOND_LOWER_8_BITS) >> 8;
322
323 break;
324
325 case REGISTER_R12L:
326 return (GuestRegs->r12 & LOWER_8_BITS);
327
328 break;
329
330 case REGISTER_R13:
331 return GuestRegs->r13;
332
333 break;
334
335 case REGISTER_R13D:
336 return (GuestRegs->r13 & LOWER_32_BITS);
337
338 break;
339
340 case REGISTER_R13W:
341 return (GuestRegs->r13 & LOWER_16_BITS);
342
343 break;
344
345 case REGISTER_R13H:
346 return (GuestRegs->r13 & SECOND_LOWER_8_BITS) >> 8;
347
348 break;
349
350 case REGISTER_R13L:
351 return (GuestRegs->r13 & LOWER_8_BITS);
352
353 break;
354
355 case REGISTER_R14:
356 return GuestRegs->r14;
357
358 break;
359
360 case REGISTER_R14D:
361 return (GuestRegs->r14 & LOWER_32_BITS);
362
363 break;
364
365 case REGISTER_R14W:
366 return (GuestRegs->r14 & LOWER_16_BITS);
367
368 break;
369
370 case REGISTER_R14H:
371 return (GuestRegs->r14 & SECOND_LOWER_8_BITS) >> 8;
372
373 break;
374
375 case REGISTER_R14L:
376 return (GuestRegs->r14 & LOWER_8_BITS);
377
378 break;
379
380 case REGISTER_R15:
381 return GuestRegs->r15;
382
383 break;
384
385 case REGISTER_R15D:
386 return (GuestRegs->r15 & LOWER_32_BITS);
387
388 break;
389
390 case REGISTER_R15W:
391 return (GuestRegs->r15 & LOWER_16_BITS);
392
393 break;
394
395 case REGISTER_R15H:
396 return (GuestRegs->r15 & SECOND_LOWER_8_BITS) >> 8;
397
398 break;
399
400 case REGISTER_R15L:
401 return (GuestRegs->r15 & LOWER_8_BITS);
402
403 break;
404
405 case REGISTER_DS:
406
407#ifdef SCRIPT_ENGINE_USER_MODE
408 return NULL;
409#endif // SCRIPT_ENGINE_USER_MODE
410
411#ifdef SCRIPT_ENGINE_KERNEL_MODE
412 return GetGuestDs().Selector;
413#endif // SCRIPT_ENGINE_KERNEL_MODE
414
415 break;
416
417 case REGISTER_ES:
418
419#ifdef SCRIPT_ENGINE_USER_MODE
420 return NULL;
421#endif // SCRIPT_ENGINE_USER_MODE
422
423#ifdef SCRIPT_ENGINE_KERNEL_MODE
424 return GetGuestEs().Selector;
425#endif // SCRIPT_ENGINE_KERNEL_MODE
426
427 break;
428
429 case REGISTER_FS:
430
431#ifdef SCRIPT_ENGINE_USER_MODE
432 return NULL;
433#endif // SCRIPT_ENGINE_USER_MODE
434
435#ifdef SCRIPT_ENGINE_KERNEL_MODE
436 return GetGuestFs().Selector;
437#endif // SCRIPT_ENGINE_KERNEL_MODE
438
439 break;
440
441 case REGISTER_GS:
442
443#ifdef SCRIPT_ENGINE_USER_MODE
444 return NULL;
445#endif // SCRIPT_ENGINE_USER_MODE
446
447#ifdef SCRIPT_ENGINE_KERNEL_MODE
448 return GetGuestGs().Selector;
449#endif // SCRIPT_ENGINE_KERNEL_MODE
450
451 break;
452
453 case REGISTER_CS:
454
455#ifdef SCRIPT_ENGINE_USER_MODE
456 return NULL;
457#endif // SCRIPT_ENGINE_USER_MODE
458
459#ifdef SCRIPT_ENGINE_KERNEL_MODE
460 return GetGuestCs().Selector;
461#endif // SCRIPT_ENGINE_KERNEL_MODE
462
463 break;
464
465 case REGISTER_SS:
466
467#ifdef SCRIPT_ENGINE_USER_MODE
468 return NULL;
469#endif // SCRIPT_ENGINE_USER_MODE
470
471#ifdef SCRIPT_ENGINE_KERNEL_MODE
472 return GetGuestSs().Selector;
473#endif // SCRIPT_ENGINE_KERNEL_MODE
474
475 break;
476
477 case REGISTER_RFLAGS:
478
479#ifdef SCRIPT_ENGINE_USER_MODE
480 return NULL;
481#endif // SCRIPT_ENGINE_USER_MODE
482
483#ifdef SCRIPT_ENGINE_KERNEL_MODE
484 return GetGuestRFlags();
485#endif // SCRIPT_ENGINE_KERNEL_MODE
486
487 break;
488
489 case REGISTER_EFLAGS:
490
491#ifdef SCRIPT_ENGINE_USER_MODE
492 return NULL;
493#endif // SCRIPT_ENGINE_USER_MODE
494
495#ifdef SCRIPT_ENGINE_KERNEL_MODE
496 return (GetGuestRFlags() & LOWER_32_BITS);
497#endif // SCRIPT_ENGINE_KERNEL_MODE
498
499 break;
500
501 case REGISTER_FLAGS:
502
503#ifdef SCRIPT_ENGINE_USER_MODE
504 return NULL;
505#endif // SCRIPT_ENGINE_USER_MODE
506
507#ifdef SCRIPT_ENGINE_KERNEL_MODE
508 return (GetGuestRFlags() & LOWER_16_BITS);
509#endif // SCRIPT_ENGINE_KERNEL_MODE
510
511 break;
512
513 case REGISTER_CF:
514
515#ifdef SCRIPT_ENGINE_USER_MODE
516 return NULL;
517#endif // SCRIPT_ENGINE_USER_MODE
518
519#ifdef SCRIPT_ENGINE_KERNEL_MODE
520 return (GetGuestRFlags() & X86_FLAGS_CF) != (UINT64)NULL ? TRUE : FALSE;
521#endif // SCRIPT_ENGINE_KERNEL_MODE
522
523 break;
524
525 case REGISTER_PF:
526
527#ifdef SCRIPT_ENGINE_USER_MODE
528 return NULL;
529#endif // SCRIPT_ENGINE_USER_MODE
530
531#ifdef SCRIPT_ENGINE_KERNEL_MODE
532 return (GetGuestRFlags() & (X86_FLAGS_PF)) != (UINT64)NULL ? TRUE : FALSE;
533#endif // SCRIPT_ENGINE_KERNEL_MODE
534
535 break;
536
537 case REGISTER_AF:
538
539#ifdef SCRIPT_ENGINE_USER_MODE
540 return NULL;
541#endif // SCRIPT_ENGINE_USER_MODE
542
543#ifdef SCRIPT_ENGINE_KERNEL_MODE
544 return (GetGuestRFlags() & (X86_FLAGS_AF)) != (UINT64)NULL ? TRUE : FALSE;
545#endif // SCRIPT_ENGINE_KERNEL_MODE
546
547 break;
548
549 case REGISTER_ZF:
550
551#ifdef SCRIPT_ENGINE_USER_MODE
552 return NULL;
553#endif // SCRIPT_ENGINE_USER_MODE
554
555#ifdef SCRIPT_ENGINE_KERNEL_MODE
556 return (GetGuestRFlags() & (X86_FLAGS_ZF)) != (UINT64)NULL ? TRUE : FALSE;
557#endif // SCRIPT_ENGINE_KERNEL_MODE
558
559 break;
560
561 case REGISTER_SF:
562
563#ifdef SCRIPT_ENGINE_USER_MODE
564 return NULL;
565#endif // SCRIPT_ENGINE_USER_MODE
566
567#ifdef SCRIPT_ENGINE_KERNEL_MODE
568 return (GetGuestRFlags() & (X86_FLAGS_SF)) != (UINT64)NULL ? TRUE : FALSE;
569#endif // SCRIPT_ENGINE_KERNEL_MODE
570
571 break;
572
573 case REGISTER_TF:
574
575#ifdef SCRIPT_ENGINE_USER_MODE
576 return NULL;
577#endif // SCRIPT_ENGINE_USER_MODE
578
579#ifdef SCRIPT_ENGINE_KERNEL_MODE
580 return (GetGuestRFlags() & (X86_FLAGS_TF)) != (UINT64)NULL ? TRUE : FALSE;
581#endif // SCRIPT_ENGINE_KERNEL_MODE
582
583 break;
584
585 case REGISTER_IF:
586
587#ifdef SCRIPT_ENGINE_USER_MODE
588 return NULL;
589#endif // SCRIPT_ENGINE_USER_MODE
590
591#ifdef SCRIPT_ENGINE_KERNEL_MODE
592 return (GetGuestRFlags() & (X86_FLAGS_IF)) != (UINT64)NULL ? TRUE : FALSE;
593#endif // SCRIPT_ENGINE_KERNEL_MODE
594
595 break;
596
597 case REGISTER_DF:
598
599#ifdef SCRIPT_ENGINE_USER_MODE
600 return NULL;
601#endif // SCRIPT_ENGINE_USER_MODE
602
603#ifdef SCRIPT_ENGINE_KERNEL_MODE
604 return (GetGuestRFlags() & (X86_FLAGS_DF)) != (UINT64)NULL ? TRUE : FALSE;
605#endif // SCRIPT_ENGINE_KERNEL_MODE
606
607 break;
608
609 case REGISTER_OF:
610
611#ifdef SCRIPT_ENGINE_USER_MODE
612 return NULL;
613#endif // SCRIPT_ENGINE_USER_MODE
614
615#ifdef SCRIPT_ENGINE_KERNEL_MODE
616 return (GetGuestRFlags() & (X86_FLAGS_OF)) != (UINT64)NULL ? TRUE : FALSE;
617#endif // SCRIPT_ENGINE_KERNEL_MODE
618
619 break;
620
621 case REGISTER_IOPL:
622
623#ifdef SCRIPT_ENGINE_USER_MODE
624 return NULL;
625#endif // SCRIPT_ENGINE_USER_MODE
626
627#ifdef SCRIPT_ENGINE_KERNEL_MODE
628 return ((GetGuestRFlags() & (0b11 << X86_FLAGS_IOPL_SHIFT)) >> 12);
629#endif // SCRIPT_ENGINE_KERNEL_MODE
630
631 break;
632
633 case REGISTER_NT:
634
635#ifdef SCRIPT_ENGINE_USER_MODE
636 return NULL;
637#endif // SCRIPT_ENGINE_USER_MODE
638
639#ifdef SCRIPT_ENGINE_KERNEL_MODE
640 return (GetGuestRFlags() & (X86_FLAGS_NT)) != (UINT64)NULL ? TRUE : FALSE;
641#endif // SCRIPT_ENGINE_KERNEL_MODE
642
643 break;
644
645 case REGISTER_RF:
646
647#ifdef SCRIPT_ENGINE_USER_MODE
648 return NULL;
649#endif // SCRIPT_ENGINE_USER_MODE
650
651#ifdef SCRIPT_ENGINE_KERNEL_MODE
652 return (GetGuestRFlags() & (X86_FLAGS_RF)) != (UINT64)NULL ? TRUE : FALSE;
653#endif // SCRIPT_ENGINE_KERNEL_MODE
654
655 break;
656
657 case REGISTER_VM:
658
659#ifdef SCRIPT_ENGINE_USER_MODE
660 return NULL;
661#endif // SCRIPT_ENGINE_USER_MODE
662
663#ifdef SCRIPT_ENGINE_KERNEL_MODE
664 return (GetGuestRFlags() & (X86_FLAGS_VM)) != (UINT64)NULL ? TRUE : FALSE;
665#endif // SCRIPT_ENGINE_KERNEL_MODE
666
667 break;
668
669 case REGISTER_AC:
670
671#ifdef SCRIPT_ENGINE_USER_MODE
672 return NULL;
673#endif // SCRIPT_ENGINE_USER_MODE
674
675#ifdef SCRIPT_ENGINE_KERNEL_MODE
676 return (GetGuestRFlags() & (X86_FLAGS_AC)) != (UINT64)NULL ? TRUE : FALSE;
677#endif // SCRIPT_ENGINE_KERNEL_MODE
678
679 break;
680
681 case REGISTER_VIF:
682
683#ifdef SCRIPT_ENGINE_USER_MODE
684 return NULL;
685#endif // SCRIPT_ENGINE_USER_MODE
686
687#ifdef SCRIPT_ENGINE_KERNEL_MODE
688 return (GetGuestRFlags() & (X86_FLAGS_VIF)) != (UINT64)NULL ? TRUE : FALSE;
689#endif // SCRIPT_ENGINE_KERNEL_MODE
690
691 break;
692
693 case REGISTER_VIP:
694
695#ifdef SCRIPT_ENGINE_USER_MODE
696 return NULL;
697#endif // SCRIPT_ENGINE_USER_MODE
698
699#ifdef SCRIPT_ENGINE_KERNEL_MODE
700 return (GetGuestRFlags() & (X86_FLAGS_VIP)) != (UINT64)NULL ? TRUE : FALSE;
701#endif // SCRIPT_ENGINE_KERNEL_MODE
702
703 break;
704
705 case REGISTER_ID:
706
707#ifdef SCRIPT_ENGINE_USER_MODE
708 return NULL;
709#endif // SCRIPT_ENGINE_USER_MODE
710
711#ifdef SCRIPT_ENGINE_KERNEL_MODE
712 return (GetGuestRFlags() & (X86_FLAGS_ID)) != (UINT64)NULL ? TRUE : FALSE;
713#endif // SCRIPT_ENGINE_KERNEL_MODE
714
715 break;
716
717 case REGISTER_RIP:
718
719#ifdef SCRIPT_ENGINE_USER_MODE
720 return NULL;
721#endif // SCRIPT_ENGINE_USER_MODE
722
723#ifdef SCRIPT_ENGINE_KERNEL_MODE
724 return GetGuestRIP();
725#endif // SCRIPT_ENGINE_KERNEL_MODE
726
727 break;
728
729 case REGISTER_EIP:
730
731#ifdef SCRIPT_ENGINE_USER_MODE
732 return NULL;
733#endif // SCRIPT_ENGINE_USER_MODE
734
735#ifdef SCRIPT_ENGINE_KERNEL_MODE
736 return (GetGuestRIP() & LOWER_32_BITS);
737#endif // SCRIPT_ENGINE_KERNEL_MODE
738
739 break;
740
741 case REGISTER_IP:
742
743#ifdef SCRIPT_ENGINE_USER_MODE
744 return NULL;
745#endif // SCRIPT_ENGINE_USER_MODE
746
747#ifdef SCRIPT_ENGINE_KERNEL_MODE
748 return (GetGuestRIP() & LOWER_16_BITS);
749#endif // SCRIPT_ENGINE_KERNEL_MODE
750
751 break;
752
753 case REGISTER_IDTR:
754
755#ifdef SCRIPT_ENGINE_USER_MODE
756 return NULL;
757#endif // SCRIPT_ENGINE_USER_MODE
758
759#ifdef SCRIPT_ENGINE_KERNEL_MODE
760
761 return GetGuestIdtr();
762#endif // SCRIPT_ENGINE_KERNEL_MODE
763
764 break;
765
766 case REGISTER_LDTR:
767
768#ifdef SCRIPT_ENGINE_USER_MODE
769 return NULL;
770#endif // SCRIPT_ENGINE_USER_MODE
771
772#ifdef SCRIPT_ENGINE_KERNEL_MODE
773
774 return GetGuestLdtr();
775#endif // SCRIPT_ENGINE_KERNEL_MODE
776
777 break;
778
779 case REGISTER_TR:
780
781#ifdef SCRIPT_ENGINE_USER_MODE
782 return NULL;
783#endif // SCRIPT_ENGINE_USER_MODE
784
785#ifdef SCRIPT_ENGINE_KERNEL_MODE
786
787 return GetGuestTr();
788#endif // SCRIPT_ENGINE_KERNEL_MODE
789
790 break;
791
792 case REGISTER_GDTR:
793
794#ifdef SCRIPT_ENGINE_USER_MODE
795 return NULL;
796#endif // SCRIPT_ENGINE_USER_MODE
797
798#ifdef SCRIPT_ENGINE_KERNEL_MODE
799 return GetGuestGdtr();
800
801#endif // SCRIPT_ENGINE_KERNEL_MODE
802
803 break;
804
805 case REGISTER_CR0:
806
807#ifdef SCRIPT_ENGINE_USER_MODE
808 return NULL;
809#endif // SCRIPT_ENGINE_USER_MODE
810
811#ifdef SCRIPT_ENGINE_KERNEL_MODE
812 return GetGuestCr0();
813#endif // SCRIPT_ENGINE_KERNEL_MODE
814
815 break;
816
817 case REGISTER_CR2:
818
819#ifdef SCRIPT_ENGINE_USER_MODE
820 return NULL;
821#endif // SCRIPT_ENGINE_USER_MODE
822
823#ifdef SCRIPT_ENGINE_KERNEL_MODE
824 return GetGuestCr2();
825#endif // SCRIPT_ENGINE_KERNEL_MODE
826
827 break;
828
829 case REGISTER_CR3:
830
831#ifdef SCRIPT_ENGINE_USER_MODE
832 return NULL;
833#endif // SCRIPT_ENGINE_USER_MODE
834
835#ifdef SCRIPT_ENGINE_KERNEL_MODE
836 return GetGuestCr3();
837#endif // SCRIPT_ENGINE_KERNEL_MODE
838
839 break;
840
841 case REGISTER_CR4:
842
843#ifdef SCRIPT_ENGINE_USER_MODE
844 return NULL;
845#endif // SCRIPT_ENGINE_USER_MODE
846
847#ifdef SCRIPT_ENGINE_KERNEL_MODE
848 return GetGuestCr4();
849#endif // SCRIPT_ENGINE_KERNEL_MODE
850
851 break;
852
853 case REGISTER_CR8:
854
855#ifdef SCRIPT_ENGINE_USER_MODE
856 return NULL;
857#endif // SCRIPT_ENGINE_USER_MODE
858
859#ifdef SCRIPT_ENGINE_KERNEL_MODE
860 return GetGuestCr8();
861#endif // SCRIPT_ENGINE_KERNEL_MODE
862
863 break;
864
865 case REGISTER_DR0:
866
867#ifdef SCRIPT_ENGINE_USER_MODE
868 return NULL;
869#endif // SCRIPT_ENGINE_USER_MODE
870
871#ifdef SCRIPT_ENGINE_KERNEL_MODE
872 return GetGuestDr0();
873#endif // SCRIPT_ENGINE_KERNEL_MODE
874
875 break;
876
877 case REGISTER_DR1:
878
879#ifdef SCRIPT_ENGINE_USER_MODE
880 return NULL;
881#endif // SCRIPT_ENGINE_USER_MODE
882
883#ifdef SCRIPT_ENGINE_KERNEL_MODE
884 return GetGuestDr1();
885#endif // SCRIPT_ENGINE_KERNEL_MODE
886
887 break;
888
889 case REGISTER_DR2:
890
891#ifdef SCRIPT_ENGINE_USER_MODE
892 return NULL;
893#endif // SCRIPT_ENGINE_USER_MODE
894
895#ifdef SCRIPT_ENGINE_KERNEL_MODE
896 return GetGuestDr2();
897#endif // SCRIPT_ENGINE_KERNEL_MODE
898
899 break;
900
901 case REGISTER_DR3:
902
903#ifdef SCRIPT_ENGINE_USER_MODE
904 return NULL;
905#endif // SCRIPT_ENGINE_USER_MODE
906
907#ifdef SCRIPT_ENGINE_KERNEL_MODE
908 return GetGuestDr3();
909#endif // SCRIPT_ENGINE_KERNEL_MODE
910
911 break;
912
913 case REGISTER_DR6:
914
915#ifdef SCRIPT_ENGINE_USER_MODE
916 return NULL;
917#endif // SCRIPT_ENGINE_USER_MODE
918
919#ifdef SCRIPT_ENGINE_KERNEL_MODE
920 return GetGuestDr6();
921#endif // SCRIPT_ENGINE_KERNEL_MODE
922
923 break;
924
925 case REGISTER_DR7:
926
927#ifdef SCRIPT_ENGINE_USER_MODE
928 return NULL;
929#endif // SCRIPT_ENGINE_USER_MODE
930
931#ifdef SCRIPT_ENGINE_KERNEL_MODE
932 return GetGuestDr7();
933#endif // SCRIPT_ENGINE_KERNEL_MODE
934
935 break;
936
937 default:
938
939#ifdef SCRIPT_ENGINE_USER_MODE
940 ShowMessages("error in reading register");
941#endif // SCRIPT_ENGINE_USER_MODE
942
943#ifdef SCRIPT_ENGINE_KERNEL_MODE
944 LogInfo("Error in reading register");
945#endif // SCRIPT_ENGINE_KERNEL_MODE
946
947 return INVALID;
948
949 break;
950 }
951}
#define LOWER_32_BITS
Definition BasicTypes.h:60
#define LOWER_16_BITS
Definition BasicTypes.h:61
#define TRUE
Definition BasicTypes.h:55
#define FALSE
Definition BasicTypes.h:54
unsigned __int64 UINT64
Definition BasicTypes.h:21
#define SECOND_LOWER_8_BITS
Definition BasicTypes.h:63
#define LOWER_8_BITS
Definition BasicTypes.h:62
#define LogInfo(format,...)
Define log variables.
Definition HyperDbgHyperLogIntrinsics.h:71
VMX_SEGMENT_SELECTOR GetGuestDs()
Get the Guest Ds Selector.
Definition ManageRegs.c:139
VMX_SEGMENT_SELECTOR GetGuestSs()
Get the Guest Ss Selector.
Definition ManageRegs.c:94
UINT64 GetGuestTr()
Get the Guest Tr.
Definition ManageRegs.c:383
UINT64 GetGuestCr2()
Get the Guest Cr2 value.
Definition ManageRegs.c:474
UINT64 GetGuestIdtr()
Get the Guest Idtr.
Definition ManageRegs.c:304
VMX_SEGMENT_SELECTOR GetGuestFs()
Get the Guest Fs Selector.
Definition ManageRegs.c:184
UINT64 GetGuestCr8()
Get the Guest Cr8 value.
Definition ManageRegs.c:516
VMX_SEGMENT_SELECTOR GetGuestCs()
Get the Guest Cs Selector.
Definition ManageRegs.c:49
VMX_SEGMENT_SELECTOR GetGuestGs()
Get the Guest Gs Selector.
Definition ManageRegs.c:229
UINT64 GetGuestDr1()
Get the Guest Dr1 value.
Definition ManageRegs.c:675
UINT64 GetGuestDr7()
Get the Guest Dr7 (breakpoint trigger) value.
Definition ManageRegs.c:727
UINT64 GetGuestDr0()
Get the Guest Dr0 value.
Definition ManageRegs.c:662
UINT64 GetGuestCr4()
Get the Guest Cr4 value.
Definition ManageRegs.c:502
UINT64 GetGuestCr3()
Get the Guest Cr3 value.
Definition ManageRegs.c:488
UINT64 GetGuestRFlags()
Get the Guest Rflags value.
Definition ManageRegs.c:409
UINT64 GetGuestCr0()
Get the Guest Cr0 value.
Definition ManageRegs.c:460
UINT64 GetGuestDr3()
Get the Guest Dr3 value.
Definition ManageRegs.c:701
UINT64 GetGuestDr6()
Get the Guest Dr6 (breakpoint status) value.
Definition ManageRegs.c:714
UINT64 GetGuestRIP()
Get the Guest RIP value.
Definition ManageRegs.c:446
UINT64 GetGuestLdtr()
Get the Guest Ldtr.
Definition ManageRegs.c:331
VMX_SEGMENT_SELECTOR GetGuestEs()
Get the Guest Es Selector.
Definition ManageRegs.c:274
UINT64 GetGuestDr2()
Get the Guest Dr2 value.
Definition ManageRegs.c:688
UINT64 GetGuestGdtr()
Get the Guest Gdtr.
Definition ManageRegs.c:358
@ REGISTER_DIL
Definition ScriptEngineCommonDefinitions.h:349
@ REGISTER_DR1
Definition ScriptEngineCommonDefinitions.h:429
@ REGISTER_R12W
Definition ScriptEngineCommonDefinitions.h:372
@ REGISTER_EDI
Definition ScriptEngineCommonDefinitions.h:347
@ REGISTER_R14W
Definition ScriptEngineCommonDefinitions.h:382
@ REGISTER_BPL
Definition ScriptEngineCommonDefinitions.h:341
@ REGISTER_CF
Definition ScriptEngineCommonDefinitions.h:399
@ REGISTER_R8D
Definition ScriptEngineCommonDefinitions.h:351
@ REGISTER_DI
Definition ScriptEngineCommonDefinitions.h:348
@ REGISTER_R14L
Definition ScriptEngineCommonDefinitions.h:384
@ REGISTER_RDX
Definition ScriptEngineCommonDefinitions.h:324
@ REGISTER_R10H
Definition ScriptEngineCommonDefinitions.h:363
@ REGISTER_BH
Definition ScriptEngineCommonDefinitions.h:332
@ REGISTER_R12D
Definition ScriptEngineCommonDefinitions.h:371
@ REGISTER_GDTR
Definition ScriptEngineCommonDefinitions.h:421
@ REGISTER_R10
Definition ScriptEngineCommonDefinitions.h:360
@ REGISTER_DR3
Definition ScriptEngineCommonDefinitions.h:431
@ REGISTER_CR4
Definition ScriptEngineCommonDefinitions.h:426
@ REGISTER_CS
Definition ScriptEngineCommonDefinitions.h:394
@ REGISTER_BL
Definition ScriptEngineCommonDefinitions.h:333
@ REGISTER_AL
Definition ScriptEngineCommonDefinitions.h:318
@ REGISTER_IOPL
Definition ScriptEngineCommonDefinitions.h:408
@ REGISTER_CH
Definition ScriptEngineCommonDefinitions.h:322
@ REGISTER_RF
Definition ScriptEngineCommonDefinitions.h:410
@ REGISTER_DR6
Definition ScriptEngineCommonDefinitions.h:432
@ REGISTER_R12
Definition ScriptEngineCommonDefinitions.h:370
@ REGISTER_CL
Definition ScriptEngineCommonDefinitions.h:323
@ REGISTER_RBX
Definition ScriptEngineCommonDefinitions.h:329
@ REGISTER_TR
Definition ScriptEngineCommonDefinitions.h:422
@ REGISTER_PF
Definition ScriptEngineCommonDefinitions.h:400
@ REGISTER_ZF
Definition ScriptEngineCommonDefinitions.h:402
@ REGISTER_R14H
Definition ScriptEngineCommonDefinitions.h:383
@ REGISTER_EIP
Definition ScriptEngineCommonDefinitions.h:417
@ REGISTER_R9
Definition ScriptEngineCommonDefinitions.h:355
@ REGISTER_R12H
Definition ScriptEngineCommonDefinitions.h:373
@ REGISTER_R14D
Definition ScriptEngineCommonDefinitions.h:381
@ REGISTER_ESP
Definition ScriptEngineCommonDefinitions.h:335
@ REGISTER_IDTR
Definition ScriptEngineCommonDefinitions.h:419
@ REGISTER_RIP
Definition ScriptEngineCommonDefinitions.h:416
@ REGISTER_DL
Definition ScriptEngineCommonDefinitions.h:328
@ REGISTER_R11
Definition ScriptEngineCommonDefinitions.h:365
@ REGISTER_NT
Definition ScriptEngineCommonDefinitions.h:409
@ REGISTER_FS
Definition ScriptEngineCommonDefinitions.h:392
@ REGISTER_SPL
Definition ScriptEngineCommonDefinitions.h:337
@ REGISTER_OF
Definition ScriptEngineCommonDefinitions.h:407
@ REGISTER_DH
Definition ScriptEngineCommonDefinitions.h:327
@ REGISTER_R15
Definition ScriptEngineCommonDefinitions.h:385
@ REGISTER_LDTR
Definition ScriptEngineCommonDefinitions.h:420
@ REGISTER_AF
Definition ScriptEngineCommonDefinitions.h:401
@ REGISTER_CR8
Definition ScriptEngineCommonDefinitions.h:427
@ REGISTER_IP
Definition ScriptEngineCommonDefinitions.h:418
@ REGISTER_R8
Definition ScriptEngineCommonDefinitions.h:350
@ REGISTER_SS
Definition ScriptEngineCommonDefinitions.h:395
@ REGISTER_DR2
Definition ScriptEngineCommonDefinitions.h:430
@ REGISTER_R8L
Definition ScriptEngineCommonDefinitions.h:354
@ REGISTER_RAX
Definition ScriptEngineCommonDefinitions.h:314
@ REGISTER_R13
Definition ScriptEngineCommonDefinitions.h:375
@ REGISTER_R11D
Definition ScriptEngineCommonDefinitions.h:366
@ REGISTER_R13H
Definition ScriptEngineCommonDefinitions.h:378
@ REGISTER_EBX
Definition ScriptEngineCommonDefinitions.h:330
@ REGISTER_GS
Definition ScriptEngineCommonDefinitions.h:393
@ REGISTER_DR0
Definition ScriptEngineCommonDefinitions.h:428
@ REGISTER_R9L
Definition ScriptEngineCommonDefinitions.h:359
@ REGISTER_R15D
Definition ScriptEngineCommonDefinitions.h:386
@ REGISTER_CR2
Definition ScriptEngineCommonDefinitions.h:424
@ REGISTER_SF
Definition ScriptEngineCommonDefinitions.h:403
@ REGISTER_DX
Definition ScriptEngineCommonDefinitions.h:326
@ REGISTER_TF
Definition ScriptEngineCommonDefinitions.h:404
@ REGISTER_R9D
Definition ScriptEngineCommonDefinitions.h:356
@ REGISTER_ESI
Definition ScriptEngineCommonDefinitions.h:343
@ REGISTER_R15H
Definition ScriptEngineCommonDefinitions.h:388
@ REGISTER_RSI
Definition ScriptEngineCommonDefinitions.h:342
@ REGISTER_SIL
Definition ScriptEngineCommonDefinitions.h:345
@ REGISTER_BP
Definition ScriptEngineCommonDefinitions.h:340
@ REGISTER_AC
Definition ScriptEngineCommonDefinitions.h:412
@ REGISTER_R10L
Definition ScriptEngineCommonDefinitions.h:364
@ REGISTER_R13D
Definition ScriptEngineCommonDefinitions.h:376
@ REGISTER_R10D
Definition ScriptEngineCommonDefinitions.h:361
@ REGISTER_EFLAGS
Definition ScriptEngineCommonDefinitions.h:397
@ REGISTER_CR0
Definition ScriptEngineCommonDefinitions.h:423
@ REGISTER_DF
Definition ScriptEngineCommonDefinitions.h:406
@ REGISTER_R11H
Definition ScriptEngineCommonDefinitions.h:368
@ REGISTER_VM
Definition ScriptEngineCommonDefinitions.h:411
@ REGISTER_R15L
Definition ScriptEngineCommonDefinitions.h:389
@ REGISTER_R9H
Definition ScriptEngineCommonDefinitions.h:358
@ REGISTER_VIP
Definition ScriptEngineCommonDefinitions.h:414
@ REGISTER_SI
Definition ScriptEngineCommonDefinitions.h:344
@ REGISTER_R10W
Definition ScriptEngineCommonDefinitions.h:362
@ REGISTER_EAX
Definition ScriptEngineCommonDefinitions.h:315
@ REGISTER_CX
Definition ScriptEngineCommonDefinitions.h:321
@ REGISTER_BX
Definition ScriptEngineCommonDefinitions.h:331
@ REGISTER_IF
Definition ScriptEngineCommonDefinitions.h:405
@ REGISTER_R13L
Definition ScriptEngineCommonDefinitions.h:379
@ REGISTER_ES
Definition ScriptEngineCommonDefinitions.h:391
@ REGISTER_AX
Definition ScriptEngineCommonDefinitions.h:316
@ REGISTER_R12L
Definition ScriptEngineCommonDefinitions.h:374
@ REGISTER_RCX
Definition ScriptEngineCommonDefinitions.h:319
@ REGISTER_R8W
Definition ScriptEngineCommonDefinitions.h:352
@ REGISTER_R8H
Definition ScriptEngineCommonDefinitions.h:353
@ REGISTER_ID
Definition ScriptEngineCommonDefinitions.h:415
@ REGISTER_EDX
Definition ScriptEngineCommonDefinitions.h:325
@ REGISTER_RFLAGS
Definition ScriptEngineCommonDefinitions.h:396
@ REGISTER_VIF
Definition ScriptEngineCommonDefinitions.h:413
@ REGISTER_R11L
Definition ScriptEngineCommonDefinitions.h:369
@ REGISTER_R14
Definition ScriptEngineCommonDefinitions.h:380
@ REGISTER_R15W
Definition ScriptEngineCommonDefinitions.h:387
@ REGISTER_CR3
Definition ScriptEngineCommonDefinitions.h:425
@ REGISTER_SP
Definition ScriptEngineCommonDefinitions.h:336
@ REGISTER_DR7
Definition ScriptEngineCommonDefinitions.h:433
@ REGISTER_FLAGS
Definition ScriptEngineCommonDefinitions.h:398
@ REGISTER_RDI
Definition ScriptEngineCommonDefinitions.h:346
@ REGISTER_ECX
Definition ScriptEngineCommonDefinitions.h:320
@ REGISTER_R13W
Definition ScriptEngineCommonDefinitions.h:377
@ REGISTER_R11W
Definition ScriptEngineCommonDefinitions.h:367
@ REGISTER_DS
Definition ScriptEngineCommonDefinitions.h:390
@ REGISTER_RSP
Definition ScriptEngineCommonDefinitions.h:334
@ REGISTER_EBP
Definition ScriptEngineCommonDefinitions.h:339
@ REGISTER_AH
Definition ScriptEngineCommonDefinitions.h:317
@ REGISTER_RBP
Definition ScriptEngineCommonDefinitions.h:338
@ REGISTER_R9W
Definition ScriptEngineCommonDefinitions.h:357
#define INVALID
Definition ScriptEngineCommonDefinitions.h:96
#define X86_FLAGS_VM
Definition Common.h:104
#define X86_FLAGS_RF
Definition Common.h:103
#define X86_FLAGS_TF
Definition Common.h:94
#define X86_FLAGS_VIP
Definition Common.h:107
#define X86_FLAGS_ZF
Definition Common.h:92
#define X86_FLAGS_OF
Definition Common.h:97
#define X86_FLAGS_AF
Definition Common.h:91
#define X86_FLAGS_CF
EFLAGS/RFLAGS.
Definition Common.h:89
#define X86_FLAGS_DF
Definition Common.h:96
#define X86_FLAGS_IF
Definition Common.h:95
#define X86_FLAGS_SF
Definition Common.h:93
#define X86_FLAGS_AC
Definition Common.h:105
#define X86_FLAGS_ID
Definition Common.h:108
#define X86_FLAGS_VIF
Definition Common.h:106
#define X86_FLAGS_NT
Definition Common.h:102
#define X86_FLAGS_IOPL_SHIFT
Definition Common.h:100
#define X86_FLAGS_PF
Definition Common.h:90
VOID ShowMessages(const char *Fmt,...)
Show messages.
Definition libhyperdbg.cpp:96
NULL()
Definition test-case-generator.py:530
UINT16 Selector
Definition DataTypes.h:437
UINT64 rsp
Definition BasicTypes.h:79
UINT64 r14
Definition BasicTypes.h:89
UINT64 r15
Definition BasicTypes.h:90
UINT64 rdi
Definition BasicTypes.h:82
UINT64 rax
Definition BasicTypes.h:75
UINT64 r12
Definition BasicTypes.h:87
UINT64 r13
Definition BasicTypes.h:88
UINT64 r9
Definition BasicTypes.h:84
UINT64 r8
Definition BasicTypes.h:83
UINT64 rbp
Definition BasicTypes.h:80
UINT64 rbx
Definition BasicTypes.h:78
UINT64 r10
Definition BasicTypes.h:85
UINT64 rcx
Definition BasicTypes.h:76
UINT64 rsi
Definition BasicTypes.h:81
UINT64 r11
Definition BasicTypes.h:86
UINT64 rdx
Definition BasicTypes.h:77

◆ 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
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
struct SYMBOL * PSYMBOL
#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
struct SYMBOL SYMBOL
#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
PSYMBOL Head
Definition ScriptEngineCommonDefinitions.h:22
Definition ScriptEngineCommonDefinitions.h:6
long long unsigned Value
Definition ScriptEngineCommonDefinitions.h:10
long long unsigned VariableType
Definition ScriptEngineCommonDefinitions.h:9
long long unsigned Len
Definition ScriptEngineCommonDefinitions.h:8
long long unsigned Type
Definition ScriptEngineCommonDefinitions.h:7

◆ 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}

◆ SetRegValue()

BOOLEAN SetRegValue ( PGUEST_REGS GuestRegs,
UINT32 RegisterId,
UINT64 Value )

Set the register value.

Parameters
GuestRegs
RegisterId
Value
Returns
BOOLEAN
964{
965 BOOLEAN Result = TRUE;
966
967 switch (RegisterId)
968 {
969 case REGISTER_RAX:
970 GuestRegs->rax = Value;
971
972 break;
973
974 case REGISTER_EAX:
975 GuestRegs->rax = (GuestRegs->rax & UPPER_32_BITS) | (Value & LOWER_32_BITS);
976
977 break;
978
979 case REGISTER_AX:
980 GuestRegs->rax = (GuestRegs->rax & UPPER_48_BITS) | (Value & LOWER_16_BITS);
981
982 break;
983
984 case REGISTER_AH:
985 GuestRegs->rax = (GuestRegs->rax & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
986
987 break;
988
989 case REGISTER_AL:
990 GuestRegs->rax = (GuestRegs->rax & UPPER_56_BITS) | (Value & LOWER_8_BITS);
991
992 break;
993
994 case REGISTER_RCX:
995 GuestRegs->rcx = Value;
996
997 break;
998 case REGISTER_ECX:
999 GuestRegs->rcx = (GuestRegs->rcx & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1000
1001 break;
1002
1003 case REGISTER_CX:
1004 GuestRegs->rcx = (GuestRegs->rcx & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1005
1006 break;
1007
1008 case REGISTER_CH:
1009 GuestRegs->rcx = (GuestRegs->rcx & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1010
1011 break;
1012
1013 case REGISTER_CL:
1014 GuestRegs->rcx = (GuestRegs->rcx & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1015
1016 break;
1017 case REGISTER_RDX:
1018 GuestRegs->rdx = Value;
1019
1020 break;
1021 case REGISTER_EDX:
1022 GuestRegs->rdx = (GuestRegs->rdx & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1023
1024 break;
1025
1026 case REGISTER_DX:
1027 GuestRegs->rdx = (GuestRegs->rdx & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1028
1029 break;
1030
1031 case REGISTER_DH:
1032 GuestRegs->rdx = (GuestRegs->rdx & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1033
1034 break;
1035
1036 case REGISTER_DL:
1037 GuestRegs->rdx = (GuestRegs->rdx & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1038
1039 break;
1040 case REGISTER_RBX:
1041 GuestRegs->rbx = Value;
1042
1043 break;
1044 case REGISTER_EBX:
1045 GuestRegs->rbx = (GuestRegs->rbx & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1046
1047 break;
1048
1049 case REGISTER_BX:
1050 GuestRegs->rbx = (GuestRegs->rbx & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1051
1052 break;
1053
1054 case REGISTER_BH:
1055 GuestRegs->rbx = (GuestRegs->rbx & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1056
1057 break;
1058
1059 case REGISTER_BL:
1060 GuestRegs->rbx = (GuestRegs->rbx & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1061
1062 break;
1063 case REGISTER_RSP:
1064
1065#ifdef SCRIPT_ENGINE_USER_MODE
1066 GuestRegs->rsp = Value;
1067#endif // SCRIPT_ENGINE_USER_MODE
1068
1069#ifdef SCRIPT_ENGINE_KERNEL_MODE
1070 GuestRegs->rsp = Value;
1072#endif // SCRIPT_ENGINE_KERNEL_MODE
1073
1074 break;
1075
1076 case REGISTER_ESP:
1077
1078#ifdef SCRIPT_ENGINE_USER_MODE
1079 GuestRegs->rsp = Value;
1080#endif // SCRIPT_ENGINE_USER_MODE
1081
1082#ifdef SCRIPT_ENGINE_KERNEL_MODE
1083 GuestRegs->rsp = (GuestRegs->rsp & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1084 SetGuestRSP(GuestRegs->rsp);
1085#endif // SCRIPT_ENGINE_KERNEL_MODE
1086
1087 break;
1088
1089 case REGISTER_SP:
1090
1091#ifdef SCRIPT_ENGINE_USER_MODE
1092 GuestRegs->rsp = Value;
1093#endif // SCRIPT_ENGINE_USER_MODE
1094
1095#ifdef SCRIPT_ENGINE_KERNEL_MODE
1096 GuestRegs->rsp = (GuestRegs->rsp & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1097 SetGuestRSP(GuestRegs->rsp);
1098#endif // SCRIPT_ENGINE_KERNEL_MODE
1099
1100 break;
1101
1102 case REGISTER_SPL:
1103
1104#ifdef SCRIPT_ENGINE_USER_MODE
1105 GuestRegs->rsp = Value;
1106#endif // SCRIPT_ENGINE_USER_MODE
1107
1108#ifdef SCRIPT_ENGINE_KERNEL_MODE
1109 GuestRegs->rsp = (GuestRegs->rsp & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1110 SetGuestRSP(GuestRegs->rsp);
1111#endif // SCRIPT_ENGINE_KERNEL_MODE
1112
1113 break;
1114
1115 case REGISTER_RBP:
1116 GuestRegs->rbp = Value;
1117
1118 break;
1119 case REGISTER_EBP:
1120 GuestRegs->rbp = (GuestRegs->rbp & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1121
1122 break;
1123
1124 case REGISTER_BP:
1125 GuestRegs->rbp = (GuestRegs->rbp & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1126
1127 break;
1128
1129 case REGISTER_BPL:
1130 GuestRegs->rbp = (GuestRegs->rbp & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1131
1132 break;
1133 case REGISTER_RSI:
1134 GuestRegs->rsi = Value;
1135
1136 break;
1137 case REGISTER_ESI:
1138 GuestRegs->rsi = (GuestRegs->rsi & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1139
1140 break;
1141
1142 case REGISTER_SI:
1143 GuestRegs->rsi = (GuestRegs->rsi & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1144
1145 break;
1146
1147 case REGISTER_SIL:
1148 GuestRegs->rsi = (GuestRegs->rsi & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1149
1150 break;
1151 case REGISTER_RDI:
1152 GuestRegs->rdi = Value;
1153
1154 break;
1155 case REGISTER_EDI:
1156 GuestRegs->rdi = (GuestRegs->rdi & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1157
1158 break;
1159
1160 case REGISTER_DI:
1161 GuestRegs->rdi = (GuestRegs->rdi & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1162
1163 break;
1164
1165 case REGISTER_DIL:
1166 GuestRegs->rdi = (GuestRegs->rdi & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1167
1168 break;
1169 case REGISTER_R8:
1170 GuestRegs->r8 = Value;
1171
1172 break;
1173 case REGISTER_R8D:
1174 GuestRegs->r8 = (GuestRegs->r8 & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1175
1176 break;
1177
1178 case REGISTER_R8W:
1179 GuestRegs->r8 = (GuestRegs->r8 & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1180
1181 break;
1182
1183 case REGISTER_R8H:
1184 GuestRegs->r8 = (GuestRegs->r8 & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1185
1186 break;
1187
1188 case REGISTER_R8L:
1189 GuestRegs->r8 = (GuestRegs->r8 & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1190
1191 break;
1192 case REGISTER_R9:
1193 GuestRegs->r9 = Value;
1194
1195 break;
1196 case REGISTER_R9D:
1197 GuestRegs->r9 = (GuestRegs->r9 & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1198
1199 break;
1200
1201 case REGISTER_R9W:
1202 GuestRegs->r9 = (GuestRegs->r9 & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1203
1204 break;
1205
1206 case REGISTER_R9H:
1207 GuestRegs->r9 = (GuestRegs->r9 & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1208
1209 break;
1210
1211 case REGISTER_R9L:
1212 GuestRegs->r9 = (GuestRegs->r9 & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1213
1214 break;
1215 case REGISTER_R10:
1216 GuestRegs->r10 = Value;
1217
1218 break;
1219 case REGISTER_R10D:
1220 GuestRegs->r10 = (GuestRegs->r10 & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1221
1222 break;
1223
1224 case REGISTER_R10W:
1225 GuestRegs->r10 = (GuestRegs->r10 & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1226
1227 break;
1228
1229 case REGISTER_R10H:
1230 GuestRegs->r10 = (GuestRegs->r10 & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1231
1232 break;
1233
1234 case REGISTER_R10L:
1235 GuestRegs->r10 = (GuestRegs->r10 & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1236
1237 break;
1238 case REGISTER_R11:
1239 GuestRegs->r11 = Value;
1240
1241 break;
1242 case REGISTER_R11D:
1243 GuestRegs->r11 = (GuestRegs->r11 & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1244
1245 break;
1246
1247 case REGISTER_R11W:
1248 GuestRegs->r11 = (GuestRegs->r11 & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1249
1250 break;
1251
1252 case REGISTER_R11H:
1253 GuestRegs->r11 = (GuestRegs->r11 & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1254
1255 break;
1256
1257 case REGISTER_R11L:
1258 GuestRegs->r11 = (GuestRegs->r11 & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1259
1260 break;
1261 case REGISTER_R12:
1262 GuestRegs->r12 = Value;
1263
1264 break;
1265 case REGISTER_R12D:
1266 GuestRegs->r12 = (GuestRegs->r12 & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1267
1268 break;
1269
1270 case REGISTER_R12W:
1271 GuestRegs->r12 = (GuestRegs->r12 & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1272
1273 break;
1274
1275 case REGISTER_R12H:
1276 GuestRegs->r12 = (GuestRegs->r12 & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1277
1278 break;
1279
1280 case REGISTER_R12L:
1281 GuestRegs->r12 = (GuestRegs->r12 & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1282
1283 break;
1284 case REGISTER_R13:
1285 GuestRegs->r13 = Value;
1286
1287 break;
1288 case REGISTER_R13D:
1289 GuestRegs->r13 = (GuestRegs->r13 & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1290
1291 break;
1292
1293 case REGISTER_R13W:
1294 GuestRegs->r13 = (GuestRegs->r13 & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1295
1296 break;
1297
1298 case REGISTER_R13H:
1299 GuestRegs->r13 = (GuestRegs->r13 & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1300
1301 break;
1302
1303 case REGISTER_R13L:
1304 GuestRegs->r13 = (GuestRegs->r13 & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1305
1306 break;
1307 case REGISTER_R14:
1308 GuestRegs->r14 = Value;
1309
1310 break;
1311 case REGISTER_R14D:
1312 GuestRegs->r14 = (GuestRegs->r14 & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1313
1314 break;
1315
1316 case REGISTER_R14W:
1317 GuestRegs->r14 = (GuestRegs->r14 & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1318
1319 break;
1320
1321 case REGISTER_R14H:
1322 GuestRegs->r14 = (GuestRegs->r14 & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1323
1324 break;
1325
1326 case REGISTER_R14L:
1327 GuestRegs->r14 = (GuestRegs->r14 & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1328
1329 break;
1330 case REGISTER_R15:
1331 GuestRegs->r15 = Value;
1332
1333 break;
1334 case REGISTER_R15D:
1335 GuestRegs->r15 = (GuestRegs->r15 & UPPER_32_BITS) | (Value & LOWER_32_BITS);
1336
1337 break;
1338
1339 case REGISTER_R15W:
1340 GuestRegs->r15 = (GuestRegs->r15 & UPPER_48_BITS) | (Value & LOWER_16_BITS);
1341
1342 break;
1343
1344 case REGISTER_R15H:
1345 GuestRegs->r15 = (GuestRegs->r15 & UPPER_48_BITS_AND_LOWER_8_BITS) | ((Value << 8) & SECOND_LOWER_8_BITS);
1346
1347 break;
1348
1349 case REGISTER_R15L:
1350 GuestRegs->r15 = (GuestRegs->r15 & UPPER_56_BITS) | (Value & LOWER_8_BITS);
1351
1352 break;
1353 case REGISTER_DS:
1354
1355#ifdef SCRIPT_ENGINE_USER_MODE
1356 //
1357 // Nothing to do
1358 //
1359#endif // SCRIPT_ENGINE_USER_MODE
1360
1361#ifdef SCRIPT_ENGINE_KERNEL_MODE
1364#endif // SCRIPT_ENGINE_KERNEL_MODE
1365
1366 break;
1367
1368 case REGISTER_ES:
1369
1370#ifdef SCRIPT_ENGINE_USER_MODE
1371 //
1372 // Nothing to do
1373 //
1374#endif // SCRIPT_ENGINE_USER_MODE
1375
1376#ifdef SCRIPT_ENGINE_KERNEL_MODE
1379#endif // SCRIPT_ENGINE_KERNEL_MODE
1380
1381 break;
1382
1383 case REGISTER_FS:
1384
1385#ifdef SCRIPT_ENGINE_USER_MODE
1386 //
1387 // Nothing to do
1388 //
1389#endif // SCRIPT_ENGINE_USER_MODE
1390
1391#ifdef SCRIPT_ENGINE_KERNEL_MODE
1394#endif // SCRIPT_ENGINE_KERNEL_MODE
1395
1396 break;
1397
1398 case REGISTER_GS:
1399
1400#ifdef SCRIPT_ENGINE_USER_MODE
1401 //
1402 // Nothing to do
1403 //
1404#endif // SCRIPT_ENGINE_USER_MODE
1405
1406#ifdef SCRIPT_ENGINE_KERNEL_MODE
1409#endif // SCRIPT_ENGINE_KERNEL_MODE
1410
1411 break;
1412
1413 case REGISTER_CS:
1414
1415#ifdef SCRIPT_ENGINE_USER_MODE
1416 //
1417 // Nothing to do
1418 //
1419#endif // SCRIPT_ENGINE_USER_MODE
1420
1421#ifdef SCRIPT_ENGINE_KERNEL_MODE
1424#endif // SCRIPT_ENGINE_KERNEL_MODE
1425
1426 break;
1427
1428 case REGISTER_SS:
1429
1430#ifdef SCRIPT_ENGINE_USER_MODE
1431 //
1432 // Nothing to do
1433 //
1434#endif // SCRIPT_ENGINE_USER_MODE
1435
1436#ifdef SCRIPT_ENGINE_KERNEL_MODE
1439#endif // SCRIPT_ENGINE_KERNEL_MODE
1440
1441 break;
1442
1443 case REGISTER_RFLAGS:
1444
1445#ifdef SCRIPT_ENGINE_USER_MODE
1446 //
1447 // Nothing to do
1448 //
1449#endif // SCRIPT_ENGINE_USER_MODE
1450
1451#ifdef SCRIPT_ENGINE_KERNEL_MODE
1453#endif // SCRIPT_ENGINE_KERNEL_MODE
1454
1455 break;
1456
1457 case REGISTER_EFLAGS:
1458
1459#ifdef SCRIPT_ENGINE_USER_MODE
1460 //
1461 // Nothing to do
1462 //
1463#endif // SCRIPT_ENGINE_USER_MODE
1464
1465#ifdef SCRIPT_ENGINE_KERNEL_MODE
1467#endif // SCRIPT_ENGINE_KERNEL_MODE
1468
1469 break;
1470
1471 case REGISTER_FLAGS:
1472
1473#ifdef SCRIPT_ENGINE_USER_MODE
1474 //
1475 // Nothing to do
1476 //
1477#endif // SCRIPT_ENGINE_USER_MODE
1478
1479#ifdef SCRIPT_ENGINE_KERNEL_MODE
1481#endif // SCRIPT_ENGINE_KERNEL_MODE
1482
1483 break;
1484
1485 case REGISTER_CF:
1486
1487#ifdef SCRIPT_ENGINE_USER_MODE
1488 //
1489 // Nothing to do
1490 //
1491#endif // SCRIPT_ENGINE_USER_MODE
1492
1493#ifdef SCRIPT_ENGINE_KERNEL_MODE
1495#endif // SCRIPT_ENGINE_KERNEL_MODE
1496
1497 break;
1498
1499 case REGISTER_PF:
1500
1501#ifdef SCRIPT_ENGINE_USER_MODE
1502 //
1503 // Nothing to do
1504 //
1505#endif // SCRIPT_ENGINE_USER_MODE
1506
1507#ifdef SCRIPT_ENGINE_KERNEL_MODE
1509#endif // SCRIPT_ENGINE_KERNEL_MODE
1510
1511 break;
1512
1513 case REGISTER_AF:
1514
1515#ifdef SCRIPT_ENGINE_USER_MODE
1516 //
1517 // Nothing to do
1518 //
1519#endif // SCRIPT_ENGINE_USER_MODE
1520
1521#ifdef SCRIPT_ENGINE_KERNEL_MODE
1523#endif // SCRIPT_ENGINE_KERNEL_MODE
1524
1525 break;
1526
1527 case REGISTER_ZF:
1528
1529#ifdef SCRIPT_ENGINE_USER_MODE
1530 //
1531 // Nothing to do
1532 //
1533#endif // SCRIPT_ENGINE_USER_MODE
1534
1535#ifdef SCRIPT_ENGINE_KERNEL_MODE
1537#endif // SCRIPT_ENGINE_KERNEL_MODE
1538
1539 break;
1540
1541 case REGISTER_SF:
1542
1543#ifdef SCRIPT_ENGINE_USER_MODE
1544 //
1545 // Nothing to do
1546 //
1547#endif // SCRIPT_ENGINE_USER_MODE
1548
1549#ifdef SCRIPT_ENGINE_KERNEL_MODE
1551#endif // SCRIPT_ENGINE_KERNEL_MODE
1552
1553 break;
1554
1555 case REGISTER_TF:
1556
1557#ifdef SCRIPT_ENGINE_USER_MODE
1558 //
1559 // Nothing to do
1560 //
1561#endif // SCRIPT_ENGINE_USER_MODE
1562
1563#ifdef SCRIPT_ENGINE_KERNEL_MODE
1565#endif // SCRIPT_ENGINE_KERNEL_MODE
1566
1567 break;
1568
1569 case REGISTER_IF:
1570
1571#ifdef SCRIPT_ENGINE_USER_MODE
1572 //
1573 // Nothing to do
1574 //
1575#endif // SCRIPT_ENGINE_USER_MODE
1576
1577#ifdef SCRIPT_ENGINE_KERNEL_MODE
1579#endif // SCRIPT_ENGINE_KERNEL_MODE
1580
1581 break;
1582
1583 case REGISTER_DF:
1584
1585#ifdef SCRIPT_ENGINE_USER_MODE
1586 //
1587 // Nothing to do
1588 //
1589#endif // SCRIPT_ENGINE_USER_MODE
1590
1591#ifdef SCRIPT_ENGINE_KERNEL_MODE
1593#endif // SCRIPT_ENGINE_KERNEL_MODE
1594
1595 break;
1596
1597 case REGISTER_OF:
1598
1599#ifdef SCRIPT_ENGINE_USER_MODE
1600 //
1601 // Nothing to do
1602 //
1603#endif // SCRIPT_ENGINE_USER_MODE
1604
1605#ifdef SCRIPT_ENGINE_KERNEL_MODE
1607#endif // SCRIPT_ENGINE_KERNEL_MODE
1608
1609 break;
1610
1611 case REGISTER_IOPL:
1612
1613#ifdef SCRIPT_ENGINE_USER_MODE
1614 //
1615 // Nothing to do
1616 //
1617#endif // SCRIPT_ENGINE_USER_MODE
1618
1619#ifdef SCRIPT_ENGINE_KERNEL_MODE
1621 Value = (Value >> 4) & 1;
1623#endif // SCRIPT_ENGINE_KERNEL_MODE
1624
1625 break;
1626
1627 case REGISTER_NT:
1628
1629#ifdef SCRIPT_ENGINE_USER_MODE
1630 //
1631 // Nothing to do
1632 //
1633#endif // SCRIPT_ENGINE_USER_MODE
1634
1635#ifdef SCRIPT_ENGINE_KERNEL_MODE
1637#endif // SCRIPT_ENGINE_KERNEL_MODE
1638
1639 break;
1640
1641 case REGISTER_RF:
1642
1643#ifdef SCRIPT_ENGINE_USER_MODE
1644 //
1645 // Nothing to do
1646 //
1647#endif // SCRIPT_ENGINE_USER_MODE
1648
1649#ifdef SCRIPT_ENGINE_KERNEL_MODE
1651#endif // SCRIPT_ENGINE_KERNEL_MODE
1652
1653 break;
1654
1655 case REGISTER_VM:
1656
1657#ifdef SCRIPT_ENGINE_USER_MODE
1658 //
1659 // Nothing to do
1660 //
1661#endif // SCRIPT_ENGINE_USER_MODE
1662
1663#ifdef SCRIPT_ENGINE_KERNEL_MODE
1665#endif // SCRIPT_ENGINE_KERNEL_MODE
1666
1667 break;
1668
1669 case REGISTER_AC:
1670
1671#ifdef SCRIPT_ENGINE_USER_MODE
1672 //
1673 // Nothing to do
1674 //
1675#endif // SCRIPT_ENGINE_USER_MODE
1676
1677#ifdef SCRIPT_ENGINE_KERNEL_MODE
1679#endif // SCRIPT_ENGINE_KERNEL_MODE
1680
1681 break;
1682
1683 case REGISTER_VIF:
1684
1685#ifdef SCRIPT_ENGINE_USER_MODE
1686 //
1687 // Nothing to do
1688 //
1689#endif // SCRIPT_ENGINE_USER_MODE
1690
1691#ifdef SCRIPT_ENGINE_KERNEL_MODE
1693#endif // SCRIPT_ENGINE_KERNEL_MODE
1694
1695 break;
1696
1697 case REGISTER_VIP:
1698
1699#ifdef SCRIPT_ENGINE_USER_MODE
1700 //
1701 // Nothing to do
1702 //
1703#endif // SCRIPT_ENGINE_USER_MODE
1704
1705#ifdef SCRIPT_ENGINE_KERNEL_MODE
1707#endif // SCRIPT_ENGINE_KERNEL_MODE
1708
1709 break;
1710
1711 case REGISTER_ID:
1712
1713#ifdef SCRIPT_ENGINE_USER_MODE
1714 //
1715 // Nothing to do
1716 //
1717#endif // SCRIPT_ENGINE_USER_MODE
1718
1719#ifdef SCRIPT_ENGINE_KERNEL_MODE
1721#endif // SCRIPT_ENGINE_KERNEL_MODE
1722
1723 break;
1724
1725 case REGISTER_RIP:
1726
1727#ifdef SCRIPT_ENGINE_USER_MODE
1728 //
1729 // Nothing to do
1730 //
1731#endif // SCRIPT_ENGINE_USER_MODE
1732
1733#ifdef SCRIPT_ENGINE_KERNEL_MODE
1735#endif // SCRIPT_ENGINE_KERNEL_MODE
1736
1737 break;
1738
1739 case REGISTER_EIP:
1740
1741#ifdef SCRIPT_ENGINE_USER_MODE
1742 //
1743 // Nothing to do
1744 //
1745#endif // SCRIPT_ENGINE_USER_MODE
1746
1747#ifdef SCRIPT_ENGINE_KERNEL_MODE
1749#endif // SCRIPT_ENGINE_KERNEL_MODE
1750
1751 break;
1752
1753 case REGISTER_IP:
1754
1755#ifdef SCRIPT_ENGINE_USER_MODE
1756 //
1757 // Nothing to do
1758 //
1759#endif // SCRIPT_ENGINE_USER_MODE
1760
1761#ifdef SCRIPT_ENGINE_KERNEL_MODE
1763#endif // SCRIPT_ENGINE_KERNEL_MODE
1764
1765 break;
1766
1767 case REGISTER_IDTR:
1768
1769#ifdef SCRIPT_ENGINE_USER_MODE
1770 //
1771 // Nothing to do
1772 //
1773#endif // SCRIPT_ENGINE_USER_MODE
1774
1775#ifdef SCRIPT_ENGINE_KERNEL_MODE
1777#endif // SCRIPT_ENGINE_KERNEL_MODE
1778
1779 break;
1780
1781 case REGISTER_LDTR:
1782
1783#ifdef SCRIPT_ENGINE_USER_MODE
1784 //
1785 // Nothing to do
1786 //
1787#endif // SCRIPT_ENGINE_USER_MODE
1788
1789#ifdef SCRIPT_ENGINE_KERNEL_MODE
1791#endif // SCRIPT_ENGINE_KERNEL_MODE
1792
1793 break;
1794
1795 case REGISTER_GDTR:
1796
1797#ifdef SCRIPT_ENGINE_USER_MODE
1798 //
1799 // Nothing to do
1800 //
1801#endif // SCRIPT_ENGINE_USER_MODE
1802
1803#ifdef SCRIPT_ENGINE_KERNEL_MODE
1805#endif // SCRIPT_ENGINE_KERNEL_MODE
1806
1807 break;
1808
1809 case REGISTER_TR:
1810
1811#ifdef SCRIPT_ENGINE_USER_MODE
1812 //
1813 // Nothing to do
1814 //
1815#endif // SCRIPT_ENGINE_USER_MODE
1816
1817#ifdef SCRIPT_ENGINE_KERNEL_MODE
1819#endif // SCRIPT_ENGINE_KERNEL_MODE
1820
1821 break;
1822
1823 case REGISTER_CR0:
1824
1825#ifdef SCRIPT_ENGINE_USER_MODE
1826 //
1827 // Nothing to do
1828 //
1829#endif // SCRIPT_ENGINE_USER_MODE
1830
1831#ifdef SCRIPT_ENGINE_KERNEL_MODE
1833#endif // SCRIPT_ENGINE_KERNEL_MODE
1834
1835 break;
1836
1837 case REGISTER_CR2:
1838
1839#ifdef SCRIPT_ENGINE_USER_MODE
1840 //
1841 // Nothing to do
1842 //
1843#endif // SCRIPT_ENGINE_USER_MODE
1844
1845#ifdef SCRIPT_ENGINE_KERNEL_MODE
1847#endif // SCRIPT_ENGINE_KERNEL_MODE
1848
1849 break;
1850
1851 case REGISTER_CR3:
1852
1853#ifdef SCRIPT_ENGINE_USER_MODE
1854 //
1855 // Nothing to do
1856 //
1857#endif // SCRIPT_ENGINE_USER_MODE
1858
1859#ifdef SCRIPT_ENGINE_KERNEL_MODE
1861#endif // SCRIPT_ENGINE_KERNEL_MODE
1862
1863 break;
1864
1865 case REGISTER_CR4:
1866
1867#ifdef SCRIPT_ENGINE_USER_MODE
1868 //
1869 // Nothing to do
1870 //
1871#endif // SCRIPT_ENGINE_USER_MODE
1872
1873#ifdef SCRIPT_ENGINE_KERNEL_MODE
1875#endif // SCRIPT_ENGINE_KERNEL_MODE
1876
1877 break;
1878
1879 case REGISTER_CR8:
1880
1881#ifdef SCRIPT_ENGINE_USER_MODE
1882 //
1883 // Nothing to do
1884 //
1885#endif // SCRIPT_ENGINE_USER_MODE
1886
1887#ifdef SCRIPT_ENGINE_KERNEL_MODE
1889#endif // SCRIPT_ENGINE_KERNEL_MODE
1890
1891 break;
1892
1893 case REGISTER_DR0:
1894
1895#ifdef SCRIPT_ENGINE_USER_MODE
1896 //
1897 // Nothing to do
1898 //
1899#endif // SCRIPT_ENGINE_USER_MODE
1900
1901#ifdef SCRIPT_ENGINE_KERNEL_MODE
1903#endif // SCRIPT_ENGINE_KERNEL_MODE
1904
1905 break;
1906
1907 case REGISTER_DR1:
1908
1909#ifdef SCRIPT_ENGINE_USER_MODE
1910 //
1911 // Nothing to do
1912 //
1913#endif // SCRIPT_ENGINE_USER_MODE
1914
1915#ifdef SCRIPT_ENGINE_KERNEL_MODE
1917#endif // SCRIPT_ENGINE_KERNEL_MODE
1918
1919 break;
1920
1921 case REGISTER_DR2:
1922
1923#ifdef SCRIPT_ENGINE_USER_MODE
1924 //
1925 // Nothing to do
1926 //
1927#endif // SCRIPT_ENGINE_USER_MODE
1928
1929#ifdef SCRIPT_ENGINE_KERNEL_MODE
1931#endif // SCRIPT_ENGINE_KERNEL_MODE
1932
1933 break;
1934
1935 case REGISTER_DR3:
1936
1937#ifdef SCRIPT_ENGINE_USER_MODE
1938 //
1939 // Nothing to do
1940 //
1941#endif // SCRIPT_ENGINE_USER_MODE
1942
1943#ifdef SCRIPT_ENGINE_KERNEL_MODE
1945#endif // SCRIPT_ENGINE_KERNEL_MODE
1946
1947 break;
1948
1949 case REGISTER_DR6:
1950
1951#ifdef SCRIPT_ENGINE_USER_MODE
1952 //
1953 // Nothing to do
1954 //
1955#endif // SCRIPT_ENGINE_USER_MODE
1956
1957#ifdef SCRIPT_ENGINE_KERNEL_MODE
1959#endif // SCRIPT_ENGINE_KERNEL_MODE
1960
1961 break;
1962
1963 case REGISTER_DR7:
1964
1965#ifdef SCRIPT_ENGINE_USER_MODE
1966 //
1967 // Nothing to do
1968 //
1969#endif // SCRIPT_ENGINE_USER_MODE
1970
1971#ifdef SCRIPT_ENGINE_KERNEL_MODE
1973#endif // SCRIPT_ENGINE_KERNEL_MODE
1974
1975 break;
1976 default:
1977 Result = FALSE;
1978 break;
1979 }
1980
1981 return Result;
1982}
#define UPPER_56_BITS
Definition BasicTypes.h:57
#define UPPER_48_BITS_AND_LOWER_8_BITS
Definition BasicTypes.h:64
#define UPPER_32_BITS
Definition BasicTypes.h:59
#define UPPER_48_BITS
Definition BasicTypes.h:58
VOID SetGuestCr3(UINT64 Cr3)
Set the Guest Cr3 Register.
Definition ManageRegs.c:555
VOID SetGuestCr0(UINT64 Cr0)
Set the Guest Cr0 Register.
Definition ManageRegs.c:531
VOID SetGuestDr7(UINT64 value)
Set the Guest Dr7 Register.
Definition ManageRegs.c:651
VOID SetGuestCr2(UINT64 Cr2)
Set the Guest Cr2 Register.
Definition ManageRegs.c:543
VOID SetGuestEsSel(PVMX_SEGMENT_SELECTOR Es)
Set just the Guest Es selector.
Definition ManageRegs.c:248
VOID SetGuestDr1(UINT64 value)
Set the Guest Dr1 Register.
Definition ManageRegs.c:603
VOID SetGuestRSP(UINT64 RSP)
Set the Guest RSP Register.
Definition ManageRegs.c:435
VOID SetGuestGsSel(PVMX_SEGMENT_SELECTOR Gs)
Set just the Guest Gs selector.
Definition ManageRegs.c:203
VOID SetGuestRFlags(UINT64 RFlags)
Set the Guest RFLAGS Register.
Definition ManageRegs.c:398
VOID SetGuestDr3(UINT64 value)
Set the Guest Dr3 Register.
Definition ManageRegs.c:627
VOID SetGuestDr2(UINT64 value)
Set the Guest Dr2 Register.
Definition ManageRegs.c:615
VOID SetGuestCr8(UINT64 Cr8)
Set the Guest Cr8 Register.
Definition ManageRegs.c:579
VOID SetGuestTr(UINT64 Tr)
Definition ManageRegs.c:372
VOID SetGuestIdtr(UINT64 Idtr)
Set the Guest Idtr.
Definition ManageRegs.c:293
VOID SetGuestLdtr(UINT64 Ldtr)
Set the Guest Ldtr.
Definition ManageRegs.c:320
VOID SetGuestDr6(UINT64 value)
Set the Guest Dr6 Register.
Definition ManageRegs.c:639
VOID SetGuestDsSel(PVMX_SEGMENT_SELECTOR Ds)
Set just the Guest Ds selector.
Definition ManageRegs.c:113
VOID SetGuestSsSel(PVMX_SEGMENT_SELECTOR Ss)
Set just the Guest Ss selector.
Definition ManageRegs.c:68
VOID SetGuestDr0(UINT64 value)
Set the Guest Dr0 Register.
Definition ManageRegs.c:591
VOID SetGuestCsSel(PVMX_SEGMENT_SELECTOR Cs)
Set just the Guest Cs selector.
Definition ManageRegs.c:22
VOID SetGuestCr4(UINT64 Cr4)
Set the Guest Cr4 Register.
Definition ManageRegs.c:567
VOID SetGuestGdtr(UINT64 Gdtr)
Set the Guest Gdtr.
Definition ManageRegs.c:347
VOID SetGuestRIP(UINT64 RIP)
Set the Guest RIP Register.
Definition ManageRegs.c:423
VOID SetGuestFsSel(PVMX_SEGMENT_SELECTOR Fs)
Set just the Guest Fs selector.
Definition ManageRegs.c:158
#define X86_FLAGS_IOPL_SHIFT_2ND_BIT
Definition Common.h:101
RequestedActionOfThePacket Value(0x1) 00000000
Segment selector.
Definition DataTypes.h:436