⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 setup.rul

📁 vc环境下的pgp源码
💻 RUL
📖 第 1 页 / 共 5 页
字号:
// $Id: Setup.rul,v 1.95.2.2.2.1.2.1 1999/07/27 22:53:02 heller Exp $
//____________________________________________________________________________
//  Copyright (C) 1998 Pretty Good Privacy, Inc.
//  All rights reserved.
//
//  Author: Philip Nathan
//____________________________________________________________________________

// Include header files
    #include "sdlang.h"
    #include "sddialog.h"
    #include "setup.h"
// --- include script file section ---

    #include "globals.rul"
    #include "prototypes.rul"

///////////////////////////////////////////////////////////////////////////////
//
//   MAIN PROGRAM
//
//      The setup begins here by hiding the visible setup
//      window.  This is done to allow all the titles, images, etc. to
//      be established before showing the main window.  The setup is
//      then performed in a series of calls to script defined functions,
//      with error checking at each step.
//
///////////////////////////////////////////////////////////////////////////////
program
    Disable( BACKGROUND );

    CheckRequirements();

    ShutDownApps();

    SetInstallType();

    SetupInstall();

    SetupScreen();

    if (FindInstalledVersions()<0) goto end_install;

    Disable( DIALOGCACHE );
    if (bPGPFiveZero = TRUE) then
        Uninstall5X ("PGPFiveZero");
    endif;
    if (bPGPFiveFive = TRUE) then
        Uninstall5X ("PGPFiveFive");
    endif;
    if (bFiveFive = TRUE) then
        Uninstall5X ("FiveFive");
    endif;
    if (bSixZero = TRUE) then
        Uninstall6X();
    endif;
    if (bSixFive = TRUE) then
        Uninstall65();
    endif;
    Enable( DIALOGCACHE );

    if (ShowDialogs()<0) goto end_install;

    if (ProcessBeforeDataMove()<0) goto end_install;

    if (MoveFileData()<0) goto end_install;

    if (ProcessAfterDataMove()<0) goto end_install;

    if (SetupRegistry()<0) goto end_install;

    SetPrefUserInfo();

    SetKeyRings();

    if (SetupFolders()<0) goto end_install;

    StartMemLock();

    LaunchCtrlUpdater();

	if (bIsWindowsNT4) then
    	CleanHardwareSettings();
	endif;
	
    //Temporary
    SetUninstall();

    FinalInstallProcess();

    end_install:

    CleanUpInstall();

    // If an unrecoverable error occurred, clean up
    // the partial installation. Otherwise, exit normally.

    if (bInstallAborted) then
        abort;
    endif;

    Disable( DIALOGCACHE );
    SdShowMsg ( "Cleaning up, Please wait. . .", TRUE );
    Delay (4);
    SdShowMsg ( "Cleaning up, Please wait. . .", FALSE );
endprogram

///////////////////////////////////////////////////////////////////////////////
//
// Function:  ShowDialogs
//
//  Purpose:  This function manages the display and navigation of
//            the standard dialogs that exist in a setup.
//
///////////////////////////////////////////////////////////////////////////////
function ShowDialogs()
    NUMBER nResult;
    STRING svValue;
