LICK
 All Data Structures Files Functions Variables Enumerations Enumerator
Functions
system-utils.h File Reference

An assortment of system-level functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int run_system (const char *c)
 run a command, similar to system() More...
 
int run_system_output (const char *c, char **out)
 run a command, similar to system(), collecting the program output More...
 
int run_unprivileged (const char *c, void *input, void *output)
 run a command, similar to system(), returning pipes to the standard input and output of the process More...
 
int run_privileged (const char *c, const char *p, int *ret)
 run a command, similar to system(), with administrator privileges More...
 
const char * get_command_line ()
 find the command line of this program More...
 
char * get_windows_path ()
 get the path of the Windows folder More...
 
char * get_windows_drive_path ()
 get the path of the drive Windows is installed on More...
 
char * get_program_path ()
 find the path of this program More...
 
char * get_config_path ()
 find the path of this ProgramData folder More...
 

Detailed Description

An assortment of system-level functions.

Function Documentation

const char* get_command_line ( )

find the command line of this program

Returns
a string. Do not pass this to free
char* get_config_path ( )

find the path of this ProgramData folder

On Windows 95 - ME, and Vista+, this will be similar to 'C:/ProgramData'. On other systems, it will be similar to 'C:/Documets and Settings/All Users/Application Data'

Returns
a string. Must be freed using free
char* get_program_path ( )

find the path of this program

Returns
a string. Must be freed using free
char* get_windows_drive_path ( )

get the path of the drive Windows is installed on

Returns
the drive structure corresponding to the drive Windows is installed on. must be freed using #free
char* get_windows_path ( )

get the path of the Windows folder

Returns
the path to the Windows folder. Must be freed using free
int run_privileged ( const char *  c,
const char *  p,
int *  ret 
)

run a command, similar to system(), with administrator privileges

Parameters
[in]cthe command to run
[in]pthe parameters
[out]retthe return code from the process
Returns
whether the process started correctly
int run_system ( const char *  c)

run a command, similar to system()

Parameters
cthe command to run
Returns
1 if the program finished correctly
int run_system_output ( const char *  c,
char **  out 
)

run a command, similar to system(), collecting the program output

Parameters
[in]cthe command to run
[out]outthe standard output and standard error output of the program, if it finished correctly. Must be freed using free()
Returns
1 if the program finished correctly
int run_unprivileged ( const char *  c,
void *  input,
void *  output 
)

run a command, similar to system(), returning pipes to the standard input and output of the process

Parameters
[in]cthe command to run
[out]inputa pointer to a handle to hold the input pipe
[out]outputa pointer to a handle to hold the output pipe
Returns
1 if the program starts correctly