Ejemplo n.º 1
0
void InitMsg( void )
{
    int initerror;

    hInstance.filename = ImageName;
    initerror = OpenResFile( &hInstance ) == NIL_HANDLE;
    if( !initerror ) {
        initerror = FindResources( &hInstance );
        if( initerror ) {
            CloseResFile( &hInstance );
        }
    }
    if( !initerror ) {
        initerror = InitResources( &hInstance );
        if( initerror ) {
            CloseResFile( &hInstance );
        }
    }
    MsgShift = WResLanguage() * MSG_LANG_SPACING;
    if( initerror ) {
        Res_Flag = EXIT_FAILURE;
        FatalResError();
    } else {
        Res_Flag = EXIT_SUCCESS;
    }
}
Ejemplo n.º 2
0
int MsgInit( void )
{
#if !defined( USE_TEXT_MSGS )
    int         initerror;
    char        name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) == NULL ) {
        initerror = 1;
    } else {
        hInstance.filename = name;
        OpenResFile( &hInstance );
        if( hInstance.handle == NIL_HANDLE ) {
            initerror = 1;
        } else {
            initerror = FindResources( &hInstance );
            if( !initerror ) {
                initerror = InitResources( &hInstance );
            }
        }
    }
    MsgShift = WResLanguage() * MSG_LANG_SPACING;
    if( !initerror && !MsgGet( MSG_USE_BASE, name ) ) {
        initerror = 1;
    }
    if( initerror ) {
        write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
        MsgFini();
        return( 0 );
    }
