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.

937 lines
14 KiB

  1. #include "dspch.h"
  2. #pragma hdrstop
  3. #include <w32topl.h>
  4. //
  5. // Notes on stub behavior
  6. //
  7. //
  8. // Whenever possible, STATUS_PROCEDURE_NOT_FOUHD, ERROR_PROC_NOT_FOUND, NULL,
  9. // or FALSE is returned.
  10. //
  11. //
  12. // Some of the functions below require the caller to look at an OUT
  13. // parameter to determine whether the results of the function (in addition
  14. // or independent of the return value). Since these are private functions
  15. // there is no need in shipping code to check for the validity of the OUT
  16. // parameter (typically a pointer). These values should always be present
  17. // in RTM versions.
  18. //
  19. //
  20. // Some functions don't return a status and were designed to never fail
  21. // (for example, functions that effectively do a table lookup). For these
  22. // functions there is no reasonable return value. However, this is not
  23. // a practical issue since these API's would only be called after the DS
  24. // initialized which means that API would have already been "snapped" in via
  25. // GetProcAddress().
  26. //
  27. // Of course, it is possible to rewrite these routines to return errors,
  28. // however, as above, this will have no practical effect.
  29. //
  30. static
  31. TOPL_LIST
  32. ToplListCreate(
  33. VOID
  34. )
  35. {
  36. return NULL;
  37. }
  38. static
  39. VOID
  40. ToplListFree(
  41. IN TOPL_LIST List,
  42. IN BOOLEAN fRecursive // TRUE implies free the elements contained
  43. // in the list
  44. )
  45. {
  46. return;
  47. }
  48. static
  49. VOID
  50. ToplListSetIter(
  51. IN TOPL_LIST List,
  52. IN TOPL_ITERATOR Iterator
  53. )
  54. {
  55. return;
  56. }
  57. static
  58. TOPL_LIST_ELEMENT
  59. ToplListRemoveElem(
  60. IN TOPL_LIST List,
  61. IN TOPL_LIST_ELEMENT Elem
  62. )
  63. {
  64. return NULL;
  65. }
  66. static
  67. VOID
  68. ToplListAddElem(
  69. IN TOPL_LIST List,
  70. IN TOPL_LIST_ELEMENT Elem
  71. )
  72. {
  73. return;
  74. }
  75. static
  76. DWORD
  77. ToplListNumberOfElements(
  78. IN TOPL_LIST List
  79. )
  80. {
  81. return 0;
  82. }
  83. static
  84. TOPL_ITERATOR
  85. ToplIterCreate(
  86. VOID
  87. )
  88. {
  89. return NULL;
  90. }
  91. static
  92. VOID
  93. ToplIterFree(
  94. IN TOPL_ITERATOR Iterator
  95. )
  96. {
  97. return;
  98. }
  99. static
  100. TOPL_LIST_ELEMENT
  101. ToplIterGetObject(
  102. IN TOPL_ITERATOR Iterator
  103. )
  104. {
  105. return NULL;
  106. }
  107. static
  108. VOID
  109. ToplIterAdvance(
  110. IN TOPL_ITERATOR Iterator
  111. )
  112. {
  113. return;
  114. }
  115. static
  116. TOPL_EDGE
  117. ToplEdgeCreate(
  118. VOID
  119. )
  120. {
  121. return NULL;
  122. }
  123. static
  124. VOID
  125. ToplEdgeFree(
  126. IN TOPL_EDGE Edge
  127. )
  128. {
  129. return;
  130. }
  131. static
  132. VOID
  133. ToplEdgeSetToVertex(
  134. IN TOPL_EDGE Edge,
  135. IN TOPL_VERTEX ToVertex
  136. )
  137. {
  138. return;
  139. }
  140. static
  141. TOPL_VERTEX
  142. ToplEdgeGetToVertex(
  143. IN TOPL_EDGE Edge
  144. )
  145. {
  146. return NULL;
  147. }
  148. static
  149. VOID
  150. ToplEdgeSetFromVertex(
  151. IN TOPL_EDGE Edge,
  152. IN TOPL_VERTEX FromVertex
  153. )
  154. {
  155. return;
  156. }
  157. static
  158. TOPL_VERTEX
  159. ToplEdgeGetFromVertex(
  160. IN TOPL_EDGE Edge
  161. )
  162. {
  163. return NULL;
  164. }
  165. static
  166. VOID
  167. ToplEdgeAssociate(
  168. IN TOPL_EDGE Edge
  169. )
  170. {
  171. return;
  172. }
  173. static
  174. VOID
  175. ToplEdgeDisassociate(
  176. IN TOPL_EDGE Edge
  177. )
  178. {
  179. return;
  180. }
  181. static
  182. VOID
  183. ToplEdgeSetWeight(
  184. IN TOPL_EDGE Edge,
  185. IN DWORD Weight
  186. )
  187. {
  188. return;
  189. }
  190. static
  191. DWORD
  192. ToplEdgeGetWeight(
  193. IN TOPL_EDGE Edge
  194. )
  195. {
  196. return 0;
  197. }
  198. static
  199. TOPL_VERTEX
  200. ToplVertexCreate(
  201. VOID
  202. )
  203. {
  204. return NULL;
  205. }
  206. static
  207. VOID
  208. ToplVertexFree(
  209. IN TOPL_VERTEX Vertex
  210. )
  211. {
  212. return;
  213. }
  214. static
  215. VOID
  216. ToplVertexSetId(
  217. IN TOPL_VERTEX Vertex,
  218. IN DWORD Id
  219. )
  220. {
  221. return;
  222. }
  223. static
  224. DWORD
  225. ToplVertexGetId(
  226. IN TOPL_VERTEX Vertex
  227. )
  228. {
  229. return 0;
  230. }
  231. static
  232. DWORD
  233. ToplVertexNumberOfInEdges(
  234. IN TOPL_VERTEX Vertex
  235. )
  236. {
  237. return 0;
  238. }
  239. static
  240. TOPL_EDGE
  241. ToplVertexGetInEdge(
  242. IN TOPL_VERTEX Vertex,
  243. IN DWORD Index
  244. )
  245. {
  246. return NULL;
  247. }
  248. static
  249. DWORD
  250. ToplVertexNumberOfOutEdges(
  251. IN TOPL_VERTEX Vertex
  252. )
  253. {
  254. return 0;
  255. }
  256. static
  257. TOPL_EDGE
  258. ToplVertexGetOutEdge(
  259. IN TOPL_VERTEX Vertex,
  260. IN DWORD Index
  261. )
  262. {
  263. return NULL;
  264. }
  265. static
  266. VOID
  267. ToplVertexSetParent(
  268. IN TOPL_VERTEX Vertex,
  269. IN TOPL_VERTEX Parent
  270. )
  271. {
  272. return;
  273. }
  274. static
  275. TOPL_VERTEX
  276. ToplVertexGetParent(
  277. IN TOPL_VERTEX Vertex
  278. )
  279. {
  280. return NULL;
  281. }
  282. static
  283. TOPL_GRAPH
  284. ToplGraphCreate(
  285. VOID
  286. )
  287. {
  288. return NULL;
  289. }
  290. static
  291. VOID
  292. ToplGraphFree(
  293. IN TOPL_GRAPH Graph,
  294. IN BOOLEAN fRecursive // TRUE implies recursively free the vertices
  295. // that have been added to this graph
  296. )
  297. {
  298. return;
  299. }
  300. static
  301. VOID
  302. ToplGraphAddVertex(
  303. IN TOPL_GRAPH Graph,
  304. IN TOPL_VERTEX VertexToAdd,
  305. IN PVOID VertexName
  306. )
  307. {
  308. return;
  309. }
  310. static
  311. TOPL_VERTEX
  312. ToplGraphRemoveVertex(
  313. IN TOPL_GRAPH Graph,
  314. IN TOPL_VERTEX VertexToRemove
  315. )
  316. {
  317. return NULL;
  318. }
  319. static
  320. VOID
  321. ToplGraphSetVertexIter(
  322. IN TOPL_GRAPH Graph,
  323. IN TOPL_ITERATOR Iter
  324. )
  325. {
  326. return;
  327. }
  328. static
  329. DWORD
  330. ToplGraphNumberOfVertices(
  331. IN TOPL_GRAPH Graph
  332. )
  333. {
  334. return 0;
  335. }
  336. static
  337. VOID
  338. ToplFree(
  339. VOID *p
  340. )
  341. {
  342. return;
  343. }
  344. static
  345. DWORD
  346. ToplSetAllocator(
  347. IN TOPL_ALLOC * pfAlloc OPTIONAL,
  348. IN TOPL_REALLOC * pfReAlloc OPTIONAL,
  349. IN TOPL_FREE * pfFree OPTIONAL
  350. )
  351. {
  352. return ERROR_PROC_NOT_FOUND;
  353. }
  354. static
  355. VOID
  356. ToplGraphMakeRing(
  357. IN TOPL_GRAPH Graph,
  358. IN DWORD Flags,
  359. OUT TOPL_LIST EdgesToAdd,
  360. OUT TOPL_EDGE **EdgesToKeep,
  361. OUT ULONG *cEdgesToKeep
  362. )
  363. {
  364. return;
  365. }
  366. static
  367. TOPL_COMPONENTS*
  368. ToplGraphFindEdgesForMST(
  369. IN TOPL_GRAPH Graph,
  370. IN TOPL_VERTEX RootVertex,
  371. IN TOPL_VERTEX VertexOfInterest,
  372. OUT TOPL_EDGE **EdgesNeeded,
  373. OUT ULONG* cEdgesNeeded
  374. )
  375. {
  376. if (EdgesNeeded != NULL) {
  377. *EdgesNeeded = NULL;
  378. }
  379. if (cEdgesNeeded != NULL) {
  380. *cEdgesNeeded = 0;
  381. }
  382. return NULL;
  383. }
  384. static
  385. VOID
  386. ToplVertexInit(
  387. PVERTEX V
  388. )
  389. {
  390. return;
  391. }
  392. static
  393. VOID
  394. ToplVertexDestroy(
  395. PVERTEX V
  396. )
  397. {
  398. return;
  399. }
  400. static
  401. VOID
  402. ToplGraphInit(
  403. PGRAPH G
  404. )
  405. {
  406. return;
  407. }
  408. static
  409. VOID
  410. ToplGraphDestroy(
  411. PGRAPH G
  412. )
  413. {
  414. return;
  415. }
  416. static
  417. VOID
  418. ToplEdgeInit(
  419. PEDGE E
  420. )
  421. {
  422. return;
  423. }
  424. static
  425. VOID
  426. ToplEdgeDestroy(
  427. PEDGE E
  428. )
  429. {
  430. return;
  431. }
  432. static
  433. int
  434. ToplIsToplException(
  435. DWORD ErrorCode
  436. )
  437. {
  438. return EXCEPTION_CONTINUE_SEARCH;
  439. }
  440. static
  441. TOPL_SCHEDULE
  442. ToplGetAlwaysSchedule(
  443. IN TOPL_SCHEDULE_CACHE ScheduleCache
  444. )
  445. {
  446. return NULL;
  447. }
  448. static
  449. TOPL_SCHEDULE_CACHE
  450. ToplScheduleCacheCreate(
  451. VOID
  452. )
  453. {
  454. return NULL;
  455. }
  456. static
  457. VOID
  458. ToplScheduleCacheDestroy(
  459. IN TOPL_SCHEDULE_CACHE ScheduleCache
  460. )
  461. {
  462. return;
  463. }
  464. static
  465. TOPL_SCHEDULE
  466. ToplScheduleCreate(
  467. IN TOPL_SCHEDULE_CACHE ScheduleCache,
  468. IN DWORD IntervalInMinutes,
  469. IN TOPL_SCHEDULE TemplateSchedule OPTIONAL,
  470. IN DWORD StaggeringNumber
  471. )
  472. {
  473. return NULL;
  474. }
  475. static
  476. DWORD
  477. ToplScheduleDuration(
  478. IN TOPL_SCHEDULE Schedule
  479. )
  480. {
  481. return 0;
  482. }
  483. static
  484. PSCHEDULE
  485. ToplScheduleExportReadonly(
  486. IN TOPL_SCHEDULE_CACHE ScheduleCache,
  487. IN TOPL_SCHEDULE Schedule
  488. )
  489. {
  490. return NULL;
  491. }
  492. static
  493. TOPL_SCHEDULE
  494. ToplScheduleImport(
  495. IN TOPL_SCHEDULE_CACHE ScheduleCache,
  496. IN PSCHEDULE pExternalSchedule
  497. )
  498. {
  499. return NULL;
  500. }
  501. static
  502. BOOLEAN
  503. ToplScheduleIsEqual(
  504. IN TOPL_SCHEDULE_CACHE ScheduleCache,
  505. IN TOPL_SCHEDULE Schedule1,
  506. IN TOPL_SCHEDULE Schedule2
  507. )
  508. {
  509. return FALSE;
  510. }
  511. static
  512. DWORD
  513. ToplScheduleMaxUnavailable(
  514. IN TOPL_SCHEDULE Schedule
  515. )
  516. {
  517. return 0;
  518. }
  519. static
  520. TOPL_SCHEDULE
  521. ToplScheduleMerge(
  522. IN TOPL_SCHEDULE_CACHE ScheduleCache,
  523. IN TOPL_SCHEDULE Schedule1,
  524. IN TOPL_SCHEDULE Schedule2,
  525. OUT PBOOLEAN fIsNever
  526. )
  527. {
  528. if (fIsNever != NULL) {
  529. *fIsNever = FALSE;
  530. }
  531. return NULL;
  532. }
  533. static
  534. DWORD
  535. ToplScheduleNumEntries(
  536. IN TOPL_SCHEDULE_CACHE ScheduleCache
  537. )
  538. {
  539. return 0;
  540. }
  541. static
  542. BOOLEAN
  543. ToplScheduleValid(
  544. IN TOPL_SCHEDULE Schedule
  545. )
  546. {
  547. return FALSE;
  548. }
  549. static
  550. BOOLEAN
  551. ToplPScheduleValid(
  552. IN PSCHEDULE Schedule
  553. )
  554. {
  555. return FALSE;
  556. }
  557. static
  558. VOID
  559. ToplAddEdgeSetToGraph(
  560. IN PTOPL_GRAPH_STATE G,
  561. IN PTOPL_MULTI_EDGE_SET s
  562. )
  563. {
  564. return;
  565. }
  566. static
  567. PTOPL_MULTI_EDGE
  568. ToplAddEdgeToGraph(
  569. IN PTOPL_GRAPH_STATE G,
  570. IN DWORD numVtx,
  571. IN DWORD edgeType,
  572. IN PTOPL_REPL_INFO ri
  573. )
  574. {
  575. return NULL;
  576. }
  577. static
  578. VOID
  579. ToplDeleteComponents(
  580. PTOPL_COMPONENTS pComponents
  581. )
  582. {
  583. return;
  584. }
  585. static
  586. VOID
  587. ToplDeleteGraphState(
  588. PTOPL_GRAPH_STATE G
  589. )
  590. {
  591. return;
  592. }
  593. static
  594. VOID
  595. ToplDeleteSpanningTreeEdges(
  596. PTOPL_MULTI_EDGE *stEdgeList,
  597. DWORD numStEdges )
  598. {
  599. return;
  600. }
  601. static
  602. VOID
  603. ToplEdgeSetVtx(
  604. IN PTOPL_GRAPH_STATE G,
  605. IN PTOPL_MULTI_EDGE e,
  606. IN DWORD whichVtx,
  607. IN PVOID vtxName
  608. )
  609. {
  610. return;
  611. }
  612. static
  613. PTOPL_MULTI_EDGE*
  614. ToplGetSpanningTreeEdgesForVtx(
  615. IN PTOPL_GRAPH_STATE G,
  616. IN PVOID whichVtxName,
  617. IN TOPL_COLOR_VERTEX *colorVtx,
  618. IN DWORD numColorVtx,
  619. OUT DWORD *numStEdges,
  620. OUT PTOPL_COMPONENTS pComponents
  621. )
  622. {
  623. if (numStEdges != NULL) {
  624. *numStEdges = 0;
  625. }
  626. return NULL;
  627. }
  628. static
  629. PTOPL_GRAPH_STATE
  630. ToplMakeGraphState(
  631. IN PVOID* vertexNames,
  632. IN DWORD numVertices,
  633. IN TOPL_COMPARISON_FUNC vnCompFunc,
  634. IN TOPL_SCHEDULE_CACHE schedCache
  635. )
  636. {
  637. return NULL;
  638. }
  639. typedef struct _TOPL_HEAP_INFO
  640. {
  641. PVOID* Array;
  642. ULONG cArray;
  643. DWORD (*pfnKey)( VOID *p );
  644. ULONG MaxElements;
  645. } TOPL_HEAP_INFO, *PTOPL_HEAP_INFO;
  646. static
  647. BOOLEAN
  648. ToplHeapCreate(
  649. OUT PTOPL_HEAP_INFO Heap,
  650. IN ULONG cArray,
  651. IN DWORD (*pfnKey)( VOID *p )
  652. )
  653. {
  654. return FALSE;
  655. }
  656. static
  657. VOID
  658. ToplHeapDestroy(
  659. IN OUT PTOPL_HEAP_INFO Heap
  660. )
  661. {
  662. return;
  663. }
  664. static
  665. PVOID
  666. ToplHeapExtractMin(
  667. IN PTOPL_HEAP_INFO Heap
  668. )
  669. {
  670. return NULL;
  671. }
  672. static
  673. VOID
  674. ToplHeapInsert(
  675. IN PTOPL_HEAP_INFO Heap,
  676. IN PVOID Element
  677. )
  678. {
  679. return;
  680. }
  681. static
  682. BOOLEAN
  683. ToplHeapIsEmpty(
  684. IN PTOPL_HEAP_INFO Heap
  685. )
  686. {
  687. return TRUE;
  688. }
  689. static
  690. BOOLEAN
  691. ToplHeapIsElementOf(
  692. IN PTOPL_HEAP_INFO Heap,
  693. IN PVOID Element
  694. )
  695. {
  696. return FALSE;
  697. }
  698. typedef int (*STHEAP_COMPARE_FUNC)( PVOID el1, PVOID el2, PVOID extra );
  699. typedef int (*STHEAP_GET_LOCN_FUNC)( PVOID el1, PVOID extra );
  700. typedef VOID (*STHEAP_SET_LOCN_FUNC)( PVOID el1, int l, PVOID extra );
  701. typedef struct {
  702. DWORD nextFreeSpot, maxSize;
  703. PVOID *data;
  704. STHEAP_COMPARE_FUNC Comp;
  705. STHEAP_GET_LOCN_FUNC GetLocn;
  706. STHEAP_SET_LOCN_FUNC SetLocn;
  707. PVOID extra;
  708. } STHEAP;
  709. typedef STHEAP *PSTHEAP;
  710. static
  711. PSTHEAP
  712. ToplSTHeapInit(
  713. DWORD maxSize,
  714. STHEAP_COMPARE_FUNC Comp,
  715. STHEAP_GET_LOCN_FUNC GetLocn,
  716. STHEAP_SET_LOCN_FUNC SetLocn,
  717. PVOID extra
  718. )
  719. {
  720. return NULL;
  721. }
  722. static
  723. VOID
  724. ToplSTHeapDestroy(
  725. PSTHEAP heap
  726. )
  727. {
  728. return;
  729. }
  730. static
  731. VOID
  732. ToplSTHeapAdd(
  733. PSTHEAP heap,
  734. PVOID element
  735. )
  736. {
  737. return;
  738. }
  739. static
  740. PVOID
  741. ToplSTHeapExtractMin(
  742. PSTHEAP heap
  743. )
  744. {
  745. return NULL;
  746. }
  747. static
  748. VOID
  749. ToplSTHeapCostReduced(
  750. PSTHEAP heap,
  751. PVOID element
  752. )
  753. {
  754. return;
  755. }
  756. //
  757. // !! WARNING !! The entries below must be in alphabetical order, and are CASE SENSITIVE (eg lower case comes last!)
  758. //
  759. DEFINE_PROCNAME_ENTRIES(w32topl)
  760. {
  761. DLPENTRY(ToplAddEdgeSetToGraph)
  762. DLPENTRY(ToplAddEdgeToGraph)
  763. DLPENTRY(ToplDeleteComponents)
  764. DLPENTRY(ToplDeleteGraphState)
  765. DLPENTRY(ToplDeleteSpanningTreeEdges)
  766. DLPENTRY(ToplEdgeAssociate)
  767. DLPENTRY(ToplEdgeCreate)
  768. DLPENTRY(ToplEdgeDestroy)
  769. DLPENTRY(ToplEdgeDisassociate)
  770. DLPENTRY(ToplEdgeFree)
  771. DLPENTRY(ToplEdgeGetFromVertex)
  772. DLPENTRY(ToplEdgeGetToVertex)
  773. DLPENTRY(ToplEdgeGetWeight)
  774. DLPENTRY(ToplEdgeInit)
  775. DLPENTRY(ToplEdgeSetFromVertex)
  776. DLPENTRY(ToplEdgeSetToVertex)
  777. DLPENTRY(ToplEdgeSetVtx)
  778. DLPENTRY(ToplEdgeSetWeight)
  779. DLPENTRY(ToplFree)
  780. DLPENTRY(ToplGetAlwaysSchedule)
  781. DLPENTRY(ToplGetSpanningTreeEdgesForVtx)
  782. DLPENTRY(ToplGraphAddVertex)
  783. DLPENTRY(ToplGraphCreate)
  784. DLPENTRY(ToplGraphDestroy)
  785. DLPENTRY(ToplGraphFindEdgesForMST)
  786. DLPENTRY(ToplGraphFree)
  787. DLPENTRY(ToplGraphInit)
  788. DLPENTRY(ToplGraphMakeRing)
  789. DLPENTRY(ToplGraphNumberOfVertices)
  790. DLPENTRY(ToplGraphRemoveVertex)
  791. DLPENTRY(ToplGraphSetVertexIter)
  792. DLPENTRY(ToplHeapCreate)
  793. DLPENTRY(ToplHeapDestroy)
  794. DLPENTRY(ToplHeapExtractMin)
  795. DLPENTRY(ToplHeapInsert)
  796. DLPENTRY(ToplHeapIsElementOf)
  797. DLPENTRY(ToplHeapIsEmpty)
  798. DLPENTRY(ToplIsToplException)
  799. DLPENTRY(ToplIterAdvance)
  800. DLPENTRY(ToplIterCreate)
  801. DLPENTRY(ToplIterFree)
  802. DLPENTRY(ToplIterGetObject)
  803. DLPENTRY(ToplListAddElem)
  804. DLPENTRY(ToplListCreate)
  805. DLPENTRY(ToplListFree)
  806. DLPENTRY(ToplListNumberOfElements)
  807. DLPENTRY(ToplListRemoveElem)
  808. DLPENTRY(ToplListSetIter)
  809. DLPENTRY(ToplMakeGraphState)
  810. DLPENTRY(ToplPScheduleValid)
  811. DLPENTRY(ToplSTHeapAdd)
  812. DLPENTRY(ToplSTHeapCostReduced)
  813. DLPENTRY(ToplSTHeapDestroy)
  814. DLPENTRY(ToplSTHeapExtractMin)
  815. DLPENTRY(ToplSTHeapInit)
  816. DLPENTRY(ToplScheduleCacheCreate)
  817. DLPENTRY(ToplScheduleCacheDestroy)
  818. DLPENTRY(ToplScheduleCreate)
  819. DLPENTRY(ToplScheduleDuration)
  820. DLPENTRY(ToplScheduleExportReadonly)
  821. DLPENTRY(ToplScheduleImport)
  822. DLPENTRY(ToplScheduleIsEqual)
  823. DLPENTRY(ToplScheduleMaxUnavailable)
  824. DLPENTRY(ToplScheduleMerge)
  825. DLPENTRY(ToplScheduleNumEntries)
  826. DLPENTRY(ToplScheduleValid)
  827. DLPENTRY(ToplSetAllocator)
  828. DLPENTRY(ToplVertexCreate)
  829. DLPENTRY(ToplVertexDestroy)
  830. DLPENTRY(ToplVertexFree)
  831. DLPENTRY(ToplVertexGetId)
  832. DLPENTRY(ToplVertexGetInEdge)
  833. DLPENTRY(ToplVertexGetOutEdge)
  834. DLPENTRY(ToplVertexGetParent)
  835. DLPENTRY(ToplVertexInit)
  836. DLPENTRY(ToplVertexNumberOfInEdges)
  837. DLPENTRY(ToplVertexNumberOfOutEdges)
  838. DLPENTRY(ToplVertexSetId)
  839. DLPENTRY(ToplVertexSetParent)
  840. };
  841. DEFINE_PROCNAME_MAP(w32topl)