begin
    Dlg_Start:
    // beginning of dialogs label

    SetInstallType();

    Dlg_SdWelcome:
    if (bEasyInstall = FALSE) then
        Disable (BACKBUTTON);
        nResult = DialogShowSdWelcome();
        if (nResult = BACK) goto Dlg_Start;
        Enable (BACKBUTTON);

        Dlg_SdLicense:
        nResult = DialogShowSdLicense();
        if (nResult = BACK) goto Dlg_SdWelcome;

        Dlg_SdShowReadMe:
        nResult = DialogShowSdShowReadMe();
        if (nResult = BACK) goto Dlg_SdLicense;

        Dlg_SdRegisterUserEx:
        nResult = DialogShowSdRegisterUserEx();
        if (nResult = BACK) goto Dlg_SdShowReadMe;
    endif;

    Dlg_SdAskDestPath:
    nResult = DialogShowSdAskDestPath();
    if (bEasyInstall = FALSE) then
        if (bImClientInstall = FALSE) then
            if (nResult = BACK) goto Dlg_SdRegisterUserEx;
        else
            if (nResult = BACK) goto Dlg_SdShowReadMe;
        endif;
    endif;

    if (bEasyInstall = FALSE) then
        Dlg_SdComponentDialog2:
        if ((nResult = BACK) && (svSetupType != "Custom") && (svSetupType != "")) then
            goto Dlg_SdAskDestPath;
        endif;
        nResult = DialogShowSdComponentDialog2();
        if (nResult = BACK) goto Dlg_SdAskDestPath;
    else
        nResult = DialogShowSdComponentDialog2();
    endif;

    nResult = AmIaPGPdisk(svDir);
    if (bEasyInstall = FALSE) then
        if (nResult = TRUE) goto Dlg_SdAskDestPath;
    else
        //this is a quick install
        return 0;
    endif;

    Dlg_SdStartCopy:
    nResult = DialogShowSdStartCopy();
    if (nResult = BACK) goto Dlg_SdComponentDialog2;

    return 0;

end;

///////////////////////////////////////////////////////////////////////////////
//
// Function: ProcessBeforeDataMove
//
//  Purpose: This function performs any necessary operations prior to the
//           actual file transfer.
//
///////////////////////////////////////////////////////////////////////////////
function ProcessBeforeDataMove()
    STRING svLogFile, szPath, szFileName, svResult;
    NUMBER nResult;

begin
  // Create app information, uninstallation, and App Paths registry keys.
    InstallationInfo( @COMPANY_NAME, @PRODUCT_NAME, PRODUCT_VERSION, @PRODUCT_KEY );

    svLogFile = @UNINST_KEY + ".isu";

    //nResult = DeinstallStart( svDir, svLogFile, @UNINST_KEY, 0 );
    //Dont log, we'll manually delete through install.dll(MUCH safer)
    VarSave ( SRCTARGETDIR );
    SRCDIR = SUPPORTDIR;
    XCopyFile ( "install.dll" , "install.dll" , COMP_NORMAL );
    VarRestore ( SRCTARGETDIR );

    Disable (LOGGING);

    //Deleteing a key created by IS that is not needed.
    RegDBSetDefaultRoot (HKEY_CURRENT_USER);
    RegDBDeleteKey ("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\PGP");
    RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
    RegDBDeleteKey ( "SOFTWARE\\"+ @COMPANY_NAME + "\\" + @PRODUCT_NAME + "\\" + PRODUCT_VERSION );

    if (nResult < 0) then
         MessageBox( @ERROR_UNINSTSETUP, WARNING );
    endif;

    szAppPath = TARGETDIR; // if your application .exe is in a subfolder
                           // of TARGETDIR then add subfolder

    if ((bIs32BitSetup) && (bIsShellExplorer)) then
        RegDBSetItem( REGDB_APPPATH, szAppPath );
        RegDBSetItem( REGDB_APPPATH_DEFAULT, szAppPath ^ @PRODUCT_KEY );
        RegDBSetItem( REGDB_UNINSTALL_NAME, @PRODUCT_NAME + " " + PRODUCT_VERSION);
    endif;

  	//Place .DAT files (pref files)
    if ((bImPersonal = FALSE) && (bImFreeware = FALSE)) then
        if (bIsWindowsNT4) then
            GetEnvVar ("USERPROFILE", szUserDir);
        endif;

        szPath = SRCDIR;
        szFileName = "PGPadmin.dat";

        if (FindFile (szPath, szFileName, svResult) = 0 ) then
            bImClientInstall = TRUE;
            //Copy the prf files over from Disk 1
            VarSave(SRCTARGETDIR);
            if (bIsWindowsNT4) then
            	TARGETDIR = szUserDir ^ "Application Data\\PGP";
            endif;
            CopyFile ("PGPclient.dat", "PGPclient.dat");
            if (bIsWindowsNT4) then
            	TARGETDIR = WINDIR ^ "Profiles\\All Users\\Application Data\\PGP";
            endif;
            CopyFile ("PGPadmin.dat", "PGPadmin.dat");
            VarRestore(SRCTARGETDIR);
            CopyFile ("PGPnet.dat", "PGPnet.dat");
            //client side of DS build so PGPadmin not needed
            DeleteFile ("PGPadmin.exe");
        else
            bImAdminInstall = TRUE;
        endif;
    endif;

    return 0;
