1. Kernel object: 1). Symbol object 2). Event object 3). File Object 4). File Image Object 5) .i / o Complete Object 6). Job Object 7). Mold Object 8). Mutually exclusive Object 9). Process Object 11). Beacon Object 12). Thread Object 13). Waiting Timener Object
2. The kernel object can only be owned by the kernel, rather than being owned by the process. 3. When the data structure of the kernel object has a counter, the process is called, the counter is added, the call is completed, the counter is reduced, the kernel object counter is zero, destroyed This kernel object. 4. Core security, what permissions use of the process calls the kernel object, specified by the data structure of the Security_Attributes structure. Almost all the functions of the call kernel objects contain the pointer parameters of the security_attributes structure .TypedEf struct _security_attributes {dWord Nlength; // Structural length LPVOID LPSECURITYDESCRIPTOR; // Security Set Bool BinheritHandle; // Sustainable} Security_Attributes, * psecurity_attributes; 5. The handle of the kernel object of the process, when the process calls the kernel object, the handle of the kernel object is created. Table, that is, the index of the kernel object in the process, the index value is the handle returned by the kernel object function. Close all kernel objects, use closehandle (); 6. Cross-process boundary shared kernel object Microsoft designed handle to process handle, no Designed to system handle is to achieve robustness and security of the handle. 1) Inheritance of the kernel object handle. Role: Access to kernel objects created for parent processes for childhood. Steps: First, when the parent process creates a kernel object, initialize the object of the Security_Attributes structure, let the member variable of the security_attributes structure BinheritHandle set to True. Then, after the child process is created, generate its own handle table, the handle table traversed the handle table of the parent process, find the handle with inheritance, and copy the kernel object of the child process and the parent process. The kernel object uses the same memory block pointer, the kernel object counter adds a kernel object in the sub-process, and the parent process calls CloseHandle () to turn off the kernel object, which does not affect the sub-process using the kernel object. 2) Change the sign of the handle Bool SetHandleinformation (Handle Hobject, // Handle To Object DWord DwMask, // Flags to Change Dword DWFlags // New Values for Flags);
Open the kernel's hexature flag setHandleinformation (HOBJ, HANDLE_FLAG_INHERIT, HANDLE_FLAG_INHERIT); Turn off the kernel's hexy flag setHandleinformation (hobj, handle_flag_inherit, 0); if the kernel object is not closed, set Handle_Flag_Protect_FROM_CLOSE.
A function Bool getHandleinFormation (Handle Hobject, // Handle To Object LPDWORD LPDWFLAGS / / HANDLE Properties);
3) Named objects: Let the kernel objects in the process can share, let other processes can access the kernel objects of this process through namespaces, cross processes. Creating an object and access object Use a function to create an object crete *: If the named kernel object already exists and has secure access, the parameter is ignored, the process is ignored, the process handles the handle of the process, and the handle of the kernel object and the handle of the process, if There is no existence, you will now create a kernel object. Example: Handle Createmutex (LPSecurity_Attributes LPMUTEXATTRIBUTES, // SD Bool Binitialowner, // Initial Owner LPCTSTR LPNAME // Object Name); Open Object Open *: If the named kernel object already exists and has a secure access, the handle of the process is copied The pointer of the kernel object and the sir to the process of the handle table, if there is no existence, return null, use getlasserror () to get the return value 2.
4) Terminal Services Name Space Each client program session has its own service namespace, and a session cannot access another session, although they have the same object name. The namespace object of the service program is always in the global namespace.
5) Copy the object handle DuplicateHandle function to copy the handle of another process object to the process handle table called this function, implement the inter-process shared kernel object. BOOL DuplicateHandle (HANDLE hSourceProcessHandle, // handle to source process HANDLE hSourceHandle, // handle to duplicate HANDLE hTargetProcessHandle, // handle to target process LPHANDLE lpTargetHandle, // duplicate handle DWORD dwDesiredAccess, // requested access BOOL bInheritHandle, // handle inheritance Option DWORD DWOPTIONS / / OPTIONAL ActionS);