sl@0
|
1 |
// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// EPOC Server providing access to Win32 stdin/stdout/stderr
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32std.h>
|
sl@0
|
19 |
#include <e32base.h>
|
sl@0
|
20 |
#include <estw32.h>
|
sl@0
|
21 |
/**
|
sl@0
|
22 |
@internalComponent
|
sl@0
|
23 |
*/
|
sl@0
|
24 |
enum TWin32Stream {
|
sl@0
|
25 |
EWin32Read,
|
sl@0
|
26 |
EWin32Write,
|
sl@0
|
27 |
EWin32Flush
|
sl@0
|
28 |
};
|
sl@0
|
29 |
|
sl@0
|
30 |
//
|
sl@0
|
31 |
class CWin32Stream
|
sl@0
|
32 |
/**
|
sl@0
|
33 |
@internalComponent
|
sl@0
|
34 |
*/
|
sl@0
|
35 |
{
|
sl@0
|
36 |
public:
|
sl@0
|
37 |
static TInt StreamName(TInt aStream, TDes& aBuf);
|
sl@0
|
38 |
static void StartServer(TInt aStream);
|
sl@0
|
39 |
static TInt ThreadFunction(TAny* aPtr);
|
sl@0
|
40 |
private:
|
sl@0
|
41 |
TInt Init(TInt aStream, const TDesC& aStreamName);
|
sl@0
|
42 |
void HandleMessage();
|
sl@0
|
43 |
TInt ReadStream(RMessage2& aMessage);
|
sl@0
|
44 |
TInt WriteStream(RMessage2& aMessage);
|
sl@0
|
45 |
void FlushStream();
|
sl@0
|
46 |
TInt MapWin32Error(TInt aDefault);
|
sl@0
|
47 |
|
sl@0
|
48 |
RServer2 iServer;
|
sl@0
|
49 |
RMessage2 iMessage;
|
sl@0
|
50 |
TAny* iHandle;
|
sl@0
|
51 |
TAny* iLogHandle; // used to log a copy of stream output, for debug purposes
|
sl@0
|
52 |
};
|
sl@0
|
53 |
|
sl@0
|
54 |
//
|