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.

143 lines
3.8 KiB

  1. /*
  2. * msnspa.h
  3. */
  4. #define STRICT
  5. #include <windows.h>
  6. #include <winsock.h>
  7. #define SECURITY_WIN32
  8. #include <issperr.h>
  9. #include <sspi.h>
  10. #define IDD_MAIN 1
  11. #define IDC_NEWS 16
  12. #define IDC_MAIL 17
  13. #define IDI_MAIN 1
  14. #ifndef RC_INVOKED
  15. #include <windowsx.h>
  16. typedef LPVOID PV;
  17. #define BEGIN_CONST_DATA data_seg(".text", "CODE")
  18. #define END_CONST_DATA data_seg(".data", "DATA")
  19. #define INLINE static __inline
  20. #define INTERNAL WINAPI
  21. #define EXTERNAL WINAPI
  22. #ifndef ARRAYSIZE
  23. #define ARRAYSIZE(a) (sizeof(a)/sizeof(a[0]))
  24. #endif
  25. /*
  26. * Plenty big enough for authorization.
  27. */
  28. #define PLENTY_BIG 1024
  29. /*
  30. * Private structure used to keep track of Win32 authorization state.
  31. */
  32. typedef struct WIN32AUTHSTATE {
  33. CredHandle hCred;
  34. CtxtHandle hCtxt;
  35. ULONG fContextReq;
  36. BOOL fHCredValid;
  37. BOOL fHCtxtValid;
  38. char szBuffer[PLENTY_BIG];
  39. } WIN32AUTHSTATE, *PWIN32AUTHSTATE;
  40. BOOL INTERNAL
  41. Security_AcquireCredentials(PWIN32AUTHSTATE pwas, LPTSTR ptszPackage);
  42. BOOL INTERNAL Security_GetNegotiation(PWIN32AUTHSTATE pwas);
  43. BOOL INTERNAL
  44. Security_GetResponse(PWIN32AUTHSTATE pwas, LPSTR szChallenge);
  45. void INTERNAL
  46. Security_ReleaseCredentials(PWIN32AUTHSTATE pwas);
  47. /*****************************************************************************/
  48. #define BUFSIZE 1024
  49. /*
  50. * Private structure used to keep track of conversation with server.
  51. */
  52. typedef struct CONNECTIONSTATE { /* cxs */
  53. SOCKET ssfd; /* Socket to server */
  54. SOCKET scfd; /* Socket to client */
  55. struct PROXYINFO *pproxy; /* Info about who we are */
  56. char buf[BUFSIZE]; /* Working buffer */
  57. int nread; /* Size of buffer */
  58. } CONNECTIONSTATE, *PCONNECTIONSTATE;
  59. #define EOL TEXT("\r\n")
  60. #ifdef DBG
  61. void __cdecl Squirt(LPCTSTR ptszMsg, ...);
  62. #else
  63. #define Squirt sizeof
  64. #endif
  65. void __cdecl Die(LPCTSTR ptszMsg, ...);
  66. int sendsz(SOCKET s, LPCSTR psz);
  67. //DWORD INTERNAL POP3_Main(LPVOID pvRef);
  68. //void POP3_Negotiate(PCONNECTIONSTATE pcxs);
  69. //DWORD INTERNAL NNTP_Main(LPVOID pvRef);
  70. //void NNTP_Negotiate(PCONNECTIONSTATE pcxs);
  71. HWND INTERNAL UI_Init(void);
  72. void INTERNAL UI_Term(void);
  73. void INTERNAL UI_UpdateCounts(void);
  74. extern HINSTANCE g_hinst;
  75. extern int g_cMailUsers;
  76. extern int g_cNewsUsers;
  77. /*****************************************************************************
  78. *
  79. * proxy.c
  80. *
  81. *****************************************************************************/
  82. SOCKET INTERNAL
  83. init_send_socket(SOCKET scfd, LPCSTR pszHost, u_short port, LPCSTR pszErrMsg);
  84. SOCKET INTERNAL
  85. create_listen_socket(u_short port);
  86. /*****************************************************************************
  87. *
  88. * PROXYINFO
  89. *
  90. *****************************************************************************/
  91. typedef BOOL (CALLBACK *NEGOTIATE)(SOCKET s);
  92. typedef struct PROXYINFO {
  93. u_short localport; /* The port we listen on */
  94. u_short serverport; /* The port we talk to */
  95. LPCSTR pszHost; /* The host we proxy to */
  96. PINT piUsers; /* Variable that tracks number of users */
  97. NEGOTIATE Negotiate; /* Negotiates security info */
  98. LPCSTR pszError; /* Error on failed connect */
  99. LPCSTR pszErrorPwd; /* Error on bad password */
  100. LPCSTR pszResponse; /* What to respond to ignored cmds */
  101. char szIgnore1[5]; /* First 4-char command to ignore */
  102. char szIgnore2[5]; /* Second 4-char command to ignore */
  103. } PROXYINFO, *PPROXYINFO;
  104. extern PROXYINFO g_proxyPop;
  105. extern PROXYINFO g_proxyNntp1;
  106. extern PROXYINFO g_proxyNntp2;
  107. DWORD CALLBACK ProxyThread(LPVOID pvRef);
  108. #endif