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.

244 lines
6.2 KiB

  1. /*++
  2. Copyright (c) 1997-1999 Microsoft Corporation
  3. Module Name:
  4. clusres.c
  5. Abstract:
  6. Common Resource DLL Startup
  7. Author:
  8. John Vert (jvert) 12/15/1996
  9. Revision History:
  10. Sivaprasad Padisetty (sivapad) 04/22/1996 Added the local quorum
  11. --*/
  12. #include "clusres.h"
  13. #include "clusrtl.h"
  14. #include "clusudef.h"
  15. PSET_RESOURCE_STATUS_ROUTINE ClusResSetResourceStatus = NULL;
  16. PLOG_EVENT_ROUTINE ClusResLogEvent = NULL;
  17. DWORD g_dwDebugLogLevel;
  18. BOOLEAN
  19. WINAPI
  20. ClusResDllEntry(
  21. IN HINSTANCE DllHandle,
  22. IN DWORD Reason,
  23. IN LPVOID Reserved
  24. )
  25. /*++
  26. Routine Description:
  27. Main DLL entrypoint for combined resource DLL.
  28. Arguments:
  29. DllHandle - Supplies the DLL handle.
  30. Reason - Supplies the call reason
  31. Return Value:
  32. TRUE if successful
  33. FALSE if unsuccessful
  34. --*/
  35. {
  36. if (Reason == DLL_PROCESS_ATTACH) {
  37. LPWSTR lpszDebugLogLevel;
  38. DisableThreadLibraryCalls(DllHandle);
  39. lpszDebugLogLevel = _wgetenv(L"ClusterLogLevel");
  40. g_dwDebugLogLevel = 0;
  41. if (lpszDebugLogLevel != NULL) {
  42. int nFields;
  43. nFields = swscanf(lpszDebugLogLevel, L"%u", &g_dwDebugLogLevel);
  44. if ( nFields != 1 ) {
  45. g_dwDebugLogLevel = 0;
  46. }
  47. }
  48. ClRtlInitialize( TRUE, &g_dwDebugLogLevel );
  49. ClRtlInitWmi(NULL);
  50. }
  51. //
  52. // Let everybody else have their shot at it.
  53. //
  54. if (!GenAppDllEntryPoint(DllHandle, Reason, Reserved)) {
  55. return(FALSE);
  56. }
  57. if (!GenSvcDllEntryPoint(DllHandle, Reason, Reserved)) {
  58. return(FALSE);
  59. }
  60. #if 0
  61. if (!FtSetDllEntryPoint(DllHandle, Reason, Reserved)) {
  62. return(FALSE);
  63. }
  64. #endif
  65. if (!DisksDllEntryPoint(DllHandle, Reason, Reserved)) {
  66. return(FALSE);
  67. }
  68. if (!NetNameDllEntryPoint(DllHandle, Reason, Reserved)) {
  69. return(FALSE);
  70. }
  71. if (!IpAddrDllEntryPoint(DllHandle, Reason, Reserved)) {
  72. return(FALSE);
  73. }
  74. if (!SmbShareDllEntryPoint(DllHandle, Reason, Reserved)) {
  75. return(FALSE);
  76. }
  77. if (!SplSvcDllEntryPoint(DllHandle, Reason, Reserved)) {
  78. return(FALSE);
  79. }
  80. if (!LkQuorumDllEntryPoint(DllHandle, Reason, Reserved)) {
  81. return(FALSE);
  82. }
  83. #if 0
  84. if (!TimeSvcDllEntryPoint(DllHandle, Reason, Reserved)) {
  85. return(FALSE);
  86. }
  87. #endif
  88. if (!GenScriptDllEntryPoint(DllHandle, Reason, Reserved)) {
  89. return(FALSE);
  90. }
  91. if (!MsMQDllEntryPoint(DllHandle, Reason, Reserved)) {
  92. return(FALSE);
  93. }
  94. if (!MajorityNodeSetDllEntryPoint(DllHandle, Reason, Reserved)) {
  95. return(FALSE);
  96. }
  97. if (Reason == DLL_PROCESS_DETACH) {
  98. ClRtlCleanup();
  99. }
  100. return(TRUE);
  101. }
  102. DWORD
  103. WINAPI
  104. Startup(
  105. IN LPCWSTR ResourceType,
  106. IN DWORD MinVersionSupported,
  107. IN DWORD MaxVersionSupported,
  108. IN PSET_RESOURCE_STATUS_ROUTINE SetResourceStatus,
  109. IN PLOG_EVENT_ROUTINE LogEvent,
  110. OUT PCLRES_FUNCTION_TABLE *FunctionTable
  111. )
  112. /*++
  113. Routine Description:
  114. Startup a particular resource type. This means verifying the version
  115. requested, and returning the function table for this resource type.
  116. Arguments:
  117. ResourceType - Supplies the type of resource.
  118. MinVersionSupported - The minimum version number supported by the cluster
  119. service on this system.
  120. MaxVersionSupported - The maximum version number supported by the cluster
  121. service on this system.
  122. SetResourceStatus - xxx
  123. LogEvent - xxx
  124. FunctionTable - Returns the Function Table for this resource type.
  125. Return Value:
  126. ERROR_SUCCESS if successful.
  127. A Win32 error code on failure.
  128. --*/
  129. {
  130. if ( (MinVersionSupported > CLRES_VERSION_V1_00) ||
  131. (MaxVersionSupported < CLRES_VERSION_V1_00) ) {
  132. return(ERROR_REVISION_MISMATCH);
  133. }
  134. if ( !ClusResLogEvent ) {
  135. ClusResLogEvent = LogEvent;
  136. ClusResSetResourceStatus = SetResourceStatus;
  137. }
  138. if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_GENSVC ) == 0 ) {
  139. *FunctionTable = &GenSvcFunctionTable;
  140. return(ERROR_SUCCESS);
  141. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_GENAPP ) == 0 ) {
  142. *FunctionTable = &GenAppFunctionTable;
  143. return(ERROR_SUCCESS);
  144. #if 0
  145. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_FTSET ) == 0 ) {
  146. *FunctionTable = &FtSetFunctionTable;
  147. return(ERROR_SUCCESS);
  148. #endif
  149. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_PHYS_DISK ) == 0 ) {
  150. *FunctionTable = &DisksFunctionTable;
  151. return(ERROR_SUCCESS);
  152. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_FILESHR ) == 0 ) {
  153. *FunctionTable = &SmbShareFunctionTable;
  154. return(ERROR_SUCCESS);
  155. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_NETNAME ) == 0 ) {
  156. *FunctionTable = &NetNameFunctionTable;
  157. return(ERROR_SUCCESS);
  158. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_IPADDR ) == 0 ) {
  159. *FunctionTable = &IpAddrFunctionTable;
  160. return(ERROR_SUCCESS);
  161. #if 0
  162. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_TIMESVC ) == 0 ) {
  163. *FunctionTable = &TimeSvcFunctionTable;
  164. return(ERROR_SUCCESS);
  165. #endif
  166. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_PRTSPLR ) == 0 ) {
  167. *FunctionTable = &SplSvcFunctionTable;
  168. return(ERROR_SUCCESS);
  169. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_LKQUORUM ) == 0 ) {
  170. *FunctionTable = &LkQuorumFunctionTable;
  171. return(ERROR_SUCCESS);
  172. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_MSMQ ) == 0 ) {
  173. *FunctionTable = &MsMQFunctionTable;
  174. return(ERROR_SUCCESS);
  175. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_GENSCRIPT ) == 0 ) {
  176. *FunctionTable = &GenScriptFunctionTable;
  177. return(ERROR_SUCCESS);
  178. } else if ( lstrcmpiW( ResourceType, CLUS_RESTYPE_NAME_MAJORITYNODESET) == 0 ) {
  179. *FunctionTable = &MajorityNodeSetFunctionTable;
  180. return(ERROR_SUCCESS);
  181. } else {
  182. return(ERROR_CLUSTER_RESNAME_NOT_FOUND);
  183. }
  184. } // Startup