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.

451 lines
5.4 KiB

  1. /*++
  2. Copyright (c) 1997 Microsoft Corporation
  3. Module Name:
  4. exports.c
  5. Abstract:
  6. entry point and functions exported by cscdll.dll
  7. Contents:
  8. Author:
  9. Shishir Pardikar
  10. Environment:
  11. Win32 (user-mode) DLL
  12. Revision History:
  13. 4-4-97 created by putting all the exported functions here.
  14. --*/
  15. #include "pch.h"
  16. #ifdef CSC_ON_NT
  17. #include <winioctl.h>
  18. #endif //CSC_ON_NT
  19. #include "shdcom.h"
  20. #include "shdsys.h"
  21. #include "reint.h"
  22. #include "utils.h"
  23. #include "resource.h"
  24. #include "strings.h"
  25. // this sets flags in a couple of headers to not include some defs.
  26. #define REINT
  27. #include "lib3.h"
  28. //
  29. // Globals/Locals
  30. //
  31. HANDLE vhinstCur=NULL; // current instance
  32. AssertData;
  33. AssertError;
  34. #ifndef CSC_ON_NT
  35. extern HWND vhwndShared;
  36. #endif
  37. //
  38. // Local prototypes
  39. //
  40. int
  41. PASCAL
  42. ReInt_WinMain(
  43. HANDLE,
  44. HANDLE,
  45. LPSTR,
  46. int
  47. );
  48. //
  49. // functions
  50. //
  51. BOOL
  52. APIENTRY
  53. LibMain(
  54. IN HANDLE hDll,
  55. IN DWORD dwReason,
  56. IN LPVOID lpReserved
  57. )
  58. /*++
  59. Routine Description:
  60. Entry point for the agent library.
  61. Arguments:
  62. hDll - Library handle
  63. dwReason - PROCESS_ATTACH etc.
  64. lpReserved - reserved
  65. Returns:
  66. TRUE if successful.
  67. Notes:
  68. --*/
  69. {
  70. switch(dwReason){
  71. case DLL_PROCESS_ATTACH:
  72. case DLL_THREAD_ATTACH:
  73. if (!vhinstCur){
  74. vhinstCur = hDll;
  75. }
  76. if (!vhMutex){
  77. vhMutex = CreateMutex(NULL, FALSE, NULL);
  78. if (!vhMutex){
  79. OutputDebugString(_TEXT("CreateMutex Failed \r\n"));
  80. }
  81. }
  82. break;
  83. case DLL_THREAD_DETACH:
  84. break;
  85. case DLL_PROCESS_DETACH:
  86. CleanupReintState();
  87. if (vhMutex)
  88. {
  89. CloseHandle(vhMutex);
  90. }
  91. break;
  92. default:
  93. break;
  94. } // end switch()
  95. return TRUE;
  96. }
  97. DWORD
  98. WINAPI
  99. MprServiceProc(
  100. IN LPVOID lpvParam
  101. )
  102. /*++
  103. Routine Description:
  104. Parameters:
  105. lpvParam - NULL indicates start, non-NULL indicates terminate
  106. Return Value:
  107. Notes:
  108. --*/
  109. {
  110. if (!lpvParam){
  111. Assert (vhinstCur != NULL);
  112. // DEBUG_PRINT(("MprServiceProc: Calling ReInt_WinMain!\n"));
  113. ReInt_WinMain(vhinstCur, NULL, NULL, SW_SHOW);
  114. }
  115. else
  116. {
  117. if (vhwndMain)
  118. {
  119. DestroyWindow(vhwndMain);
  120. }
  121. }
  122. return (0L);
  123. }
  124. #ifndef CSC_ON_NT
  125. VOID
  126. WINAPI
  127. LogonHappened(
  128. IN BOOL fDone
  129. )
  130. /*++
  131. Routine Description:
  132. Win95 specific routine. No significance for NT
  133. Parameters:
  134. Return Value:
  135. Notes:
  136. When the network comes back on, this is called by shdnp.dll
  137. we nuke our shadowed connections, and replace them with 'true' connections
  138. NB!!!!: this function could be called in the context of a thread other than the
  139. reint thread.
  140. --*/
  141. {
  142. if (vhwndShared)
  143. {
  144. SendMessage(vhwndShared, WM_COMMAND, IDM_LOGON, fDone);
  145. }
  146. }
  147. VOID
  148. WINAPI
  149. LogoffHappened(
  150. BOOL fDone
  151. )
  152. /*++
  153. Routine Description:
  154. this is called by shdnp.dll during logoff sequence by shdnp
  155. NB!!!!: this function could be called in the context of a thread other than the
  156. reint thread.
  157. Arguments:
  158. Returns:
  159. Notes:
  160. --*/
  161. {
  162. if (vhwndShared)
  163. {
  164. SendMessage(vhwndShared, WM_COMMAND, IDM_LOGOFF, fDone);
  165. }
  166. }
  167. //
  168. // Called from Shhndl.dll to update the servers
  169. // Pass the server ID and a parent window to own the UI.
  170. //
  171. int
  172. WINAPI
  173. Update(
  174. HSERVER hServer,
  175. HWND hwndParent
  176. )
  177. /*++
  178. Routine Description:
  179. Arguments:
  180. Returns:
  181. Notes:
  182. --*/
  183. {
  184. int iRes;
  185. if(hServer==(HSERVER)NULL){
  186. iRes=(int)SendMessage(vhwndShared, RWM_UPDATEALL, (WPARAM)hServer, (LPARAM)hwndParent);
  187. }
  188. else{
  189. iRes=(int)SendMessage(vhwndShared, RWM_UPDATE, (WPARAM)hServer, (LPARAM)hwndParent);
  190. }
  191. return iRes;
  192. }
  193. int
  194. WINAPI
  195. RefreshConnections(
  196. int force,
  197. BOOL verbose
  198. )
  199. /*++
  200. Routine Description:
  201. Arguments:
  202. Returns:
  203. Notes:
  204. --*/
  205. {
  206. return (SendMessage(vhwndShared, WM_COMMAND, IDM_REFRESH_CONNECTIONS, MAKELPARAM(force, verbose)));
  207. }
  208. int
  209. WINAPI
  210. BreakConnections(
  211. int force,
  212. BOOL verbose
  213. )
  214. /*++
  215. Routine Description:
  216. Arguments:
  217. Returns:
  218. Notes:
  219. --*/
  220. {
  221. return (SendMessage(vhwndShared, WM_COMMAND, IDM_BREAK_CONNECTIONS, MAKELPARAM(force, verbose)));
  222. }
  223. #else
  224. VOID
  225. WINAPI
  226. LogonHappened(
  227. IN BOOL fDone
  228. )
  229. /*++
  230. Routine Description:
  231. Parameters:
  232. Return Value:
  233. Notes:
  234. --*/
  235. {
  236. }
  237. VOID
  238. WINAPI
  239. LogoffHappened(
  240. BOOL fDone
  241. )
  242. /*++
  243. Routine Description:
  244. Arguments:
  245. Returns:
  246. Notes:
  247. --*/
  248. {
  249. }
  250. int
  251. WINAPI
  252. Update(
  253. HSERVER hServer,
  254. HWND hwndParent
  255. )
  256. /*++
  257. Routine Description:
  258. Arguments:
  259. Returns:
  260. Notes:
  261. --*/
  262. {
  263. return -1;
  264. }
  265. int
  266. WINAPI
  267. RefreshConnections(
  268. int force,
  269. BOOL verbose
  270. )
  271. /*++
  272. Routine Description:
  273. Arguments:
  274. Returns:
  275. Notes:
  276. --*/
  277. {
  278. return (-1);
  279. }
  280. int
  281. WINAPI
  282. BreakConnections(
  283. int force,
  284. BOOL verbose
  285. )
  286. /*++
  287. Routine Description:
  288. Arguments:
  289. Returns:
  290. Notes:
  291. --*/
  292. {
  293. return (-1);
  294. }
  295. #endif