blob: 6fd34e9c2cacdb1844573bdc58e98d0cd80ae433 [file] [log] [blame]
Constantin Kaplinsky47ed8d32004-10-08 09:43:57 +00001/* Copyright (C) 2002-2003 RealVNC Ltd. All Rights Reserved.
2 *
3 * This is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 * This software is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this software; if not, write to the Free Software
15 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16 * USA.
17 */
18
19// -=- LaunchProcess.h
20
21// Helper class to launch a names process from the same directory as
22// the current process executable resides in.
23
24#ifndef __RFB_WIN32_LAUNCHPROCESS_H__
25#define __RFB_WIN32_LAUNCHPROCESS_H__
26
27#define WIN32_LEAN_AND_MEAN
28#include <windows.h>
29
30#include <rfb_win32/TCharArray.h>
31
32namespace rfb {
33
34 namespace win32 {
35
36 class LaunchProcess {
37 public:
38 LaunchProcess(const TCHAR* exeName_, const TCHAR* params);
39 ~LaunchProcess();
40
41 // If userToken is 0 then starts as current user, otherwise
42 // starts as the specified user. userToken must be a primary token.
43 void start(HANDLE userToken);
44
45 // Wait for the process to quit, and close the handles to it.
46 void await();
47
48 PROCESS_INFORMATION procInfo;
49 protected:
50 TCharArray exeName;
51 TCharArray params;
52 };
53
54
55 };
56
57};
58
59#endif