author | Tom Sutcliffe <thomas.sutcliffe@accenture.com> |
Wed, 13 Oct 2010 15:07:15 +0100 | |
changeset 68 | 6a26ca985d90 |
parent 5 | 9c58252c6740 |
permissions | -rw-r--r-- |
5
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
1 |
// ProxyServer.cpp |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
2 |
// |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
3 |
// Copyright (c) 2010 Accenture. All rights reserved. |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
4 |
// This component and the accompanying materials are made available |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
5 |
// under the terms of the "Eclipse Public License v1.0" |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
6 |
// which accompanies this distribution, and is available |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
7 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
8 |
// |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
9 |
// Initial Contributors: |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
10 |
// Accenture - Initial contribution |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
11 |
// |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
12 |
#include "ProxyServer.h" |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
13 |
#include <fshell/memoryaccess.h> |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
14 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
15 |
#define LOG(x...) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
16 |
#define LOG8(x...) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
17 |
//#include <e32debug.h> |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
18 |
//#define LOG(x...) RDebug::Print(x) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
19 |
//#define LOG8(x...) RDebug::Printf(x) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
20 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
21 |
//const TInt KShutdownProxy = 1000; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
22 |
//const TInt KPingProxy = 1001; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
23 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
24 |
NONSHARABLE_CLASS(CAsyncWaiter) : public CActive |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
25 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
26 |
public: |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
27 |
CAsyncWaiter(RUnderlyingSession& aRealSession, const RMessage2& aOriginalMessage, const TIpcArgs& aArgs); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
28 |
~CAsyncWaiter(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
29 |
//void ForwardMessageL(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
30 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
31 |
protected: |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
32 |
void RunL(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
33 |
void DoCancel(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
34 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
35 |
private: |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
36 |
RUnderlyingSession& iRealSession; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
37 |
RMessage2 iMsg; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
38 |
TIpcArgs iArgs; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
39 |
}; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
40 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
41 |
CProxyServer* CProxyServer::NewInSeparateThreadL(const TDesC& aServerToReplace, MMessageHandler* aHandler) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
42 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
43 |
CProxyServer* self = new(ELeave) CProxyServer(aServerToReplace, aHandler); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
44 |
CleanupStack::PushL(self); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
45 |
self->ThreadConstructL(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
46 |
CleanupStack::Pop(self); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
47 |
return self; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
48 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
49 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
50 |
CProxyServer::CProxyServer(const TDesC& aServerToReplace, MMessageHandler* aHandler) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
51 |
: CServer2(0, ESharableSessions), iServerName(aServerToReplace), iHandler(aHandler) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
52 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
53 |
// Name the server after tid and this pointer, should be unique enough |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
54 |
iRealServerName.AppendNum(RThread().Id(), EHex); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
55 |
iRealServerName.Append('.'); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
56 |
iRealServerName.AppendNum((TInt)this, EHex); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
57 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
58 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
59 |
void CProxyServer::ThreadConstructL() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
60 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
61 |
User::LeaveIfError(iServerThread.Create(iRealServerName, &StartServerThreadFunction, 8192, NULL, this)); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
62 |
TRequestStatus stat; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
63 |
iServerThread.Rendezvous(stat); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
64 |
if (stat == KRequestPending) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
65 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
66 |
iServerThread.Resume(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
67 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
68 |
else |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
69 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
70 |
iServerThread.Kill(stat.Int()); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
71 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
72 |
User::WaitForRequest(stat); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
73 |
User::LeaveIfError(stat.Int()); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
74 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
75 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
76 |
void CProxyServer::ConstructL() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
77 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
78 |
iShutdownCallback = new(ELeave) CAsyncCallBack(CActive::EPriorityHigh); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
79 |
iShutdownCallback->Set(TCallBack(&Shutdown, this)); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
80 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
81 |
User::LeaveIfError(iMemAccess.Open()); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
82 |
if (iRealServerName.Length() > iServerName.Length()) User::Leave(KErrTooBig); // Mem access doesn't like this |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
83 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
84 |
_LIT(KTempName, "TemporaryReallyLongServerNameThatLeavesUsSpaceToManuever"); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
85 |
StartL(KTempName); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
86 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
87 |
TServerKernelInfoBuf buf; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
88 |
TInt err = iMemAccess.GetObjectInfo(EServer, iServerName, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
89 |
User::LeaveIfError(err); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
90 |
TUint8* realServer = buf().iAddressOfKernelObject; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
91 |
err = iMemAccess.GetObjectInfo(EServer, KTempName, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
92 |
User::LeaveIfError(err); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
93 |
TUint8* myServer = buf().iAddressOfKernelObject; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
94 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
95 |
// Should really have some kind of swap operation here... |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
96 |
TBuf8<KMaxName> name8; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
97 |
name8.Copy(iRealServerName); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
98 |
iMemAccess.InPlaceObjectRename(EServer, realServer, name8); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
99 |
name8.Copy(iServerName); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
100 |
iMemAccess.InPlaceObjectRename(EServer, myServer, name8); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
101 |
iProxying = ETrue; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
102 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
103 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
104 |
TInt CProxyServer::Shutdown(TAny* aSelf) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
105 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
106 |
CProxyServer* self = static_cast<CProxyServer*>(aSelf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
107 |
delete self; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
108 |
CActiveScheduler::Stop(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
109 |
return 0; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
110 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
111 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
112 |
void CProxyServer::Destroy() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
113 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
114 |
if (iShutdownCallback && iServerThread.Handle() && iServerThread.Id() != RThread().Id()) // Don't try shutting down the thread if the server is actually running in the main thread |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
115 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
116 |
TRequestStatus stat; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
117 |
// This is far harder than it should be... need to make sure we don't reference any member vars after calling the shutdown callback |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
118 |
RThread serverThread; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
119 |
Mem::Swap(&serverThread, &iServerThread, sizeof(RThread)); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
120 |
serverThread.Logon(stat); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
121 |
iShutdownCallback->CallBack(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
122 |
User::WaitForRequest(stat); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
123 |
serverThread.Close(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
124 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
125 |
else |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
126 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
127 |
delete this; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
128 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
129 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
130 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
131 |
CProxyServer::~CProxyServer() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
132 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
133 |
if (iProxying) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
134 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
135 |
TServerKernelInfoBuf buf; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
136 |
TInt err = iMemAccess.GetObjectInfo(EServer, iRealServerName, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
137 |
if (!err) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
138 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
139 |
TUint8* realServer = buf().iAddressOfKernelObject; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
140 |
TBuf8<KMaxName> name8; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
141 |
name8.Copy(iServerName); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
142 |
iMemAccess.InPlaceObjectRename(EServer, realServer, name8); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
143 |
// Temporarily both us and the real server will have name iServerName. When we finish destructing, we'll clean up and the system should be back in a sensible state |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
144 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
145 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
146 |
delete iShutdownCallback; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
147 |
iServerThread.Close(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
148 |
iMemAccess.Close(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
149 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
150 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
151 |
CSession2* CProxyServer::NewSessionL(const TVersion& aVersion, const RMessage2& /*aMessage*/) const |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
152 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
153 |
CProxySession* res = new(ELeave) CProxySession(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
154 |
CleanupStack::PushL(res); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
155 |
res->ConstructL(iRealServerName, aVersion); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
156 |
CleanupStack::Pop(res); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
157 |
return res; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
158 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
159 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
160 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
161 |
void CProxyServer::ServerThreadRunL() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
162 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
163 |
CActiveScheduler* scheduler = new(ELeave) CActiveScheduler; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
164 |
CleanupStack::PushL(scheduler); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
165 |
CActiveScheduler::Install(scheduler); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
166 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
167 |
ConstructL(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
168 |
RThread::Rendezvous(KErrNone); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
169 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
170 |
CActiveScheduler::Start(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
171 |
CleanupStack::PopAndDestroy(scheduler); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
172 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
173 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
174 |
TInt CProxyServer::StartServerThreadFunction(TAny* aSelf) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
175 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
176 |
TInt err = KErrNoMemory; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
177 |
CTrapCleanup* cleanup = CTrapCleanup::New(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
178 |
if (cleanup) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
179 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
180 |
TRAP(err, static_cast<CProxyServer*>(aSelf)->ServerThreadRunL()); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
181 |
delete cleanup; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
182 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
183 |
return err; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
184 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
185 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
186 |
MMessageHandler* CProxyServer::Handler() const |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
187 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
188 |
return iHandler; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
189 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
190 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
191 |
// |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
192 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
193 |
void CProxySession::ConstructL(const TDesC& aServerName, const TVersion& aVersion) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
194 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
195 |
User::LeaveIfError(iSession.CreateSession(aServerName, aVersion)); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
196 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
197 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
198 |
CProxyServer& CProxySession::Server() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
199 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
200 |
return *const_cast<CProxyServer*>(static_cast<const CProxyServer*>(CSession2::Server())); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
201 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
202 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
203 |
const CProxyServer& CProxySession::Server() const |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
204 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
205 |
return *static_cast<const CProxyServer*>(CSession2::Server()); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
206 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
207 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
208 |
void CProxySession::ServiceL(const RMessage2 &aMessage) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
209 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
210 |
MMessageHandler* handler = Server().Handler(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
211 |
TBool handled = EFalse; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
212 |
if (handler) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
213 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
214 |
handled = handler->HandleMessageL(this, aMessage); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
215 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
216 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
217 |
if (!handled) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
218 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
219 |
ForwardUnhandledMessageL(aMessage); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
220 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
221 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
222 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
223 |
TInt Val(const RMessage2& aMessage, TInt aIndex) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
224 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
225 |
switch (aIndex) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
226 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
227 |
case 0: |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
228 |
return aMessage.Int0(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
229 |
case 1: |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
230 |
return aMessage.Int1(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
231 |
case 2: |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
232 |
return aMessage.Int2(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
233 |
case 3: |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
234 |
return aMessage.Int3(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
235 |
default: |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
236 |
return 0; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
237 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
238 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
239 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
240 |
void CleanupArgs(TAny* aArgs) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
241 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
242 |
TIpcArgs& args = *static_cast<TIpcArgs*>(aArgs); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
243 |
for (TInt i = 0; i < KMaxMessageArguments; i++) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
244 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
245 |
if (args.iFlags & (TIpcArgs::EFlagDes<<(i*TIpcArgs::KBitsPerType))) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
246 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
247 |
LOG8("+++ deleting %x", args.iArgs[i]); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
248 |
delete (TAny*)args.iArgs[i]; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
249 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
250 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
251 |
args.iFlags = 0; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
252 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
253 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
254 |
void CProxySession::ForwardUnhandledMessageL(const RMessage2& aMessage) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
255 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
256 |
TIpcArgs args; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
257 |
CleanupStack::PushL(TCleanupItem(&CleanupArgs, &args)); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
258 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
259 |
LOG(_L("Forwarding message fn=%d"), aMessage.Function()); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
260 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
261 |
for (TInt i = 0; i < KMaxMessageArguments; i++) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
262 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
263 |
// For each arg, try and figure out if it's a descriptor and if so what type |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
264 |
TInt len = aMessage.GetDesLength(i); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
265 |
if (len < 0) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
266 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
267 |
// Not a descriptor |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
268 |
args.Set(i, Val(aMessage, i)); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
269 |
LOG(_L("Int arg %d: %d"), i, args.iArgs[i]); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
270 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
271 |
else |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
272 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
273 |
// It's a descriptor, now see if it's 16-bit or 8-bit |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
274 |
TBuf<1> wbuf; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
275 |
TInt err = aMessage.Read(i, wbuf); // This check only works if platsec enforcement is turned on (!) but fshell.bat was the only thing that generally ran with enforcement off, and I've fixed that |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
276 |
if (err == KErrNone) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
277 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
278 |
// 16-bit |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
279 |
// Gaah where's HBuf when you need it |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
280 |
TPtr* buf = (TPtr*)User::AllocL(len*2 + sizeof(TPtr)); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
281 |
new(buf) TPtr((TUint16*)(buf+1), len); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
282 |
aMessage.ReadL(i, *buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
283 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
284 |
// Figure out if it's writeable by trying to write back what we just read |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
285 |
TBool writeable = (aMessage.Write(i, *buf) == KErrNone); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
286 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
287 |
if (writeable) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
288 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
289 |
LOG(_L("TDes16 arg %d: %S"), i, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
290 |
args.Set(i, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
291 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
292 |
else |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
293 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
294 |
LOG(_L("TDesC16 arg %d: %S"), i, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
295 |
args.Set(i, (const TDesC16*)buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
296 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
297 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
298 |
else |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
299 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
300 |
// 8-bit |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
301 |
// Gaah where's HBuf when you need it |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
302 |
TPtr8* buf = (TPtr8*)User::AllocL(len + sizeof(TPtr8)); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
303 |
new(buf) TPtr8((TUint8*)(buf+1), len); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
304 |
aMessage.ReadL(i, *buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
305 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
306 |
// Figure out if it's writeable by trying to write back what we just read |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
307 |
TBool writeable = (aMessage.Write(i, *buf) == KErrNone); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
308 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
309 |
if (writeable) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
310 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
311 |
LOG8("TDes8 arg %d: %S", i, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
312 |
args.Set(i, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
313 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
314 |
else |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
315 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
316 |
LOG8("TDesC8 arg %d: %S", i, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
317 |
args.Set(i, (const TDesC8*)buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
318 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
319 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
320 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
321 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
322 |
ForwardMessageArgsL(aMessage, args); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
323 |
CleanupStack::Pop(&args); // ForwardMessageArgs takes ownership |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
324 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
325 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
326 |
void CProxySession::ForwardMessageArgsL(const RMessage2& aMessage, const TIpcArgs& aArgs) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
327 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
328 |
CAsyncWaiter* waiter = new(ELeave) CAsyncWaiter(iSession, aMessage, aArgs); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
329 |
// That's all that's needed |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
330 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
331 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
332 |
void CProxySession::Disconnect(const RMessage2 &aMessage) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
333 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
334 |
iSession.Close(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
335 |
//TODO Need to wait for any CAsyncWaiters to be completed? If so, do it here and defer the super call until that time |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
336 |
CSession2::Disconnect(aMessage); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
337 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
338 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
339 |
// CAsyncWaiter |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
340 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
341 |
CAsyncWaiter::CAsyncWaiter(RUnderlyingSession& aRealSession, const RMessage2& aOriginalMessage, const TIpcArgs& aArgs) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
342 |
: CActive(CActive::EPriorityStandard), iRealSession(aRealSession), iMsg(aOriginalMessage), iArgs(aArgs) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
343 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
344 |
CActiveScheduler::Add(this); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
345 |
LOG(_L("Sending to real server: fn=%d, args=%x,%x,%x,%x flags=%x"), aOriginalMessage.Function(), iArgs.iArgs[0], iArgs.iArgs[1], iArgs.iArgs[2], iArgs.iArgs[3], iArgs.iFlags); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
346 |
iRealSession.SendReceive(aOriginalMessage.Function(), iArgs, iStatus); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
347 |
SetActive(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
348 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
349 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
350 |
CAsyncWaiter::~CAsyncWaiter() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
351 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
352 |
CleanupArgs(&iArgs); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
353 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
354 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
355 |
void CAsyncWaiter::RunL() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
356 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
357 |
const TInt serverErr = iStatus.Int(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
358 |
TInt writeErr = KErrNone; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
359 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
360 |
// First check for any TDes args that we need to write back to the real client |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
361 |
for (TInt i = 0; i < KMaxMessageArguments; i++) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
362 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
363 |
if ((iArgs.iFlags & (TIpcArgs::EFlagDes<<(i*TIpcArgs::KBitsPerType))) && !(iArgs.iFlags & (TIpcArgs::EFlagConst<<(i*TIpcArgs::KBitsPerType)))) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
364 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
365 |
if (iArgs.iFlags & (TIpcArgs::EFlag16Bit<<(i*TIpcArgs::KBitsPerType))) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
366 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
367 |
TDes16* des = (TDes16*)iArgs.iArgs[i]; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
368 |
writeErr = iMsg.Write(i, *des); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
369 |
LOG(_L("Writing back %S returned %d"), des, writeErr); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
370 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
371 |
else |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
372 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
373 |
TDes8* des = (TDes8*)iArgs.iArgs[i]; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
374 |
writeErr = iMsg.Write(i, *des); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
375 |
LOG8("Writing back %S returned %d", des, writeErr); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
376 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
377 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
378 |
if (writeErr) break; // Who knows how the real server would have handled such a case |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
379 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
380 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
381 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
382 |
LOG(_L("Completing original request function %d with writeErr=%d serverErr=%d"), iMsg.Function(), writeErr, serverErr); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
383 |
if (writeErr) iMsg.Complete(writeErr); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
384 |
else iMsg.Complete(serverErr); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
385 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
386 |
delete this; // Our work here is done |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
387 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
388 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
389 |
void CAsyncWaiter::DoCancel() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
390 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
391 |
// We never call Cancel on our waiters |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
392 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
393 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
394 |
/* |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
395 |
EXPORT_C TInt ShutdownProxyNotifier() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
396 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
397 |
RDebugNotifier notifier; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
398 |
TInt err = notifier.Connect(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
399 |
if (err == KErrNotFound) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
400 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
401 |
// Oh dear, !Notifier isn't running. Meaning we renamed it then crashed, probably. Try renaming the real one |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
402 |
RMemoryAccess::LoadDriver(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
403 |
RMemoryAccess mem; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
404 |
err = mem.Open(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
405 |
if (err) return err; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
406 |
TServerKernelInfoBuf buf; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
407 |
TInt err = mem.GetObjectInfo(EServer, KRealNotifierServerName, buf); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
408 |
if (!err) |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
409 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
410 |
TUint8* realServer = buf().iAddressOfKernelObject; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
411 |
mem.InPlaceObjectRename(EServer, realServer, _L8("!Notifier")); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
412 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
413 |
mem.Close(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
414 |
return err; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
415 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
416 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
417 |
err = notifier.ShutdownProxy(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
418 |
if (err == KErrServerTerminated) err = KErrNone; // It's expected to get KErrServerTerminated, because we deliberately don't complete the message. This way the client is more likely to get the completion once the server has actually gone, and not slightly before |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
419 |
notifier.Close(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
420 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
421 |
return err; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
422 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
423 |
|
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
424 |
EXPORT_C TBool NotifierProxyIsRunning() |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
425 |
{ |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
426 |
RDebugNotifier notifier; |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
427 |
TInt err = notifier.Connect(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
428 |
if (err) return EFalse; // Not even original notifier is running?! |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
429 |
err = notifier.PingProxy(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
430 |
notifier.Close(); |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
431 |
return err == KErrNone; // The real proxy will return KErrNotSupported in this scenario |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
432 |
} |
9c58252c6740
Added fshell testexecute wrapper command. Fixed some uids.
Tom Sutcliffe <thomas.sutcliffe@accenture.com>
parents:
diff
changeset
|
433 |
*/ |