2006-02-16 23:23:37 +00:00
|
|
|
/*
|
|
|
|
* BATCH.H - A structure to preserve the context of a batch file
|
|
|
|
*/
|
|
|
|
|
2010-02-26 11:43:19 +00:00
|
|
|
#pragma once
|
2006-02-16 23:23:37 +00:00
|
|
|
|
|
|
|
typedef struct tagBATCHCONTEXT
|
|
|
|
{
|
2013-06-29 23:50:13 +00:00
|
|
|
struct tagBATCHCONTEXT *prev;
|
|
|
|
char *mem; /* batchfile content in memory */
|
|
|
|
DWORD memsize; /* size of batchfile */
|
|
|
|
DWORD mempos; /* current position to read from */
|
|
|
|
BOOL memfree; /* true if it need to be freed when exitbatch is called */
|
|
|
|
TCHAR BatchFilePath[MAX_PATH];
|
|
|
|
LPTSTR params;
|
|
|
|
LPTSTR raw_params; /* Holds the raw params given by the input */
|
|
|
|
INT shiftlevel[10];
|
|
|
|
BOOL bEcho; /* Preserve echo flag across batch calls */
|
|
|
|
REDIRECTION *RedirList;
|
2013-06-30 13:23:30 +00:00
|
|
|
PARSED_COMMAND *current;
|
2013-06-29 23:50:13 +00:00
|
|
|
struct _SETLOCAL *setlocal;
|
2006-02-16 23:23:37 +00:00
|
|
|
} BATCH_CONTEXT, *LPBATCH_CONTEXT;
|
|
|
|
|
2009-03-02 19:08:25 +00:00
|
|
|
typedef struct tagFORCONTEXT
|
|
|
|
{
|
2013-06-29 23:50:13 +00:00
|
|
|
struct tagFORCONTEXT *prev;
|
|
|
|
TCHAR firstvar;
|
|
|
|
UINT varcount;
|
|
|
|
LPTSTR *values;
|
2009-03-02 19:08:25 +00:00
|
|
|
} FOR_CONTEXT, *LPFOR_CONTEXT;
|
|
|
|
|
2006-02-16 23:23:37 +00:00
|
|
|
|
2013-06-29 23:50:13 +00:00
|
|
|
/*
|
|
|
|
* The stack of current batch contexts.
|
2006-02-16 23:23:37 +00:00
|
|
|
* NULL when no batch is active
|
|
|
|
*/
|
|
|
|
extern LPBATCH_CONTEXT bc;
|
|
|
|
|
2009-03-02 19:08:25 +00:00
|
|
|
extern LPFOR_CONTEXT fc;
|
|
|
|
|
2006-02-16 23:23:37 +00:00
|
|
|
extern BOOL bEcho; /* The echo flag */
|
|
|
|
|
2009-01-12 16:13:06 +00:00
|
|
|
#define BATCH_BUFFSIZE 8192
|
2006-02-16 23:23:37 +00:00
|
|
|
|
|
|
|
extern TCHAR textline[BATCH_BUFFSIZE]; /* Buffer for reading Batch file lines */
|
|
|
|
|
|
|
|
|
2009-03-15 04:54:41 +00:00
|
|
|
LPTSTR FindArg (TCHAR, BOOL *);
|
2006-02-16 23:23:37 +00:00
|
|
|
LPTSTR BatchParams (LPTSTR, LPTSTR);
|
2011-03-13 20:56:27 +00:00
|
|
|
VOID ExitBatch (VOID);
|
2009-04-12 23:51:15 +00:00
|
|
|
INT Batch (LPTSTR, LPTSTR, LPTSTR, PARSED_COMMAND *);
|
2011-06-01 19:33:20 +00:00
|
|
|
BOOL BatchGetString (LPTSTR lpBuffer, INT nBufferLength);
|
2011-03-13 20:56:27 +00:00
|
|
|
LPTSTR ReadBatchLine(VOID);
|
2011-06-01 19:33:20 +00:00
|
|
|
VOID AddBatchRedirection(REDIRECTION **);
|