dip_status DIPSysLoad( char *path, dip_client_routines *cli, dip_imp_routines **imp, unsigned long *sys_hdl ) { int dll; dip_imp_routines *(*init_func)( dip_status *, dip_client_routines * ); char newpath[256]; dip_status status; strcpy( newpath, path ); strcat( newpath, ".dll" ); dll = RdosLoadDll( newpath ); if( dll == NULL ) { return( DS_ERR|DS_FOPEN_FAILED ); } init_func = RdosGetModuleProc( dll, "DIPLOAD" ); if( init_func == NULL ) { RdosFreeDll( dll ); return( DS_ERR|DS_INVALID_DIP ); } *imp = init_func( &status, cli ); if( *imp == NULL ) { RdosFreeDll( dll ); return( status ); } *sys_hdl = (unsigned long)dll; return( DS_OK ); }
int PILLSysLoad( const char *path, const pill_client_routines *cli, link_handle *lh, link_message *msg ) { int dll; char newpath[256]; pill_init_func *init_func; msg->source = NULL; msg->id = LM_SYSTEM_ERROR; strcpy( newpath, path ); strcat( newpath, ".dll" ); dll = RdosLoadDll( newpath ); if( dll == NULL ) { msg->data.code = -1; return( 0 ); } init_func = RdosGetModuleProc( dll, "PILLLOAD" ); if( init_func == NULL ) { msg->data.code = -1; RdosFreeDll( dll ); return( 0 ); } lh->sys = (void *)dll; lh->rtns = init_func( cli, msg ); if( lh->rtns == NULL ) { /* don't free DLL yet, we need the message processor */ msg->source = lh; return( 0 ); } return( 1 ); }
mad_status MADSysLoad( char *path, mad_client_routines *cli, mad_imp_routines **imp, mad_sys_handle *sys_hdl ) { int dll; mad_init_func *init_func; char newpath[256]; mad_status status; strcpy( newpath, path ); strcat( newpath, ".dll" ); dll = RdosLoadDll( newpath ); if( dll == 0 ) { return( MS_ERR|MS_FOPEN_FAILED ); } status = MS_ERR|MS_INVALID_MAD; init_func = (mad_init_func *)RdosGetModuleProc( dll, "MADLOAD" ); if( init_func != NULL && (*imp = init_func( &status, cli )) != NULL ) { *sys_hdl = dll; return( MS_OK ); } RdosFreeDll( dll ); return( status ); }