home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / netds / sna / aremote / aremote.h < prev    next >
C/C++ Source or Header  |  1997-04-09  |  3KB  |  92 lines

  1. #define REMOTE_SERVER       1
  2. #define REMOTE_CLIENT       2
  3. #define REMOTE_INIT_MSG        TEXT("APPC Remote")
  4.  
  5. // commands for the remote server begin with this
  6. #define COMMANDCHAR         TEXT('@')
  7. #define CTRLC               3
  8.  
  9. #define CLIENT_ATTR         FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_RED|BACKGROUND_BLUE
  10. #define SERVER_ATTR         FOREGROUND_INTENSITY|FOREGROUND_GREEN|FOREGROUND_BLUE|BACKGROUND_RED
  11.  
  12. //
  13. //Some General purpose Macros
  14. //
  15. #define MINIMUM(x,y)          ((x)>(y)?(y):(x))
  16. #define MAXIMUM(x,y)          ((x)>(y)?(x):(y))
  17.  
  18. // All because printf does not work
  19. // with NT IO redirection
  20. #define WRITEF(wsprintfargs)                                 \
  21. {                                                              \
  22.     HANDLE     h = GetStdHandle(STD_OUTPUT_HANDLE);               \
  23.     wchar_t    VBuff[256];                                        \
  24.     DWORD      tmp;                                               \
  25.     wsprintf wsprintfargs;                                    \
  26.     WriteConsole(h, VBuff, lstrlen(VBuff), &tmp, NULL);        \
  27. }
  28.                   
  29. #define HOSTNAMELEN         16
  30.  
  31. #define CHARS_PER_LINE      80
  32.  
  33. // magic number is version number is 00yyyymm (yyyy = year, mm = month)
  34. #define MAGICNUMBER     0x00199406
  35. #define BEGINMARK       '\xfe'
  36. #define ENDMARK         '\xff'
  37. #define LINESTOSEND     200
  38.  
  39. #define MAX_SESSION     10
  40.  
  41. typedef struct
  42. {
  43.     DWORD    MagicNumber;                    // version of client software
  44.     TCHAR    ClientName[HOSTNAMELEN];        // name of client machine
  45.     DWORD    LinesToSend;                    // lines to send on startup
  46.     DWORD    Flag;                            // optional flags
  47. }   SESSION_STARTUPINFO;
  48.  
  49. typedef struct
  50. {
  51.     DWORD MagicNumber;                         // New Remote
  52.     DWORD FileSize;                         // Num bytes sent
  53. }   SESSION_STARTREPLY;
  54.  
  55. typedef struct
  56. {
  57.     TCHAR    Name[HOSTNAMELEN];     //Name of client Machine;
  58.     BOOL    Active;         //Client at the other end connected
  59.     BOOL    CommandRcvd;    //True if a command recieved
  60.     BOOL    SendOutput;     //True if Sendoutput output
  61.     tpconvid_t tpconv;        //TP and conversation IDs for client's APPC connection
  62.     HANDLE  rSaveFile;      //Sessions read handle to SaveFile
  63.     HANDLE  hThread;        //Session Thread
  64.     HANDLE  MoreData;       //Event handle set if data available to be read
  65.     HANDLE    DoClose;        //Event saying that this session should close
  66. } SESSION_TYPE;
  67.  
  68.  
  69.  
  70. VOID Server(TCHAR *ChildCmd, TCHAR *PipeName);
  71.  
  72. VOID Client(TCHAR *local_lu, TCHAR *server_lu, TCHAR *tp_name, TCHAR *loc_tp_name, TCHAR *mode_name);
  73.  
  74. VOID ErrorExit(TCHAR* str);
  75.  
  76. VOID DisplayClientHlp();
  77.  
  78. VOID DisplayServerHlp();
  79.  
  80. ULONG DbgPrint(PCH Format, ...);
  81.  
  82. // Timeout is ignored for now
  83. DWORD ReadFixBytes(HANDLE hRead, TCHAR *Buffer, DWORD ToRead, DWORD  TimeOut);
  84.  
  85. VOID Errormsg(TCHAR* str);
  86.  
  87. extern        TCHAR       HostName[];
  88. extern        TCHAR       *ChildCmd;
  89. extern        DWORD      ClientToServerFlag;
  90. extern        DWORD    LinesToSend;
  91. extern        TCHAR    *UserName;
  92.