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

📄 setup.rul

📁 vc环境下的pgp源码
💻 RUL
📖 第 1 页 / 共 5 页
字号:
	    					SRCDIR = TARGETDIR ^ "PGP Keyrings";
    	    				while (nReturn = 0)
        						NumToStr (svString, nvVar);
            					TARGETDIR = szBuffer ^ "Old Keyrings" + svString;
            					nReturn = ExistsDir (TARGETDIR);
            					nvVar = nvVar + 1;
        					endwhile;
        					if (XCopyFile ("*.*", "", INCLUDE_SUBDIR) = 0) then
        						TARGETDIR = TARGETDIR ^ "PGP Keyrings";
                		 		if ((svPubLoc != szLongTarget ^ "\\") &&
                 					(svPrivLoc != szLongTarget ^ "\\")) then
        							DeleteDir(SRCDIR, ALLCONTENTS);
        						else
        							if (svPubLoc != szLongTarget ^ "\\") then
										DeleteFile ("*.pkr");
									endif;
									if (svPrivLoc != szLongTarget ^ "\\") then
										DeleteFile ("*.skr");
									endif;                 	
       							endif;
    						endif;
    					endif;
    					VarRestore(SRCTARGETDIR);
    					
    					VarSave(SRCTARGETDIR);
    					TARGETDIR   = TARGETDIR ^ "PGP Keyrings";
                		SRCDIR      = svPubLoc;
                	    CopyFile (svReturnString, "pubring.pkr");
                	    SRCDIR      = svPrivLoc;
                        CopyFile (svReturnStringb, "secring.skr");

                        SdShowMsg ("Your private and public keyrings have been copied to your" +
                        " PGP Keyrings directory.", TRUE);
                        Delay (3);
                        SdShowMsg ("Your private and public keyrings have been copied to your" +
                        " PGP Keyrings directory.", FALSE);
                        VarRestore(SRCTARGETDIR);
                    endif;
                endif;
            else
        		bUseDefault = TRUE;	
        	endif;
           	VarRestore (SRCTARGETDIR);

        //if they dont have existing keys use the default keyring
        else
        	bUseDefault = TRUE;	
        endif;
    else
        //fastinstall
        bUseDefault = TRUE;
    endif;

    if (bUseDefault) then
    	//Check if a keying directory exists, if it does rename it
    	nReturn = 0;
	    nvVar = 1;
    	VarSave(SRCTARGETDIR);
    	szBuffer = TARGETDIR;
    	if (ExistsDir(TARGETDIR ^ "PGP Keyrings") = EXISTS) then
	    	SRCDIR = TARGETDIR ^ "PGP Keyrings";
    	    while (nReturn = 0)
        		NumToStr (svString, nvVar);
            	TARGETDIR = szBuffer ^ "Old Keyrings" + svString;
            	nReturn = ExistsDir (TARGETDIR);
            	nvVar = nvVar + 1;
        	endwhile;
        	if (XCopyFile ("*.*", "", INCLUDE_SUBDIR) = 0) then
        		DeleteDir(SRCDIR, ALLCONTENTS);
        	endif;
    	endif;
    	VarRestore(SRCTARGETDIR);
    	CreateDir (TARGETDIR ^ "PGP Keyrings");
    	
    	//Default keyrings are copied in
    	VarSave (SRCTARGETDIR);
    	CreateDir (TARGETDIR ^ "PGP Keyrings");
    	SRCDIR      = TARGETDIR ^ "DFK";
    	TARGETDIR   = TARGETDIR ^ "PGP Keyrings";
    	CopyFile ("pubring.pkr", "pubring.pkr");
    	CopyFile ("secring.skr", "secring.skr");
    	VarRestore (SRCTARGETDIR);
    endif;

    //delete the default ring we copied into the installdir
	DeleteDir(TARGETDIR ^ "DFK", ALLCONTENTS);

    if (bCopyKeys = TRUE) then
        //Re-Set Default keyring info
        szPubRingPath   = TARGETDIR ^ "PGP Keyrings\\pubring.pkr";
        szPrivRingPath  = TARGETDIR ^ "PGP Keyrings\\secring.skr";

        PGPclSetSDKFilePaths(szPubRingPath, szPrivRingPath, szRandSeedPath, 1);
    else
        LongPathFromShortPath (szPrivRingPath);
        LongPathFromShortPath (szPubRingPath);
        PGPclSetSDKFilePaths(szPubRingPath, szPrivRingPath, szRandSeedPath, 1);
    endif;
    UnUseDLL(WINSYSDIR + "pgpcl.dll");
 end;


///////////////////////////////////////////////////////////////////////////////
//
// Function: FileBrowse
//
//  Purpose: Access to file browse dialog.
//
//
///////////////////////////////////////////////////////////////////////////////
function FileBrowse (hwnd,szFilter,svSelected,szTitle,szExt)
    STRING szDLL,svResult;
    NUMBER nvISType,nResult,nLen,n,nvByte;
    BOOL bResult;

