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.

52 lines
976 B

  1. #include <string.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4. #include <time.h>
  5. #include "windows.h"
  6. #define FAILURE(e) printf("FAIL: %d/%d\n",e,__LINE__);exit(1)
  7. int __cdecl main(int argc,char *argv[]) {
  8. HANDLE hFile;
  9. DWORD junk;
  10. char *myPort = "COM1";
  11. if (argc > 1) {
  12. myPort = argv[1];
  13. }
  14. if ((hFile = CreateFile(
  15. myPort,
  16. GENERIC_READ | GENERIC_WRITE,
  17. 0,
  18. NULL,
  19. CREATE_ALWAYS,
  20. FILE_ATTRIBUTE_NORMAL,
  21. NULL
  22. )) != ((HANDLE)-1)) {
  23. if (!DeviceIoControl(
  24. hFile,
  25. 0x001b004c,
  26. NULL,
  27. 0,
  28. NULL,
  29. 0,
  30. &junk,
  31. NULL
  32. )) {
  33. FAILURE(GetLastError());
  34. }
  35. } else {
  36. FAILURE(GetLastError());
  37. }
  38. }