ReactOS 0.4.15-dev-5664-g3bf4ef6
psldt.c
Go to the documentation of this file.
1/*
2 * PROJECT: ReactOS Kernel
3 * LICENSE: GPL - See COPYING in the top level directory
4 * FILE: ntoskrnl/ps/i386/psldt.c
5 * PURPOSE: LDT support for x86
6 * PROGRAMMERS: Stefan Ginsberg (stefan.ginsberg@reactos.org)
7 */
8
9/* INCLUDES ******************************************************************/
10
11#include <ntoskrnl.h>
12#define NDEBUG
13#include <debug.h>
14
15/* FUNCTIONS *****************************************************************/
16
17VOID
20{
21 /* FIXME - LdtInformation must be null as long as we don't implement VDMs */
22 ASSERT(Process->LdtInformation == NULL);
23}
24
25VOID
28{
29 /* If there are no VDM objects, just exit */
30 if (Process->VdmObjects == NULL)
31 return;
32
33 /* FIXME: Need to do more than just freeing the main VdmObjects member! */
35
36 /* Free VDM objects */
38 Process->VdmObjects = NULL;
39}
40
44 IN PVOID ThreadInformation,
47{
48 DESCRIPTOR_TABLE_ENTRY DescriptorEntry;
51 PAGED_CODE();
52
53 /* Verify the size */
54 if (ThreadInformationLength != sizeof(DESCRIPTOR_TABLE_ENTRY))
55 {
56 /* Fail */
58 }
59
60 /* Enter SEH for the copy */
62 {
63 /* Get the descriptor */
64 RtlCopyMemory(&DescriptorEntry,
65 ThreadInformation,
66 sizeof(DESCRIPTOR_TABLE_ENTRY));
67 }
69 {
70 /* Return the exception code */
72 }
74
75 /* Check if this is a GDT selector */
76 if (!(DescriptorEntry.Selector & 0x4))
77 {
78 /* Get the GDT entry */
80 DescriptorEntry.Selector & 0xFFFFFFF8,
82 if (!NT_SUCCESS(Status)) return Status;
83
84 /* Enter SEH for the copy */
86 {
87 /* Copy the GDT entry to caller */
88 RtlCopyMemory(&((PDESCRIPTOR_TABLE_ENTRY)ThreadInformation)->
91 sizeof(LDT_ENTRY));
92 if (ReturnLength) *ReturnLength = sizeof(LDT_ENTRY);
93 }
95 {
96 /* Return the exception code */
98 }
100
101 /* Success */
103 }
104 else
105 {
106 /* This is only supported for VDM, which we don't implement */
107 ASSERT(Thread->ThreadsProcess->LdtInformation == NULL);
109 }
110
111 /* Return status to caller */
112 return Status;
113}
#define PAGED_CODE()
LONG NTSTATUS
Definition: precomp.h:26
#define UNIMPLEMENTED
Definition: debug.h:115
#define NULL
Definition: types.h:112
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
IN CINT OUT PVOID IN ULONG OUT PULONG ReturnLength
Definition: dumpinfo.c:43
#define _SEH2_END
Definition: filesup.c:22
#define _SEH2_TRY
Definition: filesup.c:19
_In_opt_ PFILE_OBJECT _In_opt_ PETHREAD Thread
Definition: fltkernel.h:2653
_Must_inspect_result_ _In_ PLARGE_INTEGER _In_ PLARGE_INTEGER _In_ ULONG _In_ PFILE_OBJECT _In_ PVOID Process
Definition: fsrtlfuncs.h:223
Status
Definition: gdiplustypes.h:25
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
unsigned int * PULONG
Definition: retypes.h:1
unsigned int ULONG
Definition: retypes.h:1
#define ASSERT(a)
Definition: mode.c:44
#define ExFreePoolWithTag(_P, _T)
Definition: module.h:1099
#define LDT_ENTRY
Definition: ketypes.h:292
_In_ THREADINFOCLASS _In_ ULONG ThreadInformationLength
Definition: psfuncs.h:835
NTSTATUS NTAPI Ke386GetGdtEntryThread(IN PKTHREAD Thread, IN ULONG Offset, IN PKGDTENTRY Descriptor)
Definition: ldt.c:26
#define STATUS_NO_LDT
Definition: ntstatus.h:515
#define _SEH2_GetExceptionCode()
Definition: pseh2_64.h:159
#define _SEH2_EXCEPT(...)
Definition: pseh2_64.h:34
#define _SEH2_YIELD(__stmt)
Definition: pseh2_64.h:162
VOID NTAPI PspDeleteLdt(PEPROCESS Process)
Definition: psldt.c:19
NTSTATUS NTAPI PspQueryDescriptorThread(IN PETHREAD Thread, IN PVOID ThreadInformation, IN ULONG ThreadInformationLength, OUT PULONG ReturnLength OPTIONAL)
Definition: psldt.c:43
VOID NTAPI PspDeleteVdmObjects(PEPROCESS Process)
Definition: psldt.c:27
#define STATUS_SUCCESS
Definition: shellext.h:65
PULONG MinorVersion OPTIONAL
Definition: CrossNt.h:68
KTHREAD Tcb
Definition: pstypes.h:1103
Definition: compat.h:777
#define TAG_KERNEL
Definition: tag.h:42
#define NTAPI
Definition: typedefs.h:36
#define RtlCopyMemory(Destination, Source, Length)
Definition: typedefs.h:263
#define IN
Definition: typedefs.h:39
#define OUT
Definition: typedefs.h:40
#define STATUS_INFO_LENGTH_MISMATCH
Definition: udferr_usr.h:133
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342