コード例 #1
0
ファイル: nlmver.c プロジェクト: groessler/open-watcom-v2
gui_message_return CheckInstallNLM( const char *name, vhandle var_handle )
{
    char        unpacked_as[_MAX_PATH];
    char        temp[_MAX_PATH];
    char        drive[_MAX_DRIVE];
    char        dir[_MAX_DIR];
    char        fname[_MAX_FNAME];
    char        ext[_MAX_EXT];

    _splitpath( name, drive, dir, fname, ext );
    _makepath( unpacked_as, drive, dir, fname, "._N_" );
    if( CheckNewer( unpacked_as, name ) ) {
        _makepath( temp, NULL, sysPath, fname, ext );
        if( CheckNewer( unpacked_as, temp ) ) {
            chmod( name, PMODE_RWX );
            DoCopyFile( unpacked_as, name, false );
            strcpy( temp, fname );
            strcat( temp, "_NLM_installed" );
            SetVariableByName( temp, "1" );
            SetVariableByHandle( var_handle, temp );
        }
    }
    remove( unpacked_as );
    return( GUI_RET_OK );
}
コード例 #2
0
ファイル: setup.c プロジェクト: jossk/open-watcom-v2
static bool CheckWow64( void )
{
    DWORD   version = GetVersion();
    if( version < 0x80000000 && LOBYTE( LOWORD( version ) ) >= 5 && IsWOW64() ) {
        char *msg = "You are using 32-bit installer on 64-bit host\n"
                    "It is recommended to use 64-bit installer\n"
                    "\ton 64-bit host\n"
                    "Press OK button to continue with installation\n"
                    "\tor Cancel button to abort it\n";

        InitGlobalVarList();
        SetVariableByName( "IDS_USEINST64BIT", "%s");
        if( MsgBox( NULL, "IDS_USEINST64BIT", GUI_OK_CANCEL, msg ) != GUI_RET_OK ) {
            /* return TRUE to terminate installer */
            return( TRUE );
        }
    }
    return( FALSE );
}
コード例 #3
0
ファイル: setup.c プロジェクト: Ukusbobra/open-watcom-v2
extern bool DoMainLoop( dlg_state * state )
/*****************************************/
{
    const char          *diag_list[MAX_DIAGS + 1];
    const char          *diags;
    const char          *dstdir;
    int                 dstlen;
    bool                got_disk_sizes = FALSE;
    int                 i;
    char                newdst[_MAX_PATH];
    char                *next;
    bool                ret = FALSE;

    SetupTitle();

    // display initial dialog
    diags = GetVariableStrVal( "DialogOrder" );
    if( stricmp( diags, "" ) == 0 ) {
        diags = "Welcome";
    }
    i = 0;
    for( ;; ) {
        diag_list[i] = diags;
        next = strchr( diags, ',' );
        if( next == NULL ) break;
        *next = '\0';
        diags = next + 1;
        ++i;
    }
    diag_list[i + 1] = NULL;
    /* process installation dialogs */

    i = 0;
    for( ;; ) {
        if( i < 0 ) break;
        if( diag_list[i] == NULL ) {
            if( GetVariableIntVal( "DoCopyFiles" ) == 1 ) {
                if( !CheckDrive( TRUE ) ) {
                    i = 0;
                }
            }
            if( GetVariableByName( "SetupPath" ) != NO_VAR ) {
                ret = TRUE;
                break;
            }
            if( diag_list[i] == NULL ) {
                    StatusShow( TRUE );
                    ret = SetupOperations();
                    StatusShow( FALSE );
                    if( ret ) DoDialog( "Finished" );
                    break;
            }
        }
        if( stricmp( diag_list[i], "GetDiskSizesHere" ) == 0 ) {
            if( *state == DLG_NEXT ) {

                dstdir = GetVariableStrVal( "DstDir" );
                dstlen = strlen( dstdir );
                if( dstlen != 0 &&
                    (dstdir[dstlen - 1] == '\\' || dstdir[dstlen - 1] == '/') ) {
                    strcpy( newdst, dstdir );
                    if( dstlen == 3 && dstdir[1] == ':' ) {
                        newdst[dstlen] = '.';
                        newdst[dstlen + 1] = '\0';
                    } else {
                        newdst[dstlen - 1] = '\0';
                    }
                    SetVariableByName( "DstDir", newdst );
                }
                SimSetNeedGetDiskSizes();
                ResetDiskInfo();
                got_disk_sizes = TRUE;

            }
        } else {
            *state = DoDialog( diag_list[i] );
            GUIWndDirty( NULL );
            StatusCancelled();
        }
        if( *state == DLG_CAN ) {
            if( MsgBox( NULL, "IDS_QUERYABORT", GUI_YES_NO ) == GUI_RET_YES ) {
                CancelSetup = TRUE;
                break;
            }
        } else if( *state == DLG_DONE ) {
            CancelSetup = TRUE;
            break;
        }
        if( got_disk_sizes ) {
            if( !CheckDrive( FALSE ) ) {
                break;
            }
        }
        if( *state == DLG_SAME ) {
            /* nothing */
        } else if( *state == DLG_NEXT || *state == DLG_SKIP ) {
            if( SkipDialogs ) {
                ++i;
            } else {
                for( ;; ) {
                    ++i;
                    if( diag_list[i] == NULL ) break;
                    if( CheckDialog( diag_list[i] ) ) break;
                }
            }
        } else if( *state == DLG_PREV ) {
            for( ;; ) {
                --i;
                if( i < 0 ) break;
                if( CheckDialog( diag_list[i] ) ) break;
            }
        } else if( *state == DLG_START ) {
            i = 0;
        }
    } /* for */

    return( ret );
}
コード例 #4
0
extern void SetDefaultGlobalVarList( void )
/*****************************************/
{
    char    szBuf[_MAX_PATH];
#if defined( __NT__ )
    char *  last_slash;
#endif

    // create global variables for each default system
    SetVariableByName( "true", "1" );
    SetVariableByName( "false", "0" );
#if defined( __DOS__ )
    SetVariableByName( "IsDos", "1" );
    SetVariableByName( "IsOS2DosBox", _osmajor >= 10 ? "1" : "0" );
#else
    SetVariableByName( "IsDos", "0" );
#endif

#if defined( __WINDOWS__ )
    SetVariableByName( "IsWin", "1" );
    SetVariableByName( "IsOS2DosBox", _osmajor >= 10 ? "1" : "0" );
#else
    SetVariableByName( "IsWin", "0" );
#endif

#if defined( __OS2__ )
    SetVariableByName( "IsOS2", "1" );
#else
    SetVariableByName( "IsOS2", "0" );
#endif

#if defined( __NT__ )
    {
        DWORD   version = GetVersion();
        if( version < 0x80000000 ) {
            SetVariableByName( "IsWinNT", "1" );
            SetVariableByName( "IsWin32", "1" );
            if( LOBYTE( LOWORD( version ) ) >= 4 ) {
                SetVariableByName( "IsWinNT40", "1" );
            } else {
                SetVariableByName( "IsWinNT40", "0" );
            }
        } else if( LOBYTE( LOWORD( version ) ) < 4 ) {
            SetVariableByName( "IsWin32s", "1" );
        } else {
            SetVariableByName( "IsWin95", "1" );
            SetVariableByName( "IsWin32", "1" );
        }
        if( LOBYTE( LOWORD( version ) ) >= 5 ) {
            SetVariableByName( "IsWin98", "1" );
        } else {
            SetVariableByName( "IsWin98", "0" );
        }
    }
#else
    SetVariableByName( "IsWinNT", "0" );
    SetVariableByName( "IsWin95", "0" );
#endif
#if defined( __WINDOWS__ ) || defined( __NT__ )
    GetSystemDirectory( szBuf, sizeof( szBuf ) );
#else
    strcpy( szBuf, "C:\\WINDOWS\\SYSTEM" );
#endif
    SetVariableByName( "WinSystemDir", szBuf );
#if defined( __NT__ )
    last_slash = strrchr( szBuf, '\\' );
    strcpy( last_slash, "\\SYSTEM" );
#endif
    SetVariableByName( "WinSystem16Dir", szBuf );
#if defined( __WINDOWS__ ) || defined( __NT__ )
    GetWindowsDirectory( szBuf, sizeof( szBuf ) );
#else
    strcpy( szBuf, "C:\\WINDOWS" );
#endif
    SetVariableByName( "WinDir", szBuf );

#if defined( __NT__ )
    if( !SearchPath( NULL, "CMD.EXE", NULL, sizeof( szBuf ), szBuf, NULL ) ) {
        if( !SearchPath( NULL, "COMMAND.COM", NULL, sizeof( szBuf ), szBuf, NULL ) ) {
#endif
            strcpy( szBuf, "COMMAND.COM" );
#if defined( __NT__ )
        }
    }
#endif
    SetVariableByName( "Command", szBuf );

#if defined( __AXP__ )
    SetVariableByName( "IsAlpha", "1" );
#else
    SetVariableByName( "IsAlpha", "0" );
#endif

#if defined( __LINUX__ )
    SetVariableByName( "IsLinux", "1" );
#else
    SetVariableByName( "IsLinux", "0" );
#endif
}