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.

111 lines
3.7 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. #define SPLIT_COMMAND_SEP TEXT(":=") // whole word, indicates end of id's
  40. void FormatToStream(FILE * stream,DWORD fmt,...);
  41. void Padding(int pad);
  42. bool SplitCommandLine(int & argc,LPTSTR * & argv,int & argc_right,LPTSTR * & argv_right);
  43. int EnumerateDevices(LPCTSTR BaseName,LPCTSTR Machine,DWORD Flags,int argc,LPTSTR argv[],CallbackFunc Callback,LPVOID Context);
  44. LPTSTR GetDeviceStringProperty(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo,DWORD Prop);
  45. LPTSTR GetDeviceDescription(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  46. LPTSTR * GetDevMultiSz(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo,DWORD Prop);
  47. LPTSTR * GetRegMultiSz(HKEY hKey,LPCTSTR Val);
  48. LPTSTR * GetMultiSzIndexArray(LPTSTR MultiSz);
  49. void DelMultiSz(LPTSTR * Array);
  50. LPTSTR * CopyMultiSz(LPTSTR * Array);
  51. BOOL DumpArray(int pad,LPTSTR * Array);
  52. BOOL DumpDevice(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  53. BOOL DumpDeviceClass(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  54. BOOL DumpDeviceDescr(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  55. BOOL DumpDeviceStatus(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  56. BOOL DumpDeviceResources(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  57. BOOL DumpDeviceDriverFiles(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  58. BOOL DumpDeviceDriverNodes(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  59. BOOL DumpDeviceHwIds(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  60. BOOL DumpDeviceWithInfo(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo,LPCTSTR Info);
  61. BOOL DumpDeviceStack(HDEVINFO Devs,PSP_DEVINFO_DATA DevInfo);
  62. BOOL Reboot();
  63. //
  64. // UpdateDriverForPlugAndPlayDevices
  65. //
  66. typedef BOOL (WINAPI *UpdateDriverForPlugAndPlayDevicesProto)(HWND hwndParent,
  67. LPCTSTR HardwareId,
  68. LPCTSTR FullInfPath,
  69. DWORD InstallFlags,
  70. PBOOL bRebootRequired OPTIONAL
  71. );
  72. typedef BOOL (WINAPI *SetupSetNonInteractiveModeProto)(IN BOOL NonInteractiveFlag
  73. );
  74. #ifdef _UNICODE
  75. #define UPDATEDRIVERFORPLUGANDPLAYDEVICES "UpdateDriverForPlugAndPlayDevicesW"
  76. #else
  77. #define UPDATEDRIVERFORPLUGANDPLAYDEVICES "UpdateDriverForPlugAndPlayDevicesA"
  78. #endif
  79. #define SETUPSETNONINTERACTIVEMODE "SetupSetNonInteractiveMode"
  80. //
  81. // exit codes
  82. //
  83. #define EXIT_OK (0)
  84. #define EXIT_REBOOT (1)
  85. #define EXIT_FAIL (2)
  86. #define EXIT_USAGE (3)