Annotation of mstools/samples/sdktools/remote/remote.h, revision 1.1.1.1

1.1       root        1: #define VERSION            4
                      2: #define REMOTE_SERVER       1
                      3: #define REMOTE_CLIENT       2
                      4: 
                      5: #define SERVER_READ_PIPE    "\\\\%s\\PIPE\\%sIN"   //Client Writes and Server Reads
                      6: #define SERVER_WRITE_PIPE   "\\\\%s\\PIPE\\%sOUT"  //Server Reads  and Client Writes
                      7: 
                      8: #define COMMANDCHAR         '@' //Commands intended for remote begins with this
                      9: #define CTRLC               3
                     10: 
                     11: #define CLIENT_ATTR         FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|BACKGROUND_BLUE
                     12: #define SERVER_ATTR         FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|BACKGROUND_RED
                     13: 
                     14: //
                     15: //Some General purpose Macros
                     16: //
                     17: #define MINIMUM(x,y)          ((x)>(y)?(y):(x))
                     18: #define MAXIMUM(x,y)          ((x)>(y)?(x):(y))
                     19: 
                     20: #define ERRORMSSG(str)      printf("Error %d - %s [%s %d]\n",GetLastError(),str,__FILE__,__LINE__)
                     21: #define SAFECLOSEHANDLE(x)  {if (x!=INVALID_HANDLE_VALUE) {CloseHandle(x);x=INVALID_HANDLE_VALUE;}}
                     22: 
                     23: 
                     24:                                     // All because printf does not work
                     25:                                     // with NT IO redirection
                     26:                                     //
                     27: 
                     28: #define WRITEF(VArgs)            {                                                 \
                     29:                                     HANDLE xh=GetStdHandle(STD_OUTPUT_HANDLE);     \
                     30:                                     char   VBuff[256];                             \
                     31:                                     DWORD  tmp;                                    \
                     32:                                     sprintf VArgs;                                 \
                     33:                                     WriteFile(xh,VBuff,strlen(VBuff),&tmp,NULL);   \
                     34:                                  }                                                 \
                     35: 
                     36: #define HOSTNAMELEN         16
                     37: 
                     38: #define CHARS_PER_LINE      45
                     39: 
                     40: #define MAGICNUMBER     0x31109000
                     41: #define BEGINMARK       '\xfe'
                     42: #define ENDMARK         '\xff'
                     43: #define LINESTOSEND     200
                     44: 
                     45: #define MAX_SESSION     10
                     46: 
                     47: typedef struct
                     48: {
                     49:     DWORD    Size;
                     50:     DWORD    Version;
                     51:     char     ClientName[15];
                     52:     DWORD    LinesToSend;
                     53:     DWORD    Flag;
                     54: }   SESSION_STARTUPINFO;
                     55: 
                     56: typedef struct
                     57: {
                     58:     DWORD MagicNumber;      //New Remote
                     59:     DWORD Size;             //Size of structure
                     60:     DWORD FileSize;         //Num bytes sent
                     61: }   SESSION_STARTREPLY;
                     62: 
                     63: typedef struct
                     64: {
                     65:     char    Name[HOSTNAMELEN];     //Name of client Machine;
                     66:     BOOL    Active;         //Client at the other end connected
                     67:     BOOL    CommandRcvd;    //True if a command recieved
                     68:     BOOL    SendOutput;     //True if Sendoutput output
                     69:     HANDLE  PipeReadH;      //Client sends its StdIn  through this
                     70:     HANDLE  PipeWriteH;     //Client gets  its StdOut through this
                     71:     HANDLE  rSaveFile;      //Sessions read handle to SaveFile
                     72:     HANDLE  hThread;        //Session Thread
                     73:     HANDLE  MoreData;       //Event handle set if data available to be read
                     74: } SESSION_TYPE;
                     75: 
                     76: 
                     77: 
                     78: VOID
                     79: Server(
                     80:     char* ChildCmd,
                     81:     char* PipeName
                     82:     );
                     83: 
                     84: 
                     85: VOID
                     86: Client(
                     87:     char* ServerName,
                     88:     char* PipeName
                     89:     );
                     90: 
                     91: VOID
                     92: ErrorExit(
                     93:     char* str
                     94:     );
                     95: 
                     96: VOID
                     97: DisplayClientHlp(
                     98:     );
                     99: 
                    100: VOID
                    101: DisplayServerHlp(
                    102:     );
                    103: 
                    104: ULONG
                    105: DbgPrint(
                    106:     PCH Format,
                    107:     ...
                    108:     );
                    109: 
                    110: DWORD
                    111: ReadFixBytes(
                    112:     HANDLE hRead,
                    113:     char   *Buffer,
                    114:     DWORD  ToRead,
                    115:     DWORD  TimeOut   //ignore for timebeing
                    116:     );
                    117: 
                    118: VOID
                    119: Errormsg(
                    120:     char* str
                    121:     );
                    122: 
                    123: 
                    124: extern char   HostName[HOSTNAMELEN];
                    125: extern char*  ChildCmd;
                    126: extern char*  PipeName;
                    127: extern char*  ServerName;
                    128: extern HANDLE MyOutHandle;
                    129: extern DWORD  LinesToSend;
                    130: extern BOOL   IsAdvertise;
                    131: extern DWORD  ClientToServerFlag;

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.