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.

62 lines
1.6 KiB

  1. #include "windows.h"
  2. #include "stdio.h"
  3. #include <winioctl.h>
  4. #include <ntddjoy.h>
  5. #define JOYSTATVERSION "Analog JoyStat 7/5/96\n"
  6. int __cdecl main(int argc, char **argv) {
  7. HANDLE hJoy;
  8. ULONG nBytes;
  9. BOOL bRet;
  10. JOY_STATISTICS jStats, *pjStats;
  11. float fTotalErrors;
  12. int i;
  13. printf (JOYSTATVERSION);
  14. if ((hJoy = CreateFile(
  15. "\\\\.\\Joy1", // maybe this is right, from SidewndrCreateDevice
  16. GENERIC_READ | GENERIC_WRITE,
  17. 0,
  18. NULL,
  19. OPEN_EXISTING,
  20. FILE_ATTRIBUTE_NORMAL,
  21. NULL
  22. )) != ((HANDLE)-1)) {
  23. pjStats = &jStats;
  24. bRet = DeviceIoControl (
  25. hJoy,
  26. (DWORD) IOCTL_JOY_GET_STATISTICS, // instruction to execute
  27. pjStats, sizeof(JOY_STATISTICS), // buffer and size of buffer
  28. pjStats, sizeof(JOY_STATISTICS), // buffer and size of buffer
  29. &nBytes, 0);
  30. printf ("Version %d\n", pjStats->Version);
  31. printf ("NumberOfAxes %d\n", pjStats->NumberOfAxes);
  32. printf ("Frequency %d\n", pjStats->Frequency);
  33. printf ("dwQPCLatency %d\n", pjStats->dwQPCLatency);
  34. printf ("nQuiesceLoop %d\n", pjStats->nQuiesceLoop);
  35. printf ("PolledTooSoon %d\n", pjStats->PolledTooSoon);
  36. printf ("Polls %d\n", pjStats->Polls);
  37. printf ("Timeouts %d\n", pjStats->Timeouts);
  38. // Point proven. Be a nice program and close up shop.
  39. CloseHandle(hJoy);
  40. } else {
  41. printf("Can't get a handle to joystick\n");
  42. }
  43. return 1;
  44. }