예제 #1
0
/**
Validate that nobody is trying to touch the virus scanner files.

@internalComponent

@return A value depending on whethe the virus scanner files are
being fiddled with.

@param aDriveNum The drive number of the request which called into
the test virus scanning hook.

@param aName The full pathname of the file being accessed by the
request to the file server hook.
*/
TInt CTestVirusHook::ValidateRequest(TFsPluginRequest& aRequest, TFileName& aFileName)
	{
	TInt driveNumber = aRequest.DriveNumber();
	
	TInt err = GetName(&aRequest, aFileName);
	if(err != KErrNone)
		return(err);
	
	if (driveNumber == EDriveC)
		{
		TInt r = aFileName.Find(_L("\\virusdef.txt"));

		if (r != KErrNotFound)
			{
			//Do not allow the deletion of the virus definition file.
			return KErrAccessDenied;
			}

		r = aFileName.Find(_L("\\system\\libs\\t_vshook.pxt"));
		if (r != KErrNotFound)
			{
			//Do not allow the deletion of the this dll
			return KErrAccessDenied;
			}
		r = aFileName.Find(_L("\\sys\\bin\\t_vshook.pxt"));
		if (r != KErrNotFound)
			{
			//Do not allow the deletion of the this dll
			return KErrAccessDenied;
			}
		}
	return KErrNone;
	}
예제 #2
0
/**
@internalComponent
*/
TInt CTestHexHook::DoRequestL(TFsPluginRequest& aRequest)
	{
	TInt err = KErrNotSupported;

	TInt function = aRequest.Function();
	
	iDrvNumber = aRequest.DriveNumber();

	switch(function)
		{
		case EFsFileOpen:
			err = HexFileOpen(aRequest);
			break;

		case EFsFileRead:
			// Post intercept does nothing except prove that it is possible and that no deadlock occurs.
			// plugin always calls FileRead() when receiving a EFsFileRead, and so the mesage gets completed
			// by the plugin and has to be post intercepted by the plugin (if registered to post-intercept the request) 
			// and any plugins above it.

			if (!(aRequest.IsPostOperation()))
				err = HexFileRead(aRequest);
			break;

		default:
			break;
		}

	return err;
	}
예제 #3
0
/**
@internalComponent
*/
TInt CTestVirusHook::DoRequestL(TFsPluginRequest& aRequest)
	{
	TInt err = KErrNotSupported;

	TInt function = aRequest.Function();
	
	iDrvNumber = aRequest.DriveNumber();

	switch(function)
		{
		case EFsFileOpen:
			err = VsFileOpen(aRequest);
			break;

		case EFsFileSubClose:
			VsFileClose(aRequest);
			break;

		case EFsFileRename:
		case EFsRename:
		case EFsReplace:
			err = VsFileRename(aRequest);
			break;

		case EFsDelete:
			err = VsFileDelete(aRequest);
			break;

		case EFsReadFileSection:
			err = VsReadFileSection(aRequest);
			break;

		default:
			break;
		}

	return err;
	}