PeeperLib.h
上传用户:xztxsm
上传日期:2007-02-12
资源大小:150k
文件大小:9k
源码类别:

远程控制编程

开发平台:

Visual C++

  1. ///////////////////////////////////////////////////////////////////////////////
  2. // 远程控制软件-偷窥者  开发库                                               //
  3. // 日期:2001/10/02                                                           //
  4. // 作者:刘东发                                                               //
  5. // Email:dongfa@yeah.net                                                     //
  6. // http://dongfa.yeah.net                                                    //
  7. // OICQ:5584173  阿东                                                        //
  8. // 作者声明:                                                                 //
  9. //     此部分代码全是作者所写,可以随便传播,但要保持文件的完整性,有问题     //
  10. // 或者意见请来信,谢谢!                                                      //
  11. ///////////////////////////////////////////////////////////////////////////////
  12. #ifndef __PEEPER_LIB_H__
  13. #define __PEEPER_LIB_H__
  14. #ifdef __cplusplus
  15. extern "C"
  16. {
  17. #endif
  18. DECLARE_HANDLE(HDIB);
  19. #define DISP_SOCKET_ERROR     {
  20. LPVOID lpMsgBuf = NULL;
  21. ::FormatMessage
  22. FORMAT_MESSAGE_ALLOCATE_BUFFER | 
  23. FORMAT_MESSAGE_FROM_SYSTEM | 
  24. FORMAT_MESSAGE_IGNORE_INSERTS,
  25. NULL,
  26. ::WSAGetLastError(),
  27. MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
  28. (LPTSTR) &lpMsgBuf,
  29. 0,
  30. NULL 
  31. );
  32. ::MessageBox(NULL, (LPCTSTR)lpMsgBuf, "Error", 
  33. MB_OK | MB_ICONINFORMATION);
  34. LocalFree(lpMsgBuf);
  35. }
  36.  
  37. #define PALVERSION             0x300
  38. #define WIDTHBYTES(bits)       (((bits) + 31) / 32 * 4)
  39. #define IS_WIN30_DIB(lpbi)     ((*(LPDWORD)(lpbi)) == sizeof(BITMAPINFOHEADER))
  40. #define RECTWIDTH(lpRect)      ((lpRect)->right - (lpRect)->left)
  41. #define RECTHEIGHT(lpRect)     ((lpRect)->bottom - (lpRect)->top)
  42. #define PL_PEEPER_PORT 5180
  43. // SOCKET buffer max length
  44. #define PL_SOCKET_MAXBYTES 1024
  45. // GET dib message
  46. #define PL_GET_DIB_MESSAGE WM_USER + 0x01
  47. // CONNECT server message
  48. #define PL_CONNECT_MESSAGE WM_USER + 0x02
  49. // PEEPER notify message
  50. #define PL_PEEPER_NOTIFY WM_USER + 0x0A
  51. #define PL_PEEPER_NOTIFY_CLOSE WM_USER + 0xA1
  52. #define PL_PEEPER_NOTIFY_CONNECT WM_USER + 0xA2
  53. #define PL_PEEPER_NOTIFY_DISCONNECT WM_USER + 0xA3
  54. // copy file notify message
  55. // wParam = X% 0~100
  56. #define PL_PEEPER_NOTIFY_COPYFILE   WM_USER + 0xA4
  57. //define peeper server version
  58. #define PEEPER_SERVER_VER_10 ("Ver 1.0")
  59. #define PEEPER_SERVER_VER_12 ("Ver 1.2")
  60. #define PEEPER_SERVER_VER_15 ("Ver 1.5")
  61. #define PEEPER_SERVER_VER_20 ("Ver 2.0")
  62. #define PEEPER_SERVER_VER_25 ("Ver 2.5")
  63. #define PEEPER_SERVER_VER_30 ("Ver 3.0")
  64. // UPDATE desktop timer
  65. #define PL_DIB_TIMER 200
  66. #define PL_DIB_TIMERID 50
  67. #define PL_SOCKET_RETRYTIME 4000
  68. // DEFINE enable/disable event
  69. #define PL_ENABLE_NONE 0x00000000
  70. #define PL_ENABLE_MOUSE_MOVE 0x00000001
  71. #define PL_ENABLE_MOUSE_LBUTTON 0x00000002
  72. #define PL_ENABLE_MOUSE_RBUTTON 0x00000004
  73. #define PL_ENABLE_MOUSE_LDBLCLK 0x00000008
  74. #define PL_ENABLE_MOUSE_RDBLCLK 0x00000010
  75. #define PL_ENABLE_KEY 0x00000020
  76. #define PL_ENABLE_DIB 0x00000040
  77. #define PL_ENABLE_ALL 0xFFFFFFFF
  78. // CLOSE server
  79. #define PL_CLOSE_PEEPER 0xDF
  80. // NONE define
  81. #define PL_NONE 0x00
  82. //get server version
  83. #define PL_PEEPER_VER 0x01
  84.         //server:Flag+(char*)
  85.         //client:Flag
  86. // TEMP define
  87. #define PL_TEMP 0x03
  88. // RETURN BOOL result 
  89. #define PL_RETURN_BOOL 0x04
  90.         //Flag+(BOOL)
  91. // CLIENT close
  92. #define PL_CLIENT_CLOSE 0x05
  93.         //Flag
  94. // MESSAGE define
  95. #define PL_MSG 0x08
  96.         //Flag+(char*)
  97. // SCREEN size
  98. #define PL_SCREEN_SIZE 0x09
  99.         //Flag+(int)(x)+(int)(y)
  100. // DIB define
  101. #define PL_DIB 0x11
  102.         //Server:Flag+(PL_ColorType)+(PL_ZipType)
  103.         //Client:Flag+(int)(nSize)
  104. // DIB zip and unzip
  105. #define PL_DIB_BITS 0x12
  106.         //Flag+(int)(nBits)
  107. // MOUSE define
  108. #define PL_MOUSE_MOVE 0x21
  109.         //Flag+(int)(x)+(int)(y)
  110. #define PL_MOUSE_LBUTTONDOWN 0x22
  111.         //Flag+(int)(x)+(int)(y)
  112. #define PL_MOUSE_LBUTTONUP 0x23
  113.         //Flag+(int)(x)+(int)(y)
  114. #define PL_MOUSE_RBUTTONDOWN 0x24
  115.         //Flag+(int)(x)+(int)(y)
  116. #define PL_MOUSE_RBUTTONUP 0x25
  117.         //Flag+(int)(x)+(int)(y)
  118. #define PL_MOUSE_LDBLCLK 0x26
  119.         //Flag+(int)(x)+(int)(y)
  120. #define PL_MOUSE_RDBLCLK 0x27
  121.         //Flag+(int)(x)+(int)(y)
  122. // KEYBOARD define
  123. #define PL_KEY_DOWN 0x31
  124.         //Flag+(UINT)(VK)+(UINT)(nFlag)
  125. #define PL_KEY_UP 0x32
  126.         //Flag+(UINT)(VK)+(UINT)(nFlag)
  127. // OTHER function
  128. // EXECUTE command line
  129. #define PL_FUNC_EXEC 0x81
  130.         //Flag+(char *)
  131. // LOCK and UNLOCK desktop
  132. #define PL_FUNC_LOCK 0x82
  133.         //Flag+(BOOL)  
  134. // EXIT window
  135. #define PL_FUNC_EXITWIN 0x83
  136.         //Flag+(UINT)
  137. // SEND Ctrl+Alt+Del
  138. #define PL_FUNC_CTRL_ALT_DEL 0x84
  139.         //Flag
  140. // COPY a local file to remote computer
  141. #define PL_FUNC_FILE_COPY_S 0x85
  142.         //Flag+(char*)
  143. // COPY a remote file to client computer
  144. #define PL_FUNC_FILE_COPY_C 0x86
  145.         //Flag+(char*)
  146. // DELETE a remote file
  147. #define PL_FUNC_FILE_DELETE 0x87
  148.         //Flag+(char*)
  149. // RENAME a remote file
  150. #define PL_FUNC_FILE_MOVE 0x88
  151.         //Flag+(char*)
  152. // DEFINE color bits
  153. enum PL_ColorType{color_1 = 0, color_4, color_8, color_24, color_max};
  154. // DEFINE zip type
  155. enum PL_ZipType{zip_none = 0, zip_lz77, zip_lzw, zip_jpeg, zip_lzss, zip_ari, zip_max};
  156. // Socket Tools
  157. // init socket
  158. BOOL    WINAPI PL_InitSocket();
  159. // cleanup socket
  160. BOOL    WINAPI PL_TermSocket();
  161. // SEND socket data
  162. int     WINAPI PL_SendSocketData(SOCKET s, BYTE *chData, int nLen, 
  163.  BYTE chFlag = PL_NONE, UINT uFlag = 0);
  164. // RECEIVE socket data
  165. int     WINAPI PL_ReadSocketData(SOCKET s, BYTE *chData, int nLen, 
  166.  BYTE *chFlag = NULL, UINT uFlag = 0);
  167. // Compress and Decompress
  168. // LZ77 
  169. HGLOBAL WINAPI PL_LZ77_Zip(HGLOBAL hUnZip);
  170. HGLOBAL WINAPI PL_LZ77_UnZip(HGLOBAL hZip);
  171. // LZSS
  172. HGLOBAL WINAPI PL_LZSS_Zip(HGLOBAL hUnZip);
  173. HGLOBAL WINAPI PL_LZSS_UnZip(HGLOBAL hZip);
  174. // ARI
  175. HGLOBAL WINAPI PL_ARI_Zip(HGLOBAL hUnZip);
  176. HGLOBAL WINAPI PL_ARI_UnZip(HGLOBAL hZip);
  177. // LZW
  178. HGLOBAL WINAPI PL_LZW_Zip(HGLOBAL hUnZip);
  179. HGLOBAL WINAPI PL_LZW_UnZip(HGLOBAL hZip);
  180. // Dib & Bitmap Function
  181. HBITMAP WINAPI PL_GetBitmap(HWND hWnd);
  182. BOOL    WINAPI PL_Bmp2Gry(HBITMAP hBmp, LPBYTE *lpGryData, SIZE *szGrySize);
  183. BOOL    WINAPI PL_DrawGry(HDC hDC, LPBYTE lpGryData, SIZE szGrySize);
  184. int     WINAPI PL_ColorsNum(LPBYTE lpbi);
  185. int     WINAPI PL_PaletteSize(LPBYTE lpbi);
  186. LPBYTE  WINAPI PL_DIBBits(LPBYTE lpbi);
  187. int     WINAPI PL_DIBWidth(LPBYTE lpDIB);
  188. int     WINAPI PL_DIBHeight(LPBYTE lpDIB);
  189. HDIB    WINAPI PL_BmpToDIB(HBITMAP hBitmap, HPALETTE hPal, int nBits = -1);
  190. BOOL    WINAPI PL_CreateDIBPalette(HDIB hDIB, CPalette* pPal);
  191. BOOL    WINAPI PL_DrawDIB(HDC hDC, LPRECT lpDCRect, HDIB hDIB, LPRECT lpDIBRect, CPalette* pPal);
  192. BOOL    WINAPI PL_DrawBmp(HDC hDC, LPRECT lpDCRect, HBITMAP hBmp, LPRECT lpBmpRect, CPalette* pPal);
  193. // Mouse Control Function
  194. SIZE    WINAPI PL_GetScreenSize();
  195. void    WINAPI PL_MouseMove(POINT point);
  196. void    WINAPI PL_MouseLButtonDown(POINT point, BOOL bMove = FALSE);
  197. void    WINAPI PL_MouseLButtonUp(POINT point, BOOL bMove = FALSE);
  198. void    WINAPI PL_MouseRButtonDown(POINT point, BOOL bMove = FALSE);
  199. void    WINAPI PL_MouseRButtonUp(POINT point, BOOL bMove = FALSE);
  200. void    WINAPI PL_MouseLButtonDblClk(POINT point, BOOL bMove = FALSE);
  201. void    WINAPI PL_MouseRButtonDblClk(POINT point, BOOL bMove = FALSE);
  202. // Keyboard Control Function
  203. void    WINAPI PL_KeyDown(UINT uChar, UINT uFlag);
  204. void    WINAPI PL_KeyUp(UINT uChar, UINT uFlag);
  205. // Other/Tools function
  206. BOOL    WINAPI PL_GetHostName(char *chIP, char *chName = NULL);
  207. int     WINAPI PL_ExecuteCommand(char *chCommandLine);
  208. void    WINAPI PL_LockDesktop(BOOL bLock = TRUE);
  209. BOOL    WINAPI PL_ExitWindow(UINT uFlag);
  210. void    WINAPI PL_Send_CtrlAltDel();// 未能实现
  211. BOOL    WINAPI PL_CopyFileClient(CString strIP, UINT uPort, char *chSrc, 
  212.  BOOL bSend = TRUE, HWND hNotifyWnd = NULL);
  213. BOOL    WINAPI PL_CopyFileServer(UINT uPort, char *chDes, BOOL bSend = FALSE, 
  214.  HWND hNotifyWnd = NULL);
  215. BOOL    WINAPI PL_DeleteFile(char *chFileName);
  216. BOOL    WINAPI PL_MoveFile(char *chSrcFileName, char *chDesFileName);
  217. // Send Mail function
  218. // USE SMTP protocol
  219. BOOL    WINAPI PL_SendMail(CString strSMTP, CString strFrom, 
  220.    CString strTo, CString strSubject, CString strBody);
  221. // USE ESMTP protocol
  222. BOOL    WINAPI PL_SendMail2(CString strSMTP, CString strFrom, 
  223.  CString strAuth, CString strPass,
  224.  CString strTo, CString strSubject, 
  225.  CString strBody);
  226. //Detect Internet connect
  227. BOOL    WINAPI PL_DetectInternetConnect(CString strHTTP = _T("http://www.163.com"));
  228. //Read data from a file
  229. HGLOBAL WINAPI PL_ReadDataFromFile(CString strFile);
  230. //Write data to a file
  231. BOOL    WINAPI PL_WriteDataToFile(CString strFile, HGLOBAL hData);
  232. #ifdef __cplusplus
  233. }
  234. #endif
  235. #endif //__PEEPER_LIB_H__