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.

209 lines
4.4 KiB

  1. /*++
  2. Copyright (c) 1998 Microsoft Corporation
  3. Module Name:
  4. migrate.h
  5. Environment:
  6. WIN32 User Mode
  7. --*/
  8. #include <windows.h>
  9. #include <tchar.h>
  10. #include <setupapi.h>
  11. #include <ole2.h>
  12. #include <cfgmgr32.h>
  13. #include <devguid.h>
  14. #include <debug.h>
  15. #include "..\common\deskcmmn.h"
  16. #define STRSAFE_LIB
  17. #include <strsafe.h>
  18. #define VU_ATTACHED_TO_DESKTOP 0x00000001
  19. #define VU_RELATIVE_X 0x00000002
  20. #define VU_RELATIVE_Y 0x00000004
  21. #define VU_BITS_PER_PEL 0x00000008
  22. #define VU_X_RESOLUTION 0x00000010
  23. #define VU_Y_RESOLUTION 0x00000020
  24. #define VU_VREFRESH 0x00000040
  25. #define VU_FLAGS 0x00000080
  26. #define VU_HW_ACCELERATION 0x00000100
  27. #define VU_PRUNING_MODE 0x00000200
  28. typedef struct _VU_LOGICAL_DEVICE {
  29. struct _VU_LOGICAL_DEVICE *pNextLogicalDevice;
  30. DWORD DeviceX;
  31. DWORD ValidFields;
  32. DWORD AttachedToDesktop;
  33. DWORD RelativeX;
  34. DWORD RelativeY;
  35. DWORD BitsPerPel;
  36. DWORD XResolution;
  37. DWORD YResolution;
  38. DWORD VRefresh;
  39. DWORD Flags;
  40. DWORD HwAcceleration;
  41. DWORD PruningMode;
  42. } VU_LOGICAL_DEVICE, *PVU_LOGICAL_DEVICE;
  43. typedef struct _VU_PHYSICAL_DEVICE {
  44. struct _VU_PHYSICAL_DEVICE *pNextPhysicalDevice;
  45. PVU_LOGICAL_DEVICE pFirstLogicalDevice;
  46. DWORD CountOfLogicalDevices;
  47. DWORD Legacy;
  48. DWORD BusNumber;
  49. DWORD Address;
  50. } VU_PHYSICAL_DEVICE, *PVU_PHYSICAL_DEVICE;
  51. typedef CMAPI CONFIGRET (WINAPI *PFN_CM_LOCATE_DEVNODE)(
  52. OUT PDEVINST pdnDevInst,
  53. IN DEVINSTID pDeviceID, OPTIONAL
  54. IN ULONG ulFlags
  55. );
  56. typedef BOOL (WINAPI *PFN_SETUP_DI_ENUM_DEVICES_INTERFACES)(
  57. IN HDEVINFO DeviceInfoSet,
  58. IN PSP_DEVINFO_DATA DeviceInfoData, OPTIONAL
  59. IN CONST GUID *InterfaceClassGuid,
  60. IN DWORD MemberIndex,
  61. OUT PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData
  62. );
  63. typedef BOOL (WINAPI *PFN_SETUP_DI_GET_DEVICE_INTERFACE_DETAIL)(
  64. IN HDEVINFO DeviceInfoSet,
  65. IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
  66. OUT PSP_DEVICE_INTERFACE_DETAIL_DATA DeviceInterfaceDetailData, OPTIONAL
  67. IN DWORD DeviceInterfaceDetailDataSize,
  68. OUT PDWORD RequiredSize, OPTIONAL
  69. OUT PSP_DEVINFO_DATA DeviceInfoData OPTIONAL
  70. );
  71. typedef HKEY (WINAPI *PFN_SETUP_DI_CREATE_DEVICE_INTERFACE_REG_KEY)(
  72. IN HDEVINFO DeviceInfoSet,
  73. IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
  74. IN DWORD Reserved,
  75. IN REGSAM samDesired,
  76. IN HINF InfHandle, OPTIONAL
  77. IN PCTSTR InfSectionName OPTIONAL
  78. );
  79. typedef HKEY (WINAPI *PFN_SETUP_DI_OPEN_DEVICE_INTERFACE_REG_KEY)(
  80. IN HDEVINFO DeviceInfoSet,
  81. IN PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData,
  82. IN DWORD Reserved,
  83. IN REGSAM samDesired
  84. );
  85. typedef HKEY (WINAPI *PFN_SETUP_DI_CREATE_DEVICE_INTERFACE)(
  86. IN HDEVINFO DeviceInfoSet,
  87. IN PSP_DEVINFO_DATA DeviceInfoData,
  88. IN CONST GUID *InterfaceClassGuid,
  89. IN PCTSTR ReferenceString, OPTIONAL
  90. IN DWORD CreationFlags,
  91. OUT PSP_DEVICE_INTERFACE_DATA DeviceInterfaceData OPTIONAL
  92. );
  93. VOID
  94. SaveOsInfo(
  95. HKEY hKey,
  96. POSVERSIONINFO posVer
  97. );
  98. VOID
  99. SaveLegacyDriver(
  100. HKEY hKey
  101. );
  102. VOID
  103. SaveNT4Services(
  104. HKEY hKey
  105. );
  106. VOID
  107. SaveAppletExtensions(
  108. HKEY hKey
  109. );
  110. BOOL
  111. SaveDisplaySettings(
  112. HKEY hKey,
  113. POSVERSIONINFO posVer
  114. );
  115. VOID
  116. CollectDisplaySettings(
  117. PVU_PHYSICAL_DEVICE* ppPhysicalDevice
  118. );
  119. VOID
  120. LegacyCollectDisplaySettings(
  121. PVU_PHYSICAL_DEVICE* ppPhysicalDevice
  122. );
  123. BOOL
  124. WriteDisplaySettingsToRegistry(
  125. HKEY hKey,
  126. PVU_PHYSICAL_DEVICE pPhysicalDevice
  127. );
  128. BOOL
  129. InsertNode(
  130. PVU_PHYSICAL_DEVICE* ppPhysicalDevice,
  131. PVU_LOGICAL_DEVICE pLogicalDevice,
  132. DWORD Legacy,
  133. DWORD BusNumber,
  134. DWORD Address
  135. );
  136. VOID
  137. FreeAllNodes(
  138. PVU_PHYSICAL_DEVICE pPhysicalDevice
  139. );
  140. BOOL
  141. GetDevInfoData(
  142. IN LPTSTR pDeviceKey,
  143. OUT HDEVINFO* phDevInfo,
  144. OUT PSP_DEVINFO_DATA pDevInfo
  145. );
  146. BOOL
  147. GetDevInfoDataFromInterfaceName(
  148. IN LPWSTR pwInterfaceName,
  149. OUT HDEVINFO* phDevInfo,
  150. OUT PSP_DEVINFO_DATA pDevInfo
  151. );
  152. BOOL
  153. GetDevInfoDataFromInstanceID(
  154. IN LPWSTR pwInstanceID,
  155. OUT HDEVINFO* phDevInfo,
  156. OUT PSP_DEVINFO_DATA pDevInfo
  157. );
  158. BOOL
  159. DeleteKeyAndSubkeys(
  160. HKEY hKey,
  161. LPCTSTR lpSubKey
  162. );