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.

299 lines
6.1 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All Rights Reserved.
  3. Module Name:
  4. msoobcip.h
  5. Abstract:
  6. Exception Pack installer helper DLL
  7. Can be used as a co-installer, or called via setup app, or RunDll32 stub
  8. This DLL is for internal distribution of exception packs to update
  9. OS components.
  10. Author:
  11. Jamie Hunter (jamiehun) 2001-11-27
  12. Revision History:
  13. Jamie Hunter (jamiehun) 2001-11-27
  14. Initial Version
  15. --*/
  16. #define _SETUPAPI_VER 0x0500
  17. #include <windows.h>
  18. #include <setupapi.h>
  19. #include <cfgmgr32.h>
  20. #include <infstr.h>
  21. #include <stdio.h>
  22. #include <stdlib.h>
  23. #include <tchar.h>
  24. #include <malloc.h>
  25. #include <objbase.h>
  26. #include <lm.h>
  27. #include <excppkg.h>
  28. #include <msoobci.h>
  29. //
  30. // Keywords
  31. //
  32. #define KEY_REBOOT TEXT("Reboot")
  33. #define KEY_DOTSERVICES TEXT(".Services")
  34. #define KEY_DOTPRECOPY TEXT(".Precopy")
  35. #define KEY_COMPONENTID TEXT("ComponentID")
  36. #define KEY_DEFAULTINSTALL TEXT("DefaultInstall")
  37. #define KEY_COMPONENTS TEXT("Components")
  38. #define CMD_SEP TEXT(';') // character used for DoInstall
  39. #define DESC_SIZE (64) // size of exception pack description
  40. //
  41. // common
  42. //
  43. #define COMPFIELD_NAME (1)
  44. #define COMPFIELD_FLAGS (2)
  45. //
  46. // expack
  47. //
  48. // <path\name>,<flags>,<comp>,<ver>,<desc>,<osver>-<osver>
  49. //
  50. #define COMPFIELD_COMP (3)
  51. #define COMPFIELD_VER (4)
  52. #define COMPFIELD_DESC (5)
  53. #define COMPFIELD_OSVER (6)
  54. //
  55. // qfe
  56. //
  57. // <path\name>,<flags>,<osver>,<os-sp>,<qfenum>
  58. //
  59. #define COMPFIELD_QFEOS (3)
  60. #define COMPFIELD_QFESP (4)
  61. #define COMPFIELD_QFENUM (5)
  62. #define FLAGS_METHOD 0xffff0000
  63. #define FLAGS_EXPACK 0x00010000 // method = exception pack
  64. #define FLAGS_QFE 0x00020000 // method = QFE
  65. #define FLAGS_REINSTALL 0x00000001 // indicates need to reinstall
  66. #define FLAGS_REBOOT 0x00000002 // set if reboot required
  67. #define FLAGS_INSTALLED 0x80000000 // (not user) set if a component installed
  68. #define POSTFLAGS_REINSTALL 0x00000001 // postprocessing - set problem to reinstall
  69. #define ARRAY_SIZE(x) (sizeof(x)/sizeof((x)[0]))
  70. extern HANDLE g_DllHandle;
  71. extern OSVERSIONINFOEX g_VerInfo;
  72. VOID
  73. DebugPrint(
  74. PCTSTR format,
  75. ... OPTIONAL
  76. );
  77. #if DBG
  78. //
  79. // real DebugPrint
  80. //
  81. #define VerbosePrint DebugPrint
  82. #else
  83. //
  84. // don't want VerbosePrint
  85. // below define has intentional side effect(s)
  86. // VerbosePrint(TEXT("text"),foo) -> 1?0:(TEXT("text"),foo) -> 0 -> nothing
  87. //
  88. #define VerbosePrint /* (...) */ 1?0: /* (...) */
  89. #endif // DBG
  90. DWORD
  91. DoDriverInstallComponents (
  92. IN HDEVINFO DeviceInfoSet,
  93. IN PSP_DEVINFO_DATA DeviceInfoData,
  94. IN OUT PCOINSTALLER_CONTEXT_DATA Context
  95. );
  96. DWORD
  97. DoDriverInstallComponentsPostProcessing (
  98. IN HDEVINFO DeviceInfoSet,
  99. IN PSP_DEVINFO_DATA DeviceInfoData,
  100. IN OUT PCOINSTALLER_CONTEXT_DATA Context
  101. );
  102. DWORD
  103. DoDriverComponentsSection(
  104. IN HINF InfFile,
  105. IN LPCTSTR CompSectionName,
  106. IN OUT DWORD *AndFlags,
  107. IN OUT DWORD *OrFlags
  108. );
  109. DWORD
  110. DoDriverExPack(
  111. IN INFCONTEXT *EntryLine,
  112. IN LPCTSTR PathName,
  113. IN OUT DWORD *Flags
  114. );
  115. DWORD
  116. DoDriverQfe(
  117. IN INFCONTEXT *EntryLine,
  118. IN LPCTSTR PathName,
  119. IN OUT DWORD *Flags
  120. );
  121. HRESULT
  122. StringFromGuid(
  123. IN GUID *GuidBinary,
  124. OUT LPTSTR GuidString,
  125. IN DWORD BufferSize
  126. );
  127. HRESULT
  128. GuidFromString(
  129. IN LPCTSTR GuidString,
  130. OUT GUID *GuidBinary
  131. );
  132. HRESULT
  133. VersionFromString(
  134. IN LPCTSTR VerString,
  135. OUT INT * VerMajor,
  136. OUT INT * VerMinor,
  137. OUT INT * VerBuild,
  138. OUT INT * VerQFE
  139. );
  140. int
  141. CompareVersion(
  142. IN INT VerMajor,
  143. IN INT VerMinor,
  144. IN INT VerBuild,
  145. IN INT VerQFE,
  146. IN INT OtherMajor,
  147. IN INT OtherMinor,
  148. IN INT OtherBuild,
  149. IN INT OtherQFE
  150. );
  151. int
  152. CompareCompVersion(
  153. IN INT VerMajor,
  154. IN INT VerMinor,
  155. IN INT VerBuild,
  156. IN INT VerQFE,
  157. IN PSETUP_OS_COMPONENT_DATA SetupOsComponentData
  158. );
  159. BOOL
  160. WINAPI
  161. QueryRegisteredOsComponent(
  162. IN LPGUID ComponentGuid,
  163. OUT PSETUP_OS_COMPONENT_DATA SetupOsComponentData,
  164. OUT PSETUP_OS_EXCEPTION_DATA SetupOsExceptionData
  165. );
  166. BOOL
  167. WINAPI
  168. RegisterOsComponent (
  169. IN const PSETUP_OS_COMPONENT_DATA ComponentData,
  170. IN const PSETUP_OS_EXCEPTION_DATA ExceptionData
  171. );
  172. BOOL
  173. WINAPI
  174. UnRegisterOsComponent (
  175. IN const LPGUID ComponentGuid
  176. );
  177. UINT
  178. GetRealWindowsDirectory(
  179. LPTSTR lpBuffer, // buffer to receive directory name
  180. UINT uSize // size of name buffer
  181. );
  182. BOOL QueryInfOriginalFileInformation(
  183. PSP_INF_INFORMATION InfInformation,
  184. UINT InfIndex,
  185. PSP_ALTPLATFORM_INFO AlternatePlatformInfo,
  186. PSP_ORIGINAL_FILE_INFO OriginalFileInfo
  187. );
  188. BOOL CopyOEMInf(
  189. PCTSTR SourceInfFileName,
  190. PCTSTR OEMSourceMediaLocation,
  191. DWORD OEMSourceMediaType,
  192. DWORD CopyStyle,
  193. PTSTR DestinationInfFileName,
  194. DWORD DestinationInfFileNameSize,
  195. PDWORD RequiredSize,
  196. PTSTR *DestinationInfFileNameComponent
  197. );
  198. HRESULT
  199. MakeSureParentPathExists(
  200. IN LPTSTR Path
  201. );
  202. HRESULT
  203. MakeSurePathExists(
  204. IN LPTSTR Path
  205. );
  206. LPTSTR GetSplit(
  207. IN LPCTSTR FileName
  208. );
  209. LPTSTR GetBaseName(
  210. IN LPCTSTR FileName
  211. );
  212. HRESULT
  213. ConcatPath(
  214. IN LPTSTR Path,
  215. IN DWORD Len,
  216. IN LPCTSTR NewPart
  217. );
  218. HRESULT
  219. InstallExceptionPackFromInf(
  220. IN LPCTSTR InfPath,
  221. IN LPCTSTR Media,
  222. IN LPCTSTR Store,
  223. IN DWORD Flags
  224. );
  225. HRESULT
  226. ProxyInstallExceptionPackFromInf(
  227. IN LPCTSTR InfPath,
  228. IN LPCTSTR Media,
  229. IN LPCTSTR Store,
  230. IN DWORD Flags
  231. );
  232. CONFIGRET
  233. Set_DevNode_Problem_Ex(
  234. IN DEVINST dnDevInst,
  235. IN ULONG ulProblem,
  236. IN ULONG ulFlags,
  237. IN HMACHINE hMachine
  238. );
  239. BOOL
  240. GetDeviceInfoListDetail(
  241. IN HDEVINFO DeviceInfoSet,
  242. OUT PSP_DEVINFO_LIST_DETAIL_DATA DeviceInfoSetDetailData
  243. );