* @brief Custom VMX-root compatible strlen * * @param StrAddr * @param IsWstring * @return UINT32 */
| 1261 | * @return UINT32 |
| 1262 | */ |
| 1263 | UINT32 |
| 1264 | CustomStrlen(UINT64 StrAddr, BOOLEAN IsWstring) |
| 1265 | { |
| 1266 | #ifdef SCRIPT_ENGINE_USER_MODE |
| 1267 | |
| 1268 | if (IsWstring) |
| 1269 | { |
| 1270 | return (UINT32)wcslen((const wchar_t *)StrAddr); |
| 1271 | } |
| 1272 | else |
| 1273 | { |
| 1274 | return (UINT32)strlen((const char *)StrAddr); |
| 1275 | } |
| 1276 | #endif // SCRIPT_ENGINE_USER_MODE |
| 1277 | |
| 1278 | #ifdef SCRIPT_ENGINE_KERNEL_MODE |
| 1279 | if (IsWstring) |
| 1280 | { |
| 1281 | return VmFuncVmxCompatibleWcslen((const wchar_t *)StrAddr); |
| 1282 | } |
| 1283 | else |
| 1284 | { |
| 1285 | return VmFuncVmxCompatibleStrlen((const CHAR *)StrAddr); |
| 1286 | } |
| 1287 | #endif // SCRIPT_ENGINE_KERNEL_MODE |
| 1288 | } |
| 1289 | |
| 1290 | /** |
| 1291 | * @brief Check if string is safe to be accessed or not (in vmx-root mode) |
no test coverage detected