hacks/cl_file.cpp
author William Roberts <williamr@symbian.org>
Thu, 18 Nov 2010 15:17:29 +0000
changeset 137 3c8fb4698aeb
parent 89 1650c5a7be8c
permissions -rw-r--r--
Remove more unnecessary exports from stem_mediaclientaudio.dll, use unmodified cone.dll and eiksrvui.dll Stop building stem versions of cone.dll and eiksrvui.dll
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
89
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     1
// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies).
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     2
// All rights reserved.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     3
// This component and the accompanying materials are made available
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     4
// under the terms of the License "Eclipse Public License v1.0"
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     5
// which accompanies this distribution, and is available
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     7
//
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     8
// Initial Contributors:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
     9
// Nokia Corporation - initial contribution.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    10
//
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    11
// Contributors:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    12
//
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    13
// Description:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    14
// f32\sfsrv\cl_file.cpp
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    15
// 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    16
//
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    17
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    18
#include "cl_std.h"
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    19
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    20
static _LIT_SECURITY_POLICY_S1(KFileServerPolicy,KFileServerUidValue,ECapabilityTCB);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    21
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    22
EFSRV_EXPORT_C TInt RFile::Adopt(RFs& aFs, TInt aHandle)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    23
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    24
Adopts an already open file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    25
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    26
@param aFs     The file server session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    27
@param aHandle The handle number of the already opened file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    28
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    29
@return KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    30
		KErrBadHandle if the sub-session handle is invalid, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    31
		otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    32
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    33
@deprecated
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    34
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    35
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    36
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    37
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdopt, MODULEUID, aFs.Handle(), aHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    38
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    39
	// duplicate the sub-session handle; don't panic if it's invalid.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    40
	RFile file;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    41
	TInt r = file.CreateSubSession(aFs, EFsFileDuplicate, TIpcArgs(aHandle, EFalse));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    42
	if (r == KErrArgument)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    43
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    44
		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, KErrBadHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    45
		return KErrBadHandle;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    46
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    47
	else if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    48
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    49
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    50
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    51
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    52
	// adopt the duplicated handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    53
	r = CreateAutoCloseSubSession(aFs, EFsFileAdopt, TIpcArgs(file.SubSessionHandle(), KFileAdopt32));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    54
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    55
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    56
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    57
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    58
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    59
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    60
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    61
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    62
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    63
EFSRV_EXPORT_C TInt RFile::AdoptFromServer(TInt aFsHandle, TInt aFileHandle)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    64
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    65
Allows a client to adopt an already open file from a server.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    66
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    67
Assumes that the server's RFs and RFile handles have been sent to the 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    68
client using TransferToClient().
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    69
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    70
This RFile will own it's RFs session so that when the sub-session (RFile) 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    71
is closed so will the RFs session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    72
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    73
@param aFsHandle The file server session (RFs) handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    74
@param aFileHandle The file (RFile) handle of the already opened file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    75
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    76
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    77
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    78
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    79
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    80
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServer, MODULEUID, aFsHandle, aFileHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    81
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    82
	RFs fs;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    83
	TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    84
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    85
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    86
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    87
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    88
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    89
	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt32));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    90
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    91
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    92
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    93
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    94
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    95
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    96
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    97
EFSRV_EXPORT_C TInt RFile::AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    98
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
    99
Allows a server to adopt an already open file from a client.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   100
The client's RFs and RFile handles are contained in message slots within aMsg.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   101
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   102
Assumes that the client's RFs and RFile handles have been sent to the server
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   103
using TransferToServer().
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   104
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   105
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   106
This RFile will own it's RFs session so that when the sub-session (RFile) 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   107
is closed so will the RFs session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   108
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   109
@param	aMsg		The message received from the client
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   110
@param	aFsHandleIndex	The index that identifies the message slot 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   111
					of a file server session (RFs) handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   112
