1 /* 2 * BATCH.H - A structure to preserve the context of a batch file 3 */ 4 5 #pragma once 6 7 typedef struct tagBATCHCONTEXT 8 { 9 struct tagBATCHCONTEXT *prev; 10 char *mem; /* batchfile content in memory */ 11 DWORD memsize; /* size of batchfile */ 12 DWORD mempos; /* current position to read from */ 13 BOOL memfree; /* true if it need to be freed when exitbatch is called */ 14 TCHAR BatchFilePath[MAX_PATH]; 15 LPTSTR params; 16 LPTSTR raw_params; /* Holds the raw params given by the input */ 17 INT shiftlevel[10]; 18 BOOL bEcho; /* Preserve echo flag across batch calls */ 19 REDIRECTION *RedirList; 20 PARSED_COMMAND *current; 21 struct _SETLOCAL *setlocal; 22 } BATCH_CONTEXT, *LPBATCH_CONTEXT; 23 24 typedef struct tagFORCONTEXT 25 { 26 struct tagFORCONTEXT *prev; 27 TCHAR firstvar; 28 UINT varcount; 29 LPTSTR *values; 30 } FOR_CONTEXT, *LPFOR_CONTEXT; 31 32 33 /* 34 * The stack of current batch contexts. 35 * NULL when no batch is active 36 */ 37 extern LPBATCH_CONTEXT bc; 38 39 extern LPFOR_CONTEXT fc; 40 41 extern BOOL bEcho; /* The echo flag */ 42 43 #define BATCH_BUFFSIZE 8192 44 45 extern TCHAR textline[BATCH_BUFFSIZE]; /* Buffer for reading Batch file lines */ 46 47 48 LPTSTR FindArg(TCHAR, BOOL *); 49 LPTSTR BatchParams(LPTSTR, LPTSTR); 50 VOID ExitBatch(VOID); 51 INT Batch(LPTSTR, LPTSTR, LPTSTR, PARSED_COMMAND *); 52 BOOL BatchGetString(LPTSTR lpBuffer, INT nBufferLength); 53 LPTSTR ReadBatchLine(VOID); 54 VOID AddBatchRedirection(REDIRECTION **); 55