English 中文(简体)
• 将果园* 转至一个UNICODE_STRING inkernel
原标题:Converting a char* to a UNICODE_STRING in kernel
  • 时间:2023-05-19 03:20:19
  •  标签:

I try to find the address of a given import using the MMGetSystemRoutineAddress function. The only problem is that this function takes a pointer to a UNICODE_STRING and my import name variable has the type char*.

To convert it to a UNICODE_STRING I tried using the function RtlInitUnicodeString. The problem here is that this function takes a PCWSTR and as I read that it is not possible to use a non const value for this. This is my code:

DbgPrint("%s", image_import_by_name->Name); // >> outputs "DbgPrintEx"
                
UNICODE_STRING routineNameByInput;
RtlInitUnicodeString(&routineNameByInput, L"DbgPrintEx");

UNICODE_STRING routineNameByVar;
RtlInitUnicodeString(&routineNameByVar, (PUNICODE_STRING)&image_import_by_name->Name);

DbgPrint("%wZ", routineNameByInput); // >> outputs "DbgPrintEx"
DbgPrint("%wZ", routineNameByVar); // >> outputs "???"
                 
MmGetSystemRoutineAddress(&routineNameByInput); // >> works perfectly
MmGetSystemRoutineAddress(&routineNameByInput); // >> bluescreens
MmGetSystemRoutineAddress((PUNICODE_STRING)&image_import_by_name->Name); // >> bluescreens

我也试图重启民阵。 零打断进口名称,但无所作为。

难道不容易将果园变成一个UNICODE_STRING?

RtlInitUnicodeString哪怕是首当其冲。

问题回答




相关问题
热门标签