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.

77 lines
1.5 KiB

  1. /*++
  2. Copyright (c) 1994 - 1995 Microsoft Corporation
  3. Module Name:
  4. Monitor.c
  5. Abstract:
  6. Test monitor installation
  7. Author:
  8. Revision History:
  9. --*/
  10. #define NOMINMAX
  11. #include <nt.h>
  12. #include <ntrtl.h>
  13. #include <nturtl.h>
  14. #include <windows.h>
  15. #include <setupapi.h>
  16. #include <winspool.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include "..\splsetup.h"
  20. int
  21. #if !defined(_MIPS_) && !defined(_ALPHA_) && !defined(_PPC_)
  22. _cdecl
  23. #endif
  24. main (argc, argv)
  25. int argc;
  26. char *argv[];
  27. {
  28. HANDLE h;
  29. DWORD dwLastError, dwNeeded, dwIndex;
  30. WCHAR szName[MAX_PATH];
  31. h = PSetupCreateMonitorInfo(0, FALSE);
  32. if ( !h ) {
  33. printf("%s: PSetupCreateMonitorInfo fails with %d\n",
  34. argv[0], GetLastError());
  35. return 0;
  36. }
  37. do {
  38. dwNeeded = MAX_PATH; // change in PSetupEnumMonitor to take char count instead of byte count
  39. for ( dwIndex = 0 ;
  40. PSetupEnumMonitor(h, dwIndex, szName, &dwNeeded) ;
  41. ++dwIndex ) {
  42. printf("%s: Monitor %ws\n", argv[0], szName);
  43. if ( !PSetupInstallMonitor(h, 0, szName) ) {
  44. printf("%s: PSetupInstallMonitor fails with %d for %ws\n",
  45. argv[0], GetLastError(), szName);
  46. }
  47. }
  48. dwLastError = GetLastError();
  49. } while ( dwLastError == ERROR_SUCCESS);
  50. printf("%s: Exiting because of last error %d\n", argv[0], GetLastError());
  51. if ( h )
  52. PSetupDestroyMonitorInfo(h);
  53. }