begin
    GetSystemInfo(ISTYPE,nvISType,svResult);

    // Load the DLL,which must be on disk 1 or in _SETUP.LIB
    // so that it gets placed into SUPPORTDIR.
    if (nvISType = 16) then
        szDLL = SUPPORTDIR ^ "INSTALL.DLL";
    else
        szDLL = SUPPORTDIR ^ "INSTALL.DLL";
    endif;

    nResult = UseDLL(szDLL);
    if (nResult < 0) then
        MessageBox("FileBrowse failed to load DLL:\n" +
                    szDLL,SEVERE);
        return 0;
    endif;

    // The Windows OPENFILENAME structure requires the browse
    // filter in string array format. To achieve this,replace
    // all commas (ASCII 44) with NULL. Then,append an extra NULL
    // because the array ends with two NULLs.
    nLen = StrLength(szFilter);
    for n = 0 to nLen - 1
        GetByte(nvByte,szFilter,n);
        if (nvByte = 44) then
            SetByte(szFilter,n,0);
        endif;
    endfor;
    szFilter = szFilter + "";

    bResult = MyGetOpenFileName32 (hwnd,szFilter,svSelected,szTitle,szExt);

    // Unload the DLL.
    UnUseDLL(szDLL);

    if (!bResult) then
        return -1;
    endif;

    return 0;
end;


///////////////////////////////////////////////////////////////////////////////
//
// Function: FinalInstallProcess
//
//  Purpose: Some final operations we do, this changes periodically.
//
//
///////////////////////////////////////////////////////////////////////////////
function FinalInstallProcess()

begin
    VarSave (SRCTARGETDIR);
    TARGETDIR   = WINSYSDIR;
    SRCDIR      = svDir;
    CopyFile ("PGP.hlp", "PGP.hlp");
    VarRestore (SRCTARGETDIR);

    VarSave (SRCTARGETDIR);
    TARGETDIR   = TARGETDIR ^ "Documentation";
    SRCDIR      = SUPPORTDIR;
    CopyFile ("WhatsNew.txt", "WhatsNew.txt");
    CopyFile ("license.txt", "license.txt");
    VarRestore (SRCTARGETDIR);
end;


///////////////////////////////////////////////////////////////////////////////
//
// Function: LaunchCtrlUpdater
//
//  Purpose: This launches
//
//
///////////////////////////////////////////////////////////////////////////////
function LaunchCtrlUpdater()
    STRING svVersionNumber;
begin
    VerGetFileVersion (WINSYSDIR^"comctl32.DLL", svVersionNumber);
    if (bIsWindowsNT4 = TRUE) then
        if (VerCompare (svVersionNumber, "4.7.0.0", VERSION)= LESS_THAN) then
            //launch microsofts updater 401Comupd.exe with args  /r:n /q:a for quiet
            LaunchAppAndWait (svDir ^ "401Comupd.exe","\/r:n \/q:a", WAIT);
        bReboot = TRUE;
        endif;
    else
        if (VerCompare (svVersionNumber, "4.7.0.0", VERSION)= LESS_THAN) then
            //launch microsofts updater 401Comupd.exe with args  /r:n /q:a for quiet
            LaunchAppAndWait (svDir ^ "401Comupd.exe","\/r:n \/q:a", WAIT);
        bReboot = TRUE;
        endif;
    endif;

    //Delete the microsoft comctl32.dll updater, its no longer needed
    VarSave     (SRCTARGETDIR);
    TARGETDIR  = svDir;
    SRCDIR     = svDir;
    DeleteFile  ("401Comupd.exe");
    VarRestore  (SRCTARGETDIR);
    DeleteFile  ("401Comupd.exe");
end;


///////////////////////////////////////////////////////////////////////////////
//
// Function: StartMemLock
//
//  Purpose: Attempts to start the PGP memlock driver.
//
//
///////////////////////////////////////////////////////////////////////////////
function StartMemLock()
    NUMBER nResult;
begin
    nResult = UseDLL(SUPPORTDIR ^ "install.dll");
    //#define DRIVER_NO_ERROR           0
    //#define DRIVER_NOT_WINNT          1
    //#define DRIVER_ACCESS_ERROR       2
    //#define DRIVER_CREATE_FAIL        3
    //#define DRIVER_ALREADY_STARTED    4
    //#define DRIVER_MISC_ERROR         5
    //#define UNKNOWN_ERROR             6
    nResult = PGPclStartMemLockDriver ();
    if (( nResult = 0 ) ||
        ( nResult = 1 ) ||
        ( nResult = 4 )) then
        //Dont set bReboot
    else
        bReboot = TRUE;
    endif;
    UnUseDLL(SUPPORTDIR ^ "install.dll");
end;


