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

Function CustomStrlen

hyperdbg/script-eval/code/Functions.c:1263–1288  ·  view source on GitHub ↗

* @brief Custom VMX-root compatible strlen * * @param StrAddr * @param IsWstring * @return UINT32 */

Source from the content-addressed store, hash-verified

1261 * @return UINT32
1262 */
1263UINT32
1264CustomStrlen(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)

Callers 1

Calls 2

Tested by

no test coverage detected