前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >PsLookupProcessByProcessId function

PsLookupProcessByProcessId function

作者头像
战神伽罗
发布2019-11-15 12:21:36
1.2K0
发布2019-11-15 12:21:36
举报

The PsLookupProcessByProcessId routine accepts the process ID of a process and returns a referenced pointer to EPROCESS structure of the process.

Syntax

C++

代码语言:javascript
复制
NTSTATUS PsLookupProcessByProcessId(
  HANDLE    ProcessId,
  PEPROCESS *Process
);

Parameters

ProcessId

Specifies the process ID of the process.

Process

Returns a referenced pointer to the EPROCESS structure of process specified by ProcessId.

Return Value

PsLookupProcessByProcessId returns STATUS_SUCCESS on success or an appropriate NTSTATUS value, such as:

Return code

Description

STATUS_INVALID_PARAMETER

Specifies in Windows XP and earlier versions of Windows the process ID was not found.

STATUS_INVALID_CID

Specifies in Windows Vista and later versions of Windows the specified client ID is not valid.

Remarks

This routine is available on Windows 2000 and later versions.

If the call to PsLookupProcessByProcessId is successful, PsLookupProcessByProcessID increases the reference count on the object returned in the Process parameter. Consequently, when a driver has completed using the Process parameter, the driver must call ObDereferenceObject to dereference the Process parameter received from the PsLookupProcessByProcessID routine.

The EPROCESS structure is an opaque data structure used internally by the operating system. This structure can be passed to other routines to access specific information in this structure.

A file system filter driver can enumerate active processes and then call PsLookupProcessByProcessId to convert a process ID to an EPROCESS structure. The process ID is available in the process create routine. A file system filter driver can set a process notification callback routine using PsSetCreateProcessNotifyRoutine. In the notification callback routine, the file system filter driver can use the passed in ProcessId parameter and call PsLookupProcessByProcessID to locate the EPROCESS structure. The PsSetCreateThreadNotifyRoutine can also be used to set a notification routine that returns the process ID when a thread ID is created.

The PsLookupProcessByProcessId routine contains pageable code.

Requirements

Target Platform

Universal

Header

ntifs.h (include Ntifs.h)

Library

NtosKrnl.lib

DLL

NtosKrnl.exe

IRQL

<= APC_LEVEL

See Also

ObDereferenceObject

PsGetCurrentProcess

PsGetCurrentProcessId

PsGetCurrentThread

PsGetCurrentThreadId

PsLookupThreadByThreadId

PsRemoveCreateThreadNotifyRoutine

PsRemoveLoadImageNotifyRoutine

PsSetCreateProcessNotifyRoutine

PsSetLoadImageNotifyRoutine

本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • Syntax
  • Parameters
  • Return Value
  • Remarks
  • Requirements
  • See Also
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档