Windows内核驱动程序和无证件API

发布于 2025-01-24 19:26:24 字数 774 浏览 1 评论 0 原文

我尝试在开发Windows内核驱动程序时尝试使用无证件的API。请不要告诉我这不是最好的事情;)

无论如何,我在ntoskrnl.exe中发现的无证件的API是 psgetProcesspeb

我定义了以下结构:

  • _peb _peb
  • _peb_ldr_ldr_data
  • _ldr_data _ldr_ldr_data_data_tata_tapable_entry

也是我发现我必须定义以下函数:

NTKERNELAPI PPEB NTAPI PsGetProcessPeb(IN PEPROCESS Process);

我尝试编译的代码(一个部分)是:

PsLookupProcessByProcessId(ProcessId, &pProcess);
PPEB pPeb = PsGetProcessPeb(pProcess);

当我尝试编译时,我会得到以下错误代码:

  • lnk2019
  • lnk1120:未解决的外部词,

未解决的外部是< strong> psgetProcesspeb

我想链接器找不到该功能,也不知道如何链接。

用于编译的操作系统是Windows 10 Build 19044(x64),我使用Visual Studio 2019。

如果您有任何想法,请告诉我。

问候

I try to use an undocumented API while developing a windows kernel driver. Please don't tell me this is not the best thing to do ;)

Anyway, the undocumented API is PsGetProcessPeb that i found with IDA into ntoskrnl.exe

I define the following structures:

  • _PEB
  • _PEB_LDR_DATA
  • _LDR_DATA_TABLE_ENTRY

Also, I found that I have to define the function like:

NTKERNELAPI PPEB NTAPI PsGetProcessPeb(IN PEPROCESS Process);

The code (a part of) that I try to compile is:

PsLookupProcessByProcessId(ProcessId, &pProcess);
PPEB pPeb = PsGetProcessPeb(pProcess);

When i try to compile I get the following error code:

  • LNK2019
  • LNK1120: unresolved externals

The externals that is not resolved is PsGetProcessPeb

I guess that the linker doesn't find the function and doesn't know how to link.

The OS used to compile is Windows 10 build 19044 (x64) and I use Visual Studio 2019.

If you have any idea, please let me know.

Regards

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

霞映澄塘 2025-01-31 19:26:24

使用无证件API的关键是找到API的地址。

在内内兰德,有mmgetSystemRoutineadDress()。

mmgetsystemneRoutineadDress 例程将指针返回到由 SystemRoutIneName 。

语法

c ++

PVOID MmGetSystemRoutineAddress(
  [in] PUNICODE_STRING SystemRoutineName
);

参数

[in] SystemRoutineName

指定要解决的系统例程的名称。

返回值

如果可以解决函数名称,则例程将返回指向该函数的指针。否则,例程将返回null。

备注

驱动程序可以使用此例程来确定特定版本的Windows上是否有例程。它只能用于由内核或HAL导出的例程,而不是用于任何驾驶员定义的例程。

The key to use an undocumented API is to find the API's address.

In kernelland, there is MmGetSystemRoutineAddress().

https://learn.microsoft.com/en-us/windows-hardware/drivers/ddi/wdm/nf-wdm-mmgetsystemroutineaddress

The MmGetSystemRoutineAddress routine returns a pointer to a function specified by SystemRoutineName.

Syntax

C++

PVOID MmGetSystemRoutineAddress(
  [in] PUNICODE_STRING SystemRoutineName
);

Parameters

[in] SystemRoutineName

Specifies the name of the system routine to resolve.

Return value

If the function name can be resolved, the routine returns a pointer to the function. Otherwise, the routine returns NULL.

Remarks

Drivers can use this routine to determine if a routine is available on a specific version of Windows. It can only be used for routines exported by the kernel or HAL, not for any driver-defined routine.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文