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.

102 lines
3.1 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. devcon.h
  5. Abstract:
  6. Device Console header
  7. @@BEGIN_DDKSPLIT
  8. Author:
  9. Jamie Hunter (JamieHun) Nov-30-2000
  10. Revision History:
  11. @@END_DDKSPLIT
  12. --*/
  13. #include <windows.h>
  14. #include <tchar.h>
  15. #include <stdlib.h>
  16. #include <stdio.h>
  17. #include <setupapi.h>
  18. #include <regstr.h>
  19. #include <cfgmgr32.h>
  20. #include <string.h>
  21. #include <malloc.h>
  22. #include <newdev.h>
  23. #include "msg.h"
  24. #include "rc_ids.h"
  25. typedef int (*DispatchFunc)(LPCTSTR BaseName,LPCTSTR Machine,int argc,LPTSTR argv[]);
  26. typedef int (*CallbackFunc)(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo,DWORD Index,LPVOID Context);
  27. typedef struct {
  28. LPCTSTR cmd;
  29. DispatchFunc func;
  30. DWORD shortHelp;
  31. DWORD longHelp;
  32. } DispatchEntry;
  33. extern DispatchEntry DispatchTable[];
  34. #define ARRAYSIZE(x) (sizeof(x)/sizeof(x[0]))
  35. #define INSTANCEID_PREFIX_CHAR TEXT('@') // character used to prefix instance ID's
  36. #define CLASS_PREFIX_CHAR TEXT('=') // character used to prefix class name
  37. #define WILD_CHAR TEXT('*') // wild character
  38. #define QUOTE_PREFIX_CHAR TEXT('\'') // prefix character to ignore wild characters
  39. void FormatToStream(FILE * stream,DWORD fmt,...);
  40. void Padding(int pad);
  41. int EnumerateDevices(LPCTSTR BaseName,LPCTSTR Machine,DWORD Flags,int argc,LPTSTR argv[],CallbackFunc Callback,LPVOID Context);
  42. LPTSTR GetDeviceStringProperty(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo,DWORD Prop);
  43. LPTSTR GetDeviceDescription(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  44. LPTSTR * GetDevMultiSz(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo,DWORD Prop);
  45. LPTSTR * GetRegMultiSz(HKEY hKey,LPCTSTR Val);
  46. void DelMultiSz(LPTSTR * Array);
  47. BOOL DumpDevice(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  48. BOOL DumpDeviceClass(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  49. BOOL DumpDeviceDescr(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  50. BOOL DumpDeviceStatus(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  51. BOOL DumpDeviceResources(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  52. BOOL DumpDeviceDriverFiles(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  53. BOOL DumpDeviceDriverNodes(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  54. BOOL DumpDeviceHwIds(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  55. BOOL DumpDeviceWithInfo(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo,LPCTSTR Info);
  56. BOOL DumpDeviceStack(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  57. BOOL Reboot();
  58. //
  59. // UpdateDriverForPlugAndPlayDevices
  60. //
  61. typedef BOOL (WINAPI *UpdateDriverForPlugAndPlayDevicesProto)(HWND hwndParent,
  62. LPCTSTR HardwareId,
  63. LPCTSTR FullInfPath,
  64. DWORD InstallFlags,
  65. PBOOL bRebootRequired OPTIONAL
  66. );
  67. #ifdef _UNICODE
  68. #define UPDATEDRIVERFORPLUGANDPLAYDEVICES "UpdateDriverForPlugAndPlayDevicesW"
  69. #else
  70. #define UPDATEDRIVERFORPLUGANDPLAYDEVICES "UpdateDriverForPlugAndPlayDevicesA"
  71. #endif
  72. //
  73. // exit codes
  74. //
  75. #define EXIT_OK (0)
  76. #define EXIT_REBOOT (1)
  77. #define EXIT_FAIL (2)
  78. #define EXIT_USAGE (3)