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

📄 volfile.cpp

📁 vc环境下的pgp源码
💻 CPP
字号:
//////////////////////////////////////////////////////////////////////////////
// VolFile.cpp
//
// Implementation of class VolFile.
//////////////////////////////////////////////////////////////////////////////

// $Id: VolFile.cpp,v 1.6 1998/12/14 18:58:51 nryan Exp $

// Copyright (C) 1998 by Network Associates, Inc.
// All rights reserved.

#include "StdAfx.h"

#include "Required.h"
#include "UtilityFunctions.h"

#include "Globals.h"
#include "VolFile.h"


////////////////////////////////////////
// Class VolFile public member functions
////////////////////////////////////////

// The VolFile constructor attaches a drive and a pathname for an already
// mounted VolFile.

VolFile::VolFile(LPCSTR path, PGPUInt8 drive) : File(), Volume(drive)
{
	if (IsntNull(path))
		mInitErr = File::SetPath(path);
}

// Mount asks the driver to mount the volume file specified by 'path'. If
// 'pMNT' exists, it must use this packet passed to it from a derived class,
// instead of its own packet. This allows extensions to be made to the MNT
// structure without breaking base classes.

DualErr 
VolFile::Mount(
	LPCSTR		path, 
	PGPUInt8	drive, 
	PGPBoolean	mountReadOnly, 
	PAD_Mount	useThisPMNT)
{
	AD_Mount	MNT, *pMNT;
	DualErr		derr;

	pMNT = (useThisPMNT ? useThisPMNT : &MNT);

	pgpAssertAddrValid(pMNT, AD_Mount);
	pgpAssert(Unmounted());
	pgpAssert(!Opened());
	
	derr = SetPath(path);

	// Set the fields we are responsible for and call down.
	if (derr.IsntError())
	{
		pMNT->path		= path;
		pMNT->sizePath	= strlen(path) + 1;
		pMNT->drive		= drive;

		derr = Volume::Mount(mountReadOnly, pMNT);
	}

	if (derr.IsError())
	{
		ClearPath();
	}

	return derr;
}

// Unmount asks the driver to unmount a volume. If 'pUMNT' exists, it must
// use this packet passed to it from a derived class, instead of its own
// packet. This allows extensions to be made to the UMNT structure without
// breaking base classes.

DualErr 
VolFile::Unmount(PGPBoolean isThisEmergency, PAD_Unmount useThisPUNMNT)
{
	AD_Unmount	UNMNT, *pUNMNT;
	DualErr		derr;

	pUNMNT = (useThisPUNMNT ? useThisPUNMNT : &UNMNT);

	pgpAssertAddrValid(pUNMNT, AD_Unmount);
	pgpAssert(Mounted());

	// We aren't responsible for any fields, so just call down.
	derr = Volume::Unmount(isThisEmergency, pUNMNT);

	if (derr.IsntError())
	{
		ClearPath();
	}

	return derr;
}

⌨️ 快捷键说明

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