1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir 29*cdf0e10cSrcweir #ifndef _OSL_PROCESS_H_ 30*cdf0e10cSrcweir #define _OSL_PROCESS_H_ 31*cdf0e10cSrcweir 32*cdf0e10cSrcweir #include <rtl/ustring.h> 33*cdf0e10cSrcweir #include <rtl/textenc.h> 34*cdf0e10cSrcweir #include <rtl/locale.h> 35*cdf0e10cSrcweir 36*cdf0e10cSrcweir #include <osl/time.h> 37*cdf0e10cSrcweir #include <osl/file.h> 38*cdf0e10cSrcweir #include <osl/pipe.h> 39*cdf0e10cSrcweir #include <osl/socket.h> 40*cdf0e10cSrcweir #include <osl/security.h> 41*cdf0e10cSrcweir 42*cdf0e10cSrcweir #ifdef __cplusplus 43*cdf0e10cSrcweir extern "C" { 44*cdf0e10cSrcweir #endif 45*cdf0e10cSrcweir 46*cdf0e10cSrcweir 47*cdf0e10cSrcweir typedef sal_Int32 oslProcessOption; 48*cdf0e10cSrcweir #define osl_Process_WAIT 0x0001 /* wait for completion */ 49*cdf0e10cSrcweir #define osl_Process_SEARCHPATH 0x0002 /* search path for executable */ 50*cdf0e10cSrcweir #define osl_Process_DETACHED 0x0004 /* run detached */ 51*cdf0e10cSrcweir #define osl_Process_NORMAL 0x0000 /* run in normal window */ 52*cdf0e10cSrcweir #define osl_Process_HIDDEN 0x0010 /* run hidden */ 53*cdf0e10cSrcweir #define osl_Process_MINIMIZED 0x0020 /* run in minimized window */ 54*cdf0e10cSrcweir #define osl_Process_MAXIMIZED 0x0040 /* run in maximized window */ 55*cdf0e10cSrcweir #define osl_Process_FULLSCREEN 0x0080 /* run in fullscreen window */ 56*cdf0e10cSrcweir 57*cdf0e10cSrcweir typedef sal_Int32 oslProcessData; 58*cdf0e10cSrcweir 59*cdf0e10cSrcweir /* defines for osl_getProcessInfo , can be OR'ed */ 60*cdf0e10cSrcweir #define osl_Process_IDENTIFIER 0x0001 /* retrieves the process identifier */ 61*cdf0e10cSrcweir #define osl_Process_EXITCODE 0x0002 /* retrieves exit code of the process */ 62*cdf0e10cSrcweir #define osl_Process_CPUTIMES 0x0004 /* retrieves used cpu time */ 63*cdf0e10cSrcweir #define osl_Process_HEAPUSAGE 0x0008 /* retrieves the used size of heap */ 64*cdf0e10cSrcweir 65*cdf0e10cSrcweir typedef sal_uInt32 oslProcessIdentifier; 66*cdf0e10cSrcweir typedef sal_uInt32 oslProcessExitCode; 67*cdf0e10cSrcweir 68*cdf0e10cSrcweir typedef enum { 69*cdf0e10cSrcweir osl_Process_E_None, /* no error */ 70*cdf0e10cSrcweir osl_Process_E_NotFound, /* image not found */ 71*cdf0e10cSrcweir osl_Process_E_TimedOut, /* timout occured */ 72*cdf0e10cSrcweir osl_Process_E_NoPermission, /* permission denied */ 73*cdf0e10cSrcweir osl_Process_E_Unknown, /* unknown error */ 74*cdf0e10cSrcweir osl_Process_E_InvalidError, /* unmapped error */ 75*cdf0e10cSrcweir osl_Process_E_FORCE_EQUAL_SIZE = SAL_MAX_ENUM 76*cdf0e10cSrcweir } oslProcessError; 77*cdf0e10cSrcweir 78*cdf0e10cSrcweir typedef enum { 79*cdf0e10cSrcweir osl_Process_TypeNone, /* no descriptor */ 80*cdf0e10cSrcweir osl_Process_TypeSocket, /* socket */ 81*cdf0e10cSrcweir osl_Process_TypeFile, /* file */ 82*cdf0e10cSrcweir osl_Process_TypePipe, /* pipe */ 83*cdf0e10cSrcweir osl_Process_FORCE_EQUAL_SIZE = SAL_MAX_ENUM 84*cdf0e10cSrcweir } oslDescriptorType; 85*cdf0e10cSrcweir 86*cdf0e10cSrcweir typedef sal_Int32 oslDescriptorFlag; 87*cdf0e10cSrcweir #define osl_Process_DFNONE 0x0000 88*cdf0e10cSrcweir #define osl_Process_DFWAIT 0x0001 89*cdf0e10cSrcweir 90*cdf0e10cSrcweir #ifdef SAL_W32 91*cdf0e10cSrcweir # pragma pack(push, 8) 92*cdf0e10cSrcweir #elif defined(SAL_OS2) 93*cdf0e10cSrcweir # pragma pack(push, 4) 94*cdf0e10cSrcweir #endif 95*cdf0e10cSrcweir 96*cdf0e10cSrcweir typedef struct { 97*cdf0e10cSrcweir sal_uInt32 Size; 98*cdf0e10cSrcweir oslProcessData Fields; 99*cdf0e10cSrcweir oslProcessIdentifier Ident; 100*cdf0e10cSrcweir oslProcessExitCode Code; 101*cdf0e10cSrcweir TimeValue UserTime; 102*cdf0e10cSrcweir TimeValue SystemTime; 103*cdf0e10cSrcweir sal_uInt32 HeapUsage; 104*cdf0e10cSrcweir } oslProcessInfo; 105*cdf0e10cSrcweir 106*cdf0e10cSrcweir #if defined( SAL_W32) || defined(SAL_OS2) 107*cdf0e10cSrcweir # pragma pack(pop) 108*cdf0e10cSrcweir #endif 109*cdf0e10cSrcweir 110*cdf0e10cSrcweir /** Process handle 111*cdf0e10cSrcweir 112*cdf0e10cSrcweir @see osl_executeProcess 113*cdf0e10cSrcweir @see osl_terminateProcess 114*cdf0e10cSrcweir @see osl_freeProcessHandle 115*cdf0e10cSrcweir @see osl_getProcessInfo 116*cdf0e10cSrcweir @see osl_joinProcess 117*cdf0e10cSrcweir */ 118*cdf0e10cSrcweir typedef void* oslProcess; 119*cdf0e10cSrcweir 120*cdf0e10cSrcweir /** Execute a process. 121*cdf0e10cSrcweir 122*cdf0e10cSrcweir Executes the program image provided in strImageName in a new process. 123*cdf0e10cSrcweir 124*cdf0e10cSrcweir @param ustrImageName 125*cdf0e10cSrcweir [in] The file URL of the executable to be started. 126*cdf0e10cSrcweir Can be NULL in this case the file URL of the executable must be the first element 127*cdf0e10cSrcweir in ustrArguments. 128*cdf0e10cSrcweir 129*cdf0e10cSrcweir @param ustrArguments 130*cdf0e10cSrcweir [in] An array of argument strings. Can be NULL if strImageName is not NULL. 131*cdf0e10cSrcweir If strImageName is NULL it is expected that the first element contains 132*cdf0e10cSrcweir the file URL of the executable to start. 133*cdf0e10cSrcweir 134*cdf0e10cSrcweir @param nArguments 135*cdf0e10cSrcweir [in] The number of arguments provided. If this number is 0 strArguments will be ignored. 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir @param Options 138*cdf0e10cSrcweir [in] A combination of int-constants to describe the mode of execution. 139*cdf0e10cSrcweir 140*cdf0e10cSrcweir @param Security 141*cdf0e10cSrcweir [in] The user and his rights for which the process is started. May be NULL in which case 142*cdf0e10cSrcweir the process will be started in the context of the current user. 143*cdf0e10cSrcweir 144*cdf0e10cSrcweir @param ustrDirectory 145*cdf0e10cSrcweir [in] The file URL of the working directory of the new proces. If the specified directory 146*cdf0e10cSrcweir does not exist or is inaccessible the working directory of the newly created process 147*cdf0e10cSrcweir is undefined. If this parameter is NULL or the caller provides an empty string the 148*cdf0e10cSrcweir new process will have the same current working directory as the calling process. 149*cdf0e10cSrcweir 150*cdf0e10cSrcweir @param ustrEnviroments 151*cdf0e10cSrcweir [in] An array of strings describing environment variables that should be merged into the 152*cdf0e10cSrcweir environment of the new process. Each string has to be in the form "variable=value". 153*cdf0e10cSrcweir This parameter can be NULL in which case the new process gets the same environment 154*cdf0e10cSrcweir as the parent process. 155*cdf0e10cSrcweir 156*cdf0e10cSrcweir @param nEnvironmentVars 157*cdf0e10cSrcweir [in] The number of environment variables to set. 158*cdf0e10cSrcweir 159*cdf0e10cSrcweir @param pProcess 160*cdf0e10cSrcweir [out] Pointer to a oslProcess variable, wich receives the handle of the newly created process. 161*cdf0e10cSrcweir This parameter must not be NULL. 162*cdf0e10cSrcweir 163*cdf0e10cSrcweir @return 164*cdf0e10cSrcweir <dl> 165*cdf0e10cSrcweir <dt>osl_Process_E_None</dt> 166*cdf0e10cSrcweir <dd>on success</dd> 167*cdf0e10cSrcweir <dt>osl_Process_E_NotFound</dt> 168*cdf0e10cSrcweir <dd>if the specified executable could not be found</dd> 169*cdf0e10cSrcweir <dt>osl_Process_E_InvalidError</dt> 170*cdf0e10cSrcweir <dd>if invalid parameters will be detected</dd> 171*cdf0e10cSrcweir <dt>osl_Process_E_Unknown</dt> 172*cdf0e10cSrcweir <dd>if arbitrary other errors occur</dd> 173*cdf0e10cSrcweir </dl> 174*cdf0e10cSrcweir 175*cdf0e10cSrcweir @see oslProcessOption 176*cdf0e10cSrcweir @see osl_executeProcess_WithRedirectedIO 177*cdf0e10cSrcweir @see osl_freeProcessHandle 178*cdf0e10cSrcweir @see osl_loginUser 179*cdf0e10cSrcweir */ 180*cdf0e10cSrcweir oslProcessError SAL_CALL osl_executeProcess( 181*cdf0e10cSrcweir rtl_uString* ustrImageName, 182*cdf0e10cSrcweir rtl_uString* ustrArguments[], 183*cdf0e10cSrcweir sal_uInt32 nArguments, 184*cdf0e10cSrcweir oslProcessOption Options, 185*cdf0e10cSrcweir oslSecurity Security, 186*cdf0e10cSrcweir rtl_uString* ustrDirectory, 187*cdf0e10cSrcweir rtl_uString* ustrEnvironments[], 188*cdf0e10cSrcweir sal_uInt32 nEnvironmentVars, 189*cdf0e10cSrcweir oslProcess* pProcess); 190*cdf0e10cSrcweir 191*cdf0e10cSrcweir 192*cdf0e10cSrcweir /** Execute a process and redirect child process standard IO. 193*cdf0e10cSrcweir 194*cdf0e10cSrcweir @param ustrImageName 195*cdf0e10cSrcweir [in] The file URL of the executable to be started. 196*cdf0e10cSrcweir Can be NULL in this case the file URL of the executable must be the first element 197*cdf0e10cSrcweir in ustrArguments. 198*cdf0e10cSrcweir 199*cdf0e10cSrcweir @param ustrArguments 200*cdf0e10cSrcweir [in] An array of argument strings. Can be NULL if strImageName is not NULL. 201*cdf0e10cSrcweir If strImageName is NULL it is expected that the first element contains 202*cdf0e10cSrcweir the file URL of the executable to start. 203*cdf0e10cSrcweir 204*cdf0e10cSrcweir @param nArguments 205*cdf0e10cSrcweir [in] The number of arguments provided. If this number is 0 strArguments will be ignored. 206*cdf0e10cSrcweir 207*cdf0e10cSrcweir @param Options 208*cdf0e10cSrcweir [in] A combination of int-constants to describe the mode of execution. 209*cdf0e10cSrcweir 210*cdf0e10cSrcweir @param Security 211*cdf0e10cSrcweir [in] The user and his rights for which the process is started. May be NULL in which case 212*cdf0e10cSrcweir the process will be started in the context of the current user. 213*cdf0e10cSrcweir 214*cdf0e10cSrcweir @param ustrDirectory 215*cdf0e10cSrcweir [in] The file URL of the working directory of the new proces. If the specified directory 216*cdf0e10cSrcweir does not exist or is inaccessible the working directory of the newly created process 217*cdf0e10cSrcweir is undefined. If this parameter is NULL or the caller provides an empty string the 218*cdf0e10cSrcweir new process will have the same current working directory as the calling process. 219*cdf0e10cSrcweir 220*cdf0e10cSrcweir @param ustrEnviroments 221*cdf0e10cSrcweir [in] An array of strings describing environment variables that should be merged into the 222*cdf0e10cSrcweir environment of the new process. Each string has to be in the form "variable=value". 223*cdf0e10cSrcweir This parameter can be NULL in which case the new process gets the same environment 224*cdf0e10cSrcweir as the parent process. 225*cdf0e10cSrcweir 226*cdf0e10cSrcweir @param nEnvironmentVars 227*cdf0e10cSrcweir [in] The number of environment variables to set. 228*cdf0e10cSrcweir 229*cdf0e10cSrcweir @param pProcess 230*cdf0e10cSrcweir [out] Pointer to a oslProcess variable, wich receives the handle of the newly created process. 231*cdf0e10cSrcweir This parameter must not be NULL. 232*cdf0e10cSrcweir 233*cdf0e10cSrcweir @param pChildInputWrite 234*cdf0e10cSrcweir [in] Pointer to a oslFileHandle variable that receives the handle which can be used to write 235*cdf0e10cSrcweir to the child process standard input device. The returned handle is not random accessible. 236*cdf0e10cSrcweir The handle has to be closed with osl_closeFile if no longer used. This parameter can be NULL. 237*cdf0e10cSrcweir 238*cdf0e10cSrcweir @param pChildOutputRead 239*cdf0e10cSrcweir [in] Pointer to a oslFileHandle variable that receives the handle which can be used to read from 240*cdf0e10cSrcweir the child process standard output device. The returned handle is not random accessible. 241*cdf0e10cSrcweir The Handle has to be closed with osl_closeFile if no longer used. This parameter can be NULL. 242*cdf0e10cSrcweir 243*cdf0e10cSrcweir @param pChildErrorRead 244*cdf0e10cSrcweir [in] Pointer to a oslFileHandle variable that receives the handle which can be used to read from 245*cdf0e10cSrcweir the child process standard error device. The returned handle is not random accessible. 246*cdf0e10cSrcweir The Handle has to be closed with osl_closeFile if no longer used. This parameter can be NULL. 247*cdf0e10cSrcweir 248*cdf0e10cSrcweir @return 249*cdf0e10cSrcweir <dl> 250*cdf0e10cSrcweir <dt>osl_Process_E_None</dt> 251*cdf0e10cSrcweir <dd>on success</dd> 252*cdf0e10cSrcweir <dt>osl_Process_E_NotFound</dt> 253*cdf0e10cSrcweir <dd>if the specified executable could not be found</dd> 254*cdf0e10cSrcweir <dt>osl_Process_E_InvalidError</dt> 255*cdf0e10cSrcweir <dd>if invalid parameters will be detected</dd> 256*cdf0e10cSrcweir <dt>osl_Process_E_Unknown</dt> 257*cdf0e10cSrcweir <dd>if arbitrary other errors occur</dd> 258*cdf0e10cSrcweir </dl> 259*cdf0e10cSrcweir 260*cdf0e10cSrcweir @see oslProcessOption 261*cdf0e10cSrcweir @see osl_executeProcess 262*cdf0e10cSrcweir @see osl_freeProcessHandle 263*cdf0e10cSrcweir @see osl_loginUser 264*cdf0e10cSrcweir @see osl_closeFile 265*cdf0e10cSrcweir */ 266*cdf0e10cSrcweir oslProcessError SAL_CALL osl_executeProcess_WithRedirectedIO( 267*cdf0e10cSrcweir rtl_uString* strImageName, 268*cdf0e10cSrcweir rtl_uString* ustrArguments[], 269*cdf0e10cSrcweir sal_uInt32 nArguments, 270*cdf0e10cSrcweir oslProcessOption Options, 271*cdf0e10cSrcweir oslSecurity Security, 272*cdf0e10cSrcweir rtl_uString* ustrDirectory, 273*cdf0e10cSrcweir rtl_uString* ustrEnvironments[], 274*cdf0e10cSrcweir sal_uInt32 nEnvironmentVars, 275*cdf0e10cSrcweir oslProcess* pProcess, 276*cdf0e10cSrcweir oslFileHandle* pChildInputWrite, 277*cdf0e10cSrcweir oslFileHandle* pChildOutputRead, 278*cdf0e10cSrcweir oslFileHandle* pChildErrorRead); 279*cdf0e10cSrcweir 280*cdf0e10cSrcweir /** Terminate a process 281*cdf0e10cSrcweir @param Process [in] the handle of the process to be terminated 282*cdf0e10cSrcweir 283*cdf0e10cSrcweir @see osl_executeProcess 284*cdf0e10cSrcweir @see osl_getProcess 285*cdf0e10cSrcweir @see osl_joinProcess 286*cdf0e10cSrcweir */ 287*cdf0e10cSrcweir oslProcessError SAL_CALL osl_terminateProcess(oslProcess Process); 288*cdf0e10cSrcweir 289*cdf0e10cSrcweir 290*cdf0e10cSrcweir /** @deprecated 291*cdf0e10cSrcweir Retrieve the process handle of a process identifier 292*cdf0e10cSrcweir @param Ident [in] a process identifier 293*cdf0e10cSrcweir 294*cdf0e10cSrcweir @return the process handle on success, NULL in all other cases 295*cdf0e10cSrcweir */ 296*cdf0e10cSrcweir oslProcess SAL_CALL osl_getProcess(oslProcessIdentifier Ident); 297*cdf0e10cSrcweir 298*cdf0e10cSrcweir 299*cdf0e10cSrcweir /** Free the specified proces-handle. 300*cdf0e10cSrcweir @param Process [in] 301*cdf0e10cSrcweir */ 302*cdf0e10cSrcweir void SAL_CALL osl_freeProcessHandle(oslProcess Process); 303*cdf0e10cSrcweir 304*cdf0e10cSrcweir 305*cdf0e10cSrcweir /** Wait for completation of the specified childprocess. 306*cdf0e10cSrcweir @param Process [in] 307*cdf0e10cSrcweir @return ols_Process_E_None 308*cdf0e10cSrcweir @see osl_executeProcess 309*cdf0e10cSrcweir */ 310*cdf0e10cSrcweir oslProcessError SAL_CALL osl_joinProcess(oslProcess Process); 311*cdf0e10cSrcweir 312*cdf0e10cSrcweir /** Wait with a timeout for the completion of the specified child 313*cdf0e10cSrcweir process. 314*cdf0e10cSrcweir 315*cdf0e10cSrcweir @param Process [in] 316*cdf0e10cSrcweir A process identifier. 317*cdf0e10cSrcweir 318*cdf0e10cSrcweir @param pTimeout [in] 319*cdf0e10cSrcweir A timeout value or NULL for infinite waiting. 320*cdf0e10cSrcweir The unit of resolution is second. 321*cdf0e10cSrcweir 322*cdf0e10cSrcweir @return 323*cdf0e10cSrcweir osl_Process_E_None on success 324*cdf0e10cSrcweir osl_Process_E_TimedOut waiting for the child process timed out 325*cdf0e10cSrcweir osl_Process_E_Unknown an error occured or the parameter are invalid 326*cdf0e10cSrcweir 327*cdf0e10cSrcweir @see osl_executeProcess 328*cdf0e10cSrcweir */ 329*cdf0e10cSrcweir oslProcessError SAL_CALL osl_joinProcessWithTimeout(oslProcess Process, const TimeValue* pTimeout); 330*cdf0e10cSrcweir 331*cdf0e10cSrcweir /** Retrieves information about a Process 332*cdf0e10cSrcweir @param Process [in] the process handle of the process 333*cdf0e10cSrcweir @param Field [in] the information which is to be retrieved 334*cdf0e10cSrcweir this can be one or more of 335*cdf0e10cSrcweir osl_Process_IDENTIFIER 336*cdf0e10cSrcweir osl_Process_EXITCODE 337*cdf0e10cSrcweir osl_Process_CPUTIMES 338*cdf0e10cSrcweir osl_Process_HEAPUSAGE 339*cdf0e10cSrcweir @param pInfo [out] a pointer to a vaid oslProcessInfo structure. 340*cdf0e10cSrcweir the Size field has to be initialized with the size 341*cdf0e10cSrcweir of the oslProcessInfo structure. 342*cdf0e10cSrcweir on success the the Field member holds the (or'ed) 343*cdf0e10cSrcweir retrieved valid information fields. 344*cdf0e10cSrcweir @return osl_Process_E_None on success, osl_Process_E_Unknown on failure. 345*cdf0e10cSrcweir */ 346*cdf0e10cSrcweir oslProcessError SAL_CALL osl_getProcessInfo(oslProcess Process, oslProcessData Fields, 347*cdf0e10cSrcweir oslProcessInfo* pInfo); 348*cdf0e10cSrcweir 349*cdf0e10cSrcweir /** Get the filename of the executable. 350*cdf0e10cSrcweir @param strFile [out] the string that receives the executable file path. 351*cdf0e10cSrcweir @return osl_Process_E_None or does not return. 352*cdf0e10cSrcweir @see osl_executeProcess 353*cdf0e10cSrcweir */ 354*cdf0e10cSrcweir oslProcessError SAL_CALL osl_getExecutableFile(rtl_uString **strFile); 355*cdf0e10cSrcweir 356*cdf0e10cSrcweir /** @return the number of commandline arguments passed to the main-function of 357*cdf0e10cSrcweir this process 358*cdf0e10cSrcweir @see osl_getCommandArg 359*cdf0e10cSrcweir */ 360*cdf0e10cSrcweir sal_uInt32 SAL_CALL osl_getCommandArgCount(void); 361*cdf0e10cSrcweir 362*cdf0e10cSrcweir /** Get the nArg-th command-line argument passed to the main-function of this process. 363*cdf0e10cSrcweir @param nArg [in] The number of the argument to return. 364*cdf0e10cSrcweir @param strCommandArg [out] The string receives the nArg-th command-line argument. 365*cdf0e10cSrcweir @return osl_Process_E_None or does not return. 366*cdf0e10cSrcweir @see osl_executeProcess 367*cdf0e10cSrcweir */ 368*cdf0e10cSrcweir oslProcessError SAL_CALL osl_getCommandArg(sal_uInt32 nArg, rtl_uString **strCommandArg); 369*cdf0e10cSrcweir 370*cdf0e10cSrcweir /** Set the command-line arguments as passed to the main-function of this process. 371*cdf0e10cSrcweir 372*cdf0e10cSrcweir Depricated: This function is only for internal use. Passing the args from main will 373*cdf0e10cSrcweir only work for Unix, on Windows there's no effect, the full command line will automtically 374*cdf0e10cSrcweir be taken. This is due to Windows 9x/ME limitation that don't allow UTF-16 wmain to provide 375*cdf0e10cSrcweir a osl_setCommandArgsU( int argc, sal_Unicode **argv ); 376*cdf0e10cSrcweir 377*cdf0e10cSrcweir @param argc [in] The number of elements in the argv array. 378*cdf0e10cSrcweir @param argv [in] The array of command-line arguments. 379*cdf0e10cSrcweir @see osl_getExecutableFile 380*cdf0e10cSrcweir @see osl_getCommandArgCount 381*cdf0e10cSrcweir @see osl_getCommandArg 382*cdf0e10cSrcweir */ 383*cdf0e10cSrcweir void SAL_CALL osl_setCommandArgs (int argc, char **argv); 384*cdf0e10cSrcweir 385*cdf0e10cSrcweir /** Get the value of one enviroment variable. 386*cdf0e10cSrcweir @param strVar [in] denotes the name of the variable to get. 387*cdf0e10cSrcweir @param strValue [out] string that receives the value of environment variable. 388*cdf0e10cSrcweir */ 389*cdf0e10cSrcweir oslProcessError SAL_CALL osl_getEnvironment(rtl_uString *strVar, rtl_uString **strValue); 390*cdf0e10cSrcweir 391*cdf0e10cSrcweir /** Set the value of one enviroment variable. 392*cdf0e10cSrcweir @param strVar [in] denotes the name of the variable to set. 393*cdf0e10cSrcweir @param strValue [in] string of the new value of environment variable. 394*cdf0e10cSrcweir 395*cdf0e10cSrcweir @since UDK 3.2.13 396*cdf0e10cSrcweir */ 397*cdf0e10cSrcweir oslProcessError SAL_CALL osl_setEnvironment(rtl_uString *strVar, rtl_uString *strValue); 398*cdf0e10cSrcweir 399*cdf0e10cSrcweir /** Unsets the value of one enviroment variable. 400*cdf0e10cSrcweir @param strVar [in] denotes the name of the variable to unset. 401*cdf0e10cSrcweir 402*cdf0e10cSrcweir @since UDK 3.2.13 403*cdf0e10cSrcweir */ 404*cdf0e10cSrcweir oslProcessError SAL_CALL osl_clearEnvironment(rtl_uString *strVar); 405*cdf0e10cSrcweir 406*cdf0e10cSrcweir /** Get the working directory of the current process as a file URL. 407*cdf0e10cSrcweir 408*cdf0e10cSrcweir The file URL is encoded as common for the OSL file API. 409*cdf0e10cSrcweir @param pustrWorkingDir [out] string that receives the working directory file URL. 410*cdf0e10cSrcweir */ 411*cdf0e10cSrcweir 412*cdf0e10cSrcweir oslProcessError SAL_CALL osl_getProcessWorkingDir( rtl_uString **pustrWorkingDir ); 413*cdf0e10cSrcweir 414*cdf0e10cSrcweir /** Get the locale the process is currently running in. 415*cdf0e10cSrcweir 416*cdf0e10cSrcweir The unix implementation caches the value it returns, so if you have to change the locale 417*cdf0e10cSrcweir your are running in, you will have to use osl_setProcessLocale therefor. 418*cdf0e10cSrcweir 419*cdf0e10cSrcweir @param ppLocale [out] a pointer that receives the currently selected locale structure 420*cdf0e10cSrcweir @see osl_setProcessLocale 421*cdf0e10cSrcweir */ 422*cdf0e10cSrcweir 423*cdf0e10cSrcweir oslProcessError SAL_CALL osl_getProcessLocale( rtl_Locale ** ppLocale ); 424*cdf0e10cSrcweir 425*cdf0e10cSrcweir /** Change the locale of the process. 426*cdf0e10cSrcweir 427*cdf0e10cSrcweir @param pLocale [in] a pointer to the locale to be set 428*cdf0e10cSrcweir @see osl_getProcessLocale 429*cdf0e10cSrcweir */ 430*cdf0e10cSrcweir 431*cdf0e10cSrcweir oslProcessError SAL_CALL osl_setProcessLocale( rtl_Locale * pLocale ); 432*cdf0e10cSrcweir 433*cdf0e10cSrcweir 434*cdf0e10cSrcweir sal_Bool SAL_CALL osl_sendResourcePipe(oslPipe Pipe, oslSocket Socket); 435*cdf0e10cSrcweir 436*cdf0e10cSrcweir oslSocket SAL_CALL osl_receiveResourcePipe(oslPipe Pipe); 437*cdf0e10cSrcweir 438*cdf0e10cSrcweir #ifdef __cplusplus 439*cdf0e10cSrcweir } 440*cdf0e10cSrcweir #endif 441*cdf0e10cSrcweir 442*cdf0e10cSrcweir #endif /* _OSL_PROCESS_H_ */ 443*cdf0e10cSrcweir 444