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.

97 lines
3.0 KiB

  1. /***************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. Dot4Usb.sys - Lower Filter Driver for Dot4.sys for USB connected
  5. IEEE 1284.4 devices.
  6. File Name:
  7. Test.c
  8. Abstract:
  9. Test/Diagnostic/Experimentation routines - These routines are NOT
  10. required for the normal operation of the driver.
  11. Environment:
  12. Kernel mode only
  13. Notes:
  14. THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY
  15. KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
  16. IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR
  17. PURPOSE.
  18. Copyright (c) 2000 Microsoft Corporation. All Rights Reserved.
  19. Revision History:
  20. 01/18/2000 : created
  21. Author(s):
  22. Doug Fritz (DFritz)
  23. Joby Lafky (JobyL)
  24. ****************************************************************************/
  25. #include "pch.h"
  26. VOID
  27. TestEventLog(
  28. IN PDEVICE_OBJECT DevObj
  29. )
  30. /*
  31. Demonstrate Event log usage - entries are made up using unique values
  32. to make it easier to determine the corresponding offsets in the event
  33. log entry "Data:" section. Sample event log entry resulting from this
  34. call was:
  35. ----
  36. Event Type: Information
  37. Event Source: dot4usb
  38. Event Category: None
  39. Event ID: 16
  40. Date: 1/17/2000
  41. Time: 3:04:34 PM
  42. User: N/A
  43. Computer: DFRITZ3DJ
  44. Description:
  45. Dot4Usb AddDevice - test event log message <ThisIsMsgForParam2> <ThisIsMsgForParam3>.
  46. Data:
  47. 0000: 00040109 00580003 00000000 40070010
  48. 0010: 00000017 c0000022 00000005 00000000
  49. 0020: 98762222 abcd1111 12345678
  50. ----
  51. A recommended place to call this from is from AddDevice
  52. */
  53. {
  54. WCHAR msg[] = L"ThisIsMsgForParam2\0ThisIsMsgForParam3";
  55. PIO_ERROR_LOG_PACKET log = IoAllocateErrorLogEntry( DevObj, sizeof(IO_ERROR_LOG_PACKET)+sizeof(msg) );
  56. if( log ) {
  57. log->MajorFunctionCode = (UCHAR) IRP_MJ_FLUSH_BUFFERS; // 9
  58. log->RetryCount = (UCHAR) 1;
  59. log->DumpDataSize = (USHORT)4;
  60. log->NumberOfStrings = (USHORT)2;
  61. log->StringOffset = (USHORT)sizeof(IO_ERROR_LOG_PACKET);
  62. log->EventCategory = (USHORT)0;
  63. log->ErrorCode = (NTSTATUS)D4U_ADDDEV; // IO_ERR_xxx - 0x40070010
  64. log->UniqueErrorValue = (ULONG)0x17; // made up
  65. log->FinalStatus = (NTSTATUS)STATUS_ACCESS_DENIED; // 0xC0000022 - easy to remember
  66. log->SequenceNumber = (ULONG)5; // made up
  67. log->IoControlCode = (ULONG)0;
  68. log->DeviceOffset.HighPart = 0xabcd1111;
  69. log->DeviceOffset.LowPart = 0x98762222;
  70. log->DumpData[0] = 0x12345678;
  71. RtlCopyMemory( (PCHAR)log + sizeof(IO_ERROR_LOG_PACKET), msg, sizeof(msg));
  72. IoWriteErrorLogEntry( log );
  73. }
  74. }