First public contribution.
1 // Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32test\handle sharing\interface.cpp
19 #include "handshare.h"
22 _LIT(KServerName, "FHServer");
23 _LIT(KServerName2, "FHServer2");
26 TInt RFileHandleSharer::Connect()
28 return CreateSession(KServerName, TVersion(1,0,0));
31 TInt RFileHandleSharer::SetTestDrive(TInt aDrive)
33 return SendReceive(EMsgDrive, TIpcArgs(aDrive));
36 TInt RFileHandleSharer::GetFileHandle(TInt &aHandle, TFileMode aFileMode)
39 TInt fsh = SendReceive(EMsgGetFileHandle, TIpcArgs(&fh, aFileMode));
44 TInt RFileHandleSharer::GetFileHandle2(TInt &aHandle, TFileMode aFileMode)
47 TInt fsh = SendReceive(EMsgGetFileHandle2, TIpcArgs(&fh, aFileMode));
49 Sync(); // avoid race condition with server does further tests after giving use the handle
53 TInt RFileHandleSharer::PassFileHandle(TIpcArgs& aIpcArgs)
55 return SendReceive(EMsgPassFileHandle, aIpcArgs);
59 TInt RFileHandleSharer::PassInvalidFileHandle(TIpcArgs& aIpcArgs)
61 return SendReceive(EMsgPassInvalidFileHandle, aIpcArgs);
65 TInt RFileHandleSharer::PassFileHandleProcess()
67 return SendReceive(EMsgPassFileHandleProcess);
71 TInt RFileHandleSharer::Exit()
73 return SendReceive(EMsgExit, TIpcArgs(NULL));
76 void RFileHandleSharer::Sync()
78 SendReceive(EMsgSync, TIpcArgs());
81 // file handle server 2 functions
82 TInt RFileHandleSharer2::Connect()
84 return CreateSession(KServerName2, TVersion(1,0,0));
87 TInt RFileHandleSharer2::GetFileHandle(TInt &aHandle, TFileMode aFileMode)
90 TInt fsh = SendReceive(EMsgGetFileHandle, TIpcArgs(&fh, aFileMode));
95 TInt RFileHandleSharer2::PassFileHandleNew(TIpcArgs& aIpcArgs)
97 return SendReceive(EMsgPassFileHandle, aIpcArgs);
100 TInt RFileHandleSharer2::Exit()
102 return SendReceive(EMsgExit, TIpcArgs(NULL));