什么是内核对象 What Is a Kernel Object

以下是资料介绍,如需要完整的请充值下载. 本资料已审核过,确保内容和网页里介绍一致.  
无需注册登录,支付后按照提示操作即可获取该资料.
资料介绍:
什么是内核对象
作为一名Windows软件开发者,你经常要创建,打开,并且使用内核对象。系统建立并且使用几类内核对象,例如进入标志对象,事件对象,文件对象,文件绘制对象, I/O 完成接口对象,工作对象,mailslot 对象,mutex对象,管道对象,进程对象,信号物体,线程对象和可等待的定时器对象。 这些对象通过调用各种各样的函数来建立。 例如,CreateFileMapping 函数使系统建立一个文件绘制对象。 每个内核对象都只是内核分配的一个存储块,而且只有通过内核才可以进入。 这个存储块是关于对象的信息的数据结构。 一些成员(安全性描述符,使用记数等等)相同地通过所有对象类型,但是大多数成员明确一种特定的对象类型。 例如, 一个进程对象有一个进程ID, 基本优先级和一段退出代码,而一个文件对象有一个字节补偿,一种分享方式和一种打开方式。
因为内核对象的数据结构只通过内核可以进入,对于应用者来说,在存储器里找到这些数据结构并且直接改变他们的内容是不可能的。微软公司谨慎地采用这个限制以保证内核对象结构始终保持一致的状态。 这个限制也允许微软公司增加,删除,或者改变这些结构中的成员而对应用没有任何影响。
如果我们不能直接改变这些结构,我们在应用中怎样操作这些内核对象? 方法是Windows 提供一组明确定义的如何使用这些结构的函数集。通过这些函数总可以进入内核对象。当你调用函数来建立一个内核物体时,这个函数返回一个确认这个对象的句柄。 把这个句柄作为一个能在你的进程中的任何线程中使用的不透明的表。 你向各种窗口函数传递这个句柄,因此系统知道你想要操作哪个内核对象。我们在这章里将谈论更多有关这些句柄的内容。(优秀毕业设计:www.2bysj.cn)

3.1、What Is a Kernel Object?
As a Windows software developer, you create, open, and manipulate kernel objects regularly. The system creates and manipulates several types of kernel objects, such as access token objects, event objects, file objects, file-mapping objects, I/O completion port objects, job objects, mailslot objects, mutex objects, pipe objects, process objects, semaphore objects, thread objects, and waitable timer objects. These objects are created by calling various functions. For example, the CreateFileMapping function causes the system to create a file-mapping object. Each kernel object is simply a memory block allocated by the kernel and is accessible only by the kernel. This memory block is a data structure whose members maintain information about the object. Some members (security descriptor, usage count, and so on) are the same across all object types, but most are specific to a particular object type. For example, a process object has a process ID, a base priority, and an exit code, whereas a file object has a byte offset, a sharing mode, and an open mode.
Because the kernel object data structures are accessible only by the kernel, it is impossible for an application to locate these data structures in memory and directly alter their contents. Microsoft enforces this restriction deliberately to ensure that the kernel object structures maintain a consistent state. This restriction also allows Microsoft to add, remove, or change the members in these structures without breaking any applications.

全文4200字