#endif
    return( 1 );
}
Ejemplo n.º 3
0
int InitMsg( void )
{
    char        buff[_MAX_PATH];
#if defined( IDE_PGM ) || !defined( __WATCOMC__ )
    char        imageName[_MAX_PATH];
#else
    char        *imageName;
#endif

    hInstance.handle = NIL_HANDLE;
#if defined( IDE_PGM )
    _cmdname( imageName );
#elif !defined( __WATCOMC__ )
    get_dllname( imageName, sizeof( imageName ) );
#else
    imageName = _LpDllName;;
#endif
    BannerPrinted = false;
    if( !OpenResFile( &hInstance, imageName ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( Msg_Get( MSG_PRODUCT, buff ) ) {
                Res_Flag = EXIT_SUCCESS;
                return( Res_Flag );
            }
        }
        CloseResFile( &hInstance );
        hInstance.handle = NIL_HANDLE;
    }
    WriteStdOutInfo( NO_RES_MESSAGE, ERR, NULL );
    Res_Flag = EXIT_FAILURE;
    return( Res_Flag );
}
Ejemplo n.º 4
0
bool GUILoadStrInit( const char *fname )
{
    bool        error;

    error = OpenResFile( &hInstance, fname ) == NIL_HANDLE;
    if( !error ) {
        if( GUIGetExtName() != NULL ) {
            // we are using an external resource file so we don't have to
            // search
            FileShift = 0;
        } else {
            error = FindResources( &hInstance );
        }
    }
    if( !error ) {
        error = InitResources( &hInstance );
    }
    if( error ) {
        GUIMsgInitFlag = FALSE;
        write( fileno(stdout), NO_RES_MESSAGE_PREFIX, sizeof( NO_RES_MESSAGE_PREFIX ) - 1 );
        write( fileno(stdout), fname,                 strlen( fname ) );
        write( fileno(stdout), NO_RES_MESSAGE_SUFFIX, sizeof( NO_RES_MESSAGE_SUFFIX ) - 1 );
    } else {
        GUIMsgInitFlag = TRUE;
    }

    return( GUIMsgInitFlag );
}
Ejemplo n.º 5
0
static  void    ErrorInit( const char *pgm_name )
{
    hInstance.handle = NIL_HANDLE;
    if( OpenResFile( &hInstance, pgm_name ) )
        return;
    ResFlags |= RF_OPENED;
    if( FindResources( &hInstance ) )
        return;
    if( InitResources( &hInstance ) )
        return;
    MsgShift = _WResLanguage() * MSG_LANG_SPACING;
    ResFlags |= RF_INITIALIZED;
}
Ejemplo n.º 6
0
int InitRcMsgs( void )
{
    int         error;
    WResFileID  (* oldopen)(const char *, int, ...);
    char        testbuf[1];
#if defined( IDE_PGM ) || !defined( __WATCOMC__ )
    char        imageName[_MAX_PATH];
#else
    char        *imageName;
#endif

#if defined( IDE_PGM )
    _cmdname( imageName );
#elif !defined( __WATCOMC__ )
    get_dllname( imageName, sizeof( imageName ) );
#else
    imageName = _LpDllName;
#endif
    /*
     * swap open functions so this file handle is not buffered.
     * This makes it easier for layer0 to fool WRES into thinking
     * that the resource information starts at offset 0
     */
    oldopen = WResRtns.open;
    WResRtns.open = open;
    error = OpenResFile( &Instance, imageName );
    WResRtns.open = oldopen;
    if( !error ) {
        RegisterOpenFile( Instance.handle );
        error = FindResources( &Instance );
        if( !error ) {
            error = InitResources( &Instance );
        }
        if( error ) {
            CloseResFile( &Instance );
            UnRegisterOpenFile( Instance.handle );
        }
    }
    MsgShift = _WResLanguage() * MSG_LANG_SPACING;
    if( !error && !GetRcMsg( USAGE_MSG_FIRST, testbuf, sizeof( testbuf ) ) ) {
        error = TRUE;
    }
    if( error ) {
        RcFatalError( ERR_RCSTR_NOT_FOUND );
    }
    return( 1 );
}
Ejemplo n.º 7
0
int MsgInit( void )
{
    char        name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( GetMsg( name, MSG_USAGE_FIRST ) ) {
                return( 1 );
            }
        }
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    MsgFini();
    return( 0 );
}
Ejemplo n.º 8
0
int MsgInit( void )
/******************/
{
    char        name[_MAX_PATH];
    char        dummy[MAX_RESOURCE_SIZE];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( MsgGet( MSG_USAGE_BASE, dummy ) ) {
                return( true );
            }
        }
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    MsgFini();
    return( false );
}
Ejemplo n.º 9
0
bool MsgInit( void )
{
    char            name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        res_failure = false;
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( MsgGet( WDIS_LITERAL_BASE, name ) ) {
                return( true );
            }
        }
        MsgFini();
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    res_failure = true;
    return( false );
}
Ejemplo n.º 10
0
int Msg_Init( void )
{
    char        name[_MAX_PATH];

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( Msg_Get( MSG_USAGE_FIRST, name ) ) {
                Res_Flag = EXIT_SUCCESS;
                return( Res_Flag );
            }
        }
        CloseResFile( &hInstance );
        hInstance.handle = NIL_HANDLE;
    }
    Res_Flag = EXIT_FAILURE;
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    return Res_Flag;
}
Ejemplo n.º 11
0
bool GUILoadStrInit( const char *fname )
{
    hInstance.handle = NIL_HANDLE;
    if( !OpenResFile( &hInstance, fname ) ) {
        // if we are using an external resource file then we don't have to search
        FileShift = 0;
        if( GUIGetExtName() != NULL || !FindResources( &hInstance ) ) {
            if( !InitResources( &hInstance ) ) {
                GUIMsgInitFlag = true;
                return( true );
            }
        }
        CloseResFile( &hInstance );
    }
    write( fileno(stdout), NO_RES_MESSAGE_PREFIX, sizeof( NO_RES_MESSAGE_PREFIX ) - 1 );
    write( fileno(stdout), fname,                 strlen( fname ) );
    write( fileno(stdout), NO_RES_MESSAGE_SUFFIX, sizeof( NO_RES_MESSAGE_SUFFIX ) - 1 );
    GUIMsgInitFlag = false;
    return( false );
}
Ejemplo n.º 12
0
int InitMsg( void )
{
    char        buff[_MAX_PATH];
    int         initerror;
#if defined( IDE_PGM )
    char        fname[_MAX_PATH];

    initerror = _cmdname( fname ) == NULL;
#else
    char        *fname;

    fname = _LpDllName;
    initerror = fname == NULL;
#endif
    Res_Flag = EXIT_SUCCESS;
    BannerPrinted = FALSE;
    if( !initerror ) {
        OpenResFile( &hInstance, fname );
        if( hInstance.handle == NIL_HANDLE ) {
            initerror = TRUE;
        } else {
            initerror = FindResources( &hInstance );
        }
    }
    if( !initerror ) {
        initerror = InitResources( &hInstance );
    }
    MsgShift = WResLanguage() * MSG_LANG_SPACING;
    if( !initerror && !Msg_Get( MSG_PRODUCT, buff ) ) {
        initerror = 1;
    }
    if( initerror ) {
        Res_Flag = EXIT_FAILURE;
        WriteInfoStdOut( NO_RES_MESSAGE, ERR, NULL );
    } else {
        Res_Flag = EXIT_SUCCESS;
    }
    return( Res_Flag );
}
Ejemplo n.º 13
0
int MsgInit( void )
/*****************/
{
#ifndef BOOTSTRAP
    static char     name[_MAX_PATH]; // static because address passed outside.

    hInstance.handle = NIL_HANDLE;
    if( _cmdname( name ) != NULL && !OpenResFile( &hInstance, name ) ) {
        if( !FindResources( &hInstance ) && !InitResources( &hInstance ) ) {
            MsgShift = _WResLanguage() * MSG_LANG_SPACING;
            if( MsgGet( MSG_USAGE_BASE, name ) ) {
                return( 1 );
            }
        }
    }
    write( STDOUT_FILENO, NO_RES_MESSAGE, NO_RES_SIZE );
    MsgFini();
    return( 0 );
#else    
    return( 1 );
#endif
}