📝 Access to kernel objects in Window 7 (5 MCQs)
Controlled Access to Windows Kernel Objects
Windows 7 applications access kernel objects through handles rather than directly manipulating their internal memory structures. Objects include processes, threads, events, mutexes, semaphores, file objects, and sections. The Object Manager and security reference monitor help validate requests, enforce access rights, and manage object lifetime across user and kernel components.
Why Handles Protect Internal Kernel Structures
Allowing user programs to reference kernel objects through raw addresses would expose privileged memory and make object management unsafe. Handles provide indirect references controlled by the kernel. Access rights limit operations, while process-specific handle tables help separate which objects a process can manipulate.
Opening, Using and Closing Object Handles
An application creates or opens an object through a Windows API. The system validates requested access and returns a handle when permitted. Later calls use that handle to wait, query, signal, or modify the object. CloseHandle releases the process's reference when it is no longer needed.
Example of Opening a Process Handle
A monitoring program requests a process handle with query-information access. Windows checks whether the caller's token and target process security descriptor permit the requested rights. If authorised, the program receives a handle and can query allowed information, but cannot terminate the process without the required additional permission.
Security, Lifetime and Handle Management
Handle-based access supports protection and controlled object sharing. Excessive handle permissions can expose sensitive operations, while leaked handles retain references and consume resources. Inherited and duplicated handles require careful configuration, particularly when processes communicate or transfer access to privileged objects.
Misconceptions About Kernel Object Handles
'A handle is the kernel object's physical address' is false because it is an indirect reference. 'Knowing a handle value grants access from every process' ignores process-specific handle tables. 'Closing a handle always destroys the underlying object' overlooks other outstanding references.
Exam Focus: Handles, Access Rights and Object Lifetime
Trace object creation or opening, access checking, handle use, duplication, and closure. Distinguish handle values from kernel object pointers. Questions may ask why a process can query but not terminate another process or how reference management prevents premature object deletion.
Key Terms of Windows Kernel Object Access
- Handle - Process-specific reference to an object.
- Handle table - Stores a process's object references.
- Access right - Permitted operation on an object.
- Object Manager - Manages kernel objects.
- CloseHandle - Releases a handle reference.
📝 All Access to kernel objects in Window 7 MCQs
Q1. A high‑rate network card generates an interrupt, the ISR queues a DPC to finish packet processing. Which statement correctly describes the priority relationship that guarantees the DPC will not pre‑empt other device ISRs but will still run before normal threads?
📖 Explanation: The DPC’s priority is deliberately set between the highest interrupt request level (IRQL) used by device ISRs and the IRQL for regular thread execution. This ensures that while the ISR finishes first, the DPC can run without being delayed by normal thread scheduling, preserving system responsiveness. Option B captures this design; A ignores the need for a middle priority, C misstates the relationship with APCs, and D suggests a pre‑emptive rule that does not exist.
Q2. When a driver needs to perform a lengthy file‑system cleanup after an I/O completion, it can queue the work to the system’s worker‑thread pool instead of using a DPC. Which advantage best explains why this approach is preferred?
📖 Explanation: Worker threads operate at PASSIVE_LEVEL, allowing them to block, wait on synchronization objects, or perform page‑faultable operations without increasing interrupt latency. This contrasts with DPCs, which must execute quickly and cannot block. Option B correctly highlights the latency benefit; A is false because higher IRQL would worsen latency, C is inaccurate as worker threads may run in kernel mode, and D is wrong because scheduling is still subject to normal thread policies.
Q3. A thread is put into an alertable wait state and an APC is queued to it. What is the most likely outcome once the wait condition is satisfied?
📖 Explanation: When a thread is in an alertable wait, the kernel checks for queued APCs each time the wait is satisfied. If an APC is present, it is delivered and runs in the context of that thread before the thread resumes normal execution. Therefore, option A is correct. Option B contradicts the alertable behavior, C misrepresents the timing, and D confuses APC delivery with termination semantics.
Q4. Why does the Windows dispatcher assign DPCs a priority that is lower than device‑interrupt IRQLs but higher than normal thread IRQLs?
📖 Explanation: The dispatcher’s priority scheme is designed so that the most urgent work—the ISR—completes before any deferred processing begins, yet the deferred work still runs before ordinary thread scheduling to avoid unnecessary delays. Option C accurately reflects this intent. Option A is wrong because DPCs are not pre‑empted by threads, B suggests concurrency that does not occur, and D misstates the isolation purpose.
Q5. An operating system needs to terminate a specific thread from user mode. Which mechanism involving APCs makes this possible?
📖 Explanation: A kernel‑mode APC can be queued to the target thread; when the thread becomes alertable, the APC runs and can invoke functions such as ZwTerminateThread, safely ending the thread’s execution. This is the standard method for remote termination. Option A describes this process. Option B is invalid because user‑mode APCs cannot directly free kernel resources, C misuses DPCs for termination, and D conflates I/O completion with thread control.