Leaked source code of windows server 2003
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.

127 lines
3.8 KiB

  1. /*++
  2. Copyright(c) 1999-2002 Microsoft Corporation
  3. --*/
  4. #include "pch.cpp"
  5. #include <time.h>
  6. //----------------------------------------------------------------------------
  7. //
  8. // WinCeWin32LiveSystemProvider.
  9. //
  10. //----------------------------------------------------------------------------
  11. class WinCeWin32LiveSystemProvider : public Win32LiveSystemProvider
  12. {
  13. public:
  14. WinCeWin32LiveSystemProvider(ULONG BuildNumber);
  15. ~WinCeWin32LiveSystemProvider(void);
  16. virtual void Release(void);
  17. virtual HRESULT GetCurrentTimeDate(OUT PULONG TimeDate);
  18. virtual HRESULT OpenThread(IN ULONG DesiredAccess,
  19. IN BOOL InheritHandle,
  20. IN ULONG ThreadId,
  21. OUT PHANDLE Handle);
  22. virtual HRESULT GetTeb(IN HANDLE Thread,
  23. OUT PULONG64 Offset,
  24. OUT PULONG Size);
  25. virtual HRESULT GetThreadInfo(IN HANDLE Process,
  26. IN HANDLE Thread,
  27. OUT PULONG64 Teb,
  28. OUT PULONG SizeOfTeb,
  29. OUT PULONG64 StackBase,
  30. OUT PULONG64 StackLimit,
  31. OUT PULONG64 StoreBase,
  32. OUT PULONG64 StoreLimit);
  33. virtual HRESULT GetPeb(IN HANDLE Process,
  34. OUT PULONG64 Offset,
  35. OUT PULONG Size);
  36. };
  37. WinCeWin32LiveSystemProvider::WinCeWin32LiveSystemProvider(ULONG BuildNumber)
  38. : Win32LiveSystemProvider(VER_PLATFORM_WIN32_CE, BuildNumber)
  39. {
  40. }
  41. WinCeWin32LiveSystemProvider::~WinCeWin32LiveSystemProvider(void)
  42. {
  43. }
  44. void
  45. WinCeWin32LiveSystemProvider::Release(void)
  46. {
  47. delete this;
  48. }
  49. HRESULT
  50. WinCeWin32LiveSystemProvider::GetCurrentTimeDate(OUT PULONG TimeDate)
  51. {
  52. *TimeDate = (ULONG)time(NULL);
  53. return S_OK;
  54. }
  55. HRESULT
  56. WinCeWin32LiveSystemProvider::OpenThread(IN ULONG DesiredAccess,
  57. IN BOOL InheritHandle,
  58. IN ULONG ThreadId,
  59. OUT PHANDLE Handle)
  60. {
  61. if (m_OpenThread) {
  62. // OS supports regular Win32 OpenThread, so try it.
  63. *Handle = m_OpenThread(DesiredAccess, InheritHandle, ThreadId);
  64. if (*Handle) {
  65. return S_OK;
  66. }
  67. }
  68. // WinCE's "handles" and thread IDs are both just pointers
  69. // to the OS thread data.
  70. *Handle = (HANDLE)(ULONG_PTR)ThreadId;
  71. return S_OK;
  72. }
  73. HRESULT
  74. WinCeWin32LiveSystemProvider::GetTeb(IN HANDLE Thread,
  75. OUT PULONG64 Offset,
  76. OUT PULONG Size)
  77. {
  78. // WinCE doesn't have a TIB.
  79. *Offset = NULL;
  80. *Size = 0;
  81. return S_OK;
  82. }
  83. HRESULT
  84. WinCeWin32LiveSystemProvider::GetThreadInfo(IN HANDLE Process,
  85. IN HANDLE Thread,
  86. OUT PULONG64 Teb,
  87. OUT PULONG SizeOfTeb,
  88. OUT PULONG64 StackBase,
  89. OUT PULONG64 StackLimit,
  90. OUT PULONG64 StoreBase,
  91. OUT PULONG64 StoreLimit)
  92. {
  93. return E_NOTIMPL;
  94. }
  95. HRESULT
  96. WinCeWin32LiveSystemProvider::GetPeb(IN HANDLE Process,
  97. OUT PULONG64 Offset,
  98. OUT PULONG Size)
  99. {
  100. // WinCE doesn't have a PEB.
  101. *Offset = 0;
  102. *Size = 0;
  103. return S_OK;
  104. }
  105. Win32LiveSystemProvider*
  106. NewWinCeWin32LiveSystemProvider(ULONG BuildNumber)
  107. {
  108. return new WinCeWin32LiveSystemProvider(BuildNumber);
  109. }