MOOS 0.2375
/home/toby/moos-ivp/MOOS-2375-Oct0611/Essentials/pAntler/XPCProcessAttrib.h
Go to the documentation of this file.
00001 
00002 //
00003 //   MOOS - Mission Oriented Operating Suite 
00004 //  
00005 //   A suit of Applications and Libraries for Mobile Robotics Research 
00006 //   Copyright (C) 2001-2005 Massachusetts Institute of Technology and 
00007 //   Oxford University. 
00008 //    
00009 //   This software was written by Paul Newman at MIT 2001-2002 and Oxford 
00010 //   University 2003-2005. email: pnewman@robots.ox.ac.uk. 
00011 //      
00012 //   This file is part of a  MOOS CORE Component. 
00013 //        
00014 //   This program is free software; you can redistribute it and/or 
00015 //   modify it under the terms of the GNU General Public License as 
00016 //   published by the Free Software Foundation; either version 2 of the 
00017 //   License, or (at your option) any later version. 
00018 //          
00019 //   This program is distributed in the hope that it will be useful, 
00020 //   but WITHOUT ANY WARRANTY; without even the implied warranty of 
00021 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 
00022 //   General Public License for more details. 
00023 //            
00024 //   You should have received a copy of the GNU General Public License 
00025 //   along with this program; if not, write to the Free Software 
00026 //   Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 
00027 //   02111-1307, USA. 
00028 //
00029 //   The XPC classes in MOOS are modified versions of the source provided 
00030 //   in "Making UNIX and Windows NT Talk" by Mark Nadelson and Thomas Haga 
00031 //
00033 
00034 #if !defined(XPCPROCESSATTRIB_H_)
00035 #define XPCPROCESSATTRIB_H_
00036 
00037 #if _MSC_VER >= 1000
00038 #pragma once
00039 #endif // _MSC_VER >= 1000
00040 #include <windows.h>
00041 #include "XPCException.h"
00042 
00043 class XPCProcessAttrib  
00044 {
00045     friend class XPCProcess;
00046 
00047 public:
00048     XPCProcessAttrib(LPTSTR appName= NULL,
00049                     LPSTR commandLine= NULL,
00050                     BOOL processInheritable= FALSE,
00051                     BOOL threadInheritable= FALSE,
00052                     BOOL inheritHandles= FALSE,
00053                     DWORD creationFlags= 0,
00054                     LPVOID environment= NULL,
00055                     LPTSTR currentDirectory= NULL);
00056 
00057     virtual ~XPCProcessAttrib();
00058 
00059     void AddEnvironmentVariable (LPCTSTR param, LPCTSTR val);
00060 
00061     LPVOID GetEnvironmentBlock()
00062     {return pEnvironment;}
00063 
00064     void vSetProcessInheritable (BOOL bInherit) 
00065     {pProcessSA->bInheritHandle= bInherit;}
00066 
00067     void vSetThreadInheritable (BOOL bInherit)
00068     {pThreadSA->bInheritHandle= bInherit;}
00069 
00070     void vSetInheritHandles (BOOL bInherit)
00071     {bInheritHandles= bInherit;}
00072 
00073     void vSetCreationFlag (DWORD dwBitmap)
00074     {dwCreationFlags |= dwBitmap;}
00075 
00076     void vSetEnvironment (LPVOID pEnv);
00077     void vSetCommandLine (LPTSTR pCmd);
00078     void vSetApplicationName (LPTSTR pApp);
00079     void vSetCurrentDirectory (LPTSTR pDir);
00080 
00081     void vSetStartupInfo (LPSTARTUPINFO pStrt)
00082     {memmove (pSI, pStrt, sizeof (STARTUPINFO));}
00083 
00084     void vGetProcessInformation (LPPROCESS_INFORMATION pPI)
00085     {memmove (pPI, pProcessInfo, sizeof (PROCESS_INFORMATION));}
00086 
00087     LPPROCESS_INFORMATION pGetProcessInformation()
00088     {return pProcessInfo;}
00089     
00090 private:
00091     DWORD dwEnvSize;
00092     LPTSTR pCurrentDirectory;
00093     LPVOID pEnvironment;
00094     DWORD dwCreationFlags;
00095     BOOL bInheritHandles;
00096     LPTSTR pCommandLine;
00097     LPTSTR pApplicationName;
00098     LPPROCESS_INFORMATION pProcessInfo;
00099     LPSECURITY_ATTRIBUTES pThreadSA;
00100     LPSECURITY_ATTRIBUTES pProcessSA;
00101     LPSTARTUPINFO pSI;
00102 
00103     char * ErrorString(char * sLeader);
00104 };
00105 
00106 #endif // !defined(XPCPROCESSATTRIB_H_)
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines