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

📄 setup.rul

📁 vc环境下的pgp源码
💻 RUL
📖 第 1 页 / 共 3 页
字号:
			abort;
		else
			goto TestForRunningApps;
		endif;
	endif;

	hWnd8 = FindWindow("PGPtools","");
	if (hWnd8 != NULL) then
		if (SprintfBox (MB_RETRYCANCEL, "Application Running", "%s","For install to continue PGPtools must not be running.\n"+
		"Please shut down PGPtools.") = IDCANCEL) then
			abort;
		else
			goto TestForRunningApps;
		endif;
	endif;

	hWnd9 = FindWindow("PGPlog","");
	if (hWnd9 != NULL) then
		if (SprintfBox (MB_RETRYCANCEL, "Application Running", "%s","For install to continue PGPLog must not be running.\n"+
		"Please shut down PGPLog.") = IDCANCEL) then
			abort;
		else
			goto TestForRunningApps;
		endif;
	endif;

	//Ensure that Outlook Express is not running
	if (FindWindow ("ThorBrowserWndClass", "") != NULL) then
		if (SprintfBox (MB_RETRYCANCEL, "Application Running", "%s","For install to continue Outlook Express must not be running.\n"+
		"Please shut down Outlook Express.") = IDCANCEL) then
			abort;
		else
			goto TestForRunningApps;
		endif;
	endif;

	if (FindWindow ("Ath_Note", "") != NULL) then
		if (SprintfBox (MB_RETRYCANCEL, "Application Running", "%s","For install to continue Outlook Express must not be running.\n"+
		"Please shut down Outlook Express.") = IDCANCEL) then
			abort;
		else
			goto TestForRunningApps;
		endif;
	endif;
	
	if(bIsWindowsNT4) then
	UseDLL ("install.dll");
		StopService("PGPnetIke");
		StopService("PgpMacMP");
		StopService("PGPmemlock");
	UnUseDLL ("install.dll");
	endif;
end;


///////////////////////////////////////////////////////////////////////////////
//
// Function:  CheckRequirements
//
//  Purpose:  This function checks all minimum requirements for the
//            application being installed.  If any fail, then the user
//            is informed and the setup is terminated.
//
///////////////////////////////////////////////////////////////////////////////
function CheckRequirements()
    NUMBER  nvDx, nvDy, nvResult, nvType, nvSize;
    STRING  svResult, szVersion, szKey, szName;

begin

	//check if user has admin privs.
	if !(Is (USER_ADMINISTRATOR, "")) then
		MessageBox("To run this uninstall you need to be logged in with\n" +
					"Administrator privileges. Setup will now exit.", SEVERE);
		abort;
	endif;
	
	RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
    szKey = "SOFTWARE\\Network Associates\\PGP";
    szName = "Version";
    RegDBGetKeyValueEx (szKey, szName, nvType, szVersion, nvSize);
	
	//MAKE SURE THE USER REALLY WANTS TO UNINSTALL
	SetDialogTitle (DLG_ASK_YESNO,"Confirm uninstall");
	if (AskYesNo("Are you sure you want to Uninstall " + szVersion,NO) = NO) then
		exit;
	endif;
	
    bIsShellExplorer = FALSE;
    bIsWindowsNT4    = FALSE;
    bIsWindowsNT351  = FALSE;
    bIsWindows95     = FALSE;
    bIsWindows98     = FALSE;

    // Check screen resolution.
    GetExtents( nvDx, nvDy );

    if (nvDy < 480) then
        MessageBox( @ERROR_VGARESOLUTION, WARNING );
        abort;
    endif;

    // Set 'setup' operation mode
    bIs32BitSetup = TRUE;
    GetSystemInfo( ISTYPE, nvResult, svResult );
    if (nvResult = 16) then
        bIs32BitSetup = FALSE; // running 16-bit setup
        return 0; // no additional information required
    endif;

    // --- 32-bit testing after this point ---

    // Determine the target system's operating system.
    GetSystemInfo( OS, nvResult, svResult );

    if (nvResult = IS_WINDOWSNT) then
        // Check to see if OS is Windows NT 4.0 or Windows NT 3.51,
        // and if the shell being used is the Explorer shell.
        if (GetSystemInfo( WINMAJOR, nvResult, svResult ) = 0) then
            if (nvResult >= 4) then
                bIsShellExplorer = TRUE;
                bIsWindowsNT4 = TRUE;
            else
            	bIsWindowsNT351 = TRUE;
            endif;
        endif;

    elseif (nvResult = IS_WINDOWS9X) then
        bIsShellExplorer = TRUE;
        // Check to see if OS is Windows 95 or Windows 98
        GetSystemInfo (WINMINOR, nvResult, svResult);
        if (nvResult < 10) then
           bIsWindows95 = TRUE;
        else
           bIsWindows98 = TRUE;
        endif;
    endif;

end;

