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.

335 lines
6.9 KiB

  1. /*****************************************************************************
  2. * minihelp.c - services provided by the port class driver to miniports
  3. *****************************************************************************
  4. * Copyright (c) 1996-2000 Microsoft Corporation. All rights reserved.
  5. *
  6. * 11/8/96 Dale Sather
  7. *
  8. */
  9. #define _NO_SYS_GUID_OPERATOR_EQ_ // So operator == / != in guiddef.h isn't included
  10. #include "private.h"
  11. #include <kcom.h>
  12. #ifdef DRM_PORTCLS
  13. #include <drmk.h>
  14. #endif // DRM_PORTCLS
  15. NTSTATUS
  16. GetClassInfo
  17. (
  18. IN REFCLSID ClassId,
  19. OUT PFNCREATEINSTANCE * Create
  20. );
  21. #pragma code_seg("PAGE")
  22. /*****************************************************************************
  23. * PcNewPort()
  24. *****************************************************************************
  25. * Creates an instance of a port driver.
  26. */
  27. PORTCLASSAPI
  28. NTSTATUS
  29. NTAPI
  30. PcNewPort
  31. (
  32. OUT PPORT * OutPort,
  33. IN REFCLSID ClassId
  34. )
  35. {
  36. PAGED_CODE();
  37. ASSERT(OutPort);
  38. //
  39. // Validate Parameters.
  40. //
  41. if (NULL == OutPort)
  42. {
  43. _DbgPrintF(DEBUGLVL_TERSE, ("PcNewPort : Invalid Parameter."));
  44. return STATUS_INVALID_PARAMETER;
  45. }
  46. PUNKNOWN unknown;
  47. PFNCREATEINSTANCE create;
  48. NTSTATUS ntStatus =
  49. GetClassInfo
  50. (
  51. ClassId,
  52. &create
  53. );
  54. if (NT_SUCCESS(ntStatus))
  55. {
  56. ntStatus =
  57. create
  58. (
  59. &unknown,
  60. ClassId,
  61. NULL,
  62. NonPagedPool
  63. );
  64. if (NT_SUCCESS(ntStatus))
  65. {
  66. ntStatus = unknown->QueryInterface(IID_IPort,(PVOID *) OutPort);
  67. unknown->Release();
  68. }
  69. }
  70. else
  71. {
  72. ntStatus =
  73. KoCreateInstance
  74. (
  75. ClassId,
  76. NULL,
  77. CLSCTX_KERNEL_SERVER,
  78. IID_IPort,
  79. (PVOID *) OutPort
  80. );
  81. }
  82. return ntStatus;
  83. }
  84. /*****************************************************************************
  85. * PcNewMiniport()
  86. *****************************************************************************
  87. * Creates an instance of a miniport driver.
  88. */
  89. PORTCLASSAPI
  90. NTSTATUS
  91. NTAPI
  92. PcNewMiniport
  93. (
  94. OUT PMINIPORT * OutMiniport,
  95. IN REFCLSID ClassId
  96. )
  97. {
  98. PAGED_CODE();
  99. ASSERT(OutMiniport);
  100. //
  101. // Validate Parameters.
  102. //
  103. if (NULL == OutMiniport)
  104. {
  105. _DbgPrintF(DEBUGLVL_TERSE, ("PcNewMiniport : Invalid Parameter."));
  106. return STATUS_INVALID_PARAMETER;
  107. }
  108. PUNKNOWN unknown;
  109. PFNCREATEINSTANCE create;
  110. NTSTATUS ntStatus =
  111. GetClassInfo
  112. (
  113. ClassId,
  114. &create
  115. );
  116. if (NT_SUCCESS(ntStatus))
  117. {
  118. ntStatus =
  119. create
  120. (
  121. &unknown,
  122. ClassId,
  123. NULL,
  124. NonPagedPool
  125. );
  126. if (NT_SUCCESS(ntStatus))
  127. {
  128. ntStatus =
  129. unknown->QueryInterface
  130. (
  131. IID_IMiniport,
  132. (PVOID *) OutMiniport
  133. );
  134. unknown->Release();
  135. }
  136. }
  137. else
  138. {
  139. ntStatus =
  140. KoCreateInstance
  141. (
  142. ClassId,
  143. NULL,
  144. CLSCTX_KERNEL_SERVER,
  145. IID_IMiniport,
  146. (PVOID *) OutMiniport
  147. );
  148. }
  149. return ntStatus;
  150. }
  151. #pragma code_seg()
  152. /*****************************************************************************
  153. * PcGetTimeInterval
  154. *****************************************************************************
  155. * Gets the system time interval
  156. */
  157. PORTCLASSAPI
  158. ULONGLONG
  159. NTAPI
  160. PcGetTimeInterval
  161. (
  162. IN ULONGLONG Since
  163. )
  164. {
  165. LARGE_INTEGER deltaTime;
  166. KeQuerySystemTime(&deltaTime);
  167. return deltaTime.QuadPart - Since;
  168. }
  169. #pragma code_seg("PAGE")
  170. #ifdef DRM_PORTCLS
  171. PORTCLASSAPI
  172. NTSTATUS
  173. NTAPI
  174. PcAddContentHandlers(IN ULONG ContentId,IN PVOID* paHandlers,IN ULONG NumHandlers)
  175. {
  176. PAGED_CODE();
  177. return DrmAddContentHandlers(ContentId,paHandlers,NumHandlers);
  178. }
  179. PORTCLASSAPI
  180. NTSTATUS
  181. NTAPI
  182. PcCreateContentMixed(IN PULONG paContentId,IN ULONG cContentId,OUT PULONG pMixedContentId)
  183. {
  184. PAGED_CODE();
  185. return DrmCreateContentMixed(paContentId,cContentId,pMixedContentId);
  186. }
  187. PORTCLASSAPI
  188. NTSTATUS
  189. NTAPI
  190. PcDestroyContent(IN ULONG ContentId)
  191. {
  192. PAGED_CODE();
  193. return DrmDestroyContent(ContentId);
  194. }
  195. PORTCLASSAPI
  196. NTSTATUS
  197. NTAPI
  198. PcForwardContentToDeviceObject(IN ULONG ContentId,IN PVOID Reserved,IN PCDRMFORWARD DrmForward)
  199. {
  200. PAGED_CODE();
  201. return DrmForwardContentToDeviceObject(ContentId,Reserved,DrmForward);
  202. }
  203. PORTCLASSAPI
  204. NTSTATUS
  205. NTAPI
  206. PcForwardContentToFileObject(IN ULONG ContentId,IN PFILE_OBJECT FileObject)
  207. {
  208. PAGED_CODE();
  209. return DrmForwardContentToFileObject(ContentId,FileObject);
  210. }
  211. PORTCLASSAPI
  212. NTSTATUS
  213. NTAPI
  214. PcForwardContentToInterface(IN ULONG ContentId,
  215. IN PUNKNOWN pUnknown,
  216. IN ULONG NumMethods)
  217. {
  218. PAGED_CODE();
  219. return DrmForwardContentToInterface(ContentId,pUnknown,NumMethods);
  220. }
  221. PORTCLASSAPI
  222. NTSTATUS
  223. NTAPI
  224. PcGetContentRights(IN ULONG ContentId,OUT PDRMRIGHTS DrmRights)
  225. {
  226. PAGED_CODE();
  227. return DrmGetContentRights(ContentId,DrmRights);
  228. }
  229. #else // DRM_PORTCLS
  230. PORTCLASSAPI
  231. NTSTATUS
  232. NTAPI
  233. PcAddContentHandlers(IN ULONG ContentId,IN PVOID* paHandlers,IN ULONG NumHandlers)
  234. {
  235. PAGED_CODE();
  236. return STATUS_UNSUCCESSFUL;
  237. }
  238. PORTCLASSAPI
  239. NTSTATUS
  240. NTAPI
  241. PcCreateContentMixed(IN PULONG paContentId,
  242. IN ULONG cContentId,
  243. OUT PULONG pMixedContentId)
  244. {
  245. PAGED_CODE();
  246. return STATUS_UNSUCCESSFUL;
  247. }
  248. PORTCLASSAPI
  249. NTSTATUS
  250. NTAPI
  251. PcDestroyContent(IN ULONG ContentId)
  252. {
  253. PAGED_CODE();
  254. return STATUS_UNSUCCESSFUL;
  255. }
  256. PORTCLASSAPI
  257. NTSTATUS
  258. NTAPI
  259. PcForwardContentToDeviceObject(IN ULONG ContentId,IN PVOID Reserved,IN PCDRMFORWARD DrmForward)
  260. {
  261. PAGED_CODE();
  262. return STATUS_UNSUCCESSFUL;
  263. }
  264. PORTCLASSAPI
  265. NTSTATUS
  266. NTAPI
  267. PcForwardContentToFileObject(IN ULONG ContentId,IN PFILE_OBJECT FileObject)
  268. {
  269. PAGED_CODE();
  270. return STATUS_UNSUCCESSFUL;
  271. }
  272. PORTCLASSAPI
  273. NTSTATUS
  274. NTAPI
  275. PcForwardContentToInterface(IN ULONG ContentId,
  276. IN PUNKNOWN pUnknown,
  277. IN ULONG NumMethods)
  278. {
  279. PAGED_CODE();
  280. return STATUS_UNSUCCESSFUL;
  281. }
  282. PORTCLASSAPI
  283. NTSTATUS
  284. NTAPI
  285. PcGetContentRights(IN ULONG ContentId,OUT PDRMRIGHTS DrmRights)
  286. {
  287. PAGED_CODE();
  288. return STATUS_UNSUCCESSFUL;
  289. }
  290. #endif // DRM_PORTCLS