///////////////////////////////////////////////////////////////////////////////
//
// Function: AmIaPGPdisk
//
//  Purpose: Checks to see if user is installing onto a PGPdisk
//
//
///////////////////////////////////////////////////////////////////////////////
function AmIaPGPdisk(szPath)
    STRING DrvLetUpper, svSubStr, szMsg, szQIMsg;
    NUMBER DriveNum, nDrvLetUpper;
begin
    Disable(DIALOGCACHE);
    //Shut Down PGPdisk Resident
    if (ComponentIsItemSelected
        (MEDIA, "PGPdisk") = TRUE) then
        UseDLL (SUPPORTDIR ^ "PGPdskIH.dll");
        KillPGPdiskResident();

        //svSubStr is the first char. of the full path (so the drive letter)
        //svTarget is the directory where the user has selected to install
        StrSub (svSubStr, szPath, 0, 1);
        //Convert the drive letter to uppercase
        StrToUpper (DrvLetUpper, svSubStr);
        GetByte (nDrvLetUpper, DrvLetUpper, 0);
        DriveNum = nDrvLetUpper - 65;
        if (IsVolumeAPGPdisk (DriveNum) = TRUE) then
                //The drive they are installing to is a PGP disk
            szMsg = "You cannot install PGPdisk onto a PGPdisk volume. Do you\n" +
                    "want to change the target location to a different disk.";

            szQIMsg = "You cannot install PGPdisk onto a PGPdisk volume. Please\n" +
                    "contact your administrator.";
            if (bEasyInstall = TRUE) then
                MessageBox(szQIMsg, WARNING);
                abort;
            endif;

            if (AskYesNo(szMsg + "\n\n" +
                "If you do not change the target location PGPdisk will not\n" +
                " be installed. \n Change target location ?",YES) = YES) then
                Enable(DIALOGCACHE);
                return TRUE;
            else
                Enable(DIALOGCACHE);
                ComponentSelectItem(MEDIA,"PGPdisk",FALSE);
            endif;
        endif;
        UnUseDLL (SUPPORTDIR ^ "PGPdskIH.dll");
    endif;
return FALSE;
end;


///////////////////////////////////////////////////////////////////////////////
//
// Function: CanIinstallPGPnet
//
//  Purpose: Checks to see if user can install PGPnet
//
//
///////////////////////////////////////////////////////////////////////////////
function CanIinstallPGPnet()
    #define svSerPack "Service Pack 3"

    NUMBER nvResult;
    NUMBER nvType, nvSize, nvNumProcessors;
    STRING svValue, szKey, szValue, szNumProcessors;
	BOOL bvRc;	
	
begin
	if (bIsWindows95) then
		UseDLL(SUPPORTDIR ^ "install.dll");
		bvRc = IsWin95OSR2Compatible();
		UnUseDLL(SUPPORTDIR ^ "install.dll");
		
		if !(bvRc) then
    		MessageBox(@NOTOSR2COMPATABLE, INFORMATION);
        	ComponentSelectItem(MEDIA,"PGPnet",FALSE);
        	Enable (DIALOGCACHE);
        	return FALSE;
        endif;
		
	endif;
	
	if(ALLOWDUALPROCESSORS = "FALSE") then
    	if (bIsWindowsNT4) then
    		GetEnvVar ("NUMBER_OF_PROCESSORS", szNumProcessors);
    		StrToNum (nvNumProcessors, szNumProcessors);
    		if (nvNumProcessors > 1) then
    			MessageBox(@TOMANYPROCESSORS, INFORMATION);
            	ComponentSelectItem(MEDIA,"PGPnet",FALSE);
            	Enable (DIALOGCACHE);
            	return FALSE;
        	endif;    	
    	endif;
    endif;

    //Check for proper service pack  (>=3)
    Disable (DIALOGCACHE);
    if (bIsWindowsNT4 = TRUE) then
        nvResult = ISCompareServicePack (svSerPack);
        if (nvResult < 0) then
            MessageBox(@INCORRECTSP, INFORMATION);
            ComponentSelectItem(MEDIA,"PGPnet",FALSE);
            Enable (DIALOGCACHE);
            return FALSE;
        elseif (nvResult = LESS_THAN) then
            MessageBox(@INCORRECTSP, INFORMATION);
            ComponentSelectItem(MEDIA,"PGPnet",FALSE);
            Enable (DIALOGCACHE);
            return FALSE;
        endif;


    	//Check to see if the user has anything bound (linked) to TCPIP for PGPnet
    	//if not then PGPnet install is not allowed
    	szKey = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Linkage";
    	szValue = "Bind";
    	svValue = "";
    	RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
   	 	RegDBGetKeyValueEx ( szKey ,szValue  ,nvType ,svValue ,nvSize );
    	if (svValue = "") then
        	MessageBox(@NOTCPIPLINK, INFORMATION);
        	ComponentSelectItem(MEDIA,"PGPnet",FALSE);
        	Enable (DIALOGCACHE);
        	return FALSE;
    	endif;
	endif;
    Enable (DIALOGCACHE);
    return TRUE;
end;


/////////////////////////////////////

⌨️ 快捷键说明

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