/*++ Copyright (c) 1987-1993 Microsoft Corporation Module Name: ImpStart.c Abstract: Contains ImportDirStartRepl(). Author: 10/31/91 madana initial coding Environment: User mode only. Requires ANSI C extensions: slash-slash comments, long external names. Tab size is set to 4. Revision History: 09-Feb-1992 JohnRo Created this routine from code written by MadanA. 14-Feb-1992 JohnRo ApiStatus is sometimes wrong. 05-Mar-1992 JohnRo Changed interface to match new service controller. 06-Mar-1992 JohnRo Avoid starting RPC server too soon. 23-Mar-1992 JohnRo Got rid of useless master and client termination codes. 01-Apr-1992 JohnRo Avoid assertion if import startup fails. Up the stack size, just to be on the safe side. 19-Aug-1992 JohnRo RAID 2115: repl svc should wait while stopping or changing role. 11-Mar-1993 JohnRo RAID 12100: stopping repl sometimes goes into infinite loop. Use PREFIX_ equates. 02-Apr-1993 JohnRo Use NetpKdPrint() where possible. 24-May-1993 JohnRo RAID 10587: repl could deadlock with changed NetpStopRpcServer(), so just call ExitProcess() instead. --*/ // These must be included first: #include // CreateThread(), DWORD, etc. #include // IN, NET_API_STATUS, etc. // These can be included in any order: #include // ImportDir{Start,Stop}Repl routines. #include // REPL_ROLE_ equates. #include // DBGSTATIC, NetpKdPrint(), FORMAT_ equates. #include // PREFIX_ equates. #include // IF_DEBUG(). #include // ReplGlobal variables. #include // ERROR_ and NO_ERROR equates. #define CLIENT_STACK_SIZE (24 * 1024) /* BUGBUG: Wild guess! */ DBGSTATIC NET_API_STATUS CreateClientThread( IN BOOL ServiceIsStarting ); // Start replicating (importing). Wait for client thread to startup. // Called when service starts or user does NetReplSetInfo() and changes role. NET_API_STATUS ImportDirStartRepl ( IN BOOL ServiceIsStarting ) { NET_API_STATUS ApiStatus; DWORD EventTriggered; HANDLE WaitHandles[3]; IF_DEBUG(REPL) { NetpKdPrint(( PREFIX_REPL_CLIENT "ImportDirStartRepl: Beginning...\n" )); } // Reset events in case we've ever been running before. (VOID) ResetEvent( ReplGlobalImportStartupEvent ); (VOID) ResetEvent( ReplGlobalClientTerminateEvent ); // start up client ApiStatus = CreateClientThread( ServiceIsStarting ); if (ApiStatus != NO_ERROR) { goto Cleanup; } NetpAssert( ReplGlobalClientThreadHandle != NULL ); #define DUMP_WAIT_HANDLES( array, total ) \ { \ DWORD index; \ for (index=0; index