Source code of Windows XP (NT5)
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.

203 lines
4.1 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. FileEnumInitialize ();
  112. RegInitialize ();
  113. IsmGetTempDirectory (memDbDir, ARRAYSIZE (memDbDir));
  114. if (!MemDbInitializeEx (memDbDir)) {
  115. IsmSetCancel();
  116. return FALSE;
  117. }
  118. return TRUE;
  119. }
  120. EXPORT
  121. VOID
  122. WINAPI
  123. ModuleTerminate (
  124. VOID
  125. )
  126. {
  127. MemDbTerminateEx (TRUE);
  128. RegTerminate();
  129. FileEnumTerminate ();
  130. UtTerminate ();
  131. }
  132. BOOL
  133. WINAPI
  134. pFindModule (
  135. IN PCTSTR ModuleId,
  136. OUT PVOID IsmBuffer,
  137. IN PCTSTR *TableEntry,
  138. IN UINT StructureSize
  139. )
  140. {
  141. while (*TableEntry) {
  142. if (StringIMatch (*TableEntry, ModuleId)) {
  143. CopyMemory (
  144. IsmBuffer,
  145. (PBYTE) (TableEntry + 1),
  146. StructureSize
  147. );
  148. return TRUE;
  149. }
  150. TableEntry = (PCTSTR *) ((PBYTE) (TableEntry + 1) + StructureSize);
  151. }
  152. return FALSE;
  153. }
  154. EXPORT
  155. BOOL
  156. WINAPI
  157. TransportModule (
  158. IN PCTSTR ModuleId,
  159. IN OUT PTRANSPORT_ENTRYPOINTS TransportEntryPoints
  160. )
  161. {
  162. return pFindModule (
  163. ModuleId,
  164. (PVOID) TransportEntryPoints,
  165. (PCTSTR *) g_TransportEntryPoints,
  166. sizeof (TRANSPORT_ENTRYPOINTS)
  167. );
  168. }