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.

115 lines
3.2 KiB

  1. /*++
  2. Copyright (c) 1998-2000 Microsoft Corporation
  3. Module Name:
  4. thnkhlpr.h
  5. Abstract:
  6. Header for thunk helper functions.
  7. Author:
  8. 19-Jul-1998 BarryBo
  9. Revision History:
  10. --*/
  11. // Determines if a pointer points to a item or is a special value.
  12. // If it is a special value it should be copied without dereferencing.
  13. #define WOW64_ISPTR(a) ((void *)a != NULL)
  14. //
  15. // Helper thunk functions called by all the thunks to thunk common types.
  16. //
  17. NT32SIZE_T*
  18. Wow64ShallowThunkSIZE_T64TO32(
  19. OUT NT32SIZE_T *dst,
  20. IN PSIZE_T src
  21. );
  22. PSIZE_T
  23. Wow64ShallowThunkSIZE_T32TO64(
  24. OUT PSIZE_T dst,
  25. IN NT32SIZE_T *src
  26. );
  27. #define Wow64ThunkSIZE_T32TO64(src) \
  28. (SIZE_T)(src)
  29. #define Wow64ThunkSIZE_T64TO32(src) \
  30. (NT32SIZE_T)min((src), 0xFFFFFFFF)
  31. #define Wow64ShallowThunkUnicodeString32TO64(dst, src) \
  32. ((PUNICODE_STRING)(dst))->Length = ((NT32UNICODE_STRING *)(src))->Length; \
  33. ((PUNICODE_STRING)(dst))->MaximumLength = ((NT32UNICODE_STRING *)(src))->MaximumLength; \
  34. ((PUNICODE_STRING)(dst))->Buffer = (PWSTR)((NT32UNICODE_STRING *)(src))->Buffer;
  35. #define Wow64ShallowThunkUnicodeString64TO32(dst, src) \
  36. ((NT32UNICODE_STRING *)(dst))->Length = ((PUNICODE_STRING)(src))->Length; \
  37. ((NT32UNICODE_STRING *)(dst))->MaximumLength = ((PUNICODE_STRING)(src))->MaximumLength; \
  38. ((NT32UNICODE_STRING *)(dst))->Buffer = (NT32PWSTR)((PUNICODE_STRING)(src))->Buffer;
  39. #define Wow64ShallowThunkAllocUnicodeString32TO64(src) \
  40. Wow64ShallowThunkAllocUnicodeString32TO64_FNC((NT32UNICODE_STRING *)(src))
  41. PUNICODE_STRING
  42. Wow64ShallowThunkAllocUnicodeString32TO64_FNC(
  43. IN NT32UNICODE_STRING *src
  44. );
  45. #define Wow64ShallowThunkAllocSecurityDescriptor32TO64(src) \
  46. Wow64ShallowThunkAllocSecurityDescriptor32TO64_FNC((NT32SECURITY_DESCRIPTOR *)(src))
  47. PSECURITY_DESCRIPTOR
  48. Wow64ShallowThunkAllocSecurityDescriptor32TO64_FNC(
  49. IN NT32SECURITY_DESCRIPTOR *src
  50. );
  51. #define Wow64ShallowThunkAllocSecurityTokenProxyData32TO64(src) \
  52. Wow64ShallowThunkAllocSecurityTokenProxyData32TO64_FNC((NT32SECURITY_TOKEN_PROXY_DATA *)(src))
  53. PSECURITY_TOKEN_PROXY_DATA
  54. Wow64ShallowThunkAllocSecurityTokenProxyData32TO64_FNC(
  55. IN NT32SECURITY_TOKEN_PROXY_DATA *src
  56. );
  57. #define Wow64ShallowThunkAllocSecurityQualityOfService32TO64(src) \
  58. Wow64ShallowThunkAllocSecurityQualityOfService32TO64_FNC((NT32SECURITY_QUALITY_OF_SERVICE *)(src))
  59. PSECURITY_QUALITY_OF_SERVICE
  60. Wow64ShallowThunkAllocSecurityQualityOfService32TO64_FNC(
  61. IN NT32SECURITY_QUALITY_OF_SERVICE *src
  62. );
  63. #define Wow64ShallowThunkAllocObjectAttributes32TO64(src) \
  64. Wow64ShallowThunkAllocObjectAttributes32TO64_FNC((NT32OBJECT_ATTRIBUTES *)(src))
  65. POBJECT_ATTRIBUTES
  66. Wow64ShallowThunkAllocObjectAttributes32TO64_FNC(
  67. IN NT32OBJECT_ATTRIBUTES *src
  68. );
  69. ULONG
  70. Wow64ThunkAffinityMask64TO32(
  71. IN ULONG_PTR Affinity64
  72. );
  73. ULONG_PTR
  74. Wow64ThunkAffinityMask32TO64(
  75. IN ULONG Affinity32
  76. );
  77. VOID WriteReturnLengthSilent(PULONG ReturnLength, ULONG Length);
  78. VOID WriteReturnLengthStatus(PULONG ReturnLength, NTSTATUS *pStatus, ULONG Length);
  79. VOID
  80. Wow64RedirectFileName(
  81. IN OUT WCHAR *Name,
  82. IN OUT ULONG *Length
  83. );