winpty/include/pconsole.h

70 lines
1.5 KiB
C
Raw Normal View History

#ifndef PCONSOLE_H
#define PCONSOLE_H
#include <stdlib.h>
2012-02-10 10:09:38 +00:00
#include <windows.h>
#ifdef PCONSOLE
#define PCONSOLE_API __declspec(dllexport)
#else
#define PCONSOLE_API __declspec(dllimport)
#endif
#ifdef __cplusplus
extern "C" {
#endif
typedef struct pconsole_s pconsole_t;
/*
* pconsole API.
*/
/*
* Starts a new pconsole instance with the given size.
*/
PCONSOLE_API pconsole_t *pconsole_open(int cols, int rows);
/*
* Start a child process. Either (but not both) of appname and cmdline may
* be NULL. cwd and env may be NULL. env is a pointer to an environment
* block like that passed to CreateProcess.
*
* This function never modifies the cmdline, unlike CreateProcess.
*
* Only one child process may be started. After the child process exits, the
2012-02-10 10:09:38 +00:00
* agent will flush and close the data pipe.
*/
2012-02-10 10:09:38 +00:00
PCONSOLE_API int pconsole_start_process(pconsole_t *pc,
const wchar_t *appname,
const wchar_t *cmdline,
const wchar_t *cwd,
const wchar_t *env);
2012-02-10 10:09:38 +00:00
PCONSOLE_API int pconsole_get_exit_code(pconsole_t *pc);
2012-03-14 05:15:02 +00:00
/* TODO: Not implemented. Should it be? */
2012-02-10 10:09:38 +00:00
PCONSOLE_API int pconsole_flush_and_close(pconsole_t *pc);
/*
2012-02-10 10:09:38 +00:00
* Returns an overlapped-mode pipe handle that can be read and written
* like a Unix terminal.
*/
2012-02-10 10:09:38 +00:00
PCONSOLE_API HANDLE pconsole_get_data_pipe(pconsole_t *pc);
/*
2012-02-10 10:09:38 +00:00
* Change the size of the Windows console.
*/
2012-02-10 10:09:38 +00:00
PCONSOLE_API int pconsole_set_size(pconsole_t *pc, int cols, int rows);
/*
* Closes the pconsole.
*/
2012-02-10 10:09:38 +00:00
PCONSOLE_API void pconsole_close(pconsole_t *pc);
#ifdef __cplusplus
}
#endif
#endif /* PCONSOLE_H */