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.

83 lines
1.9 KiB

  1. #include <stdarg.h>
  2. #include <stdio.h>
  3. //#include <windows.h>
  4. #include<nt.h>
  5. #include<ntrtl.h>
  6. #include<nturtl.h>
  7. #include<stdlib.h>
  8. #include<string.h>
  9. #include<ctype.h>
  10. #include<stdarg.h>
  11. #include<tchar.h>
  12. #include<windows.h>
  13. #include <wmium.h>
  14. #include <tcguid.h>
  15. #include <netevent.h>
  16. VOID
  17. SendPschedIoctl(
  18. )
  19. /*++
  20. Routine Description:
  21. Does device i/o control with the driver for IOCTL_PSCHED_ZAW_EVENT. This kicks psched to read the registry.
  22. Arguments:
  23. None.
  24. Return Value:
  25. None.
  26. --*/
  27. {
  28. HANDLE PschedDriverHandle;
  29. ULONG BytesReturned;
  30. BOOL IOStatus;
  31. #define DriverName TEXT("\\\\.\\PSCHED")
  32. #define IOCTL_PSCHED_ZAW_EVENT CTL_CODE( \
  33. FILE_DEVICE_NETWORK, \
  34. 20, \
  35. METHOD_BUFFERED, \
  36. FILE_ANY_ACCESS \
  37. )
  38. PschedDriverHandle = CreateFile(
  39. DriverName,
  40. GENERIC_READ | GENERIC_WRITE,
  41. FILE_SHARE_READ | FILE_SHARE_WRITE,
  42. NULL,
  43. OPEN_EXISTING,
  44. FILE_ATTRIBUTE_NORMAL | FILE_FLAG_OVERLAPPED,
  45. NULL
  46. );
  47. if (PschedDriverHandle != INVALID_HANDLE_VALUE) {
  48. IOStatus = DeviceIoControl(
  49. PschedDriverHandle,
  50. IOCTL_PSCHED_ZAW_EVENT,
  51. NULL,
  52. 0,
  53. NULL,
  54. 0,
  55. &BytesReturned,
  56. NULL
  57. );
  58. printf("Configured psched with status %x \n", IOStatus);
  59. CloseHandle(PschedDriverHandle);
  60. }
  61. }
  62. int _cdecl main()
  63. {
  64. SendPschedIoctl();
  65. return 0;
  66. }