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.

219 lines
4.3 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name:
  4. entry.c
  5. Abstract:
  6. Implements the DLL entry point that provides all Cobra module entry points
  7. to the engine.
  8. Author:
  9. Jim Schmidt (jimschm) 11-Aug-2000
  10. Revision History:
  11. <alias> <date> <comments>
  12. --*/
  13. #include "pch.h"
  14. #include "v1p.h"
  15. typedef struct {
  16. PCTSTR Name;
  17. TYPE_ENTRYPOINTS EntryPoints;
  18. } ETM_TABLE, *PETM_TABLE;
  19. typedef struct {
  20. PCTSTR Name;
  21. VIRTUAL_COMPUTER_ENTRYPOINTS EntryPoints;
  22. } VCM_TABLE, *PVCM_TABLE;
  23. typedef struct {
  24. PCTSTR Name;
  25. SOURCE_ENTRYPOINTS EntryPoints;
  26. } SOURCE_TABLE, *PSOURCE_TABLE;
  27. typedef struct {
  28. PCTSTR Name;
  29. DESTINATION_ENTRYPOINTS EntryPoints;
  30. } DESTINATION_TABLE, *PDESTINATION_TABLE;
  31. //
  32. // Add an entry for each ETM module in the DLL
  33. //
  34. ETM_TABLE g_EtmEntryPoints[] = {
  35. { TEXT("SCRIPT"), ISM_VERSION,
  36. ScriptEtmInitialize, ScriptEtmParse, ScriptEtmTerminate, NULL
  37. },
  38. { TEXT("CERTIFICATES"), ISM_VERSION,
  39. CertificatesEtmInitialize, NULL, NULL, CertificatesEtmNewUserCreated
  40. },
  41. {NULL}
  42. };
  43. //
  44. // Add an entry for each VCM module in the DLL
  45. //
  46. VCM_TABLE g_VcmEntryPoints[] = {
  47. { TEXT("SCRIPT"), ISM_VERSION,
  48. ScriptVcmInitialize, ScriptVcmParse, ScriptVcmQueueEnumeration, NULL, ScriptTerminate
  49. },
  50. {NULL}
  51. };
  52. //
  53. // Add an entry for each source module in the DLL
  54. //
  55. SOURCE_TABLE g_SourceEntryPoints[] = {
  56. { TEXT("SCRIPT"), ISM_VERSION,
  57. ScriptSgmInitialize, ScriptSgmParse, ScriptSgmQueueEnumeration, NULL, (PSGMTERMINATE) ScriptTerminate,
  58. NULL, NULL, NULL, NULL
  59. },
  60. {NULL}
  61. };
  62. //
  63. // Add an entry for each destination module in the DLL
  64. //
  65. DESTINATION_TABLE g_DestinationEntryPoints[] = {
  66. { TEXT("SCRIPT"), ISM_VERSION,
  67. ScriptDgmInitialize, ScriptDgmQueueEnumeration, NULL, NULL,
  68. NULL, NULL, NULL, NULL,
  69. ScriptCsmInitialize, ScriptCsmExecute, NULL, ScriptCsmTerminate,
  70. ScriptOpmInitialize, ScriptOpmTerminate
  71. },
  72. {NULL}
  73. };
  74. EXPORT
  75. BOOL
  76. WINAPI
  77. DllMain (
  78. IN HINSTANCE hInstance,
  79. IN DWORD dwReason,
  80. IN LPVOID lpReserved
  81. )
  82. {
  83. if (dwReason == DLL_PROCESS_ATTACH) {
  84. g_hInst = hInstance;
  85. }
  86. return TRUE;
  87. }
  88. BOOL
  89. WINAPI
  90. pFindModule (
  91. IN PCTSTR ModuleId,
  92. OUT PVOID IsmBuffer,
  93. IN PCTSTR *TableEntry,
  94. IN UINT StructureSize
  95. )
  96. {
  97. while (*TableEntry) {
  98. if (StringIMatch (*TableEntry, ModuleId)) {
  99. CopyMemory (
  100. IsmBuffer,
  101. (PBYTE) (TableEntry + 1),
  102. StructureSize
  103. );
  104. return TRUE;
  105. }
  106. TableEntry = (PCTSTR *) ((PBYTE) (TableEntry + 1) + StructureSize);
  107. }
  108. return FALSE;
  109. }
  110. EXPORT
  111. BOOL
  112. WINAPI
  113. TypeModule (
  114. IN PCTSTR ModuleId,
  115. IN OUT PTYPE_ENTRYPOINTS TypeEntryPoints
  116. )
  117. {
  118. return pFindModule (
  119. ModuleId,
  120. (PVOID) TypeEntryPoints,
  121. (PCTSTR *) g_EtmEntryPoints,
  122. sizeof (TYPE_ENTRYPOINTS)
  123. );
  124. }
  125. EXPORT
  126. BOOL
  127. WINAPI
  128. VirtualComputerModule (
  129. IN PCTSTR ModuleId,
  130. IN OUT PVIRTUAL_COMPUTER_ENTRYPOINTS VirtualComputerEntryPoints
  131. )
  132. {
  133. return pFindModule (
  134. ModuleId,
  135. (PVOID) VirtualComputerEntryPoints,
  136. (PCTSTR *) g_VcmEntryPoints,
  137. sizeof (VIRTUAL_COMPUTER_ENTRYPOINTS)
  138. );
  139. }
  140. EXPORT
  141. BOOL
  142. WINAPI
  143. SourceModule (
  144. IN PCTSTR ModuleId,
  145. IN OUT PSOURCE_ENTRYPOINTS SourceEntryPoints
  146. )
  147. {
  148. return pFindModule (
  149. ModuleId,
  150. (PVOID) SourceEntryPoints,
  151. (PCTSTR *) g_SourceEntryPoints,
  152. sizeof (SOURCE_ENTRYPOINTS)
  153. );
  154. }
  155. EXPORT
  156. BOOL
  157. WINAPI
  158. DestinationModule (
  159. IN PCTSTR ModuleId,
  160. IN OUT PDESTINATION_ENTRYPOINTS DestinationEntryPoints
  161. )
  162. {
  163. return pFindModule (
  164. ModuleId,
  165. (PVOID) DestinationEntryPoints,
  166. (PCTSTR *) g_DestinationEntryPoints,
  167. sizeof (DESTINATION_ENTRYPOINTS)
  168. );
  169. }