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.

100 lines
5.3 KiB

  1. #include <nt.h>
  2. #include <ntrtl.h>
  3. #include <nturtl.h>
  4. #include <windows.h>
  5. #include <stdio.h>
  6. PRTL_EVENT_ID_INFO IopCreateFileEventId;
  7. int
  8. _cdecl
  9. main(
  10. int argc,
  11. char *argv[]
  12. )
  13. {
  14. char Buffer[ 80 ];
  15. PWSTR Pwstr = L"This is a PWSTR";
  16. UNICODE_STRING UnicodeString;
  17. ANSI_STRING AnsiString;
  18. RtlInitUnicodeString( &UnicodeString, L"This is a UNICODE_STRING" );
  19. printf( "Waiting for <Enter> to proceed..." );
  20. fflush( stdout );
  21. gets( Buffer );
  22. IopCreateFileEventId = RtlCreateEventId( NULL,
  23. 0,
  24. "CreateFile",
  25. RTL_EVENT_CLASS_IO,
  26. 9,
  27. RTL_EVENT_PUNICODE_STRING_PARAM, "FileName", 0,
  28. RTL_EVENT_FLAGS_PARAM, "", 13,
  29. GENERIC_READ, "GenericRead",
  30. GENERIC_WRITE, "GenericWrite",
  31. GENERIC_EXECUTE, "GenericExecute",
  32. GENERIC_ALL, "GenericAll",
  33. FILE_READ_DATA, "Read",
  34. FILE_WRITE_DATA, "Write",
  35. FILE_APPEND_DATA, "Append",
  36. FILE_EXECUTE, "Execute",
  37. FILE_READ_EA, "ReadEa",
  38. FILE_WRITE_EA, "WriteEa",
  39. FILE_DELETE_CHILD, "DeleteChild",
  40. FILE_READ_ATTRIBUTES, "ReadAttributes",
  41. FILE_WRITE_ATTRIBUTES, "WriteAttributes",
  42. RTL_EVENT_FLAGS_PARAM, "", 3,
  43. FILE_SHARE_READ, "ShareRead",
  44. FILE_SHARE_WRITE, "ShareWrite",
  45. FILE_SHARE_DELETE, "ShareDelete",
  46. RTL_EVENT_ENUM_PARAM, "", 5,
  47. FILE_SUPERSEDE, "Supersede",
  48. FILE_OPEN, "Open",
  49. FILE_CREATE, "Create",
  50. FILE_OPEN_IF, "OpenIf",
  51. FILE_OVERWRITE, "Overwrite",
  52. RTL_EVENT_FLAGS_PARAM, "", 15,
  53. FILE_DIRECTORY_FILE, "OpenDirectory",
  54. FILE_WRITE_THROUGH, "WriteThrough",
  55. FILE_SEQUENTIAL_ONLY, "Sequential",
  56. FILE_NO_INTERMEDIATE_BUFFERING, "NoBuffering",
  57. FILE_SYNCHRONOUS_IO_ALERT, "Synchronous",
  58. FILE_SYNCHRONOUS_IO_NONALERT, "SynchronousNoAlert",
  59. FILE_NON_DIRECTORY_FILE, "OpenNonDirectory",
  60. FILE_CREATE_TREE_CONNECTION, "CreateTreeConnect",
  61. FILE_COMPLETE_IF_OPLOCKED, "CompleteIfOpLocked",
  62. FILE_NO_EA_KNOWLEDGE, "NoEas",
  63. FILE_EIGHT_DOT_THREE_ONLY, "EightDot3",
  64. FILE_RANDOM_ACCESS, "Random",
  65. FILE_DELETE_ON_CLOSE, "DeleteOnClose",
  66. FILE_OPEN_BY_FILE_ID, "OpenById",
  67. FILE_OPEN_FOR_BACKUP_INTENT, "BackupIntent",
  68. RTL_EVENT_ENUM_PARAM, "", 2,
  69. 1, "NamedPiped",
  70. 2, "MailSlot",
  71. RTL_EVENT_ULONG_PARAM, "Handle", 0,
  72. RTL_EVENT_STATUS_PARAM, "", 0,
  73. RTL_EVENT_ENUM_PARAM, "", 6,
  74. FILE_SUPERSEDED, "Superseded",
  75. FILE_OPENED, "Opened",
  76. FILE_CREATED, "Created",
  77. FILE_OVERWRITTEN, "Truncated",
  78. FILE_EXISTS, "Exists",
  79. FILE_DOES_NOT_EXIST, "DoesNotExist"
  80. );
  81. RtlLogEvent( IopCreateFileEventId,
  82. &UnicodeString,
  83. GENERIC_READ | DELETE,
  84. FILE_SHARE_READ | FILE_SHARE_WRITE,
  85. FILE_CREATE,
  86. FILE_SYNCHRONOUS_IO_NONALERT | FILE_NON_DIRECTORY_FILE,
  87. 0,
  88. 0x24,
  89. STATUS_SUCCESS,
  90. FILE_CREATED
  91. );
  92. ExitProcess( 0x22 );
  93. }