7 ldap_add_s(NULL, NULL, NULL);
8 ldap_bind_s(NULL, NULL, NULL, 0);
9 ldap_delete_s(NULL, NULL);
10 ldap_first_attribute(NULL, NULL, NULL);
11 ldap_first_entry(NULL, NULL);
12 ldap_get_dn(NULL, NULL);
13 ldap_get_option(NULL, 0, NULL);
14 ldap_get_values_len(NULL, NULL, NULL);
16 ldap_modify_s(NULL, NULL, NULL);
17 ldap_modrdn_s(NULL, NULL, NULL);
19 ldap_next_attribute(NULL, NULL, NULL);
20 ldap_result(NULL, 0, 0, NULL, NULL);
21 ldap_search(NULL, NULL, 0, NULL, NULL, 0);
25 #ifdef HAVE_NT_SERVICE_MANAGER
28 #include <ac/string.h>
32 ldap_pvt_thread_cond_t started_event, stopped_event;
33 ldap_pvt_thread_t start_status_tid, stop_status_tid;
37 void WINAPI ServiceMain( DWORD argc, LPTSTR *argv );
40 int srv_install( char* service, char* filename );
41 int srv_remove ( char* service, char* filename );
43 int main( int argc, LPTSTR *argv )
46 char filename[MAX_PATH], *fname_start;
47 extern int is_NT_Service;
49 SERVICE_TABLE_ENTRY DispatchTable[] = {
50 { SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION) ServiceMain },
55 // set the service's current directory to being the installation directory for the service.
56 // this way we don't have to write absolute paths in the configuration files
58 GetModuleFileName( NULL, filename, sizeof( filename ) );
59 fname_start = strrchr( filename, *LDAP_DIRSEP );
61 SetCurrentDirectory( filename );
64 if ( _stricmp( "install", argv[1] ) == 0 )
66 char *svcName = SERVICE_NAME;
67 if ( (argc > 2) && (argv[2] != NULL) )
69 if ( (length = GetModuleFileName(NULL, filename, sizeof( filename ))) == 0 )
71 fputs( "unable to retrieve file name for the service.\n", stderr );
74 if ( !srv_install(svcName, filename) )
76 fputs( "service failed installation ...\n", stderr );
79 fputs( "service has been installed ...\n", stderr );
83 if ( _stricmp( "remove", argv[1] ) == 0 )
85 char *svcName = SERVICE_NAME;
86 if ( (argc > 2) && (argv[2] != NULL) )
88 if ( (length = GetModuleFileName(NULL, filename, sizeof( filename ))) == 0 )
90 fputs( "unable to retrieve file name for the service.\n", stderr );
93 if ( !srv_remove(svcName, filename) )
95 fputs( "failed to remove the service ...\n", stderr );
98 fputs( "service has been removed ...\n", stderr );
103 puts( "starting slapd..." );
104 if ( !StartServiceCtrlDispatcher(DispatchTable) )
107 ServiceMain( argc, argv );