9 ldap_add_s(NULL, NULL, NULL);
10 ldap_bind_s(NULL, NULL, NULL, 0);
11 ldap_delete_s(NULL, NULL);
12 ldap_first_attribute(NULL, NULL, NULL);
13 ldap_first_entry(NULL, NULL);
14 ldap_get_dn(NULL, NULL);
15 ldap_get_option(NULL, 0, NULL);
16 ldap_get_values_len(NULL, NULL, NULL);
18 ldap_modify_s(NULL, NULL, NULL);
19 ldap_modrdn_s(NULL, NULL, NULL);
21 ldap_next_attribute(NULL, NULL, NULL);
22 ldap_result(NULL, 0, 0, NULL, NULL);
23 ldap_search(NULL, NULL, 0, NULL, NULL, 0);
27 #ifdef HAVE_NT_SERVICE_MANAGER
30 #include <ac/string.h>
34 ldap_pvt_thread_cond_t started_event, stopped_event;
35 ldap_pvt_thread_t start_status_tid, stop_status_tid;
39 void WINAPI ServiceMain( DWORD argc, LPTSTR *argv );
42 int srv_install( char* service, char* filename );
43 int srv_remove ( char* service, char* filename );
45 int main( int argc, LPTSTR *argv )
48 char filename[MAX_PATH], *fname_start;
49 extern int is_NT_Service;
51 SERVICE_TABLE_ENTRY DispatchTable[] = {
52 { SERVICE_NAME, (LPSERVICE_MAIN_FUNCTION) ServiceMain },
57 // set the service's current directory to being the installation directory for the service.
58 // this way we don't have to write absolute paths in the configuration files
60 GetModuleFileName( NULL, filename, sizeof( filename ) );
61 fname_start = strrchr( filename, *LDAP_DIRSEP );
63 SetCurrentDirectory( filename );
66 if ( _stricmp( "install", argv[1] ) == 0 )
68 char *svcName = SERVICE_NAME;
69 if ( (argc > 2) && (argv[2] != NULL) )
71 if ( (length = GetModuleFileName(NULL, filename, sizeof( filename ))) == 0 )
73 fputs( "unable to retrieve file name for the service.\n", stderr );
76 if ( !srv_install(svcName, filename) )
78 fputs( "service failed installation ...\n", stderr );
81 fputs( "service has been installed ...\n", stderr );
85 if ( _stricmp( "remove", argv[1] ) == 0 )
87 char *svcName = SERVICE_NAME;
88 if ( (argc > 2) && (argv[2] != NULL) )
90 if ( (length = GetModuleFileName(NULL, filename, sizeof( filename ))) == 0 )
92 fputs( "unable to retrieve file name for the service.\n", stderr );
95 if ( !srv_remove(svcName, filename) )
97 fputs( "failed to remove the service ...\n", stderr );
100 fputs( "service has been removed ...\n", stderr );
105 puts( "starting slapd..." );
106 if ( !StartServiceCtrlDispatcher(DispatchTable) )
109 ServiceMain( argc, argv );