Leaked source code of windows server 2003
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.

68 lines
1.7 KiB

  1. // NamedPipe.h
  2. #pragma once
  3. #include "Transport.h"
  4. #define CALLBACK_BUFFSIZE 2048
  5. struct READ_DATA
  6. {
  7. OVERLAPPED overlap;
  8. BYTE cBuffer[CALLBACK_BUFFSIZE];
  9. class CNamedPipeClient *pThis;
  10. };
  11. class CNamedPipeClient : public CTransport
  12. {
  13. public:
  14. CNamedPipeClient();
  15. virtual ~CNamedPipeClient();
  16. // Overrideables
  17. virtual IsReady();
  18. virtual BOOL SendData(LPBYTE pBuffer, DWORD dwSize);
  19. virtual void Deinit();
  20. virtual BOOL InitCallback();
  21. virtual void SendMsgReply(NC_SRVMSG_REPLY *pReply);
  22. // Init function.
  23. virtual BOOL Init(LPCWSTR szBasePipeName, LPCWSTR szBaseProviderName);
  24. BOOL SignalProviderDisabled();
  25. protected:
  26. HANDLE // Objects visible to P2 client but created by the server.
  27. m_hPipe,
  28. m_heventProviderReady,
  29. // Other handles used for implementation
  30. m_hthreadReady,
  31. m_heventDone;
  32. WCHAR m_szPipeName[MAX_PATH],
  33. m_szProviderReadyEvent[MAX_PATH];
  34. BOOL m_bDone;
  35. void DeinitPipe();
  36. BOOL GetPipe();
  37. static DWORD WINAPI ProviderReadyThreadProc(CNamedPipeClient *pThis);
  38. static void WINAPI CompletedReadRoutine(
  39. DWORD dwErr,
  40. DWORD nBytesRead,
  41. LPOVERLAPPED pOverlap);
  42. BOOL StartReadyThreadProc();
  43. long DealWithBuffer(READ_DATA* pData, DWORD dwOrigBytesRead,
  44. BOOL* pbClosePipe);
  45. // Callback properties.
  46. HANDLE m_heventCallbackReady,
  47. m_hthreadCallbackListen;
  48. // Callback methods.
  49. static DWORD WINAPI CallbackListenThreadProc(CNamedPipeClient *pThis);
  50. BOOL StartCallbackListenThread();
  51. };