-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMyIPC.cpp
762 lines (733 loc) · 28.2 KB
/
MyIPC.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
// $Id: MyIPC.cpp 700 2012-02-22 11:56:52Z felfert $
//
// Copyright (C) 2006 The OpenNX Team
// Author: Fritz Elfert
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU Library General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU Library General Public
// License along with this program; if not, write to the
// Free Software Foundation, Inc.,
// 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma implementation "MyIPC.h"
#endif
// For compilers that support precompilation, includes "wx/wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#ifndef WX_PRECOMP
#include "wx/wx.h"
#endif
#include <wx/process.h>
#include <wx/txtstrm.h>
#include <wx/filename.h>
#include <wx/regex.h>
#include "MyIPC.h"
#include "AsyncProcess.h"
#include "trace.h"
ENABLE_TRACE;
DEFINE_LOCAL_EVENT_TYPE(wxEVT_NXSSH);
DEFINE_LOCAL_EVENT_TYPE(wxEVT_NXSERVICE);
DEFINE_LOCAL_EVENT_TYPE(wxEVT_GENERIC);
IMPLEMENT_CLASS(MyIPC, wxEvtHandler);
BEGIN_EVENT_TABLE(MyIPC, wxEvtHandler)
EVT_COMMAND(wxID_ANY, wxEVT_PROCESS_STDOUT, MyIPC::OnOutReceived )
EVT_COMMAND(wxID_ANY, wxEVT_PROCESS_STDERR, MyIPC::OnErrReceived )
EVT_COMMAND(wxID_ANY, wxEVT_PROCESS_EXIT, MyIPC::OnTerminate )
END_EVENT_TABLE();
MyIPC::MyIPC()
: m_pProcess(NULL)
, m_pEvtHandler(NULL)
, m_cEvhMutex()
, m_eType(TypeNone)
, m_iOutCollect(0)
, m_iErrCollect(0)
, m_nLines618(0)
, m_sOutMessage(wxEmptyString)
, m_sErrMessage(wxEmptyString)
{
#ifdef __WXMSW__
m_MsgSession = ::RegisterWindowMessage(wxT("NX_SESSION_MESSAGE"));
m_MsgKill = ::RegisterWindowMessage(wxT("NxKill"));
#endif
m_re = new wxRegEx();
m_re->Compile(wxT("\\(yes/no\\)\\?"), wxRE_ADVANCED|wxRE_ICASE);
}
MyIPC::~MyIPC()
{
myLogTrace(MYTRACETAG, wxT("~MyIPC() called"));
Detach();
delete m_re;
}
void
MyIPC::Detach()
{
myLogTrace(MYTRACETAG, wxT("Detach() called"));
m_cEvhMutex.Lock();
m_pEvtHandler = NULL;
m_cEvhMutex.Unlock();
if (m_pProcess) {
if (m_pProcess->IsRunning())
m_pProcess->Detach();
else
delete m_pProcess;
m_pProcess = NULL;
}
}
void
MyIPC::sendUpEvent(wxCommandEvent &event)
{
wxMutexLocker lock(m_cEvhMutex);
if (lock.IsOk() && (NULL != m_pEvtHandler)) {
m_pEvtHandler->AddPendingEvent(event);
}
}
bool
MyIPC::IsRunning()
{
return (m_pProcess && m_pProcess->IsRunning());
}
int MyIPC::GetResult()
{
return m_pProcess ? m_pProcess->GetStatus() : -1;
}
bool
MyIPC::Kill()
{
bool ret (m_pProcess && m_pProcess->Kill());
m_pProcess = NULL;
return ret;
}
void
MyIPC::Print(const wxString &s, bool doLog /* = true */ )
{
if (m_pProcess)
m_pProcess->Print(s, doLog);
}
bool
MyIPC::GenericProcess(const wxString &cmd, const wxString &dir, wxEvtHandler *h)
{
m_eType = TypeNone;
bool ret = false;
m_iOutCollect = 0;
m_iErrCollect = 0;
m_sOutMessage.Empty();
m_sErrMessage.Empty();
m_pEvtHandler = h;
m_pProcess = new AsyncProcess(cmd, dir, this);
ret = m_pProcess->Start();
if (!ret) {
delete m_pProcess;
m_pProcess = NULL;
}
return ret;
}
bool
MyIPC::SshProcess(const wxString &cmd, const wxString &dir, wxEvtHandler *h)
{
m_eType = TypeSsh;
bool ret = false;
m_iOutCollect = 0;
m_iErrCollect = 0;
m_sOutMessage.Empty();
m_sErrMessage.Empty();
m_pEvtHandler = h;
m_pProcess = new AsyncProcess(cmd, dir, wxT("NX> 105 "), this);
ret = m_pProcess->Start();
if (!ret) {
delete m_pProcess;
m_pProcess = NULL;
}
return ret;
}
int
MyIPC::parseCode(const wxString &buf)
{
int ret = -1;
long n;
if (buf.Find(wxT("NX> ")) == 0) {
int idx = 0;
while (buf.Mid(4+idx, 1).IsNumber()) {
if (ret == -1)
ret = 0;
buf.Mid(4+idx, 1).ToLong(&n);
ret *= 10;
ret += n;
idx++;
}
}
return ret;
}
void
MyIPC::OnTerminate(wxCommandEvent &event)
{
switch (m_eType) {
case TypeNone:
myLogTrace(MYTRACETAG, wxT("process terminated"));
if (m_pEvtHandler) {
wxCommandEvent upevent(wxEVT_GENERIC, wxID_ANY);
upevent.SetInt(ActionTerminated);
sendUpEvent(upevent);
}
break;
case TypeSsh:
myLogTrace(MYTRACETAG, wxT("nxssh terminated"));
if (m_pEvtHandler) {
wxCommandEvent upevent(wxEVT_NXSSH, wxID_ANY);
upevent.SetInt(ActionTerminated);
sendUpEvent(upevent);
}
break;
}
event.Skip();
}
void
MyIPC::OnOutReceived(wxCommandEvent &event)
{
wxString msg;
int code;
switch (m_eType) {
case TypeNone:
myLogTrace(MYTRACETAG, wxT("process O: '%s'"), VMB(msg));
if (m_pEvtHandler) {
wxCommandEvent upevent(wxEVT_GENERIC, wxID_ANY);
upevent.SetInt(ActionStdout);
upevent.SetString(event.GetString());
sendUpEvent(upevent);
}
break;
case TypeSsh:
msg = event.GetString();
// Normalize "FREENX>" -> "NX>"
if (msg.StartsWith(wxT("FREENX>")))
msg = msg.Mid(4);
code = parseCode(msg);
myLogTrace(MYTRACETAG, wxT("nxssh O[%04d]: '%s'"), code, VMB(msg));
if (m_pEvtHandler) {
wxCommandEvent upevent(wxEVT_NXSSH, wxID_ANY);
upevent.SetInt(ActionLog);
upevent.SetString(msg);
sendUpEvent(upevent);
switch (code) {
case -1:
// No code found
if (m_iOutCollect) {
m_iOutCollect--;
m_sOutMessage << wxT("\n") << msg;
if (m_iOutCollect == 0) {
m_re->Replace(&m_sOutMessage, wxEmptyString);
upevent.SetString(m_sOutMessage + wxT("?"));
upevent.SetInt(ActionPromptYesNo);
sendUpEvent(upevent);
}
break;
}
if (msg.StartsWith(wxT("HELLO NXSERVER - Version "))) {
upevent.SetString(msg.Mid(25).BeforeFirst(wxT(' ')).Strip(wxString::both));
upevent.SetInt(ActionHello);
sendUpEvent(upevent);
break;
}
if (msg.StartsWith(wxT("Warning: the RSA host key"))) {
m_sOutMessage = msg;
m_iOutCollect = 4;
break;
}
if (msg.StartsWith(wxT("Enter PIN for"))) {
// Generated by scard-opensc
upevent.SetInt(ActionPinDialog);
sendUpEvent(upevent);
}
break;
case 100:
// Server version & licence
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionStatus);
sendUpEvent(upevent);
break;
case 101:
// request username
upevent.SetInt(ActionSendUsername);
sendUpEvent(upevent);
break;
case 102:
// request password
upevent.SetInt(ActionSendPassword);
sendUpEvent(upevent);
break;
case 103:
// Welcome message
upevent.SetInt(ActionWelcome);
sendUpEvent(upevent);
break;
case 104:
// NX4 resource list
upevent.SetInt(ActionResList);
sendUpEvent(upevent);
break;
case 105:
// request for next command
upevent.SetInt(ActionNextCommand);
sendUpEvent(upevent);
break;
case 106:
// Result: server parameters
case 110:
// Result: server status (running|stopped)
case 113:
// Announce: changing password
case 114:
// Announce: password changed
case 122:
// Result: service started
case 123:
// Result: service stopped
break;
case 127:
// Result: session list
upevent.SetInt(ActionSessionListStart);
sendUpEvent(upevent);
break;
case 134:
// NX> 134 Accepted protocol: <version>
break;
case 140:
// Set length for push session config
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionSessionPushLength);
sendUpEvent(upevent);
break;
case 141:
// Push session config
upevent.SetInt(ActionSessionPushStart);
sendUpEvent(upevent);
break;
case 146:
// Result: user list
break;
case 147:
// Result: server capacity reached
case 148:
// Result: server capacity not reached
upevent.SetInt(ActionSessionListEnd);
upevent.SetExtraLong(code);
sendUpEvent(upevent);
break;
// Codes 200 - 299 are from local nxssh
case 200:
// Connected to adress ...
break;
#ifdef OBSOLETE_CODE
// Apparently gone
case 201:
ret = wxT("NX Server not installed or the server access has been disabled");
return ActionError;
#endif
case 202:
// Authenticating user ...
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionStatus);
sendUpEvent(upevent);
break;
case 203:
// NXSSH started with pid: ...
msg = msg.AfterFirst(wxT(':')).Strip(wxString::both);
if (msg.IsNumber()) {
long n;
msg.ToLong(&n);
m_iSshPid = n;
}
break;
case 204:
// Authentication failed
upevent.SetString(_("Authentication failed"));
upevent.SetInt(ActionError);
sendUpEvent(upevent);
break;
case 205:
// ?? generic
m_iOutCollect = 2;
m_sOutMessage = msg.Mid(8);
break;
case 208:
// Using auth method: ...
break;
case 209:
// Remote host authentication has changed
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionWarning);
sendUpEvent(upevent);
break;
case 210:
// Enter passphrase for key ...
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionPassphraseDialog);
sendUpEvent(upevent);
break;
case 211:
// The authenticity of host ... can't be verified ... (multiline message)
m_iOutCollect = 2;
m_sOutMessage = msg.Mid(8);
break;
case 250:
// NX4 request username or password
if (msg.Find(wxT("login required")) != wxNOT_FOUND) {
upevent.SetInt(ActionSendUsername);
sendUpEvent(upevent);
}
if (msg.Find(wxT("password required")) != wxNOT_FOUND) {
upevent.SetInt(ActionSendPassword);
sendUpEvent(upevent);
}
break;
case 280:
case 282:
case 285:
case 286:
break;
case 287:
// Successfully redirected ports
upevent.SetInt(ActionSessionRunning);
sendUpEvent(upevent);
break;
case 288:
case 289:
// Debug messages ?
case 290:
case 291:
case 292:
case 294:
case 295:
case 296:
case 297:
case 298:
case 299:
// Subchannel system ?
break;
#ifdef OBSOLETE_CODE
// Apparently gone
case 300:
case 301:
ret = wxT("Connection error");
return -99;
case 302:
case 303:
ret = wxT("Connection refused");
return -99;
case 304:
case 305:
ret = wxT("Host not found");
return -99;
case 306:
ret = wxT("Network unreachable");
return -99;
case 307:
case 310:
ret = wxT("Host key verification failed");
return -99;
#endif
case 404:
// Error: wrong password or login
case 500:
// Generic error
upevent.SetString(m_s595msg + msg.Mid(8));
m_s595msg.Empty();
upevent.SetInt(ActionError);
sendUpEvent(upevent);
break;
case 595:
// Fatal server error (usually multiline and
// followed by a 500
m_s595msg << msg.Mid(15) << wxT("\n");
break;
case 503:
// Unknown command
case 504:
// Session startup failed
case 536:
// User limit exceeded
case 537:
// Passwords did not match
case 542:
// Max # of guest sessions reached
case 596:
// No running session, resp. Session startup failed
case 598:
// Unrecoverable exception
case 599:
// Reached the maximum number of concurrent sessions on this server.
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionError);
sendUpEvent(upevent);
break;
case 618:
// Evaluation license expired (commercial NoMachine server) - 3 lines
if (3 > ++m_nLines618) {
m_s618msg.Append(msg.Mid(8)).Append(wxT("\n"));
} else {
m_nLines618 = 0;
m_s618msg.Append(msg.Mid(8));
upevent.SetString(m_s618msg);
upevent.SetInt(ActionError);
sendUpEvent(upevent);
}
break;
case 700:
// Session ID
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetSessionID);
sendUpEvent(upevent);
break;
case 701:
// Session proxy cookie
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetProxyCookie);
sendUpEvent(upevent);
break;
case 702:
// Session proxy IP
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetProxyIP);
sendUpEvent(upevent);
break;
case 703:
// Session type
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetSessionType);
sendUpEvent(upevent);
break;
case 704:
// Session cache
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetSessionCache);
sendUpEvent(upevent);
break;
case 705:
// Session display
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetSessionDisplay);
sendUpEvent(upevent);
break;
case 706:
// Session agent cookie
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetAgentCookie);
sendUpEvent(upevent);
break;
case 707:
// Session ssl tunneling
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetSslTunneling);
sendUpEvent(upevent);
break;
case 708:
// Subscription
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetSubscription);
sendUpEvent(upevent);
break;
case 709:
// SMB Port
upevent.SetString(msg.AfterFirst(wxT(':')).Strip(wxString::both));
upevent.SetInt(ActionSetSmbPort);
sendUpEvent(upevent);
break;
case 710:
// session running
upevent.SetInt(ActionStartProxy);
sendUpEvent(upevent);
break;
case 716:
// terminationg session on user request
case 718:
// session restore successful
break;
case 719:
// SMB filesystem: running
/* Workaround for newer nxnodes (since 3.2.0?):
* On those, the message "NX> 709 Filesharing Port: nnn" is missing.
* Therefore, we now use message 719 and hardcode the port
* to SMBFS (139) if running on Windows and CIFS (445) otherwise.
*/
#ifdef __WXMSW__
upevent.SetString(wxT("139"));
#else
upevent.SetString(wxT("445"));
#endif
upevent.SetInt(ActionSetSmbPort);
sendUpEvent(upevent);
break;
case 720:
// CUPS printer: running
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionStatus);
sendUpEvent(upevent);
break;
case 725:
// Shadow: Geometry 1024x768x24
upevent.SetString(msg.Mid(25).Strip(wxString::both));
upevent.SetInt(ActionSetShadowGeometry);
sendUpEvent(upevent);
break;
case 726:
// Asking user for authorization to attach to session
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionStatus);
sendUpEvent(upevent);
break;
case 728:
// Session caption: NX - felfert@nx3-test.id-testlab.str.topalis:1008 - nx3-test
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionStatus);
sendUpEvent(upevent);
break;
case 900:
// Terminating session
case 1000:
// nxnode version
case 1001:
// Bye
case 1002:
// Commit
break;
case 1004:
// Session status: failed
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionError);
sendUpEvent(upevent);
break;
case 1005:
// Session status: suspended
case 1006:
// Session status: running|closed
case 1009:
// Session status: terminating
break;
case 999:
// Terminating
upevent.SetInt(ActionExit);
sendUpEvent(upevent);
break;
}
}
break;
}
event.Skip();
}
void
MyIPC::OnErrReceived(wxCommandEvent &event)
{
wxString msg = event.GetString();
int code;
switch (m_eType) {
case TypeNone:
myLogTrace(MYTRACETAG, wxT("process E: '%s'"), VMB(msg));
if (m_pEvtHandler) {
wxCommandEvent upevent(wxEVT_GENERIC, wxID_ANY);
upevent.SetInt(ActionStderr);
upevent.SetString(event.GetString());
sendUpEvent(upevent);
}
break;
case TypeSsh:
code = parseCode(msg);
myLogTrace(MYTRACETAG, wxT("nxssh E[%04d]: '%s'"), code, VMB(msg));
if (m_pEvtHandler) {
wxCommandEvent upevent(wxEVT_NXSSH, wxID_ANY);
upevent.SetInt(ActionLog);
upevent.SetString(event.GetString());
sendUpEvent(upevent);
switch (code) {
case -1:
// No code found
if (m_iErrCollect) {
m_iErrCollect--;
m_sErrMessage << wxT("\n") << msg;
if (m_iErrCollect == 0) {
upevent.SetString(m_sErrMessage);
upevent.SetInt(ActionError);
sendUpEvent(upevent);
}
break;
}
if (msg.StartsWith(wxT("Offending key in "))) {
upevent.SetString(msg.Mid(17));
upevent.SetInt(ActionOffendingKey);
sendUpEvent(upevent);
break;
}
if (msg.Contains(wxT("WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!"))) {
m_sErrMessage = msg.AfterFirst(wxT('@')).BeforeLast(wxT('@')).Strip(wxString::both);
m_iErrCollect = 99;
break;
}
if (msg.Contains(wxT("usage:"))) {
m_sErrMessage = msg;
m_iErrCollect = 6;
break;
}
if (msg.Contains(wxT("Connection refused")) ||
msg.Contains(wxT("onnection closed")) ||
msg.Contains(wxT("no address associated")) ||
msg.Contains(wxT("failed with error")) ||
msg.Contains(wxT("Smartcard init failed")) ||
msg.Contains(wxT("PIN code verification failed")) ||
msg.Contains(wxT("No certificates found on smartcard")) ||
msg.Contains(wxT("proxy error:"))
) {
upevent.SetString(msg);
upevent.SetInt(ActionError);
sendUpEvent(upevent);
break;
}
if (msg.Contains(wxT("Warning:"))) {
upevent.SetString(msg.Mid(8));
upevent.SetInt(ActionWarning);
sendUpEvent(upevent);
break;
}
break;
case 209:
// Remote host identification changed
m_iErrCollect = 0;
m_sErrMessage.Replace(wxT("@"), wxEmptyString);
m_sErrMessage.Remove(m_sErrMessage.Find(wxT("Please contact")));
upevent.SetString(m_sErrMessage);
upevent.SetInt(ActionKeyChangedYesNo);
sendUpEvent(upevent);
break;
case 287:
// Successfully redirected ports
upevent.SetInt(ActionSessionRunning);
sendUpEvent(upevent);
break;
case 999:
upevent.SetInt(ActionExit);
sendUpEvent(upevent);
break;
}
}
}
event.Skip();
}
long MyIPC::GetPID()
{
if (m_pProcess && (m_pProcess->IsRunning()))
return m_pProcess->GetPid();
return 0;
}
// vim:cindent:expandtab:shiftwidth=4