@param aFileHandleIndex The index that identifies the message slot 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   113
					of the sub-session (RFile) handle of the already opened file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   114
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   115
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   116
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   117
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   118
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   119
	TInt fileHandle = NULL;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   120
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   121
	TInt r = KErrNone;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   122
	if (aFileHandleIndex == 0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   123
		fileHandle = aMsg.Int0();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   124
	else if (aFileHandleIndex == 1)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   125
   		fileHandle = aMsg.Int1();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   126
	else if (aFileHandleIndex == 2)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   127
		fileHandle = aMsg.Int2();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   128
	else if (aFileHandleIndex == 3)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   129
		fileHandle = aMsg.Int3();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   130
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   131
		r = KErrArgument;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   132
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   133
#ifdef SYMBIAN_FTRACE_ENABLE
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   134
	TInt handle = NULL;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   135
	if (aFsHandleIndex == 0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   136
		handle = aMsg.Int0();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   137
	else if (aFsHandleIndex == 1)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   138
   		handle = aMsg.Int1();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   139
	else if (aFsHandleIndex == 2)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   140
		handle = aMsg.Int2();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   141
	else if (aFsHandleIndex == 3)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   142
		handle = aMsg.Int3();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   143
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClient, MODULEUID, handle, fileHandle, aFsHandleIndex, aFileHandleIndex);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   144
#endif
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   145
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   146
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   147
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   148
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   149
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   150
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   151
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   152
	// Duplicates the file server (RFs) session handle identified by an 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   153
	// existing handle contained in the message slot at index aFsHandleIndex
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   154
	RFs fs;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   155
	r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   156
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   157
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   158
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   159
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   160
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   161
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   162
	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   163
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   164
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   165
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   166
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   167
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   168
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   169
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   170
EFSRV_EXPORT_C TInt RFile::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   171
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   172
Allows a server to adopt an already open file from a client process.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   173
The client's file-server (RFs) and file (RFile) handles are contained in 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   174
this process's environment data slots.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   175
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   176
Assumes that the client's RFs and RFile handles have been sent to the server process
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   177
using TransferToProcess().
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   178
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   179
This RFile will own it's RFs session so that when the sub-session (RFile) 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   180
is closed so will the RFs session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   181
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   182
@param	aFsHandleIndex	An index that identifies the slot in the process
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   183
					environment data that contains the file server session (RFs) handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   184
@param	aFileHandleIndex	An index that identifies the slot in the process
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   185
					environment data that contains the sub-session (RFile) handle 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   186
					of the already opened file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   187
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   188
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   189
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   190
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   191
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   192
	TInt fileHandle = NULL;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   193
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   194
	TInt r = User::GetTIntParameter(aFileHandleIndex,  fileHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   195
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   196
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreator, MODULEUID, fileHandle, aFsHandleIndex, aFileHandleIndex);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   197
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   198
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   199
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   200
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   201
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   202
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   203
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   204
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   205
	// Duplicates the file server (RFs) session handle identified by an 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   206
	// existing handle contained in the environment slot at index aFsHandleIndex
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   207
	RFs fs;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   208
	r = fs.Open(aFsHandleIndex, KFileServerPolicy);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   209
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   210
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   211
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   212
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   213
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   214
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   215
	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt32));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   216
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   217
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   218
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   219
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   220
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   221
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   222
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   223
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   224
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   225
Make a duplicate of the passed file handle in the same thread.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   226
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   227
By default, any thread in the process can use the duplicated handle to access the 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   228
file. However, specifying EOwnerThread as the second parameter to this function, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   229
means that only the creating thread can use the handle.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   230
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   231
@param	aFile	The file handle to duplicate
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   232
@param	aType	An enumeration whose enumerators define the ownership of this 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   233
				handle. If not explicitly specified, EOwnerProcess is taken
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   234
				as default.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   235
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   236
@return	one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   237
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   238
EFSRV_EXPORT_C TInt RFile::Duplicate(const RFile& aFile, TOwnerType aType)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   239
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   240
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicate, MODULEUID, aFile.Session().Handle(), aFile.SubSessionHandle(), aType);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   241
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   242
	RFs fs;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   243
	fs.SetHandle(aFile.Session().Handle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   244
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   245
	// Need to make a duplicate of the session handle in the current thread, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   246
	// otherwise closing one session will close both sub-sessions.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   247
	TInt r = fs.Duplicate(RThread(), aType);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   248
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   249
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   250
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   251
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   252
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   253
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   254
	// duplicate the sub-session handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   255
	TInt dupSubSessionHandle;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   256
	r = aFile.DuplicateHandle(dupSubSessionHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   257
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   258
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   259
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   260
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   261
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   262
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   263
	// adopt the duplicated sub-session handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   264
	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(dupSubSessionHandle, KFileDuplicate));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   265
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   266
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileDuplicateReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   267
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   268
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   269
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   270
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   271
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   272
// Makes a duplicate of this file (RFile) handle in the current thread and 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   273
// returns it in aSubSessionHandle. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   274
// The duplicate file handle will effectively be in limbo (although still 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   275
// owned by the session) until :
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   276
// (1) the session handle is duplicated into another process - 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   277
//     this happens in one of : TransferToClient(), TransferToProcess() or 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   278
//     AdoptFromClient() and
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   279
// (2) the sub-session handle is transferred to the other process - using AdoptXXX()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   280
// 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   281
TInt RFile::DuplicateHandle(TInt& aSubSessionHandle) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   282
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   283
	RFs fs;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   284
	fs.SetHandle(Session().Handle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   285
	RFile file;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   286
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   287
	// duplicate the sub-session handle; panic if it's invalid.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   288
	TInt r = file.CreateSubSession(fs, EFsFileDuplicate, TIpcArgs(SubSessionHandle(), ETrue));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   289
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   290
	// return the duplicated handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   291
	// Note that this handle needs to be adopted before it can be used
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   292
	aSubSessionHandle = file.SubSessionHandle();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   293
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   294
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   295
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   296
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   297
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   298
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   299
Transfers an already open file to a server.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   300
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   301
Before this function can be called, the file server session which owns this file handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   302
must first be marked as shareable by calling RFs::ShareProtected().
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   303
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   304
This function packages handle details for this file into 2 arguments of a TIpcArgs object.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   305
When these arguments are sent in an IPC message, the server which receives them may 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   306
call AdoptFromClient() to open a new RFile object which refers to the same file as this.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   307
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   308
@param	aIpcArgs	The IPC message arguments.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   309
@param	aFsHandleIndex	An index that identifies an argument in aIpcArgs where the
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   310
					file server session handle will be stored.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   311
					This argument must not be used for anything else otherwise the 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   312
					results will be unpredictable.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   313
@param	aFileHandleIndex	An index that identifies an argument in aIpcArgs where the
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   314
					file handle will be stored.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   315
					This argument must not be used for anything else otherwise the 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   316
					results will be unpredictable.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   317
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   318
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   319
		error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   320
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   321
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   322
EFSRV_EXPORT_C TInt RFile::TransferToServer(TIpcArgs& aIpcArgs, TInt aFsHandleIndex, TInt aFileHandleIndex) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   323
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   324
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServer, MODULEUID, Session().Handle(), SubSessionHandle(), aFsHandleIndex, aFileHandleIndex);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   325
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   326
	if ((aFsHandleIndex < 0) || (aFsHandleIndex > (KMaxMessageArguments-2)))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   327
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   328
		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServerReturn, MODULEUID,  (TUint) KErrArgument);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   329
		return KErrArgument;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   330
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   331
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   332
	TInt dupSubSessionHandle;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   333
	TInt r = DuplicateHandle(dupSubSessionHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   334
	if (r == KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   335
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   336
		aIpcArgs.Set(aFsHandleIndex, Session());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   337
		aIpcArgs.Set(aFileHandleIndex, dupSubSessionHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   338
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   339
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   340
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToServerReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   341
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   342
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   343
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   344
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   345
Transfers an already open file from a server to a client.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   346
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   347
Before this function can be called, the file server session which owns this file handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   348
must first be marked as shareable by calling RFs::ShareProtected().
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   349
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   350
The file (RFile) handle is written to the client's address space to the package 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   351
buffer in the message address slot in aMsg identified by aFileHandleIndex.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   352
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   353
If no error occurs, then the message is completed with the file-server (RFs) 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   354
session handle.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   355
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   356
When the message completes, the client may call AdoptFromServer() to open 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   357
a new RFile object which refers to the same file as this.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   358
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   359
Note that if an error occurs then the message is not completed.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   360
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   361
@param	aMsg		A message received from the client
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   362
@param	aFileHandleIndex	Identifies the message slot that contains a package 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   363
					buffer pointing to an address in the client's address space 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   364
					to receive the file (RFile) handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   365
  
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   366
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   367
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   368
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   369
EFSRV_EXPORT_C TInt RFile::TransferToClient(const RMessage2& aMsg, TInt aFileHandleIndex) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   370
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   371
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClient, MODULEUID, Session().Handle(), SubSessionHandle(), aFileHandleIndex);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   372
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   373
	if (TUint(aFileHandleIndex) >= TUint(KMaxMessageArguments))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   374
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   375
		TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID,  (TUint) KErrArgument);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   376
		return KErrArgument;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   377
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   378
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   379
	TInt dupSubSessionHandle;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   380
	TInt r = DuplicateHandle(dupSubSessionHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   381
	if (r == KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   382
		r = aMsg.Write(aFileHandleIndex, TPckgC<TInt>(dupSubSessionHandle));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   383
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   384
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   385
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   386
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   387
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   388
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   389
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   390
	aMsg.Complete(Session());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   391
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   392
	TRACE1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToClientReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   393
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   394
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   395
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   396
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   397
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   398
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   399
Transfers an already open file to another process.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   400
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   401
Before this function can be called, the file server session which owns this file handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   402
must first be marked as shareable by calling RFs::ShareProtected().
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   403
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   404
This function packages handle details for this file into 2 arguments in another
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   405
process's  environment data slots.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   406
When the other process runs, it may call AdoptFromCreator() to open a new RFile 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   407
object which refers to the same file as this.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   408
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   409
@param	aProcess	A handle to another process.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   410
@param	aFsHandleIndex	An index that identifies a slot in the process's
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   411
					environment data which on exit will contain the file server 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   412
					session (RFs) handle 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   413
					This slot must not be used for anything else otherwise the 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   414
					results will be unpredictable.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   415
@param	aFileHandleIndex	An index that identifies a slot in the process's
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   416
					environment data which on exit will contain the file 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   417
					(RFile) handle.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   418
					This slot must not be used for anything else otherwise the 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   419
					results will be unpredictable.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   420
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   421
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   422
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   423
// NB slot 0 is reserved for the command line
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   424
EFSRV_EXPORT_C TInt RFile::TransferToProcess(RProcess& aProcess, TInt aFsHandleIndex, TInt aFileHandleIndex) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   425
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   426
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToProcess, MODULEUID, Session().Handle(), SubSessionHandle(), aFsHandleIndex, aFileHandleIndex);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   427
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   428
	TInt dupSubSessionHandle;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   429
	TInt r = DuplicateHandle(dupSubSessionHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   430
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   431
	if (r == KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   432
		r = aProcess.SetParameter(aFsHandleIndex, RHandleBase(Session()));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   433
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   434
	if (r == KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   435
		r = aProcess.SetParameter(aFileHandleIndex, dupSubSessionHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   436
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   437
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileTransferToProcessReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   438
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   439
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   440
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   441
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   442
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   443
EFSRV_EXPORT_C TInt RFile::Name(TDes& aName) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   444
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   445
Gets the final part of a filename
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   446
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   447
This is used to retrieve the name and extension of a file that has been 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   448
passed from one process to another using the RFile::AdoptXXX() methods.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   449
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   450
@param	aName	On return, contains the name of the file, including the name and 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   451
				extension but excluding the drive letter and path.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   452
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   453
@return KErrNone if successful, otherwise one of the other
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   454
        system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   455
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   456
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   457
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   458
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileName, MODULEUID, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   459
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   460
	TInt r = SendReceive(EFsFileName, TIpcArgs(&aName));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   461
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   462
	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFileNameReturn, MODULEUID, r, aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   463
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   464
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   465
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   466
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   467
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   468
EFSRV_EXPORT_C TInt RFile::FullName(TDes& aName) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   469
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   470
Gets the full filename
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   471
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   472
This is used to retrieve the full filename, including drive and path,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   473
of a file that has been passed from one process to another using the 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   474
RFile::AdoptXXX() methods.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   475
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   476
@param	aName	On return, contains the full name of the file, including drive and path.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   477
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   478
@return KErrNone if successful, otherwise one of the other
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   479
        system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   480
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   481
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   482
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   483
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileFullName, MODULEUID, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   484
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   485
	TInt r = SendReceive(EFsFileFullName, TIpcArgs(&aName));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   486
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   487
	TRACERETMULT2(UTF::EBorder, UTraceModuleEfsrv::EFileFullNameReturn, MODULEUID, r, aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   488
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   489
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   490
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   491
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   492
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   493
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   494
EFSRV_EXPORT_C TInt RFile::Open(RFs& aFs,const TDesC& aName,TUint aMode)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   495
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   496
Opens an existing file for reading or writing.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   497
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   498
If the file does not already exist, an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   499
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   500
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   501
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   502
1. To close the file, use Close()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   503
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   504
2. Attempting to open a file with the read-only attribute using the EFileWrite
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   505
   access mode results in an error.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   506
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   507
3. Attempting to open a file which is greater than or equal to 2GByte (2,147,483,648 bytes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   508
   will fail with KErrTooBig
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   509
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   510
4. After a file has been opened, the current write position is set to the start
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   511
   of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   512
   If necessary, use RFile::Seek() to move to a different position within
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   513
   the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   514
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   515
@param aFs   The file server session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   516
@param aName The name of the file. Any path components (i.e. drive letter
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   517
             or directory), which are not specified, are taken from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   518
             the session path.The file name shall not contain wild cards
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   519
             ('?' or '*' characters) and illegal characters like 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   520
             '<', '>', ':', '"', '/', '|' and '\000'. Backslash '\\' character 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   521
             is allowed only as a path delimiter. The filename containing only 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   522
             white space characters (See TChar::IsSpace()) is also illegal.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   523
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   524
@param aMode The mode in which the file is opened. See TFileMode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   525
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   526
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   527
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   528
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   529
@see TFileMode
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   530
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   531
@capability Dependent If the path for aName is /Sys and aMode is neither
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   532
					  EFileShareReadersOnly nor EFileRead then Tcb capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   533
@capability Dependent If the path for aName is /Sys and aMode is either
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   534
					  EFileShareReadersOnly or EFileRead then Allfiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   535
@capability Dependent If the path for aName begins with /Private and does not match this process'
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   536
					  SID then AllFiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   537
@capability Dependent If the path for aName begins with /Resource and aMode is neither
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   538
 					  EFileShareReadersOrWriters|EFileRead nor EFileShareReadersOnly 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   539
 					  nor EFileRead then Tcb capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   540
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   541
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   542
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   543
	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileOpen, MODULEUID, aFs.Handle(), aMode, aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   544
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   545
	aMode &= ~EFileBigFile;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   546
	TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aMode));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   547
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   548
	//TomP - temp file logging.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   549
	RDebug::Print(_L("RFile::Open, file= %S, errorcode=%d"), &aName, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   550
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   551
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileOpenReturn, MODULEUID, r, SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   552
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   553
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   554
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   555
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   556
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   557
EFSRV_EXPORT_C void RFile::Close()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   558
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   559
Closes the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   560
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   561
Any open files are closed when the file server session is closed.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   562
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   563
Close() is guaranteed to return, and provides no indication whether
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   564
it completed successfully or not. When closing a file you have written to,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   565
you should ensure that data is committed to the file by invoking RFile::Flush()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   566
before closing. If Flush() completes successfully, Close() is essentially a
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   567
no-operation.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   568
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   569
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   570
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileClose, MODULEUID, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   571
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   572
#if defined (SYMBIAN_FTRACE_ENABLE) && defined(__DLL__)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   573
	// Need to close the handle to the trace LDD if this is an auto-close subsession
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   574
	// as these close their parent session by calling RHandleBase::Close(), i.e. they
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   575
	// bypass RFs::Close() which would normally be responsible for closing the LDD
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   576
	TInt h = Session().Handle() ^ CObjectIx::ENoClose;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   577
	if ( h != NULL && (!(h & CObjectIx::ENoClose)) ) 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   578
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   579
		RFTRACE_CLOSE;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   580
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   581
#endif
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   582
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   583
	CloseSubSession(EFsFileSubClose);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   584
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   585
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileCloseReturn, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   586
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   587
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   588
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   589
EFSRV_EXPORT_C TInt RFile::Create(RFs& aFs,const TDesC& aName,TUint aMode)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   590
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   591
Creates and opens a new file for writing.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   592
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   593
If the file already exists, an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   594
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   595
If the resulting path does not exist, then the operation cannot proceed and
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   596
the function returns an error code.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   597
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   598
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   599
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   600
1. To close the file, use Close()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   601
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   602
2. It automatically sets the file's archive attribute.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   603
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   604
@param aFs   The file server session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   605
@param aName The name of the file. Any path components (i.e. drive letter
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   606
             or directory), which are not specified, are taken from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   607
             the session path. The file name shall not contain wild cards
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   608
             ('?' or '*' characters) and illegal characters like 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   609
             '<', '>', ':', '"', '/', '|' and '\000'. Backslash '\\' character 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   610
             is allowed only as a path delimiter. The filename containing only 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   611
             white space characters (See TChar::IsSpace()) is also illegal.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   612
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   613
@param aMode The mode in which the file is opened. The access mode is
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   614
             automatically set to EFileWrite. See TFileMode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   615
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   616
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   617
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   618
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   619
@see TFileMode
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   620
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   621
@capability Dependent If the path in aName starts with /Sys then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   622
@capability Dependent If the path in aName starts with /Resource then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   623
@capability Dependent If the path in aName starts with /Private and does not match this process'
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   624
					  SID then AllFiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   625
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   626
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   627
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   628
	aMode &= ~EFileBigFile;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   629
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   630
	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileCreate, MODULEUID, aFs.Handle(), aMode, aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   631
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   632
	TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aMode));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   633
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   634
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileCreateReturn, MODULEUID, r, SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   635
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   636
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   637
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   638
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   639
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   640
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   641
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   642
EFSRV_EXPORT_C TInt RFile::Replace(RFs& aFs,const TDesC& aName,TUint aMode)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   643
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   644
Opens a file for writing, replacing the content of any existing file of the
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   645
same name if it exists, or creating a new file if it does not exist.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   646
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   647
If the resulting path exists, then:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   648
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   649
- the length of an existing file with the same filename is re-set to zero 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   650
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   651
- a new file is created, if no existing file with the same filename can be found.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   652
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   653
If the resulting path does not exist, then the operation cannot proceed and
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   654
the function returns an error code.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   655
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   656
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   657
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   658
- To close the file, use Close(), defined in the base class RFsBase.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   659
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   660
- It automatically sets the file's archive attribute.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   661
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   662
@param aFs   The file server session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   663
@param aName The name of the file. Any path components (i.e. drive letter
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   664
             or directory), which are not specified, are taken from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   665
             the session path. The file name shall not contain wild cards
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   666
             ('?' or '*' characters) and illegal characters like 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   667
             '<', '>', ':', '"', '/', '|' and '\000'. Backslash '\\' character 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   668
             is allowed only as a path delimiter. The filename containing only 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   669
             white space characters (See TChar::IsSpace()) is also illegal.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   670
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   671
@param aMode The mode in which the file is opened. The access mode is
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   672
             automatically set to EFileWrite. See TFileMode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   673
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   674
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   675
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   676
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   677
@see TFileMode
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   678
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   679
@capability Dependent If the path in aName starts with /Sys then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   680
@capability Dependent If the path in aName starts with /Resource then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   681
@capability Dependent If the path in aName starts with /Private and does not match this process'
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   682
					  SID then AllFiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   683
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   684
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   685
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   686
	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileReplace, MODULEUID, aFs.Handle(), aMode, aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   687
	aMode &= ~EFileBigFile;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   688
	TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aMode));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   689
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileReplaceReturn, MODULEUID, r, SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   690
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   691
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   692
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   693
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   694
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   695
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   696
EFSRV_EXPORT_C TInt RFile::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aMode)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   697
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   698
Creates and opens a temporary file with a unique name for writing and reading.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   699
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   700
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   701
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   702
1. To close the file, use Close()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   703
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   704
@param aFs   The file server session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   705
@param aPath The directory in which the file is created.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   706
@param aName On return, contains the full path and file name of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   707
             The filename is guaranteed to be unique within the directory
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   708
             specified by aPath.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   709
@param aMode The mode in which the file is opened. The access mode is
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   710
             automatically set to EFileWrite. See TFileMode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   711
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   712
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   713
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   714
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   715
@see TFileMode
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   716
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   717
@capability Dependent If aPath starts with /Sys then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   718
@capability Dependent If aPath starts with /Resource then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   719
@capability Dependent If aPath starts with /Private and does not match this process'
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   720
					  SID then AllFiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   721
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   722
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   723
   	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTemp, MODULEUID, aFs.Handle(), aPath, aMode);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   724
	aMode &= ~EFileBigFile;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   725
	TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aMode,&aName));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   726
	TRACERETMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTempReturn, MODULEUID, r, SubSessionHandle(), aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   727
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   728
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   729
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   730
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   731
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   732
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   733
EFSRV_EXPORT_C TInt RFile::Read(TDes8& aDes) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   734
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   735
Reads from the file at the current position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   736
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   737
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   738
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   739
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   740
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   741
The descriptor's length is set to the number of bytes read into 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   742
it. Therefore, when reading through a file,the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   743
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   744
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   745
@param aDes Descriptor into which binary data is read. Any existing contents 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   746
            are overwritten. On return, its length is set to the number of
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   747
            bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   748
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   749
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   750
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   751
@see TDesC8::Length
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   752
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   753
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   754
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileRead1, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.MaxLength());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   755
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   756
	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   757
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   758
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead1Return, MODULEUID, r, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   759
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   760
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   761
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   762
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   763
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   764
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   765
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   766
EFSRV_EXPORT_C void RFile::Read(TDes8& aDes,TRequestStatus& aStatus) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   767
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   768
Reads from the file at the current position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   769
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   770
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   771
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   772
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   773
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   774
The descriptor's length is set to the number of bytes read into 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   775
it. Therefore, when reading through a file,the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   776
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   777
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   778
@param aDes    Descriptor into which binary data is read. Any existing contents 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   779
               are overwritten. On return, its length is set to the number of
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   780
               bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   781
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   782
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   783
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   784
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   785
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   786
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   787
@param aStatus Request status. On completion contains:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   788
       KErrNone, if successful, otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   789
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   790
@see TDesC8::Length       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   791
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   792
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   793
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileRead2, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.MaxLength(), &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   794
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   795
    RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(KCurrentPosition64)),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   796
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   797
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead2Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   798
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   799
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   800
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   801
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   802
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   803
EFSRV_EXPORT_C TInt RFile::Read(TDes8& aDes,TInt aLength) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   804
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   805
Reads the specified number of bytes of binary data from the file at the current position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   806
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   807
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   808
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   809
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   810
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   811
The descriptor's length is set to the number of bytes read into 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   812
it. Therefore, when reading through a file,the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   813
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   814
Assuming aLength is less than the maximum length of the descriptor, the only circumstances 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   815
in which Read() can return fewer bytes than requested, is when the end of 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   816
file is reached or if an error occurs.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   817
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   818
@param aDes    Descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   819
               contents are overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   820
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   821
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   822
@param aLength The number of bytes to be read from the file into the descriptor. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   823
               If an attempt is made to read more bytes than the descriptor's 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   824
               maximum length, the function returns KErrOverflow.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   825
               This value must not be negative, otherwise the function
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   826
               returns KErrArgument.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   827
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   828
@return KErrNone if successful, otherwise one of the other system-wide error
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   829
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   830
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   831
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   832
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileRead1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   833
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   834
	if (aLength==0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   835
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   836
		aDes.Zero();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   837
		return(KErrNone);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   838
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   839
	else if(aLength>aDes.MaxLength())
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   840
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   841
		return(KErrOverflow);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   842
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   843
	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   844
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   845
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead1Return, MODULEUID, r, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   846
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   847
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   848
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   849
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   850
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   851
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   852
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   853
EFSRV_EXPORT_C void RFile::Read(TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   854
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   855
Reads a specified number of bytes of binary data from the file at the current position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   856
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   857
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   858
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   859
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   860
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   861
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   862
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   863
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   864
Assuming aLength is less than the maximum length of the descriptor, the only
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   865
circumstances in which Read() can return fewer bytes than requested is when
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   866
the end of file is reached or if an error has occurred.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   867
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   868
@param aDes    Descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   869
               contents are overwritten. On return, its length is set to the
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   870
               number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   871
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   872
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   873
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   874
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   875
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   876
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   877
@param aLength The number of bytes to be read from the file into the descriptor. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   878
               If an attempt is made to read more bytes than the descriptor's
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   879
               maximum length, then the function updates aStatus parameter with KErrOverflow.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   880
               It must not be negative otherwise the function updates aStatus with KErrArgument.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   881
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   882
@param aStatus Request status. On completion contains KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   883
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   884
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   885
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   886
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileRead2, MODULEUID, Session().Handle(), SubSessionHandle(), aLength, &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   887
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   888
	if (aLength==0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   889
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   890
		aDes.Zero();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   891
		TRequestStatus* req=(&aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   892
		User::RequestComplete(req,KErrNone);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   893
		return;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   894
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   895
	else if(aLength>aDes.MaxLength())
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   896
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   897
		TRequestStatus* req=(&aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   898
		User::RequestComplete(req,KErrOverflow);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   899
		return;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   900
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   901
		
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   902
	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   903
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   904
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead2Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   905
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   906
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   907
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   908
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   909
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   910
EFSRV_EXPORT_C TInt RFile::Read(TInt aPos,TDes8& aDes) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   911
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   912
Reads from the file at the specified offset within the file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   913
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   914
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   915
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   916
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   917
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   918
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   919
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   920
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   921
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   922
@param aPos Position of first byte to be read.  This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   923
            the start of the file. If no position is specified, reading
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   924
            begins at the current file position. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   925
            If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   926
            a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   927
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   928
@param aDes The descriptor into which binary data is read. Any existing content
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   929
            is overwritten. On return, its length is set to the number of
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   930
            bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   931
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   932
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   933
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   934
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   935
@panic FSCLIENT 19 if aPos is negative.        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   936
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   937
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   938
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   939
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   940
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   941
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   942
	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   943
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   944
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   945
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   946
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   947
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   948
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   949
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   950
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   951
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   952
EFSRV_EXPORT_C void RFile::Read(TInt aPos,TDes8& aDes,TRequestStatus& aStatus) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   953
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   954
Reads from the file at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   955
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   956
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   957
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   958
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   959
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   960
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   961
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   962
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   963
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   964
@param aPos    Position of first byte to be read. This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   965
               the start of the file. If no position is specified, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   966
               reading begins at the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   967
               If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   968
               a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   969
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   970
@param aDes    The descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   971
               content is overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   972
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   973
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   974
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   975
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   976
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   977
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   978
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   979
@param aStatus The request status. On completion, contains an error code of KErrNone 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   980
               if successful, otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   981
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   982
@panic FSCLIENT 19 if aPos is negative.        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   983
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   984
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   985
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength(), &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   986
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   987
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   988
	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   989
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   990
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   991
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   992
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   993
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   994
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   995
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   996
EFSRV_EXPORT_C TInt RFile::Read(TInt aPos,TDes8& aDes,TInt aLength) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   997
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   998
Reads the specified number of bytes of binary data from the file at a specified 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
   999
offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1000
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1001
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1002
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1003
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1004
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1005
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1006
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1007
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1008
Assuming aLength is less than the maximum length of the descriptor, the only
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1009
circumstances in which Read() can return fewer bytes than requested is when
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1010
the end of file is reached or if an error has occurred.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1011
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1012
@param aPos    Position of first byte to be read. This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1013
               the start of the file. If no position is specified, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1014
               reading begins at the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1015
               If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1016
               a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1017
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1018
@param aDes    The descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1019
               contents are overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1020
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1021
@param aLength The number of bytes to read from the file into the descriptor. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1022
               If an attempt is made to read more bytes than the descriptor's
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1023
               maximum length, then the function updates aStatus parameter with KErrOverflow.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1024
               It must not be negative otherwise the function updates aStatus with KErrArgument.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1025
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1026
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1027
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1028
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1029
@panic FSCLIENT 19 if aPos is negative.        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1030
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1031
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1032
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1033
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1034
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1035
	if (aLength==0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1036
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1037
		aDes.Zero();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1038
		return(KErrNone);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1039
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1040
	else if(aLength>aDes.MaxLength())
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1041
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1042
		return(KErrOverflow);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1043
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1044
		
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1045
	TInt r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1046
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1047
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1048
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1049
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1050
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1051
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1052
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1053
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1054
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1055
EFSRV_EXPORT_C void RFile::Read(TInt aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1056
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1057
Reads the specified number of bytes of binary data from the file at a specified 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1058
offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1059
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1060
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1061
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1062
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1063
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1064
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1065
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1066
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1067
Assuming aLength is less than the maximum length of the descriptor, the only
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1068
circumstances in which Read() can return fewer bytes than requested is when
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1069
the end of file is reached or if an error has occurred.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1070
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1071
@param aPos    Position of first byte to be read. This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1072
               the start of the file. If no position is specified, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1073
               reading begins at the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1074
               If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1075
               a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1076
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1077
@param aDes    The descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1078
               contents are overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1079
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1080
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1081
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1082
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1083
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1084
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1085
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1086
@param aLength The number of bytes to read from the file into the descriptor. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1087
               If an attempt is made to read more bytes than the descriptor's
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1088
               maximum length, then the function returns KErrOverflow.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1089
               It must not be negative otherwise the function returns KErrArgument.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1090
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1091
@param aStatus Request status. On completion contains KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1092
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1093
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1094
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1095
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1096
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1097
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1098
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1099
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1100
	if (aLength==0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1101
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1102
		aDes.Zero();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1103
		TRequestStatus* req=(&aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1104
		User::RequestComplete(req,KErrNone);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1105
		return;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1106
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1107
	else if(aLength>aDes.MaxLength())
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1108
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1109
		TRequestStatus* req=(&aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1110
		User::RequestComplete(req,KErrOverflow);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1111
		return;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1112
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1113
		
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1114
	RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1115
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1116
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1117
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1118
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1119
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1120
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1121
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1122
EFSRV_EXPORT_C void RFile::ReadCancel(TRequestStatus& aStatus) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1123
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1124
Cancels a specific outstanding asynchronous read request.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1125
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1126
The outstanding request completes with KErrCancel.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1127
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1128
@param aStat The request status object identified with the original
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1129
			 asynchronous read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1130
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1131
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1132
	if(aStatus != KRequestPending)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1133
		return;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1134
	SendReceive(EFsFileReadCancel, TIpcArgs(&aStatus));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1135
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1136
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1137
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1138
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1139
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1140
EFSRV_EXPORT_C void RFile::ReadCancel() const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1141
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1142
Cancels all outstanding asynchronous read requests for this subsession.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1143
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1144
All outstanding requests complete with KErrCancel.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1145
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1146
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1147
	SendReceive(EFsFileReadCancel, TIpcArgs(NULL));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1148
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1149
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1150
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1151
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1152
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1153
EFSRV_EXPORT_C TInt RFile::Write(const TDesC8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1154
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1155
Writes to the file at the current offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1156
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1157
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1158
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1159
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1160
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1161
@param aDes The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1162
            The function writes the entire contents of aDes to the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1163
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1164
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1165
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1166
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1167
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1168
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1169
	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1170
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1171
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1172
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1173
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1174
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1175
EFSRV_EXPORT_C void RFile::Write(const TDesC8& aDes,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1176
/** 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1177
Writes to the file at the current offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1178
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1179
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1180
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1181
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1182
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1183
@param aDes    The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1184
               The function writes the entire contents of aDes to the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1185
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1186
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1187
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1188
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1189
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1190
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1191
@param aStatus Request status. On completion contains KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1192
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1193
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1194
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1195
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length(), &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1196
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1197
	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(KCurrentPosition64)),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1198
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1199
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1200
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1201
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1202
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1203
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1204
EFSRV_EXPORT_C TInt RFile::Write(const TDesC8& aDes,TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1205
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1206
Writes a portion of a descriptor to the file at the current offset within
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1207
the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1208
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1209
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1210
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1211
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1212
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1213
@param aDes    The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1214
@param aLength The number of bytes to be written from the descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1215
               This must not be greater than the length of the descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1216
               It must not be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1217
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1218
@return KErrNone if successful; KErrArgument if aLength is negative;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1219
		otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1220
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1221
@panic FSCLIENT 27 in debug mode, if aLength is greater than the length
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1222
       of the descriptor aDes.  
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1223
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1224
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1225
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1226
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1227
	__ASSERT_DEBUG(aDes.Length()>=aLength,Panic(EBadLength));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1228
	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1229
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1230
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1231
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1232
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1233
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1234
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1235
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1236
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1237
EFSRV_EXPORT_C void RFile::Write(const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1238
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1239
Writes a portion of a descriptor to the file at the current offset
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1240
within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1241
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1242
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1243
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1244
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1245
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1246
@param aDes    The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1247
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1248
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1249
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1250
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1251
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1252
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1253
@param aLength The number of bytes to be written from the descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1254
               This must not be greater than the length of the descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1255
               It must not be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1256
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1257
@param aStatus Request status. On completion contains KErrNone if successful; 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1258
			   KErrArgument if aLength is negative; 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1259
			   otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1260
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1261
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1262
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1263
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aLength, &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1264
		
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1265
	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(KCurrentPosition64)),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1266
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1267
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1268
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1269
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1270
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1271
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1272
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1273
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1274
EFSRV_EXPORT_C TInt RFile::Write(TInt aPos,const TDesC8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1275
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1276
Writes to the file at the specified offset within the file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1277
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1278
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1279
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1280
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1281
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1282
@param aPos The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1283
            byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1284
            If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1285
            the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1286
            If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1287
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1288
@param aDes The descriptor from which binary data is written. The function writes 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1289
            the entire contents of aDes to the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1290
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1291
@return KErrNone if successful, otherwise one of the other system-wide error
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1292
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1293
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1294
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1295
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1296
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1297
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1298
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1299
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1300
	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1301
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1302
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1303
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1304
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1305
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1306
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1307
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1308
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1309
EFSRV_EXPORT_C void RFile::Write(TInt aPos,const TDesC8& aDes,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1310
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1311
Writes to the file at the specified offset within the file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1312
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1313
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1314
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1315
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1316
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1317
@param aPos    The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1318
               byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1319
               If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1320
               the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1321
               If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1322
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1323
@param aDes    The descriptor from which binary data is written. The function
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1324
               writes the entire contents of aDes to the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1325
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1326
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1327
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1328
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1329
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1330
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1331
@param aStatus Request status. On completion contains KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1332
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1333
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1334
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1335
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1336
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1337
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length(), &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1338
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1339
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1340
	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1341
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1342
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1343
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1344
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1345
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1346
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1347
EFSRV_EXPORT_C TInt RFile::Write(TInt aPos,const TDesC8& aDes,TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1348
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1349
Writes the specified number of bytes to the file at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1350
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1351
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1352
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1353
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1354
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1355
@param aPos    The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1356
               byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1357
               If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1358
               the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1359
               If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1360
                             
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1361
@param aDes    The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1362
@param aLength The number of bytes to be written from aDes .
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1363
			   It must not be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1364
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1365
@return KErrNone if successful; KErrArgument if aLength is negative;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1366
		otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1367
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1368
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1369
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1370
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1371
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1372
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1373
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1374
	TInt r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1375
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1376
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1377
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1378
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1379
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1380
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1381
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1382
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1383
EFSRV_EXPORT_C void RFile::Write(TInt aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1384
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1385
Writes the specified number of bytes to the file at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1386
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1387
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1388
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1389
NB Attempting to extend the file to 2 GByte or greater will fail with KErrTooBig
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1390
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1391
@param aPos    The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1392
               byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1393
               If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1394
               the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1395
               If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1396
              
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1397
@param aDes    The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1398
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1399
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1400
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1401
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1402
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1403
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1404
@param aLength The number of bytes to be written from aDes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1405
			   It must not be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1406
			   
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1407
@param aStatus Request status. On completion contains KErrNone if successful; 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1408
			   KErrArgument if aLength is negative; 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1409
			   otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1410
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1411
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1412
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1413
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1414
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1415
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1416
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1417
	RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1418
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1419
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1420
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1421
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1422
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1423
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1424
EFSRV_EXPORT_C TInt RFile::Lock(TInt aPos,TInt aLength) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1425
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1426
Locks a region within the file as defined by a range of bytes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1427
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1428
This ensures that those bytes are accessible 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1429
only through the RFile object which claims the lock. To re-allow access by 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1430
other programs to the locked region, it must either be unlocked or the file 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1431
closed. Locking can be used to synchronize operations on a file when more 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1432
than one program has access to the file in EFileShareAny mode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1433
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1434
More than one distinct region of a file can be locked, but an error is returned 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1435
if more than one lock is placed on the same region. Different RFile objects 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1436
can lock different parts of the same file as long as the file is opened in 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1437
EFileShareAny mode. The locked region may extend beyond the end of a file;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1438
this prevents the file from being extended by other programs.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1439
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1440
@param aPos    Position in file from which to lock; this is the  offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1441
               the beginning of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1442
@param aLength Number of bytes to lock.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1443
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1444
@return KErrNone if successful; KErrArgument if aPos+aLength>2G-1 boundary;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1445
 		otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1446
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1447
@panic FSCLIENT 17 if aLength is not greater than zero,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1448
@panic FSCLIENT 19 if aPos is negative. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1449
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1450
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1451
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1452
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileLock, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1453
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1454
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1455
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1456
	TInt r = SendReceive(EFsFileLock,TIpcArgs(aPos,aLength));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1457
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1458
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileLockReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1459
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1460
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1461
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1462
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1463
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1464
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1465
EFSRV_EXPORT_C TInt RFile::UnLock(TInt aPos,TInt aLength) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1466
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1467
Unlocks a region within the file as defined by a range of bytes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1468
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1469
A lock can only be removed by the RFile object which claimed the lock.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1470
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1471
A portion of a locked region cannot be unlocked. The entire locked region 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1472
must be unlocked otherwise an error is returned. If any byte within
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1473
the specified range of bytes to unlock is not locked, an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1474
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1475
@param aPos    Position in file from which to unlock; this is the  offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1476
               the beginning of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1477
@param aLength Number of bytes to unlock.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1478
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1479
@return KErrNone if successful; KErrArgument if aPos+aLength>2G-1 boundary;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1480
		otherwise one of the other  system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1481
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1482
@panic FSCLIENT 18 if aLength is not greater than zero,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1483
@panic FSCLIENT 19 if aPos is negative. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1484
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1485
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1486
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileUnLock, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1487
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1488
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1489
	TInt r = SendReceive(EFsFileUnLock,TIpcArgs(aPos,aLength));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1490
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1491
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileUnLockReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1492
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1493
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1494
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1495
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1496
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1497
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1498
EFSRV_EXPORT_C TInt RFile::Seek(TSeek aMode,TInt& aPos) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1499
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1500
Sets the the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1501
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1502
The function can also be used to get the current file 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1503
position without changing it. The file position is the position at which
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1504
reading and writing takes place. The start of the file is position zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1505
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1506
To retrieve the current file position without changing it, specify ESeekCurrent 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1507
for the seek mode, and zero for the offset.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1508
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1509
If the seek mode is ESeekStart, then:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1510
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1511
1. the function does not modify the aPos argument,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1512
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1513
2. the function returns an error if the offset specified is negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1514
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1515
If the seek mode is ESeekAddress, an error is returned if:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1516
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1517
1. the file is not in ROM, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1518
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1519
2. the offset specified is greater than the size of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1520
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1521
@param aMode Seek mode. Controls the destination of the seek operation.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1522
@param aPos  Offset from location specified in aMode. Can be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1523
             On return contains the new file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1524
             If the seek mode is either ESeekCurrent or ESeekEnd and the offset
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1525
             specifies a position before the start of the file 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1526
             or beyond the end of the file, then on return, aPos is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1527
             the new file position (either the start or the end of the file).
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1528
             If the seek mode is ESeekAddress, aPos returns the address of
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1529
             the byte at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1530
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1531
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1532
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1533
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1534
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1535
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileSeek, MODULEUID, Session().Handle(), SubSessionHandle(), aMode, aPos, 0);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1536
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1537
	TInt64 newPos = aPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1538
	TPckg<TInt64>  pkNewPos(newPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1539
	TInt r = SendReceive(EFsFileSeek|KIpcArgSlot2Desc,TIpcArgs(aPos,aMode,&pkNewPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1540
	if(KErrNone == r)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1541
		aPos = I64LOW(newPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1542
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1543
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSeekReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1544
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1545
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1546
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1547
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1548
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1549
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1550
EFSRV_EXPORT_C TInt RFile::Flush()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1551
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1552
Commits data to the storage device and flushes internal buffers without closing 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1553
the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1554
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1555
Although RFile::Close() also flushes internal buffers, it is often useful 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1556
to call Flush() before a file is closed. This is because Close() returns no 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1557
error information, so there is no way of telling whether the final data was 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1558
written to the file successfully or not. Once data has been flushed, Close() 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1559
is effectively a no-operation.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1560
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1561
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1562
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1563
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1564
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1565
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileFlush, MODULEUID, Session().Handle(), SubSessionHandle(), NULL);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1566
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1567
	TInt r = RSubSessionBase::SendReceive(EFsFileFlush);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1568
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1569
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileFlushReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1570
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1571
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1572
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1573
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1574
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1575
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1576
EFSRV_EXPORT_C void RFile::Flush(TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1577
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1578
Commits data to the storage device and flushes internal buffers without closing 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1579
the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1580
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1581
Although RFile::Close() also flushes internal buffers, it is often useful 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1582
to call Flush() before a file is closed. This is because Close() returns no 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1583
error information, so there is no way of telling whether the final data was 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1584
written to the file successfully or not. Once data has been flushed, Close() 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1585
is effectively a no-operation.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1586
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1587
@param aStatus Request status. On completion contains KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1588
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1589
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1590
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1591
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileFlush, MODULEUID, Session().Handle(), SubSessionHandle(), &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1592
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1593
	RSubSessionBase::SendReceive(EFsFileFlush, aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1594
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1595
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileFlushReturn, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1596
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1597
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1598
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1599
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1600
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1601
EFSRV_EXPORT_C TInt RFile::Size(TInt& aSize) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1602
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1603
Gets the current file size.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1604
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1605
@param aSize On return, the size of the file in bytes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1606
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1607
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1608
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1609
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1610
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1611
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSize, MODULEUID, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1612
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1613
	TInt64 size = aSize;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1614
	TPckg<TInt64> pkSize(size);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1615
	TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1616
	if(KErrNone != r)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1617
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1618
	aSize = I64LOW(size);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1619
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1620
	if (size > KMaxTInt)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1621
		return (KErrTooBig);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1622
#endif
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1623
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1624
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSizeReturn, MODULEUID, r, aSize);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1625
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1626
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1627
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1628
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1629
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1630
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1631
EFSRV_EXPORT_C TInt RFile::SetSize(TInt aSize)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1632
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1633
Sets the file size.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1634
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1635
If the size of the file is reduced, data may be lost from 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1636
the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1637
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1638
Note:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1639
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1640
1. The current file position remains unchanged unless SetSize() reduces the size 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1641
   of the file in such a way that the current file position is now beyond
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1642
   the end of the file. In this case, the current file position is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1643
   the end of file. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1644
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1645
2. If the file was not opened for writing, an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1646
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1647
@param aSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1648
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1649
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1650
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1651
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1652
@panic FSCLIENT 20 If aSize is negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1653
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1654
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1655
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1656
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetSize, MODULEUID, Session().Handle(), SubSessionHandle(), aSize, 0);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1657
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1658
	TInt r = SendReceive(EFsFileSetSize,TIpcArgs(aSize));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1659
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1660
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetSizeReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1661
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1662
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1663
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1664
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1665
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1666
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1667
EFSRV_EXPORT_C TInt RFile::Att(TUint& aVal) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1668
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1669
Gets the file's attributes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1670
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1671
@param aVal A bitmask which, on return, contains the file’s attributes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1672
            For more information, see KEntryAttNormal and the other
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1673
            file/directory attributes.    
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1674
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1675
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1676
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1677
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1678
@see KEntryAttNormal        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1679
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1680
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1681
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAtt, MODULEUID, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1682
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1683
	TPtr8 a((TUint8*)&aVal,sizeof(TUint));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1684
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1685
	TInt r = SendReceive(EFsFileAtt,TIpcArgs(&a));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1686
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1687
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileAttReturn, MODULEUID, r, aVal);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1688
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1689
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1690
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1691
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1692
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1693
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1694
EFSRV_EXPORT_C TInt RFile::SetAtt(TUint aSetAttMask,TUint aClearAttMask)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1695
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1696
Sets or clears file attributes using two bitmasks.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1697
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1698
The first mask controls which attributes are set.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1699
The second controls which attributes are cleared.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1700
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1701
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1702
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1703
1. The file must have been opened for writing, or an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1704
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1705
2. A panic is raised if any attribute is specified in both bitmasks.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1706
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1707
3. An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1708
   attributes have no effect.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1709
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1710
4. The new attribute values take effect when the file is flushed or closed (which 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1711
   implies a flush).
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1712
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1713
@param aSetAttMask   A bitmask indicating the file attributes to be set
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1714
@param aClearAttMask A bitmask indicating the attributes to be cleared. For 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1715
                     more information see KEntryAttNormal, and the other
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1716
                     file/directory attributes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1717
                     
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1718
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1719
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1720
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1721
@panic FSCLIENT 21 if the same attribute bit is set in both bitmasks.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1722
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1723
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1724
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetAtt, MODULEUID, Session().Handle(), SubSessionHandle(), aSetAttMask, aClearAttMask);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1725
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1726
	__ASSERT_ALWAYS((aSetAttMask&aClearAttMask)==0,Panic(EAttributesIllegal));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1727
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1728
	TInt r = SendReceive(EFsFileSetAtt,TIpcArgs(aSetAttMask,aClearAttMask));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1729
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1730
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetAttReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1731
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1732
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1733
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1734
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1735
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1736
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1737
EFSRV_EXPORT_C TInt RFile::Modified(TTime& aTime) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1738
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1739
Gets local date and time the file was last modified, in universal time.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1740
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1741
@param aTime On return, contains the date and time the file was last modified in UTC.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1742
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1743
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1744
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1745
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1746
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1747
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileModified, MODULEUID, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1748
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1749
	TPtr8 t((TUint8*)&aTime,sizeof(TTime));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1750
	TInt r = SendReceive(EFsFileModified,TIpcArgs(&t));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1751
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1752
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileModifiedReturn, MODULEUID, r, I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1753
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1754
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1755
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1756
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1757
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1758
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1759
EFSRV_EXPORT_C TInt RFile::SetModified(const TTime& aTime)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1760
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1761
Sets the date and time the file was last modified. UTC date and time should be used.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1762
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1763
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1764
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1765
1. The file must have been opened for writing, or an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1766
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1767
2. The new modified time takes effect when the file is flushed or closed (which 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1768
   implies a flush).
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1769
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1770
@param aTime The new date and time the file was last modified, in universal time.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1771
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1772
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1773
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1774
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1775
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1776
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetModified, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1777
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1778
	TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1779
	TInt r = SendReceive(EFsFileSetModified,TIpcArgs(&t));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1780
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1781
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetModifiedReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1782
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1783
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1784
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1785
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1786
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1787
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1788
EFSRV_EXPORT_C TInt RFile::Set(const TTime& aTime,TUint aMask,TUint aVal)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1789
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1790
Sets the file’s attributes, and the date and time it was last modified.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1791
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1792
It combines the functionality of SetAtt() and SetModified()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1793
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1794
An attempt to set or clear the KEntryAttDir, KEntryAttVolume or KEntryAttRemote 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1795
attributes have no effect. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1796
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1797
@param aTime The new date and time the file was last modified. UTC date and time should be used.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1798
@param aMask A bitmask indicating the file attributes to be set
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1799
@param aVal  A bitmask indicating the attributes to be cleared. For 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1800
             more information see KEntryAttNormal, and the other
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1801
             file/directory attributes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1802
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1803
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1804
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1805
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1806
@panic FSCLIENT 21 if the same attribute bit is set in both bitmasks.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1807
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1808
@see RFile::SetModified
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1809
@see RFile::SetAtt
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1810
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1811
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1812
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileSet, MODULEUID, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1813
		Session().Handle(), SubSessionHandle(), I64LOW(aTime.Int64()), I64HIGH(aTime.Int64()), aMask, aVal);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1814
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1815
	__ASSERT_ALWAYS((aVal&aMask)==0,Panic(EAttributesIllegal));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1816
	TPtrC8 t((TUint8*)&aTime,sizeof(TTime));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1817
	TInt r = SendReceive(EFsFileSet,TIpcArgs(&t,aMask,aVal));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1818
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1819
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1820
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1821
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1822
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1823
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1824
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1825
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1826
EFSRV_EXPORT_C TInt RFile::ChangeMode(TFileMode aNewMode)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1827
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1828
Switches an open file's access mode between EFileShareExclusive and EFileShareReadersOnly.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1829
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1830
This allows or disallows read-only access without having to close and re-open the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1831
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1832
@param aNewMode The new access mode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1833
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1834
@return KErrNone, if successful;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1835
        KErrArgument, if aNewMode has any value other than the two specified;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1836
        KErrAccessDenied, if:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1837
        a) the function is called when the current file share
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1838
        mode is EFileShareAny;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1839
        b) the file has multiple readers, and an attempt is made
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1840
        to change the share mode to EFileShareExclusive; 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1841
        c) the file has been opened for writing in EFileShareExclusive mode, and an 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1842
        attempt is made to change the access mode to EFileShareReadersOnly.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1843
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1844
@capability Dependent If the path starts with /Resource then capability DiskAdmin is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1845
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1846
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1847
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1848
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileChangeMode, MODULEUID, Session().Handle(), SubSessionHandle(), aNewMode);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1849
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1850
	if (aNewMode!=EFileShareExclusive && aNewMode!=EFileShareReadersOnly)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1851
		return(KErrArgument);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1852
	TInt r = SendReceive(EFsFileChangeMode,TIpcArgs(aNewMode));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1853
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1854
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileChangeModeReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1855
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1856
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1857
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1858
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1859
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1860
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1861
EFSRV_EXPORT_C TInt RFile::Rename(const TDesC& aNewName)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1862
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1863
Renames a file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1864
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1865
If aNewName specifies a different directory to the one in which 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1866
the file is currently located, then the file is moved.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1867
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1868
No other process may have access to the file, that is, the file must have 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1869
been opened in EFileShareExclusive share mode, or an error is returned. The 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1870
file must have been opened for writing (using EFileWrite access mode). An 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1871
error is returned if a file with the new filename already exists in the target 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1872
directory.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1873
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1874
The file or directory may not be moved to another device by this means, either 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1875
explicitly (by another drive specified in the name) or implicitly (because 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1876
the directory has been mapped to another device with RFs::SetSubst()).
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1877
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1878
Note that the function builds up the new file specification by using all
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1879
of the path components specified
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1880
in aNewName (directory path, filename and extension), 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1881
then adding any missing components from the current file specification, and 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1882
finally adding any missing components from the session path. A consequence 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1883
of this is that you cannot rename a file to remove its extension. An alternative 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1884
to this function is RFs::Rename() which renames the file using the new name 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1885
as provided.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1886
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1887
@param aNewName The new file name and/or directory path. No part may contain 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1888
                wildcard characters or an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1889
                
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1890
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1891
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1892
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1893
@capability Dependent If aNewName starts with /Sys then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1894
@capability Dependent If aNewName starts with /Resource then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1895
@capability Dependent If aNewName starts with /Private and does not match this process'
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1896
					  SID then AllFiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1897
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1898
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1899
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1900
	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileRename, MODULEUID, Session().Handle(), SubSessionHandle(), aNewName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1901
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1902
	TInt r = SendReceive(EFsFileRename,TIpcArgs(&aNewName));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1903
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1904
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileRenameReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1905
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1906
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1907
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1908
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1909
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1910
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1911
EFSRV_EXPORT_C TInt RFile::Drive(TInt &aDriveNumber, TDriveInfo &aDriveInfo) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1912
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1913
Gets information about the drive on which this file resides.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1914
 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1915
@param aDriveNumber On return, the drive number.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1916
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1917
@param aDriveInfo   On return, contains information describing the drive
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1918
                    and the medium mounted on it. The value of TDriveInfo::iType
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1919
                    shows whether the drive contains media.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1920
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1921
@return       KErrNone, if successful, otherwise one of the other
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1922
              system-wide error codes
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1923
              
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1924
@see RFs::Drive
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1925
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1926
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1927
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileDrive, MODULEUID, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1928
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1929
	TPckg<TInt> pki(aDriveNumber);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1930
	TPckg<TDriveInfo> pkdi(aDriveInfo);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1931
	TInt r = SendReceive(EFsFileDrive,TIpcArgs(&pki,&pkdi));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1932
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1933
	TRACERET4(UTF::EBorder, UTraceModuleEfsrv::EFileDriveReturn, MODULEUID, r, aDriveInfo.iDriveAtt, aDriveInfo.iMediaAtt, aDriveInfo.iType);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1934
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1935
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1936
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1937
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1938
TInt RFile::Clamp(RFileClamp& aHandle)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1939
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1940
Instructs the File Server that the file is not to be modified on storage media.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1941
 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1942
@param aHandle		On return, a handle to the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1943
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1944
@return				KErrNone, if successful, otherwise one of the other
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1945
					system-wide error codes
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1946
              
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1947
@see RFs::Unclamp
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1948
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1949
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1950
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileClamp, MODULEUID, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1951
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1952
	TPckg<RFileClamp> pkHandle(aHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1953
	TInt r = SendReceive(EFsFileClamp,TIpcArgs(& pkHandle));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1954
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1955
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileClampReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1956
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1957
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1958
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1959
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1960
Fetches the Block Map of a file. Each file in the file system will consist of
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1961
a number of groups of blocks. Each group represents a number of contiguous blocks.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1962
Such a group is represented by the TBlockMapEntry class. The full Block Map representing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1963
the file may be determined by repeatedly calling RFile::BlockMap until KErrCompletion is
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1964
returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1965
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1966
Note:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1967
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1968
1. If the Block Map for the whole file is not required, then a start and end position 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1969
   for a section of the file can be specified. Both of these parameters specify offsets
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1970
   from the start of the file in bytes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1971
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1972
@param aInfo		A structure describing a group of block maps.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1973
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1974
@param aStartPos	A start position for a desired section of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1975
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1976
@param aEndPos		An end position for a desired section of the file. If not passed, then the end of the 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1977
					file is assumed.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1978
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1979
@return				KErrNone until the end of the file or the file section is successfully reached;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1980
					KErrCompletion if the end of the file is reached;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1981
					KErrNotSupported if the file system does not support Block Mapping or the media is either removable or not pageable.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1982
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1983
EFSRV_EXPORT_C TInt RFile::BlockMap(SBlockMapInfo& aInfo, TInt64& aStartPos, TInt64 aEndPos, TInt aBlockMapUsage) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1984
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1985
	TRACE7(UTF::EBorder, UTraceModuleEfsrv::EFileBlockMap, MODULEUID, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1986
		Session().Handle(), SubSessionHandle(), I64LOW(aStartPos), I64HIGH(aEndPos), I64LOW(aEndPos), I64HIGH(aEndPos), aBlockMapUsage);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1987
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1988
	SBlockMapArgs args;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1989
	args.iStartPos = aStartPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1990
	args.iEndPos = aEndPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1991
	TPckg<SBlockMapInfo> pkInfo(aInfo);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1992
	TPckg<SBlockMapArgs> pkArgs(args);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1993
 	TInt r = SendReceive(EFsBlockMap, TIpcArgs(&pkInfo, &pkArgs, aBlockMapUsage));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1994
	if(r==KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1995
		aStartPos = args.iStartPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1996
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1997
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileBlockMapReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1998
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  1999
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2000
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2001
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2002
#ifdef SYMBIAN_ENABLE_64_BIT_FILE_SERVER_API
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2003
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2004
Opens an existing file for reading or writing.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2005
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2006
If the file does not already exist, an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2007
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2008
This is equivalent to calling RFile::Open except that this function 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2009
can open files of size greater than 2GB - 1 also.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2010
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2011
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2012
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2013
1. To close the file, use Close()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2014
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2015
2. Attempting to open a file with the read-only attribute using the EFileWrite
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2016
    access mode results in an error.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2017
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2018
3. After a file has been opened, the current write position is set to the start
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2019
    of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2020
    If necessary, use RFile64::Seek() to move to a different position within
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2021
    the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2022
    
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2023
4. It enables big file support to handle files whose size are greater then 2GB-1
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2024
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2025
@param aFs   The file server session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2026
@param aName The name of the file. Any path components (i.e. drive letter
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2027
             or directory), which are not specified, are taken from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2028
             the session path.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2029
@param aMode The mode in which the file is opened. See TFileMode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2030
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2031
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2032
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2033
    
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2034
@see TFileMode
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2035
@see RFile::Open()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2036
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2037
@capability Dependent If the path for aName is /Sys and aMode is neither
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2038
                      EFileShareReadersOnly nor EFileRead then Tcb capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2039
@capability Dependent If the path for aName is /Sys and aMode is either
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2040
                      EFileShareReadersOnly or EFileRead then Allfiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2041
@capability Dependent If the path for aName begins with /Private and does not match this process'
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2042
                      SID then AllFiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2043
@capability Dependent If the path for aName begins with /Resource and aMode is neither
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2044
                       EFileShareReadersOrWriters|EFileRead nor EFileShareReadersOnly 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2045
                       nor EFileRead then Tcb capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2046
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2047
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2048
EFSRV_EXPORT_C TInt RFile64::Open(RFs& aFs,const TDesC& aName,TUint aFileMode)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2049
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2050
	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileOpen, MODULEUID, aFs.Handle(), aFileMode, aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2051
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2052
	TInt r = CreateSubSession(aFs,EFsFileOpen,TIpcArgs(&aName,aFileMode|EFileBigFile));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2053
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2054
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileOpenReturn, MODULEUID, r, SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2055
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2056
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2057
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2058
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2059
Creates and opens a new file for writing.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2060
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2061
If the file already exists, an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2062
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2063
If the resulting path does not exist, then the operation cannot proceed and
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2064
the function returns an error code.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2065
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2066
This is equivalent to calling RFile::Create except that the file created with 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2067
this function can grow beyond 2GB - 1 also.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2068
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2069
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2070
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2071
1. To close the file, use Close()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2072
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2073
2. It automatically sets the file's archive attribute.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2074
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2075
3. It enables big file support to handle files whose size are greater then 2GB-1
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2076
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2077
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2078
@param aFs   The file server session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2079
@param aName The name of the file. Any path components (i.e. drive letter
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2080
             or directory), which are not specified, are taken from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2081
             the session path.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2082
@param aMode The mode in which the file is opened. The access mode is
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2083
             automatically set to EFileWrite. See TFileMode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2084
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2085
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2086
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2087
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2088
@see RFile::Create()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2089
@see TFileMode
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2090
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2091
@capability Dependent If the path in aName starts with /Sys then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2092
@capability Dependent If the path in aName starts with /Resource then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2093
@capability Dependent If the path in aName starts with /Private and does not match this process'
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2094
                      SID then AllFiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2095
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2096
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2097
EFSRV_EXPORT_C TInt RFile64::Create(RFs& aFs,const TDesC& aName,TUint aFileMode)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2098
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2099
	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileCreate, MODULEUID, aFs.Handle(), aFileMode, aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2100
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2101
	TInt r = CreateSubSession(aFs,EFsFileCreate,TIpcArgs(&aName,aFileMode|EFileBigFile));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2102
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2103
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileCreateReturn, MODULEUID, r, SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2104
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2105
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2106
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2107
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2108
Opens a file for writing, replacing the content of any existing file of the
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2109
same name if it exists, or creating a new file if it does not exist.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2110
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2111
This is equivalent to calling RFile::Replace except that the file created or replaced 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2112
with this function can grow beyond 2GB - 1 also.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2113
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2114
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2115
If the resulting path exists, then:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2116
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2117
- the length of an existing file with the same filename is re-set to zero 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2118
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2119
- a new file is created, if no existing file with the same filename can be found.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2120
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2121
If the resulting path does not exist, then the operation cannot proceed and
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2122
the function returns an error code.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2123
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2124
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2125
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2126
- To close the file, use Close(), defined in the base class RFsBase.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2127
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2128
- It automatically sets the file's archive attribute.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2129
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2130
- It enables big file support to handle files whose size are greater then 2GB-1
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2131
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2132
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2133
@param aFs   The file server session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2134
@param aName The name of the file. Any path components (i.e. drive letter
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2135
             or directory), which are not specified, are taken from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2136
             the session path.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2137
@param aMode The mode in which the file is opened. The access mode is
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2138
             automatically set to EFileWrite. See TFileMode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2139
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2140
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2141
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2142
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2143
@see TFileMode
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2144
@see RFile::Replace()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2145
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2146
@capability Dependent If the path in aName starts with /Sys then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2147
@capability Dependent If the path in aName starts with /Resource then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2148
@capability Dependent If the path in aName starts with /Private and does not match this process'
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2149
                      SID then AllFiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2150
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2151
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2152
EFSRV_EXPORT_C TInt RFile64::Replace(RFs& aFs,const TDesC& aName,TUint aFileMode)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2153
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2154
	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileReplace, MODULEUID, aFs.Handle(), aFileMode, aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2155
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2156
	TInt r = CreateSubSession(aFs,EFsFileReplace,TIpcArgs(&aName,aFileMode|EFileBigFile));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2157
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2158
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileReplaceReturn, MODULEUID, r, SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2159
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2160
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2161
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2162
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2163
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2164
Creates and opens a temporary file with a unique name for writing and reading.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2165
This is equivalent to calling RFile::Temp except that the file created 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2166
with this function can grow beyond 2GB - 1 also.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2167
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2168
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2169
Notes:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2170
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2171
1. To close the file, use Close()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2172
2. It enables big file support to handle files whose size are greater then 2GB-1
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2173
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2174
@param aFs   The file server session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2175
@param aPath The directory in which the file is created.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2176
@param aName On return, contains the full path and file name of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2177
             The filename is guaranteed to be unique within the directory
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2178
             specified by aPath.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2179
@param aMode The mode in which the file is opened. The access mode is
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2180
             automatically set to EFileWrite. See TFileMode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2181
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2182
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2183
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2184
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2185
@see TFileMode
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2186
@see RFile::Temp()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2187
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2188
@capability Dependent If aPath starts with /Sys then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2189
@capability Dependent If aPath starts with /Resource then capability Tcb is required
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2190
@capability Dependent If aPath starts with /Private and does not match this process'
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2191
                      SID then AllFiles capability is required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2192
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2193
EFSRV_EXPORT_C TInt RFile64::Temp(RFs& aFs,const TDesC& aPath,TFileName& aName,TUint aFileMode)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2194
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2195
   	TRACEMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTemp, MODULEUID, aFs.Handle(), aPath, aFileMode);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2196
	TInt r = CreateSubSession(aFs,EFsFileTemp,TIpcArgs(&aPath,aFileMode|EFileBigFile,&aName));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2197
	TRACERETMULT3(UTF::EBorder, UTraceModuleEfsrv::EFileTempReturn, MODULEUID, r, SubSessionHandle(), aName);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2198
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2199
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2200
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2201
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2202
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2203
Allows a server to adopt an already open file from a client.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2204
The client's RFs and RFile or RFile64 handles are contained in message slots within aMsg.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2205
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2206
Assumes that the client's RFs and RFile or RFile64 handles have been sent to the server
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2207
using TransferToServer().
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2208
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2209
This is equivalent to calling RFile::AdoptFromClient
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2210
except that the file adopted can be enlarged to sizes beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2211
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2212
Note: 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2213
If a RFile handle is received from the client then enlarging the file beyond
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2214
2GB-1 might result in inconsistent behaviour by the client, since it(client) would 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2215
not be able to handle files of size greater than 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2216
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2217
If a RFile64 handle is received from the client then enlarging the file beyond
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2218
2GB-1 should not cause any issues since the client would be 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2219
capable of handling files of size greater than 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2220
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2221
This RFile or RFile64 will own it's RFs session so that when the sub-session (RFile or RFile64) 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2222
is closed so will the RFs session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2223
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2224
@param	aMsg		The message received from the client
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2225
@param	aFsHandleIndex	The index that identifies the message slot 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2226
					of a file server session (RFs) handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2227
@param aFileHandleIndex The index that identifies the message slot 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2228
					of the sub-session (RFile or RFile64) handle of the already opened file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2229
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2230
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2231
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2232
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2233
EFSRV_EXPORT_C TInt RFile64::AdoptFromClient(const RMessage2& aMsg, TInt aFsHandleIndex, TInt aFileHandleIndex)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2234
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2235
	TInt fileHandle = NULL;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2236
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2237
	TInt r = KErrNone;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2238
	if (aFileHandleIndex == 0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2239
		fileHandle = aMsg.Int0();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2240
	else if (aFileHandleIndex == 1)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2241
   		fileHandle = aMsg.Int1();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2242
	else if (aFileHandleIndex == 2)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2243
		fileHandle = aMsg.Int2();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2244
	else if (aFileHandleIndex == 3)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2245
		fileHandle = aMsg.Int3();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2246
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2247
		r = KErrArgument;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2248
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2249
#ifdef SYMBIAN_FTRACE_ENABLE
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2250
	TInt handle = NULL;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2251
	if (aFsHandleIndex == 0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2252
		handle = aMsg.Int0();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2253
	else if (aFsHandleIndex == 1)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2254
   		handle = aMsg.Int1();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2255
	else if (aFsHandleIndex == 2)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2256
		handle = aMsg.Int2();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2257
	else if (aFsHandleIndex == 3)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2258
		handle = aMsg.Int3();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2259
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClient, MODULEUID, handle, fileHandle, aFsHandleIndex, aFileHandleIndex);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2260
#endif
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2261
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2262
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2263
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2264
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2265
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2266
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2267
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2268
	// Duplicates the file server (RFs) session handle identified by an 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2269
	// existing handle contained in the message slot at index aFsHandleIndex
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2270
	RFs fs;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2271
	r = fs.Open(aMsg, aFsHandleIndex, KFileServerPolicy);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2272
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2273
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2274
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2275
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2276
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2277
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2278
	//return CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2279
	// Slot 1: Indicate Large File Supportis required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2280
	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2281
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2282
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromClientReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2283
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2284
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2285
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2286
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2287
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2288
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2289
Allows a client to adopt an already open file from a server.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2290
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2291
Assumes that the server's RFs and RFile or RFile64 handles have been sent to the 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2292
client using TransferToClient().
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2293
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2294
This is equivalent to calling RFile::AdoptFromServer
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2295
except that the file adopted can be enlarged to sizes beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2296
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2297
Note: 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2298
If a RFile handle is received from the server then enlarging the file beyond
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2299
2GB-1 might result in inconsistent behaviour by the server, since it(server) would 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2300
not be able to handle files of size greater than 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2301
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2302
If a RFile64 handle is received from the server then enlarging the file beyond
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2303
2GB-1 should not cause any issues since the server would be capable of 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2304
handling files of size greater than 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2305
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2306
This RFile or RFile64 will own it's RFs session so that when the sub-session (RFile or RFile64) 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2307
is closed so will the RFs session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2308
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2309
@param aFsHandle The file server session (RFs) handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2310
@param aFileHandle The file (RFile or RFile64) handle of the already opened file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2311
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2312
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2313
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2314
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2315
EFSRV_EXPORT_C TInt RFile64::AdoptFromServer(TInt aFsHandle, TInt aFileHandle)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2316
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2317
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServer, MODULEUID, aFsHandle, aFileHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2318
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2319
	RFs fs;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2320
	TInt r = fs.SetReturnedHandle(aFsHandle, KFileServerPolicy);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2321
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2322
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2323
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2324
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2325
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2326
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2327
	//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2328
	// Slot 1: Indicate Large File Supportis required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2329
	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(aFileHandle, KFileAdopt64));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2330
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2331
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromServerReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2332
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2333
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2334
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2335
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2336
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2337
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2338
Allows a server to adopt an already open file from a client process.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2339
The client's file-server (RFs) and file (RFile or RFile64) handles are contained in 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2340
this process's environment data slots.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2341
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2342
Assumes that the client's RFs and RFile or RFile64 handles have been sent to the server process
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2343
using TransferToProcess().
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2344
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2345
This is equivalent to calling RFile::AdoptFromCreator
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2346
except that the file adopted can be enlarged to sizes beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2347
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2348
Note: 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2349
If a RFile handle is received from the client then enlarging the file beyond
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2350
2GB-1 might result in inconsistent behaviour by the client, since it(client) would 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2351
not be able to handle files of size greater than 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2352
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2353
If a RFile64 handle is received from the client then enlarging the file beyond
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2354
2GB-1 should not cause any issues since the client would be capable of 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2355
handling files of size greater than 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2356
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2357
This RFile or RFile64 will own it's RFs session so that when the sub-session (RFile or RFile64) 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2358
is closed so will the RFs session.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2359
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2360
@param	aFsHandleIndex	An index that identifies the slot in the process
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2361
					environment data that contains the file server session (RFs) handle
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2362
@param	aFileHandleIndex	An index that identifies the slot in the process
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2363
					environment data that contains the sub-session (RFile or RFile64) handle 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2364
					of the already opened file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2365
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2366
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2367
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2368
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2369
EFSRV_EXPORT_C TInt RFile64::AdoptFromCreator(TInt aFsHandleIndex, TInt aFileHandleIndex)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2370
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2371
	TInt fileHandle;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2372
	TInt r = User::GetTIntParameter(aFileHandleIndex,  fileHandle);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2373
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2374
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreator, MODULEUID, fileHandle, aFsHandleIndex, aFileHandleIndex);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2375
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2376
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2377
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2378
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2379
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2380
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2381
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2382
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2383
	// Duplicates the file server (RFs) session handle identified by an 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2384
	// existing handle contained in the environment slot at index aFsHandleIndex
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2385
	RFs fs;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2386
	r = fs.Open(aFsHandleIndex, KFileServerPolicy);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2387
	if (r != KErrNone)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2388
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2389
		TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2390
		return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2391
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2392
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2393
	//return(CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2394
	// Slot 1: Indicate Large File Supportis required.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2395
	r = CreateAutoCloseSubSession(fs, EFsFileAdopt, TIpcArgs(fileHandle, KFileAdopt64));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2396
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2397
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileAdoptFromCreatorReturn, MODULEUID, r, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2398
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2399
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2400
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2401
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2402
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2403
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2404
Reads from the file at the specified offset within the file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2405
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2406
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2407
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2408
This is equivalent to calling RFile::Read(TInt, TDes8&) except that this function
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2409
accepts TInt64, instead of TInt, as its first parameter. This allows to specify 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2410
the read position beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2411
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2412
@see RFile::Read(TInt aPos, TDes8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2413
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2414
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2415
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2416
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2417
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2418
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2419
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2420
@param aPos Position of first byte to be read.  This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2421
            the start of the file. If no position is specified, reading
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2422
            begins at the current file position. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2423
            If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2424
            a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2425
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2426
@param aDes The descriptor into which binary data is read. Any existing content
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2427
            is overwritten. On return, its length is set to the number of
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2428
            bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2429
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2430
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2431
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2432
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2433
@panic FSCLIENT 19 if aPos is negative.        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2434
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2435
EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2436
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2437
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.MaxLength());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2438
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2439
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2440
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2441
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2442
	if (!(I64HIGH(aPos+1)))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2443
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2444
		r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(aPos)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2445
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2446
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2447
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2448
		TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2449
 		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2450
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2451
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2452
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2453
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2454
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2455
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2456
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2457
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2458
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2459
Reads from the file at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2460
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2461
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2462
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2463
This is equivalent to calling RFile::Read(TInt, TDes8&, TRequestStatus&) except 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2464
that this function accepts TInt64, instead of TInt, as its first parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2465
This allows to specify the read position beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2466
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2467
@see RFile::Read(TInt aPos, TDes8& aDes, TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2468
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2469
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2470
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2471
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2472
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2473
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2474
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2475
@param aPos    Position of first byte to be read. This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2476
               the start of the file. If no position is specified, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2477
               reading begins at the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2478
               If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2479
               a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2480
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2481
@param aDes    The descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2482
               content is overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2483
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2484
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2485
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2486
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2487
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2488
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2489
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2490
@param aStatus The request status. On completion, contains an error code of KErrNone 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2491
               if successful, otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2492
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2493
@panic FSCLIENT 19 if aPos is negative.        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2494
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2495
EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TRequestStatus& aStatus) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2496
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2497
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.MaxLength(), &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2498
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2499
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2500
	if (!(I64HIGH(aPos+1)))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2501
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2502
		RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),I64LOW(aPos)),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2503
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2504
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2505
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2506
		TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2507
		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2508
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2509
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2510
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2511
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2512
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2513
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2514
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2515
Reads the specified number of bytes of binary data from the file at a specified 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2516
offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2517
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2518
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2519
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2520
This is equivalent to calling RFile::Read(TInt, TDes8&, TInt) except 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2521
that this function accepts TInt64, instead of TInt, as its first parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2522
This allows to specify the read position beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2523
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2524
@see RFile::Read(TInt aPos, TDes8& aDes, TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2525
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2526
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2527
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2528
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2529
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2530
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2531
Assuming aLength is less than the maximum length of the descriptor, the only
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2532
circumstances in which Read() can return fewer bytes than requested is when
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2533
the end of file is reached or if an error has occurred.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2534
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2535
@param aPos    Position of first byte to be read. This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2536
               the start of the file. If no position is specified, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2537
               reading begins at the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2538
               If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2539
               a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2540
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2541
@param aDes    The descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2542
               contents are overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2543
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2544
@param aLength The number of bytes to read from the file into the descriptor. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2545
               If an attempt is made to read more bytes than the descriptor's
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2546
               maximum length, then the function updates aStatus parameter with KErrOverflow.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2547
               It must not be negative otherwise the function updates aStatus with KErrArgument.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2548
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2549
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2550
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2551
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2552
@panic FSCLIENT 19 if aPos is negative.        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2553
*/    	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2554
EFSRV_EXPORT_C TInt RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2555
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2556
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2557
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2558
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2559
	if (aLength==0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2560
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2561
		aDes.Zero();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2562
		return(KErrNone);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2563
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2564
	else if(aLength>aDes.MaxLength())
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2565
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2566
		return(KErrOverflow);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2567
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2568
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2569
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2570
	if (!(I64HIGH(aPos+1)))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2571
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2572
		r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(aPos)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2573
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2574
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2575
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2576
		TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2577
		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2578
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2579
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2580
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2581
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2582
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2583
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2584
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2585
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2586
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2587
Reads the specified number of bytes of binary data from the file at a specified 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2588
offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2589
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2590
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2591
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2592
This is equivalent to calling RFile::Read(TInt, TDes8&, TInt, TRequestStatus&) except 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2593
that this function accepts TInt64, instead of TInt, as its first parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2594
This allows to specify the read position beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2595
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2596
@see RFile::Read(TInt aPos, TDes8& aDes,TInt aLength,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2597
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2598
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2599
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2600
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2601
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2602
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2603
Assuming aLength is less than the maximum length of the descriptor, the only
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2604
circumstances in which Read() can return fewer bytes than requested is when
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2605
the end of file is reached or if an error has occurred.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2606
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2607
@param aPos    Position of first byte to be read. This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2608
               the start of the file. If no position is specified, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2609
               reading begins at the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2610
               If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2611
               a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2612
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2613
@param aDes    The descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2614
               contents are overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2615
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2616
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2617
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2618
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2619
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2620
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2621
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2622
@param aLength The number of bytes to read from the file into the descriptor. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2623
               If an attempt is made to read more bytes than the descriptor's
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2624
               maximum length, then the function returns KErrOverflow.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2625
               It must not be negative otherwise the function returns KErrArgument.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2626
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2627
@param aStatus Request status. On completion contains KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2628
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2629
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2630
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2631
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2632
EFSRV_EXPORT_C void RFile64::Read(TInt64 aPos, TDes8& aDes, TInt aLength,TRequestStatus& aStatus) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2633
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2634
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength, &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2635
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2636
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2637
	if (aLength==0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2638
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2639
		aDes.Zero();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2640
		TRequestStatus* req=(&aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2641
		User::RequestComplete(req,KErrNone);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2642
		return;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2643
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2644
	else if(aLength>aDes.MaxLength())
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2645
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2646
		TRequestStatus* req=(&aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2647
		User::RequestComplete(req,KErrOverflow);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2648
		return;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2649
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2650
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2651
	if (!(I64HIGH(aPos+1)))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2652
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2653
		RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,I64LOW(aPos)),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2654
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2655
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2656
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2657
		TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2658
		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2659
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2660
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2661
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2662
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2663
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2664
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2665
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2666
Writes to the file at the specified offset within the file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2667
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2668
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2669
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2670
This is equivalent to calling RFile::Write(TInt, TDes8&) except 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2671
that this function accepts TInt64, instead of TInt, as its first parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2672
This allows to specify the write position beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2673
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2674
@see RFile::Write(TInt aPos, TDes8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2675
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2676
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2677
@param aPos The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2678
            byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2679
            If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2680
            the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2681
            If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2682
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2683
@param aDes The descriptor from which binary data is written. The function writes 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2684
            the entire contents of aDes to the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2685
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2686
@return KErrNone if successful, otherwise one of the other system-wide error
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2687
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2688
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2689
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2690
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2691
EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2692
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2693
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2694
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2695
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2696
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2697
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2698
	if (!(I64HIGH(aPos+1)))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2699
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2700
		r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(aPos)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2701
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2702
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2703
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2704
		TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2705
		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2706
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2707
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2708
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2709
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2710
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2711
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2712
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2713
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2714
Writes to the file at the specified offset within the file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2715
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2716
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2717
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2718
This is equivalent to calling RFile::Write(TInt, TDes8&, TRequestStatus&) except 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2719
that this function accepts TInt64, instead of TInt, as its first parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2720
This allows to specify the write position beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2721
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2722
@see RFile::Write(TInt aPos, TDes8& aDes, TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2723
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2724
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2725
@param aPos    The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2726
               byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2727
               If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2728
               the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2729
               If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2730
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2731
@param aDes    The descriptor from which binary data is written. The function
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2732
               writes the entire contents of aDes to the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2733
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2734
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2735
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2736
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2737
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2738
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2739
@param aStatus Request status. On completion contains KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2740
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2741
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2742
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2743
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2744
EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2745
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2746
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aDes.Length(), &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2747
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2748
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2749
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2750
	if (!(I64HIGH(aPos+1)))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2751
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2752
		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),I64LOW(aPos)),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2753
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2754
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2755
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2756
		TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2757
		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2758
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2759
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2760
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2761
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2762
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2763
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2764
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2765
Writes the specified number of bytes to the file at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2766
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2767
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2768
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2769
This is equivalent to calling RFile::Write(TInt, TDes8&, TInt) except 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2770
that this function accepts TInt64, instead of TInt, as its first parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2771
This allows to specify the write position beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2772
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2773
@see RFile::Write(TInt aPos, TDes8& aDes, TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2774
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2775
@param aPos    The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2776
               byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2777
               If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2778
               the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2779
               If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2780
                             
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2781
@param aDes    The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2782
@param aLength The number of bytes to be written from aDes .
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2783
               It must not be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2784
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2785
@return KErrNone if successful; KErrArgument if aLength is negative;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2786
        otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2787
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2788
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2789
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2790
EFSRV_EXPORT_C TInt RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2791
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2792
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2793
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2794
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2795
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2796
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2797
	if (!(I64HIGH(aPos+1)))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2798
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2799
		r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(aPos)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2800
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2801
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2802
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2803
		TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2804
		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2805
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2806
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2807
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2808
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2809
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2810
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2811
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2812
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2813
Writes the specified number of bytes to the file at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2814
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2815
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2816
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2817
This is equivalent to calling RFile::Write(TInt, TDes8&, TInt, TRequestStatus&) except 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2818
that this function accepts TInt64, instead of TInt, as its first parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2819
This allows to specify the write position beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2820
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2821
@see RFile::Write(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus &aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2822
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2823
@param aPos    The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2824
               byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2825
               If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2826
               the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2827
               If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2828
              
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2829
@param aDes    The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2830
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2831
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2832
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2833
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2834
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2835
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2836
@param aLength The number of bytes to be written from aDes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2837
               It must not be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2838
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2839
@param aStatus Request status. On completion contains KErrNone if successful; 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2840
               KErrArgument if aLength is negative; 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2841
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2842
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2843
@panic FSCLIENT 19 if aPos is negative.                       
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2844
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2845
EFSRV_EXPORT_C void RFile64::Write(TInt64 aPos, const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2846
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2847
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength, &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2848
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2849
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2850
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2851
	if (!(I64HIGH(aPos+1)))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2852
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2853
		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,I64LOW(aPos)),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2854
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2855
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2856
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2857
		TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2858
		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2859
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2860
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2861
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2862
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2863
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2864
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2865
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2866
Sets the the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2867
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2868
The function can also be used to get the current file 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2869
position without changing it. The file position is the position at which
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2870
reading and writing takes place. The start of the file is position zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2871
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2872
To retrieve the current file position without changing it, specify ESeekCurrent 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2873
for the seek mode, and zero for the offset.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2874
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2875
This is equivalent to calling RFile::Seek except that this function accepts
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2876
a reference to TInt64, instead of TInt, as its second parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2877
This allows to seek to positions beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2878
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2879
@see RFile::Seek()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2880
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2881
If the seek mode is ESeekStart, then:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2882
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2883
1. the function does not modify the aPos argument,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2884
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2885
2. the function returns an error if the offset specified is negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2886
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2887
If the seek mode is ESeekAddress, an error is returned if:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2888
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2889
1. the file is not in ROM, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2890
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2891
2. the offset specified is greater than the size of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2892
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2893
@param aMode Seek mode. Controls the destination of the seek operation.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2894
@param aPos  Offset from location specified in aMode. Can be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2895
             On return contains the new file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2896
             If the seek mode is either ESeekCurrent or ESeekEnd and the offset
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2897
             specifies a position before the start of the file 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2898
             or beyond the end of the file, then on return, aPos is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2899
             the new file position (either the start or the end of the file).
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2900
             If the seek mode is ESeekAddress, aPos returns the address of
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2901
             the byte at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2902
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2903
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2904
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2905
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2906
EFSRV_EXPORT_C TInt RFile64::Seek(TSeek aMode, TInt64& aPos) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2907
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2908
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileSeek, MODULEUID, Session().Handle(), SubSessionHandle(), aMode, aPos, 0);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2909
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2910
	TPckgC<TInt64> pkOffset(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2911
	TPckg<TInt64> pkNewPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2912
 	TInt r = SendReceive(EFsFileSeek|KIpcArgSlot0Desc|KIpcArgSlot2Desc,TIpcArgs(&pkOffset,aMode,&pkNewPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2913
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2914
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSeekReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2915
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2916
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2917
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2918
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2919
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2920
Gets the current file size.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2921
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2922
This is equivalent to calling RFile::Size except that this function accepts
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2923
a reference to TInt64, instead of TInt, as its first parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2924
This allows to query file sizes, which are greater than 2GB-1
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2925
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2926
@see RFile::Size()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2927
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2928
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2929
@param aSize On return, the size of the file in bytes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2930
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2931
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2932
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2933
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2934
EFSRV_EXPORT_C TInt RFile64::Size(TInt64& aSize) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2935
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2936
	TRACE2(UTF::EBorder, UTraceModuleEfsrv::EFileSize2, MODULEUID, Session().Handle(), SubSessionHandle());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2937
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2938
	TPckg<TInt64> pkSize(aSize);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2939
	TInt r = SendReceive(EFsFileSize|KIpcArgSlot0Desc,TIpcArgs(&pkSize));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2940
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2941
	TRACERET3(UTF::EBorder, UTraceModuleEfsrv::EFileSize2Return, MODULEUID, r, I64LOW(aSize), I64HIGH(aSize));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2942
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2943
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2944
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2945
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2946
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2947
Sets the file size.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2948
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2949
If the size of the file is reduced, data may be lost from 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2950
the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2951
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2952
This is equivalent to calling RFile::SetSize except that this function accepts
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2953
a reference to TInt64, instead of TInt, as its first parameter. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2954
This allows to set file sizes to greater than 2GB-1
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2955
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2956
@see RFile::SetSize()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2957
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2958
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2959
Note:
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2960
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2961
1. The current file position remains unchanged unless SetSize() reduces the size 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2962
   of the file in such a way that the current file position is now beyond
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2963
   the end of the file. In this case, the current file position is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2964
   the end of file. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2965
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2966
2. If the file was not opened for writing, an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2967
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2968
@param aSize The new size of the file, in bytes. This value must not be negative, otherwise the function raises a panic.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2969
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2970
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2971
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2972
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2973
@panic FSCLIENT 20 If aSize is negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2974
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2975
EFSRV_EXPORT_C TInt RFile64::SetSize(TInt64 aSize)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2976
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2977
	TRACE4(UTF::EBorder, UTraceModuleEfsrv::EFileSetSize, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aSize), I64HIGH(aSize));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2978
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2979
	TPckgC<TInt64> pkSize(aSize);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2980
	TInt r = SendReceive(EFsFileSetSize|KIpcArgSlot0Desc, TIpcArgs(&pkSize));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2981
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2982
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileSetSizeReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2983
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2984
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2985
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2986
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2987
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2988
Locks a region within the file as defined by a range of bytes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2989
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2990
This ensures that those bytes are accessible 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2991
only through the RFile object which claims the lock. To re-allow access by 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2992
other programs to the locked region, it must either be unlocked or the file 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2993
closed. Locking can be used to synchronize operations on a file when more 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2994
than one program has access to the file in EFileShareAny mode.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2995
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2996
More than one distinct region of a file can be locked, but an error is returned 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2997
if more than one lock is placed on the same region. Different RFile objects 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2998
can lock different parts of the same file as long as the file is opened in 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  2999
EFileShareAny mode. The locked region may extend beyond the end of a file;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3000
this prevents the file from being extended by other programs.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3001
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3002
This is equivalent to calling RFile::Lock except that this function accepts
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3003
TInt64 parameters instead of TInt parameters. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3004
This allows to to lock positions in file beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3005
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3006
@see RFile::Lock()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3007
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3008
@param aPos    Position in file from which to lock; this is the  offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3009
               the beginning of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3010
@param aLength Number of bytes to lock.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3011
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3012
@return KErrNone if successful, otherwise one of the other  system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3013
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3014
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3015
@panic FSCLIENT 17 if aLength is not greater than zero,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3016
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3017
EFSRV_EXPORT_C TInt RFile64::Lock(TInt64 aPos, TInt64 aLength) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3018
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3019
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileLock, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3020
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3021
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3022
	TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3023
	TPckgC<TInt64> pkLength(aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3024
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3025
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3026
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3027
	if(aPos <= KMaxTInt && aLength <= KMaxTInt)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3028
		r = SendReceive(EFsFileLock,TIpcArgs(I64LOW(aPos), I64LOW(aLength)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3029
	else if(aPos <= KMaxTInt)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3030
		r = SendReceive(EFsFileLock|KIpcArgSlot1Desc,TIpcArgs(I64LOW(aPos), &pkLength));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3031
	else if(aLength <= KMaxTInt)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3032
		r = SendReceive(EFsFileLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3033
	else 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3034
		r = SendReceive(EFsFileLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3035
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileLockReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3036
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3037
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3038
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3039
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3040
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3041
Unlocks a region within the file as defined by a range of bytes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3042
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3043
A lock can only be removed by the RFile object which claimed the lock.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3044
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3045
A portion of a locked region cannot be unlocked. The entire locked region 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3046
must be unlocked otherwise an error is returned. If any byte within
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3047
the specified range of bytes to unlock is not locked, an error is returned.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3048
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3049
This is equivalent to calling RFile::UnLock except that this function accepts
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3050
TInt64 parameters instead of TInt parameters. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3051
This allows to to unlock positions in file beyond 2GB-1.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3052
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3053
@see RFile::UnLock()
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3054
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3055
@param aPos    Position in file from which to unlock; this is the  offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3056
               the beginning of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3057
@param aLength Number of bytes to unlock.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3058
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3059
@return KErrNone if successful, otherwise one of the other  system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3060
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3061
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3062
@panic FSCLIENT 18 if aLength is not greater than zero,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3063
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3064
EFSRV_EXPORT_C TInt RFile64::UnLock(TInt64 aPos, TInt64 aLength) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3065
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3066
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileUnLock, MODULEUID, Session().Handle(), SubSessionHandle(), I64LOW(aPos), I64HIGH(aPos), aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3067
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3068
	__ASSERT_ALWAYS(aPos>=0,Panic(EPosNegative));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3069
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3070
	TPckgC<TInt64> pkPos(aPos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3071
	TPckgC<TInt64> pkLength(aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3072
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3073
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3074
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3075
	if(aPos <= KMaxTInt && aLength <= KMaxTInt)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3076
		r = SendReceive(EFsFileUnLock,TIpcArgs(I64LOW(aPos), I64LOW(aLength)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3077
	else if(aPos <= KMaxTInt)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3078
		r = SendReceive(EFsFileUnLock|KIpcArgSlot1Desc,TIpcArgs(I64LOW(aPos), &pkLength));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3079
	else if(aLength <= KMaxTInt)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3080
		r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc,TIpcArgs(&pkPos, I64LOW(aLength)));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3081
	else 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3082
		r = SendReceive(EFsFileUnLock|KIpcArgSlot0Desc|KIpcArgSlot1Desc,TIpcArgs(&pkPos, &pkLength));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3083
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3084
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileUnLockReturn, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3085
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3086
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3087
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3088
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3089
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3090
Reads from the file at the specified offset within the file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3091
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3092
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3093
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3094
This is equivalent to calling RFile::Read(TInt, TDes8&) or RFile64::Read(TInt64, TDes8&)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3095
except that this function accepts TUint, instead of TInt or TInt64, as its first parameter.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3096
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3097
This function is provided for gradual migration of a client from 32-bit RFile APIs
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3098
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3099
macro. If the macro is defined, then it hides this overload, which would then throw
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3100
compile-time errors for any user code that uses TUint parameter for RFile64::Read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3101
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3102
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3103
@see RFile::Read(TInt aPos, TDes8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3104
@see RFile64::Read(TInt aPos, TDes8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3105
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3106
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3107
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3108
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3109
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3110
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3111
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3112
@param aPos Position of first byte to be read.  This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3113
            the start of the file. If no position is specified, reading
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3114
            begins at the current file position. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3115
            If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3116
            a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3117
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3118
@param aDes The descriptor into which binary data is read. Any existing content
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3119
            is overwritten. On return, its length is set to the number of
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3120
            bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3121
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3122
@return KErrNone if successful, otherwise one of the other system-wide error 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3123
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3124
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3125
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3126
EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3127
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3128
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3129
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3130
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3131
	if(!(aPos + 1))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3132
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3133
		r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3134
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3135
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3136
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3137
		TInt64 pos = aPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3138
		TPckgC<TInt64> pkPos(pos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3139
 		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3140
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3141
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3142
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3143
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3144
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3145
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3146
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3147
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3148
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3149
Reads from the file at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3150
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3151
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3152
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3153
This is equivalent to calling RFile::Read(TInt, TDes8&, TRequestStatus&) or 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3154
RFile64::Read(TInt64, TDes8&, TRequestStatus&) except that this function 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3155
accepts TUint, instead of TInt or TInt64, as its first parameter.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3156
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3157
This function is provided for gradual migration of a client from 32-bit RFile APIs
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3158
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3159
macro. If the macro is defined, then it hides this overload, which would then throw
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3160
compile-time errors for any user code that uses TUint parameter for RFile64::Read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3161
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3162
@see RFile::Read(TInt aPos, TDes8& aDes, TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3163
@see RFile64::Read(TInt aPos, TDes8& aDes, TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3164
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3165
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3166
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3167
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3168
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3169
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3170
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3171
@param aPos    Position of first byte to be read. This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3172
               the start of the file. If no position is specified, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3173
               reading begins at the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3174
               If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3175
               a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3176
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3177
@param aDes    The descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3178
               content is overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3179
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3180
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3181
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3182
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3183
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3184
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3185
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3186
@param aStatus The request status. On completion, contains an error code of KErrNone 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3187
               if successful, otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3188
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3189
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3190
EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TRequestStatus& aStatus) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3191
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3192
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.MaxLength(), &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3193
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3194
	if(!(aPos + 1))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3195
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3196
		RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aDes.MaxLength(),aPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3197
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3198
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3199
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3200
		TInt64 pos = aPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3201
		TPckgC<TInt64> pkPos(pos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3202
		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.MaxLength(),&pkPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3203
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3204
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3205
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3206
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3207
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3208
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3209
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3210
Reads the specified number of bytes of binary data from the file at a specified 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3211
offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3212
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3213
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3214
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3215
This is equivalent to calling RFile::Read(TInt, TDes8&, TInt) or 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3216
RFile64::Read(TInt64, TDes8&, TInt) except that this function 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3217
accepts TUint, instead of TInt or TInt64, as its first parameter.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3218
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3219
This function is provided for gradual migration of a client from 32-bit RFile APIs
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3220
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3221
macro. If the macro is defined, then it hides this overload, which would then throw
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3222
compile-time errors for any user code that uses TUint parameter for RFile64::Read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3223
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3224
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3225
@see RFile::Read(TInt aPos, TDes8& aDes,TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3226
@see RFile64::Read(TInt aPos, TDes8& aDes,TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3227
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3228
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3229
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3230
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3231
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3232
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3233
Assuming aLength is less than the maximum length of the descriptor, the only
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3234
circumstances in which Read() can return fewer bytes than requested is when
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3235
the end of file is reached or if an error has occurred.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3236
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3237
@param aPos    Position of first byte to be read. This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3238
               the start of the file. If no position is specified, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3239
               reading begins at the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3240
               If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3241
               a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3242
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3243
@param aDes    The descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3244
               contents are overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3245
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3246
@param aLength The number of bytes to read from the file into the descriptor. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3247
               If an attempt is made to read more bytes than the descriptor's
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3248
               maximum length, then the function updates aStatus parameter with KErrOverflow.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3249
               It must not be negative otherwise the function updates aStatus with KErrArgument.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3250
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3251
@return KErrNone if successful, otherwise one of the other system-wide
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3252
        error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3253
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3254
*/    
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3255
EFSRV_EXPORT_C TInt RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3256
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3257
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileRead3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3258
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3259
	if (aLength==0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3260
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3261
		aDes.Zero();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3262
		return(KErrNone);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3263
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3264
	else if(aLength>aDes.MaxLength())
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3265
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3266
		return(KErrOverflow);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3267
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3268
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3269
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3270
	if(!(aPos + 1))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3271
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3272
		r = SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3273
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3274
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3275
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3276
		TInt64 pos = aPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3277
		TPckgC<TInt64> pkPos(pos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3278
		r = SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3279
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3280
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3281
	TRACERET2(UTF::EBorder, UTraceModuleEfsrv::EFileRead3Return, MODULEUID, r, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3282
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3283
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3284
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3285
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3286
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3287
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3288
Reads the specified number of bytes of binary data from the file at a specified 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3289
offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3290
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3291
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3292
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3293
This is equivalent to calling RFile::Read(TInt, TDes8&, TInt,TRequestStatus&) or 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3294
RFile64::Read(TInt64, TDes8&, TInt, TRequestStatus&) except that this function 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3295
accepts TUint, instead of TInt or TInt64, as its first parameter.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3296
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3297
This function is provided for gradual migration of a client from 32-bit RFile APIs
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3298
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3299
macro. If the macro is defined, then it hides this overload, which would then throw
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3300
compile-time errors for any user code that uses TUint parameter for RFile64::Read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3301
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3302
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3303
@see RFile::Read(TInt aPos, TDes8& aDes,TInt aLength,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3304
@see RFile64::Read(TInt aPos, TDes8& aDes,TInt aLength,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3305
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3306
Note that when an attempt is made to read beyond the end of the file,
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3307
no error is returned. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3308
The descriptor's length is set to the number of bytes read into it.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3309
Therefore, when reading through a file, the end of file has been reached 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3310
when the descriptor length, as returned by TDesC8::Length(), is zero.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3311
Assuming aLength is less than the maximum length of the descriptor, the only
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3312
circumstances in which Read() can return fewer bytes than requested is when
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3313
the end of file is reached or if an error has occurred.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3314
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3315
@param aPos    Position of first byte to be read. This is an offset from
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3316
               the start of the file. If no position is specified, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3317
               reading begins at the current file position.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3318
               If aPos is beyond the end of the file, the function returns
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3319
               a zero length descriptor.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3320
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3321
@param aDes    The descriptor into which binary data is read. Any existing
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3322
               contents are overwritten. On return, its length is set to
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3323
               the number of bytes read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3324
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3325
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3326
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3327
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3328
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3329
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3330
@param aLength The number of bytes to read from the file into the descriptor. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3331
               If an attempt is made to read more bytes than the descriptor's
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3332
               maximum length, then the function returns KErrOverflow.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3333
               It must not be negative otherwise the function returns KErrArgument.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3334
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3335
@param aStatus Request status. On completion contains KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3336
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3337
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3338
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3339
EFSRV_EXPORT_C void RFile64::Read(TUint aPos,TDes8& aDes,TInt aLength,TRequestStatus& aStatus) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3340
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3341
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileRead4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3342
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3343
	if (aLength==0)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3344
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3345
		aDes.Zero();
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3346
		TRequestStatus* req=(&aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3347
		User::RequestComplete(req,KErrNone);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3348
		return;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3349
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3350
	else if(aLength>aDes.MaxLength())
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3351
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3352
		TRequestStatus* req=(&aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3353
		User::RequestComplete(req,KErrOverflow);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3354
		return;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3355
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3356
	
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3357
	if(!(aPos + 1))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3358
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3359
		RSubSessionBase::SendReceive(EFsFileRead,TIpcArgs(&aDes,aLength,aPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3360
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3361
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3362
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3363
		TInt64 pos = aPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3364
		TPckgC<TInt64> pkPos(pos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3365
		RSubSessionBase::SendReceive(EFsFileRead|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3366
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3367
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3368
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileRead4Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3369
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3370
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3371
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3372
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3373
Writes to the file at the specified offset within the file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3374
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3375
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3376
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3377
This is equivalent to calling RFile::Write(TInt, TDes8&) or 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3378
RFile64::Write(TInt64, TDes8&) except that this function 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3379
accepts TUint, instead of TInt or TInt64, as its first parameter.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3380
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3381
This function is provided for gradual migration of a client from 32-bit RFile APIs
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3382
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3383
macro. If the macro is defined, then it hides this overload, which would then throw
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3384
compile-time errors for any user code that uses TUint parameter for RFile64::Read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3385
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3386
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3387
@see RFile::Write(TInt aPos, TDes8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3388
@see RFile64::Write(TInt aPos, TDes8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3389
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3390
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3391
@param aPos The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3392
            byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3393
            If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3394
            the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3395
            If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3396
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3397
@param aDes The descriptor from which binary data is written. The function writes 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3398
            the entire contents of aDes to the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3399
            
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3400
@return KErrNone if successful, otherwise one of the other system-wide error
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3401
        codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3402
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3403
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3404
EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3405
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3406
	TRACE5(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length());
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3407
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3408
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3409
	if(!(aPos + 1))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3410
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3411
		r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3412
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3413
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3414
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3415
		TInt64 pos = aPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3416
		TPckgC<TInt64> pkPos(pos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3417
		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3418
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3419
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3420
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite3Return, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3421
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3422
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3423
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3424
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3425
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3426
Writes to the file at the specified offset within the file
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3427
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3428
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3429
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3430
This is equivalent to calling RFile::Write(TInt, TDes8&,TRequestStatus&) or 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3431
RFile64::Write(TInt64, TDes8&,TRequestStatus&) except that this function 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3432
accepts TUint, instead of TInt or TInt64, as its first parameter.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3433
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3434
This function is provided for gradual migration of a client from 32-bit RFile APIs
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3435
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3436
macro. If the macro is defined, then it hides this overload, which would then throw
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3437
compile-time errors for any user code that uses TUint parameter for RFile64::Read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3438
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3439
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3440
@see RFile::Write(TInt aPos, TDes8& aDes,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3441
@see RFile64::Write(TInt aPos, TDes8& aDes,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3442
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3443
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3444
@param aPos    The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3445
               byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3446
               If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3447
               the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3448
               If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3449
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3450
@param aDes    The descriptor from which binary data is written. The function
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3451
               writes the entire contents of aDes to the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3452
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3453
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3454
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3455
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3456
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3457
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3458
@param aStatus Request status. On completion contains KErrNone if successful, 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3459
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3460
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3461
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3462
EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3463
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3464
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aDes.Length(), &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3465
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3466
	if(!(aPos + 1))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3467
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3468
		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aDes.Length(),aPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3469
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3470
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3471
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3472
		TInt64 pos = aPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3473
		TPckgC<TInt64> pkPos(pos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3474
		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aDes.Length(),&pkPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3475
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3476
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite4Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3477
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3478
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3479
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3480
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3481
Writes the specified number of bytes to the file at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3482
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3483
This is a synchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3484
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3485
This is equivalent to calling RFile::Write(TInt, TDes8&,TInt) or 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3486
RFile64::Write(TInt64, TDes8&,TInt) except that this function 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3487
accepts TUint, instead of TInt or TInt64, as its first parameter.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3488
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3489
This function is provided for gradual migration of a client from 32-bit RFile APIs
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3490
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3491
macro. If the macro is defined, then it hides this overload, which would then throw
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3492
compile-time errors for any user code that uses TUint parameter for RFile64::Read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3493
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3494
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3495
@see RFile::Write(TInt aPos, TDes8& aDes,TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3496
@see RFile64::Write(TInt aPos, TDes8& aDes,TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3497
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3498
@param aPos    The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3499
               byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3500
               If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3501
               the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3502
               If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3503
                             
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3504
@param aDes    The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3505
@param aLength The number of bytes to be written from aDes .
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3506
               It must not be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3507
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3508
@return KErrNone if successful; KErrArgument if aLength is negative;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3509
        otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3510
        
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3511
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3512
EFSRV_EXPORT_C TInt RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3513
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3514
	TRACE3(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1, MODULEUID, Session().Handle(), SubSessionHandle(), aLength);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3515
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3516
	TInt r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3517
	if(!(aPos + 1))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3518
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3519
		r = SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3520
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3521
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3522
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3523
		TInt64 pos = aPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3524
		TPckgC<TInt64> pkPos(pos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3525
		r = SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos));
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3526
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3527
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3528
	TRACERET1(UTF::EBorder, UTraceModuleEfsrv::EFileWrite1Return, MODULEUID, r);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3529
	return r;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3530
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3531
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3532
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3533
/**
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3534
Writes the specified number of bytes to the file at the specified offset within the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3535
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3536
This is an asynchronous function.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3537
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3538
This is equivalent to calling RFile::Write(TInt, TDes8&,TInt,TRequestStatus&) or 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3539
RFile64::Write(TInt64, TDes8&,TInt,TRequestStatus&) except that this function 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3540
accepts TUint, instead of TInt or TInt64, as its first parameter.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3541
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3542
This function is provided for gradual migration of a client from 32-bit RFile APIs
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3543
to 64-bit RFile64 APIs. It is protected under _F32_STRICT_64_BIT_MIGRATION
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3544
macro. If the macro is defined, then it hides this overload, which would then throw
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3545
compile-time errors for any user code that uses TUint parameter for RFile64::Read.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3546
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3547
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3548
@see RFile::Write(TInt aPos, TDes8& aDes, TInt aLength, TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3549
@see RFile64::Write(TInt aPos, TDes8& aDes,TInt aLength, TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3550
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3551
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3552
@param aPos    The offset from the start of the file at which the first
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3553
               byte is written. 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3554
               If a position beyond the end of the file is specified, then
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3555
               the write operation begins at the end of the file.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3556
               If the position has been locked, then the write fails.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3557
              
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3558
@param aDes    The descriptor from which binary data is written.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3559
               NB: this function is asynchronous and the request that it
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3560
               represents may not complete until some time after the call
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3561
               to the function has returned. It is important, therefore, that
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3562
               this descriptor remain valid, or remain in scope, until you have
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3563
               been notified that the request is complete.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3564
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3565
@param aLength The number of bytes to be written from aDes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3566
               It must not be negative.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3567
               
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3568
@param aStatus Request status. On completion contains KErrNone if successful; 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3569
               KErrArgument if aLength is negative; 
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3570
               otherwise one of the other system-wide error codes.
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3571
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3572
*/
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3573
EFSRV_EXPORT_C void RFile64::Write(TUint aPos,const TDesC8& aDes,TInt aLength,TRequestStatus& aStatus)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3574
	{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3575
	TRACE6(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2, MODULEUID, Session().Handle(), SubSessionHandle(), aPos, 0, aLength, &aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3576
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3577
	if(!(aPos + 1))
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3578
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3579
		RSubSessionBase::SendReceive(EFsFileWrite,TIpcArgs(&aDes,aLength,aPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3580
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3581
	else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3582
		{
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3583
		TInt64 pos = aPos;
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3584
		TPckgC<TInt64> pkPos(pos);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3585
		RSubSessionBase::SendReceive(EFsFileWrite|KIpcArgSlot2Desc,TIpcArgs(&aDes,aLength,&pkPos),aStatus);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3586
		}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3587
	TRACE0(UTF::EBorder, UTraceModuleEfsrv::EFileWrite2Return, MODULEUID);
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3588
	}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3589
#else
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3590
EFSRV_EXPORT_C TInt RFile64::Open(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3591
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3592
EFSRV_EXPORT_C TInt RFile64::Create(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3593
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3594
EFSRV_EXPORT_C TInt RFile64::Replace(RFs& /*aFs*/,const TDesC& /*aName*/,TUint /*aFileMode*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3595
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3596
EFSRV_EXPORT_C TInt RFile64::Temp(RFs& /*aFs*/,const TDesC& /*aPath*/,TFileName& /*aName*/,TUint /*aFileMode*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3597
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3598
EFSRV_EXPORT_C TInt RFile64::AdoptFromClient(const RMessage2& /*aMsg*/, TInt /*aFsHandleIndex*/, TInt /*aFileHandleIndex*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3599
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3600
EFSRV_EXPORT_C TInt RFile64::AdoptFromServer(TInt /*aFsHandle*/, TInt /*aFileHandle*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3601
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3602
EFSRV_EXPORT_C TInt RFile64::AdoptFromCreator(TInt /*aFsHandleIndex*/, TInt /*aFileHandleIndex*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3603
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3604
EFSRV_EXPORT_C TInt RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3605
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3606
EFSRV_EXPORT_C void RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/, TRequestStatus& /*aStatus*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3607
	{Panic(ENotImplemented);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3608
EFSRV_EXPORT_C TInt RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/, TInt /*aLength*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3609
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3610
EFSRV_EXPORT_C void RFile64::Read(TInt64 /*aPos*/, TDes8& /*aDes*/, TInt /*aLength*/,TRequestStatus& /*aStatus*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3611
	{Panic(ENotImplemented);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3612
EFSRV_EXPORT_C TInt RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3613
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3614
EFSRV_EXPORT_C void RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/,TRequestStatus& /*aStatus*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3615
	{Panic(ENotImplemented);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3616
EFSRV_EXPORT_C TInt RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/, TInt /*aLength*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3617
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3618
EFSRV_EXPORT_C void RFile64::Write(TInt64 /*aPos*/, const TDesC8& /*aDes*/,TInt /*aLength*/,TRequestStatus& /*aStatus*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3619
	{Panic(ENotImplemented);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3620
EFSRV_EXPORT_C TInt RFile64::Seek(TSeek /*aMode*/, TInt64& /*aPos*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3621
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3622
EFSRV_EXPORT_C TInt RFile64::Size(TInt64& /*aSize*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3623
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3624
EFSRV_EXPORT_C TInt RFile64::SetSize(TInt64 /*aSize*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3625
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3626
EFSRV_EXPORT_C TInt RFile64::Lock(TInt64 /*aPos*/, TInt64 /*aLength*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3627
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3628
EFSRV_EXPORT_C TInt RFile64::UnLock(TInt64 /*aPos*/, TInt64 /*aLength*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3629
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3630
EFSRV_EXPORT_C TInt RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3631
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3632
EFSRV_EXPORT_C void RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/,TRequestStatus& /*aStatus*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3633
	{Panic(ENotImplemented);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3634
EFSRV_EXPORT_C TInt RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/,TInt /*aLength*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3635
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3636
EFSRV_EXPORT_C void RFile64::Read(TUint /*aPos*/,TDes8& /*aDes*/,TInt /*aLength*/,TRequestStatus& /*aStatus*/) const
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3637
	{Panic(ENotImplemented);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3638
EFSRV_EXPORT_C TInt RFile64::Write(TUint /*aPos*/,const TDesC8& /*aDes*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3639
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3640
EFSRV_EXPORT_C void RFile64::Write(TUint /*aPos*/,const TDesC8& /*aDes*/,TRequestStatus& /*aStatus*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3641
	{Panic(ENotImplemented);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3642
EFSRV_EXPORT_C TInt RFile64::Write(TUint /*aPos*/,const TDesC8& /*aDes*/,TInt /*aLength*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3643
	{Panic(ENotImplemented);return (KErrNotSupported);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3644
EFSRV_EXPORT_C void RFile64::Write(TUint /*aPos*/, const TDesC8& /*aDes*/,TInt /*aLength*/,TRequestStatus& /*aStatus*/)
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3645
	{Panic(ENotImplemented);}
1650c5a7be8c Hack to switch on ECOM server logging
Tom Pritchard <tomp@symbian.org>
parents:
diff changeset
  3646
#endif