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.

85 lines
3.8 KiB

  1. #if !defined(FUSION_INC_FUSIONNTDLL_H_INCLUDED_)
  2. #define FUSION_INC_FUSIONNTDLL_H_INCLUDED_
  3. #pragma once
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #endif
  7. #if !defined(FUSION_STATIC_NTDLL)
  8. #if FUSION_WIN
  9. #define FUSION_STATIC_NTDLL 1
  10. #else
  11. #define FUSION_STATIC_NTDLL 0
  12. #endif // FUSION_WIN
  13. #endif // !defined(FUSION_STATIC_NTDLL)
  14. void
  15. FusionpInitializeNTDLLPtr(
  16. PVOID *ppfn,
  17. PCSTR szFunctionName
  18. );
  19. #define FUSION_NTDLL_RETURN_VOID /* nothing */
  20. #define FUSION_NTDLL_RETURN_NTSTATUS return
  21. #define FUSION_NTDLL_RETURN_WCHAR return
  22. #define FUSION_NTDLL_RETURN_LONG return
  23. #define FUSION_NTDLL_RETURN_ULONG return
  24. #define FUSION_NTDLL_RETURN_DWORD return
  25. #define FUSION_NTDLL_RETURN_ULONG return
  26. #if defined(__cplusplus)
  27. #define FUSION_NTDLL_INLINE inline
  28. #else
  29. #define FUSION_NTDLL_INLINE __inline
  30. #endif
  31. #if FUSION_STATIC_NTDLL
  32. #define FUSION_WRAP_NTDLL_FN(_rt, _api, _ai, _ao) FUSION_NTDLL_INLINE _rt Fusionp ## _api _ai { FUSION_NTDLL_RETURN_ ## _rt _api _ao; }
  33. #else
  34. #define FUSION_WRAP_NTDLL_FN(_rt, _api, _ai, _ao) \
  35. extern _rt (NTAPI * g_Fusionp ## _api) _ai; \
  36. FUSION_NTDLL_INLINE _rt Fusionp ## _api _ai { FUSION_NTDLL_RETURN_ ## _rt (*g_Fusionp ## _api) _ao; }
  37. #endif
  38. FUSION_WRAP_NTDLL_FN(WCHAR, RtlUpcaseUnicodeChar, (WCHAR wch), (wch))
  39. FUSION_WRAP_NTDLL_FN(WCHAR, RtlDowncaseUnicodeChar, (WCHAR wch), (wch))
  40. FUSION_WRAP_NTDLL_FN(ULONG, vDbgPrintExWithPrefix, (PCSTR Prefix, ULONG ComponentId, ULONG Level, PCSTR Format, va_list arglist), ((PCH) Prefix, ComponentId, Level, (PCH) Format, arglist))
  41. FUSION_WRAP_NTDLL_FN(DWORD, RtlNtStatusToDosError, (NTSTATUS st), (st))
  42. FUSION_WRAP_NTDLL_FN(NTSTATUS, RtlHashUnicodeString, (PCUNICODE_STRING String, BOOLEAN CaseInSensitive, ULONG HashAlgorithm, PULONG HashValue), (String, CaseInSensitive, HashAlgorithm, HashValue))
  43. FUSION_WRAP_NTDLL_FN(NTSTATUS, RtlExpandEnvironmentStrings_U, (PVOID Environment, PUNICODE_STRING Source, PUNICODE_STRING Destination, PULONG ReturnedLength), (Environment, Source, Destination, ReturnedLength))
  44. FUSION_WRAP_NTDLL_FN(NTSTATUS, NtQueryDebugFilterState, (ULONG ComponentId, ULONG Level), (ComponentId, Level))
  45. FUSION_WRAP_NTDLL_FN(LONG, RtlCompareUnicodeString, (PCUNICODE_STRING String1, PCUNICODE_STRING String2, BOOLEAN CaseInSensitive), ((PUNICODE_STRING) String1, (PUNICODE_STRING) String2, CaseInSensitive));
  46. FUSION_WRAP_NTDLL_FN(LONG, RtlUnhandledExceptionFilter, (struct _EXCEPTION_POINTERS *ExceptionInfo), (ExceptionInfo))
  47. FUSION_WRAP_NTDLL_FN(NTSTATUS, NtAllocateLocallyUniqueId, (PLUID Luid), (Luid))
  48. FUSION_WRAP_NTDLL_FN(NTSTATUS, LdrLockLoaderLock, (IN ULONG Flags, OUT ULONG *Disposition OPTIONAL, OUT PVOID *Cookie), (Flags, Disposition, Cookie))
  49. FUSION_WRAP_NTDLL_FN(NTSTATUS, LdrUnlockLoaderLock, (IN ULONG Flags, IN OUT PVOID Cookie), (Flags, Cookie))
  50. FUSION_WRAP_NTDLL_FN(VOID, RtlAcquirePebLock, (VOID), ())
  51. FUSION_WRAP_NTDLL_FN(VOID, RtlReleasePebLock, (VOID), ())
  52. #if DBG
  53. FUSION_WRAP_NTDLL_FN(VOID, RtlAssert, (PVOID FailedAssertion, PVOID FileName, ULONG LineNumber, PCSTR Message), (FailedAssertion, FileName, LineNumber, (PCHAR) Message))
  54. #endif // DBG
  55. FUSION_NTDLL_INLINE ULONG FusionpDbgPrint(PCSTR Format, ...) { ULONG uRetVal; va_list ap; va_start(ap, Format); uRetVal = FusionpvDbgPrintExWithPrefix("", DPFLTR_FUSION_ID, 0, Format, ap); va_end(ap); return uRetVal; }
  56. #if !FUSION_STATIC_NTDLL
  57. FUSION_NTDLL_INLINE void FusionpRtlInitUnicodeString(PUNICODE_STRING ntstr, PCWSTR str)
  58. {
  59. USHORT Length;
  60. ntstr->Buffer = (PWSTR)str;
  61. Length = (USHORT)(wcslen(str) * sizeof(WCHAR));
  62. ntstr->Length = Length;
  63. ntstr->MaximumLength = Length + sizeof(WCHAR);
  64. }
  65. #else
  66. #define FusionpRtlInitUnicodeString RtlInitUnicodeString
  67. #endif
  68. #ifdef __cplusplus
  69. }
  70. #endif
  71. #endif // FUSION_INC_FUSIONNTDLL_H_INCLUDED_