ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

psldt.c
Go to the documentation of this file.
00001 /*
00002  * PROJECT:         ReactOS Kernel
00003  * LICENSE:         GPL - See COPYING in the top level directory
00004  * FILE:            ntoskrnl/ps/i386/psldt.c
00005  * PURPOSE:         LDT support for x86
00006  * PROGRAMMERS:     Stefan Ginsberg (stefan.ginsberg@reactos.org)
00007  */
00008 
00009 /* INCLUDES ******************************************************************/
00010 
00011 #include <ntoskrnl.h>
00012 #define NDEBUG
00013 #include <debug.h>
00014 
00015 /* FUNCTIONS *****************************************************************/
00016 
00017 NTSTATUS
00018 NTAPI
00019 PspDeleteLdt(PEPROCESS Process)
00020 {
00021     /* FIXME */
00022     return STATUS_SUCCESS;
00023 }
00024 
00025 NTSTATUS
00026 NTAPI
00027 PspDeleteVdmObjects(PEPROCESS Process)
00028 {
00029     /* FIXME */
00030     return STATUS_SUCCESS;
00031 }
00032 
00033 NTSTATUS
00034 NTAPI
00035 PspQueryDescriptorThread(IN PETHREAD Thread,
00036                          IN PVOID ThreadInformation,
00037                          IN ULONG ThreadInformationLength,
00038                          OUT PULONG ReturnLength OPTIONAL)
00039 {
00040     DESCRIPTOR_TABLE_ENTRY DescriptorEntry;
00041     LDT_ENTRY Descriptor;
00042     NTSTATUS Status;
00043     PAGED_CODE();
00044 
00045     /* Verify the size */
00046     if (ThreadInformationLength != sizeof(DESCRIPTOR_TABLE_ENTRY))
00047     {
00048         /* Fail */
00049         return STATUS_INFO_LENGTH_MISMATCH;
00050     }
00051 
00052     /* Enter SEH for the copy */
00053     _SEH2_TRY
00054     {
00055         /* Get the descriptor */
00056         RtlCopyMemory(&DescriptorEntry,
00057                       ThreadInformation,
00058                       sizeof(DESCRIPTOR_TABLE_ENTRY));
00059     }
00060     _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
00061     {
00062         /* Return the exception code */
00063         _SEH2_YIELD(return _SEH2_GetExceptionCode());
00064     }
00065     _SEH2_END;
00066 
00067     /* Check if this is a GDT selector */
00068     if (!(DescriptorEntry.Selector & 0x4))
00069     {
00070         /* Get the GDT entry */
00071         Status = Ke386GetGdtEntryThread(&Thread->Tcb,
00072                                         DescriptorEntry.Selector & 0xFFFFFFF8,
00073                                         (PKGDTENTRY)&Descriptor);
00074         if (!NT_SUCCESS(Status)) return Status;
00075 
00076         /* Enter SEH for the copy */
00077         _SEH2_TRY
00078         {
00079             /* Copy the GDT entry to caller */
00080             RtlCopyMemory(&((PDESCRIPTOR_TABLE_ENTRY)ThreadInformation)->
00081                           Descriptor,
00082                           &Descriptor,
00083                           sizeof(LDT_ENTRY));
00084             if (ReturnLength) *ReturnLength = sizeof(LDT_ENTRY);
00085         }
00086         _SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
00087         {
00088             /* Return the exception code */
00089             _SEH2_YIELD(return _SEH2_GetExceptionCode());
00090         }
00091         _SEH2_END;
00092 
00093         /* Success */
00094         Status = STATUS_SUCCESS;
00095     }
00096     else
00097     {
00098         /* This is only supported for VDM, which we don't implement */
00099         ASSERT(Thread->ThreadsProcess->LdtInformation == NULL);
00100         Status = STATUS_NO_LDT;
00101     }
00102 
00103     /* Return status to caller */
00104     return Status;
00105 }

Generated on Fri May 25 2012 04:36:06 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.