You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _posts/2025-06-22-02.md
-307Lines changed: 0 additions & 307 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -117,310 +117,3 @@ The changed example is shown below:
117
117
118
118
---
119
119
120
-
# Precautions
121
-
122
-
Code obfuscation tools cannot accurately understand all contexts. Therefore, users must protect their code by being alert to dangerous situations.
123
-
When using code obfuscation and virtualization, be mindful of the following situations.
124
-
125
-
## Compiler Optimization Considerations
126
-
If you're using the VxLang SDK to obfuscate or virtualize your code, ensure that you check the compiler optimization settings. When compiler optimization is enabled, your code might be merged in ways that differ from how you originally wrote it. If VxLang SDK functions are referenced within this merged code, the Begin/End positions might change, resulting in less obfuscation than intended.
127
-
128
-
- Here's how to fix the problem:
129
-
- Turn off compiler optimization.
130
-
- Disable code optimization for specific functions or pages at the code level.
131
-
```cpp
132
-
#pragma optimize("", off) /// turn off optimization ..
133
-
voidObfuscationTest() {
134
-
VL_OBFUSCATION_BEGIN;
135
-
136
-
// ...
137
-
138
-
VL_OBFUSCATION_END;
139
-
140
-
return;
141
-
}
142
-
```
143
-
- Use MAP/PDB-based obfuscation/virtualization.
144
-
- It is described in the next chapter.
145
-
146
-
## Potential Code Generation
147
-
148
-
Be aware of the following code pattern that may occur during the obfuscation and virtualization process:
149
-
- In this example, the jmp rax instruction causes a jump from the VxLang region back to the original code. This type of code can occur when table-based operations are used in a switch-case statement.
VxLang currently only supports SEH (Structured Exception Handling). Therefore, be cautious when using it in conjunction with try-catch blocks.
370
-
- As of version `2.1.6.1`, ***MSVC C++ exception handling*** has been added, but please be aware that the context is unstable.
371
-
- This is explained in the next chapter.
372
-
373
-
```cpp
374
-
#pragma optimize("", off)
375
-
void ObfuscationSEHTest() {
376
-
VL_OBFUSCATION_BEGIN;
377
-
378
-
__try {
379
-
printf("SEH Test \n");
380
-
__debugbreak();
381
-
}
382
-
__except (1) {
383
-
printf(" Except \n");
384
-
}
385
-
386
-
VL_OBFUSCATION_END;
387
-
388
-
return;
389
-
}
390
-
```
391
-
392
-
## Avoiding C++ exception handlers
393
-
394
-
SEH works with Windows system specifications. C++ EH, on the other hand, depends on the compiler specification (e.g. MSVC/Clang/GCC/Etc.), which can be circumvented by using the SDK as described below.
395
-
396
-
1. Unlike SEH, Catch syntax in C++ is represented as a separate function, so we apply the SDK separately as shown below.
397
-
2. In addition, the C++ EH records where exceptions can be thrown.
398
-
For this reason, code that can throw exceptions must be excluded from SDK sections.
399
-
400
-
```cpp
401
-
#pragma optimize("", off)
402
-
voidtest() {
403
-
try {
404
-
VL_OBFUSCATION_BEGIN;
405
-
406
-
printf(" > ObfuscationCxxEHTest \n");
407
-
408
-
VL_OBFUSCATION_END;
409
-
410
-
// *** Raise Exception
411
-
throw std::runtime_error("Something went wrong - 1");
0 commit comments