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.

63 lines
1.4 KiB

  1. #include "windows.h"
  2. #include <stdio.h>
  3. #include <stddef.h>
  4. #include <stdlib.h>
  5. void __cdecl main(int argc,char *argv[]) {
  6. DCB NewDCB;
  7. COMMTIMEOUTS To = {0};
  8. char firstString[] = "1200,n,8,1";
  9. char secondString[] = "COM1 1200,n,8,1";
  10. char thirdString[] = "HOST1 1200,8,N,1";
  11. char fourthString[] = "COM1:1200,n,8,1";
  12. char fifthString[] = "COM1: baud=9600 TO=ON";
  13. printf("About to do %s\n",&firstString[0]);
  14. if (!BuildCommDCB(
  15. &firstString[0],
  16. &NewDCB
  17. )) {
  18. printf("Bad BuildDCB: %d\n",GetLastError());
  19. }
  20. printf("About to do %s\n",&secondString[0]);
  21. if (!BuildCommDCB(
  22. &secondString[0],
  23. &NewDCB
  24. )) {
  25. printf("Bad BuildDCB: %d\n",GetLastError());
  26. }
  27. printf("About to do %s\n",&thirdString[0]);
  28. if (!BuildCommDCB(
  29. &thirdString[0],
  30. &NewDCB
  31. )) {
  32. printf("Bad BuildDCB: %d\n",GetLastError());
  33. }
  34. printf("About to do %s\n",&fourthString[0]);
  35. if (!BuildCommDCB(
  36. &fourthString[0],
  37. &NewDCB
  38. )) {
  39. printf("Bad BuildDCB: %d\n",GetLastError());
  40. }
  41. printf("About to do %s\n",&fifthString[0]);
  42. if (!BuildCommDCBAndTimeouts(
  43. &fifthString[0],
  44. &NewDCB,
  45. &To
  46. )) {
  47. printf("Bad BuildDCB: %d\n",GetLastError());
  48. }
  49. }