///////////////////////////////////////////////////////////////////////////////
//
// Function:  Reboot
//
//  Purpose:  Informs the user that a reboot is needed
//
//
//
///////////////////////////////////////////////////////////////////////////////
function Reboot()
	STRING szMsg, szMsg2, szKey;
	NUMBER nReserved, nSize;
	BOOL bOpt1, bOpt2;
begin
	//end of uninstall, refresh the startmenu
	UseDLL ("install.dll");
	RefreshStartMenu();
	UnUseDLL ("install.dll");
	TARGETDIR = gInstallDir;
	DeleteFile ("install.dll");
	
szMsg  = "Your computer needs to be rebooted for the uninstall\n" +
		 "to complete. Some files may not have been deleted,\n" +
		 "these are safe to be manually deleted.";
	Start:
		bOpt1 = TRUE;
       	SetDialogTitle (DLG_ASK_OPTIONS, "Uninstall Complete.");
        SdFinish ("Setup Complete.", szMsg, "", "&Yes, I want to restart my computer now.",
        		"", bOpt1, bOpt2);
        Disable (DIALOGCACHE);
        szKey = "SOFTWARE\\Network Associates\\PGP" ;
        if (bOpt1) then
        	RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
        	RegDBSetKeyValueEx ( szKey, "Reboot" , REGDB_NUMBER , "3" , nSize );
        endif;
end;


///////////////////////////////////////////////////////////////////////////////
//
// Function: SetEnvVar
//
//  Purpose: This function adds or removes items from env. var.
//			
//
///////////////////////////////////////////////////////////////////////////////
function SetEnvVar(mode, szText)
    #define WM_SETTINGCHANGE	0x001A
    #define HWND_BROADCAST 		0xffff

    NUMBER	nType, nSize, nReturn, nResult;
    NUMBER	nvLineNumber;
    STRING	szKey, szEnv, szNewEnv, svString;
    STRING	svFileName, svReturnString;
    STRING	szBuffer, svReturnLine;
    POINTER pEnv;
    LIST	listID;
    BOOL	berr;

begin
	LongPathFromShortPath (szText);
	
	if ((bIsWindows98) || (bIsWindows95)) then
		if (mode = 1) then
			//SETTING
			LongPathToShortPath(szText);
			szBuffer = "%PATH%;" + szText;
			BatchFileLoad ("");
			BatchAdd ("PATH", szBuffer, "", AFTER);
			BatchFileSave ("");
		else
			//UNSETTING
			LongPathToShortPath(szText);
			szBuffer = "%PATH%;" + szText;
			BatchGetFileName (svFileName);
			ParsePath (svReturnString, svFileName, PATH);
			VarSave(SRCTARGETDIR);
			SRCDIR = svReturnString;
			if (FileGrep ("Autoexec.bat", szBuffer, svReturnLine, nvLineNumber, RESTART) = 0) then
				FileDeleteLine ("Autoexec.bat", nvLineNumber, nvLineNumber);
			endif;
			VarRestore(SRCTARGETDIR);
			return;
		endif;
	else
		//this is Windows NT
		berr = FALSE;
		RegDBSetDefaultRoot (HKEY_LOCAL_MACHINE);
    	szKey = "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
    	nResult = RegDBGetKeyValueEx (szKey, "Path", nType, szEnv, nSize);

		if (mode = 1) then
    		//SETTING	
  			if ( szEnv % szText ) then
				//already in PATH
				berr = TRUE;
    		else
				szEnv = szEnv + ";" + szText;
				nResult = RegDBSetKeyValueEx (szKey, "Path", REGDB_STRING_EXPAND, szEnv, -1);
			endif;
			goto common;
		else
   			//UNSETTING
    		listID = ListCreate (STRINGLIST);
   			StrGetTokens (listID, szEnv, ";");	
   			szNewEnv = "";
   			if (ListGetFirstString (listID, svString) != END_OF_LIST) then
   				szNewEnv = svString;
   			endif;
	
GetNextString:

   			nReturn = ListGetNextString (listID, svString);
   		
   			if (nReturn = -1) then
				berr = TRUE;
				goto common;
   			elseif (nReturn = 0)then
   				//got string
   				if (svString != szText) then
   					szNewEnv = szNewEnv + ";" + svString;
   				endif;
   				goto GetNextString;
   			endif;
   			//Set new value
   			nResult = RegDBSetKeyValueEx (szKey, "Path", REGDB_STRING_EXPAND, szNewEnv, -1);
    		// Remove the list from memory.
   			ListDestroy (listID);
   		endif;
   	
common:
   		if !(berr) then
   	   		szEnv = "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment";
   			pEnv = &szEnv;
   			SendMessage ( HWND_BROADCAST, WM_SETTINGCHANGE, 0, pEnv );
   			return TRUE;
   		else
	   		return FALSE;
   		endif;
   	endif;	
	end;
// --- include script file section ---

#include "sddialog.rul"





































































⌨️ 快捷键说明

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