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.

117 lines
2.3 KiB

  1. //Copyright (c) 1998 - 1999 Microsoft Corporation
  2. /*****************************************************************************
  3. *
  4. * DOSDEV.C for Windows NT
  5. *
  6. * Description:
  7. *
  8. * Query NT DOS Objects.
  9. *
  10. * Copyright Citrix Systems Inc. 1993-1995
  11. *
  12. * Author: Kurt Perry (adapted from bradp's dosdev utility).
  13. *
  14. * Log: See VLOG
  15. *
  16. ****************************************************************************/
  17. /*******************************************************************************
  18. *
  19. * dosdev utility (NT only)
  20. *
  21. * Brad Pedersen
  22. * August 10, 1993
  23. ******************************************************************************/
  24. /*
  25. * Includes
  26. */
  27. #include <stdio.h>
  28. #include <stdlib.h>
  29. #include <string.h>
  30. #include <malloc.h>
  31. #include <nt.h>
  32. #include <ntrtl.h>
  33. #include <nturtl.h>
  34. #include <windef.h>
  35. // #include <ntddkbd.h>
  36. // #include <ntddmou.h>
  37. // #include <ntddbeep.h>
  38. // #include <ntddvdeo.h>
  39. #include <winstaw.h>
  40. #include <ntcsrsrv.h>
  41. #include <windows.h>
  42. #include "qobject.h"
  43. #define MAXBUFFER (1024 * 2)
  44. WCHAR Name[ MAXBUFFER ];
  45. WCHAR Info[ MAXBUFFER ];
  46. /*
  47. * Procedure prototypes
  48. */
  49. void display_devices( void );
  50. void display_one( WCHAR * );
  51. void Print( int nResourceID, ... );
  52. /*******************************************************************************
  53. *
  54. * display_devices
  55. *
  56. ******************************************************************************/
  57. void
  58. display_devices()
  59. {
  60. WCHAR * pName;
  61. /*
  62. * Get complete device list
  63. */
  64. if ( !QueryDosDevice( NULL, Name, MAXBUFFER ) ) {
  65. Print(IDS_ERROR_TOO_MANY_DEVICES);
  66. return;
  67. }
  68. /*
  69. * Display each device name in list
  70. */
  71. pName = Name;
  72. while ( *pName ) {
  73. display_one( pName );
  74. pName += (wcslen( pName ) + 1);
  75. }
  76. }
  77. /*******************************************************************************
  78. *
  79. * display_one
  80. *
  81. ******************************************************************************/
  82. void
  83. display_one( WCHAR * pName )
  84. {
  85. WCHAR * pInfo;
  86. /*
  87. * Get additional information on device name
  88. */
  89. if ( !QueryDosDevice( pName, Info, MAXBUFFER ) )
  90. return;
  91. wprintf( L"%-17s", pName );
  92. pInfo = Info;
  93. while ( *pInfo ) {
  94. wprintf( L"%s ", pInfo );
  95. pInfo += (wcslen( pInfo ) + 1);
  96. }
  97. wprintf( L"\n" );
  98. }