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.

201 lines
4.2 KiB

  1. /*++
  2. Copyright (c) 2000 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 "guitrans.h"
  15. typedef struct {
  16. PCTSTR Name;
  17. TRANSPORT_ENTRYPOINTS EntryPoints;
  18. } TRANSPORT_TABLE, *PTRANSPORT_TABLE;
  19. #define NOPROGBAR NULL
  20. #define NORESET NULL
  21. #define NORESUME NULL
  22. //
  23. // Add an entry for each transport module in the DLL
  24. //
  25. TRANSPORT_TABLE g_TransportEntryPoints[] = {
  26. { TEXT("REMOVABLE_MEDIA"), ISM_VERSION,
  27. RmvMedTransportInitialize,
  28. RmvMedTransportEstimateProgressBar,
  29. RmvMedTransportQueryCapabilities,
  30. RmvMedTransportSetStorage,
  31. NORESET,
  32. RmvMedTransportTerminate,
  33. RmvMedTransportSaveState,
  34. NORESUME,
  35. RmvMedTransportBeginApply,
  36. NORESUME,
  37. RmvMedTransportAcquireObject,
  38. RmvMedTransportReleaseObject,
  39. RmvMedTransportEndApply
  40. },
  41. { TEXT("DIRECT_CABLE"), ISM_VERSION,
  42. DirectCableTransportInitialize,
  43. DirectCableTransportEstimateProgressBar,
  44. DirectCableTransportQueryCapabilities,
  45. DirectCableTransportSetStorage,
  46. NORESET,
  47. DirectCableTransportTerminate,
  48. DirectCableTransportSaveState,
  49. NORESUME,
  50. DirectCableTransportBeginApply,
  51. NORESUME,
  52. DirectCableTransportAcquireObject,
  53. DirectCableTransportReleaseObject,
  54. DirectCableTransportEndApply
  55. },
  56. { TEXT("HOME_NETWORKING"), ISM_VERSION,
  57. HomeNetTransportInitialize,
  58. HomeNetTransportEstimateProgressBar,
  59. HomeNetTransportQueryCapabilities,
  60. HomeNetTransportSetStorage,
  61. HomeNetTransportResetStorage,
  62. HomeNetTransportTerminate,
  63. HomeNetTransportSaveState,
  64. NORESUME,
  65. HomeNetTransportBeginApply,
  66. NORESUME,
  67. HomeNetTransportAcquireObject,
  68. HomeNetTransportReleaseObject,
  69. HomeNetTransportEndApply
  70. },
  71. { TEXT("OPAQUE_UNC_TRANSPORT"), ISM_VERSION,
  72. OpaqueTransportInitialize,
  73. OpaqueTransportEstimateProgressBar,
  74. OpaqueTransportQueryCapabilities,
  75. OpaqueTransportSetStorage,
  76. NORESET,
  77. OpaqueTransportTerminate,
  78. OpaqueTransportSaveState,
  79. NORESUME,
  80. OpaqueTransportBeginApply,
  81. NORESUME,
  82. OpaqueTransportAcquireObject,
  83. OpaqueTransportReleaseObject,
  84. OpaqueTransportEndApply
  85. },
  86. {NULL}
  87. };
  88. EXPORT
  89. BOOL
  90. WINAPI
  91. DllMain (
  92. IN HINSTANCE hInstance,
  93. IN DWORD dwReason,
  94. IN LPVOID lpReserved
  95. )
  96. {
  97. if (dwReason == DLL_PROCESS_ATTACH) {
  98. g_hInst = hInstance;
  99. }
  100. return TRUE;
  101. }
  102. EXPORT
  103. BOOL
  104. WINAPI
  105. ModuleInitialize (
  106. VOID
  107. )
  108. {
  109. TCHAR memDbDir[MAX_PATH];
  110. UtInitialize (NULL);
  111. RegInitialize ();
  112. IsmGetTempDirectory (memDbDir, ARRAYSIZE (memDbDir));
  113. if (!MemDbInitializeEx (memDbDir)) {
  114. IsmSetCancel();
  115. return FALSE;
  116. }
  117. return TRUE;
  118. }
  119. EXPORT
  120. VOID
  121. WINAPI
  122. ModuleTerminate (
  123. VOID
  124. )
  125. {
  126. MemDbTerminateEx (TRUE);
  127. RegTerminate();
  128. UtTerminate ();
  129. }
  130. BOOL
  131. WINAPI
  132. pFindModule (
  133. IN PCTSTR ModuleId,
  134. OUT PVOID IsmBuffer,
  135. IN PCTSTR *TableEntry,
  136. IN UINT StructureSize
  137. )
  138. {
  139. while (*TableEntry) {
  140. if (StringIMatch (*TableEntry, ModuleId)) {
  141. CopyMemory (
  142. IsmBuffer,
  143. (PBYTE) (TableEntry + 1),
  144. StructureSize
  145. );
  146. return TRUE;
  147. }
  148. TableEntry = (PCTSTR *) ((PBYTE) (TableEntry + 1) + StructureSize);
  149. }
  150. return FALSE;
  151. }
  152. EXPORT
  153. BOOL
  154. WINAPI
  155. TransportModule (
  156. IN PCTSTR ModuleId,
  157. IN OUT PTRANSPORT_ENTRYPOINTS TransportEntryPoints
  158. )
  159. {
  160. return pFindModule (
  161. ModuleId,
  162. (PVOID) TransportEntryPoints,
  163. (PCTSTR *) g_TransportEntryPoints,
  164. sizeof (TRANSPORT_ENTRYPOINTS)
  165. );
  166. }