Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

73 lines
1.0 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. vdmtib.c
  5. Abstract:
  6. This module contains routines that provide secure access to
  7. the vdmtib from user-mode or kernel-mode object
  8. Author:
  9. Vadim Bluvshteyn (vadimb) Jul-28-1998
  10. Revision History:
  11. --*/
  12. #include "vdmp.h"
  13. #ifdef ALLOC_PRAGMA
  14. #pragma alloc_text(PAGE, VdmpGetVdmTib)
  15. #endif
  16. NTSTATUS
  17. VdmpGetVdmTib(
  18. OUT PVDM_TIB *ppVdmTib
  19. )
  20. /*++
  21. Routine Description:
  22. Arguments:
  23. Return Value:
  24. NTStatus reflecting results of the probe made to the user-mode
  25. vdmtib memory
  26. --*/
  27. {
  28. NTSTATUS Status;
  29. PVDM_TIB VdmTib;
  30. PAGED_CODE();
  31. try {
  32. VdmTib = NtCurrentTeb()->Vdm;
  33. //
  34. // Make sure it is a valid VdmTib
  35. //
  36. ProbeForWrite(VdmTib, sizeof(VDM_TIB), sizeof(UCHAR));
  37. if (VdmTib->Size != sizeof(VDM_TIB)) {
  38. return STATUS_UNSUCCESSFUL;
  39. }
  40. } except(ExSystemExceptionFilter()) {
  41. return GetExceptionCode();
  42. }
  43. *ppVdmTib = VdmTib;
  44. return STATUS_SUCCESS;
  45. }