ddk.pas 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. {
  2. Driver Development Kit for Native NT
  3. This file is part of the Free Pascal run time library.
  4. Copyright (c) 2009 by Sven Barth
  5. See the file COPYING.FPC, included in this distribution,
  6. for details about the copyright.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  10. **********************************************************************}
  11. unit DDK;
  12. interface
  13. uses
  14. NDK;
  15. const
  16. // we distinguish the user- AND kernel-mode imports (NDK.ntdll) from the pure
  17. // kernel mode imports (ntkrnl)
  18. ntkrnl = 'ntoskrnl.exe';
  19. {$include ddktypes.inc}
  20. // these two only return not Nil in main routine of a device driver
  21. function RegistryPath: PNtUnicodeString; inline;
  22. function DriverObject: PDriverObject; inline;
  23. function DbgPrint(aFormat: PChar): LongWord; cdecl; varargs; external ntkrnl name 'DbgPrint';
  24. function PoolTag(aTag: TTagString): LongWord;
  25. {$include ddkex.inc}
  26. implementation
  27. function RegistryPath: PNtUnicodeString; inline;
  28. begin
  29. RegistryPath := SysRegistryPath;
  30. end;
  31. function DriverObject: PDriverObject; inline;
  32. begin
  33. DriverObject := SysDriverObject;
  34. end;
  35. function PoolTag(aTag: TTagString): LongWord;
  36. begin
  37. PoolTag := Ord(aTag[1]) + Ord(aTag[2]) shl 8 +
  38. Ord(aTag[3]) shl 16 + Ord(aTag[4]) shl 24;
  39. end;
  40. end.