end;

///////////////////////////////////////////////////////////////////////////////
//
//  Function:  MoveFileData
//
//  Purpose:  This function handles the file transfer for
//            the setup.
//
///////////////////////////////////////////////////////////////////////////////
function MoveFileData()
    NUMBER nResult, nDisk;

begin

    nDisk = 1;
    SetStatusWindow( 0, "" );
    Disable( DIALOGCACHE );
    Enable( STATUSDLG );
    Enable( STATUS );
    //PlaceWindow (FEEDBACK, 0, 0, LOWER_RIGHT);

    StatusUpdate( ON, 100 );
    nResult = ComponentMoveData( MEDIA, nDisk, 0 );

    HandleMoveDataError( nResult );

    Disable( STATUS );

    return nResult;

end;


///////////////////////////////////////////////////////////////////////////////
//
// Function: HandleMoveDataError
//
//  Purpose: This function handles the error (if any) during the file transfer
//           operation.
//
///////////////////////////////////////////////////////////////////////////////
function HandleMoveDataError( nResult )
    STRING szErrMsg, svComponent , svFileGroup , svFile;

begin

    svComponent = "";
    svFileGroup = "";
    svFile = "";

    switch (nResult)
        case 0:
            return 0;
        default:
            ComponentError ( MEDIA , svComponent , svFileGroup , svFile , nResult );
            szErrMsg = @ERROR_MOVEDATA  + "\n\n" +
                @ERROR_COMPONENT + " " + svComponent + "\n" +
                @ERROR_FILEGROUP + " " + svFileGroup + "\n" +
                @ERROR_FILE      + " " + svFile;
            SprintfBox( SEVERE, "", szErrMsg, nResult );
            bInstallAborted = TRUE;
            return nResult;
    endswitch;

end;

///////////////////////////////////////////////////////////////////////////////
//
// Function: ProcessAfterDataMove
//
//  Purpose: This function performs any necessary operations needed after
//           all files have been transferred.
//
///////////////////////////////////////////////////////////////////////////////
function ProcessAfterDataMove()
    STRING szReferenceFile, szMsg;

begin
	if(bImClientInstall) then
		DeleteFile ("PGPadmin.exe");
	endif;
	
	//if this is not winnt4.0 remove inf files and nt driver
	if !(bIsWindowsNT4) then
		DeleteFile ("Oemsetup.inf");
		DeleteFile ("PGPRebind.inf");
		VarSave(SRCTARGETDIR);
		TARGETDIR = WINSYSDIR ^ "Drivers";
		DeleteFile ("PGPnet.sys");
		VarRestore(SRCTARGETDIR);
		DeleteDir (WINSYSDIR ^ "Drivers", ONLYDIR);
	endif;
	
	if (ComponentIsItemSelected ( MEDIA , "NTCmdline" ) = TRUE) then
		SetEnvVar(1, TARGETDIR);
	endif;
	
    // DeinstallSetReference specifies a file to be checked before
    // uninstallation. If the file is in use, uninstallation will not proceed.
    //szReferenceFile = svDir ^ PRODUCT_KEY;
    //DeinstallSetReference( szReferenceFile );
    return 0;
end;


///////////////////////////////////////////////////////////////////////////////
//
// Function: CleanUpInstall
//
//  Purpose: This cleans up the setup.  Anything that should
//           be released or deleted at the end of the setup should
//           be done here.
//
///////////////////////////////////////////////////////////////////////////////
function CleanUpInstall()
    STRING svResult;
begin
    ListDestroy( listStartCopy );

    if (bInstallAborted) then
        return 0;
    endif;

    DialogShowSdFinishReboot();

    if (BATCH_INSTALL) then // ensure locked files are properly transferred
        CommitSharedFiles(0);
    endif;

    return 0;
end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -