Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

179 lines
8.4 KiB

  1. /*++
  2. * File name:
  3. * tclient.h
  4. * Contents:
  5. * Common definitions for tclient.dll
  6. *
  7. * Copyright (C) 1998-1999 Microsoft Corp.
  8. --*/
  9. #ifndef _TCLIENT_H
  10. #define _TCLIENT_H
  11. #ifndef OS_WIN32
  12. #define OS_WIN32
  13. #endif
  14. #include "feedback.h"
  15. #include "clntdata.h"
  16. // Error messages
  17. #define ERR_START_MENU_NOT_APPEARED "Start menu not appeared"
  18. #define ERR_COULDNT_OPEN_PROGRAM "Couldn't open a program"
  19. #define ERR_INVALID_SCANCODE_IN_XLAT "Invalid scancode in Xlat table"
  20. #define ERR_WAIT_FAIL_TIMEOUT "Wait failed: TIMEOUT"
  21. #define ERR_INVALID_PARAM "Invalid parameter"
  22. #define ERR_NULL_CONNECTINFO "ConnectInfo structure is NULL"
  23. #define ERR_CLIENT_IS_DEAD "Client is dead, sorry"
  24. #define ERR_ALLOCATING_MEMORY "Couldn't allocate memory"
  25. #define ERR_CREATING_PROCESS "Couldn't start process"
  26. #define ERR_CREATING_THREAD "Can't create thread"
  27. #define ERR_INVALID_COMMAND "Check: Invalid command"
  28. #define ERR_ALREADY_DISCONNECTED "No Info. Disconnect command" \
  29. " was executed"
  30. #define ERR_CONNECTING "Can't connect"
  31. #define ERR_CANTLOGON "Can't logon"
  32. #define ERR_NORMAL_EXIT "Client exit normaly"
  33. #define ERR_UNKNOWN_CLIPBOARD_OP "Unknown clipboard operation"
  34. #define ERR_COPY_CLIPBOARD "Error copying to the clipboard"
  35. #define ERR_PASTE_CLIPBOARD "Error pasting from the clipboard"
  36. #define ERR_PASTE_CLIPBOARD_EMPTY "The clipboard is empty"
  37. #define ERR_PASTE_CLIPBOARD_DIFFERENT_SIZE "Check clipboard: DIFFERENT SIZE"
  38. #define ERR_PASTE_CLIPBOARD_NOT_EQUAL "Check clipboard: NOT EQUAL"
  39. #define ERR_SAVE_CLIPBOARD "Save clipboard FAILED"
  40. #define ERR_CLIPBOARD_LOCKED "Clipboard is locked for writing " \
  41. "by another thread"
  42. #define ERR_CLIENTTERMINATE_FAIL "Client termination FAILED"
  43. #define ERR_NOTSUPPORTED "Call is not supported in this mode"
  44. #define ERR_CLIENT_DISCONNECTED "Client is disconnected"
  45. #define ERR_NODATA "The call failed, data is missing"
  46. // scancode modifier(s)
  47. #define SHIFT_DOWN 0x10000
  48. // Look for WM_KEYUP or WM_KEYDOWN
  49. #define WM_KEY_LPARAM(repeat, scan, exten, context, prev, trans) \
  50. (repeat + ((scan & 0xff) << 16) + ((exten & 1) << 24) +\
  51. ((context & 1) << 29) + ((prev & 1) << 30) + ((trans & 1) << 31))
  52. extern VOID _TClientAssert( LPCTSTR filename, INT line);
  53. #ifndef ASSERT
  54. #define ASSERT(_x_) if (!(_x_)) _TClientAssert( __FILE__, __LINE__)
  55. #endif // !ASSERT
  56. #ifndef TRACE
  57. #define TRACE(_x_) if (g_pfnPrintMessage) {\
  58. g_pfnPrintMessage(ALIVE_MESSAGE, "Worker:%d ", GetCurrentThreadId());\
  59. g_pfnPrintMessage _x_; }
  60. #endif // !TRACE
  61. #define REG_FORMAT "smclient_%X_%X"
  62. // Registry key used to start the client
  63. // Sort of: smclient_0xProcId_0xThreadId
  64. #ifdef OS_WIN16
  65. #define SMCLIENT_INI "\\smclient.ini" // Our ini file
  66. #define TCLIENT_INI_SECTION "tclient" // Our section in ini file
  67. #else
  68. #define SMCLIENT_INI L"\\smclient.ini"
  69. #define TCLIENT_INI_SECTION L"tclient"
  70. #endif
  71. #define CHAT_SEPARATOR L"<->" // Separates wait<->repsonse
  72. // in chat sequence
  73. #define WAIT_STR_DELIMITER '|' // Deleimiter in Wait for
  74. // multiple strings
  75. #define MAX_WAITING_EVENTS 16
  76. #define MAX_STRING_LENGTH 128
  77. #define FEEDBACK_SIZE 32
  78. #define WAITINPUTIDLE 180000 // 3 min
  79. typedef struct _RCLXDATACHAIN {
  80. UINT uiOffset;
  81. struct _RCLXDATACHAIN *pNext;
  82. RCLXDATA RClxData;
  83. } RCLXDATACHAIN, *PRCLXDATACHAIN;
  84. typedef struct _CONNECTINFO { // Connection context
  85. HWND hClient; // Main HWND of the client
  86. // or in RCLX mode
  87. // context structure
  88. HWND hContainer; // Client's child windows
  89. HWND hInput;
  90. HWND hOutput;
  91. HANDLE hProcess; // Client's process handle
  92. LONG_PTR lProcessId; // Client's process Id
  93. // or in RCLX mode, socket
  94. HANDLE hThread; // Clients first thread
  95. DWORD dwThreadId; // --"--
  96. // In RCLX mode this contains
  97. // our ThreadID
  98. DWORD OwnerThreadId; // thread id of the owner of
  99. // this structure
  100. BOOL dead; // TRUE if the client is dead
  101. UINT xRes; // client's resolution
  102. UINT yRes;
  103. BOOL RClxMode; // TRUE if this thread is
  104. // in RCLX mode
  105. // the client is on remote
  106. // machine
  107. HANDLE evWait4Str; // "Wait for something"
  108. // event handle
  109. HANDLE aevChatSeq[MAX_WAITING_EVENTS]; // Event on chat sequences
  110. INT nChatNum; // Number of chat sequences
  111. WCHAR Feedback[FEEDBACK_SIZE][MAX_STRING_LENGTH];
  112. // Feedback buffer
  113. INT nFBsize, nFBend; // Pointer within feedback
  114. // buffer
  115. CHAR szDiscReason[MAX_STRING_LENGTH*2]; // Explains disconnect reason
  116. CHAR szWait4MultipleStrResult[MAX_STRING_LENGTH];
  117. // Result of
  118. // Wait4MultipleStr:string
  119. INT nWait4MultipleStrResult; // Result of
  120. // Wait4MultipleStr:ID[0-n]
  121. HGLOBAL ghClipboard; // handle to received clipboard
  122. UINT uiClipboardFormat; // received clipboard format
  123. UINT nClipboardSize; // recevied clipboard size
  124. BOOL bRClxClipboardReceived; // Flag the clipbrd is received
  125. CHAR szClientType[MAX_STRING_LENGTH]; // in RCLX mode identifys the
  126. // client machine and platform
  127. UINT uiSessionId;
  128. BOOL bWillCallAgain; // TRUE if FEED_WILLCALLAGAIN
  129. // is received in RCLX mode
  130. PRCLXDATACHAIN pRClxDataChain; // data receved from RCLX
  131. PRCLXDATACHAIN pRClxLastDataChain; // BITMAPs, Virtual Channels
  132. struct _CONNECTINFO *pNext; // Next structure in the queue
  133. } CONNECTINFO, *PCONNECTINFO;
  134. typedef enum {
  135. WAIT_STRING, // Wait for unicode string from the client
  136. WAIT_DISC, // Wait for disconnected event
  137. WAIT_CONN, // Wait for conneted event
  138. WAIT_MSTRINGS, // Wait for multiple strings
  139. WAIT_CLIPBOARD, // Wait for clipboard data
  140. WAIT_DATA // Wait for data block (RCLX mode responces)
  141. } WAITTYPE;
  142. // Different event types
  143. // on which we wait
  144. typedef struct _WAIT4STRING {
  145. HANDLE evWait; // Wait for event
  146. PCONNECTINFO pOwner; // Context of the owner
  147. LONG_PTR lProcessId; // Clients ID
  148. WAITTYPE WaitType; // Event type
  149. DWORD strsize; // String length (WAIT_STRING,
  150. // WAIT_MSTRING)
  151. WCHAR waitstr[MAX_STRING_LENGTH]; // String we are waiting for
  152. DWORD respsize; // Length of responf
  153. WCHAR respstr[MAX_STRING_LENGTH]; // Respond string
  154. // (in chat sequences)
  155. struct _WAIT4STRING *pNext; // Next in the queue
  156. } WAIT4STRING, *PWAIT4STRING;
  157. #endif /* _TCLIENT_H */