SysModule.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. #pragma once
  2. #ifndef _SYSMODULE_
  3. #define _SYSMODULE_
  4. #ifndef SYSMODULE
  5. #define SYSMODULE extern "C" _declspec(dllexport)
  6. #else
  7. #undef SYSMODULE
  8. #define SYSMODULE extern "C" _declspec(dllimport)
  9. #endif
  10. #define CLSID_BASEMODULE L"{DA90D68D-99EB-45D5-A969-BC3D0D12D92A}"
  11. #pragma pack(push,1)
  12. class IBaseCurl;
  13. class IServerList;
  14. class IUserinfo;
  15. //获取其他类的指针
  16. class IBaseGloablModule
  17. {
  18. public:
  19. virtual ~IBaseGloablModule(void) {}
  20. ////获取错误的消息
  21. //virtual LPCSTR GetLastErrorA() = 0;
  22. //virtual LPCWSTR GetLastErrorW() = 0;
  23. virtual IBaseCurl* GetBaseCurlInstance() = 0;
  24. virtual INT AddRef() = 0;
  25. virtual INT Release() = 0;
  26. };
  27. template<typename T>
  28. class IInstanceList
  29. {
  30. public:
  31. IInstanceList(void)
  32. {
  33. m_pNext = NULL;
  34. m_pPrev = NULL;
  35. }
  36. virtual ~IInstanceList(void)
  37. {
  38. Detach();
  39. }
  40. virtual void AddInstance(T* pInstance)
  41. {
  42. if (m_pNext && (m_pNext != pInstance))
  43. m_pNext->AddInstance(pInstance);
  44. else
  45. {
  46. pInstance->m_pPrev = (T*)this;
  47. m_pNext = pInstance;
  48. }
  49. }
  50. virtual void Detach()
  51. {
  52. if (m_pNext)
  53. m_pNext->m_pPrev = m_pPrev;
  54. if (m_pPrev)
  55. m_pPrev->m_pNext = m_pNext;
  56. m_pPrev = m_pNext = NULL;
  57. }
  58. T* m_pPrev;
  59. T* m_pNext;
  60. };
  61. struct SPROXY_NET
  62. {
  63. int sid;
  64. int groupid;
  65. char addproxy[64];
  66. char username[64];
  67. char password[64];
  68. char processname[64];
  69. char title[64];
  70. int port;
  71. int status;
  72. int id;
  73. int pid;
  74. int isros;
  75. int proxy_type;
  76. bool select;
  77. int count;
  78. int mid; //模拟器ID
  79. //查找结构体e是否存在
  80. bool operator == (const SPROXY_NET& e) {
  81. return (this->id == e.id);
  82. }
  83. //查找数值
  84. bool operator == (const int& id) {
  85. return (this->id == id);
  86. }
  87. };
  88. struct PROESSSHOW
  89. {
  90. char title[64];
  91. int pid;
  92. };
  93. struct ProcessInfo
  94. {
  95. int id;
  96. wchar_t gnmae[256];
  97. wchar_t proceessname[256];
  98. int select;
  99. };
  100. struct USERINFO
  101. {
  102. char username[64];
  103. char password[64];
  104. char expiretime[64];
  105. int id;
  106. int number;
  107. int alreadycount;
  108. };
  109. /**
  110. 服务器组
  111. */
  112. struct ServerGroup
  113. {
  114. int id;
  115. char title[64];
  116. };
  117. class IServerListCallback
  118. {
  119. public:
  120. virtual ~IServerListCallback(void) {};
  121. virtual void ServerListCallback() = 0;
  122. };
  123. class IServerList
  124. : public IInstanceList<IServerList>
  125. {
  126. public:
  127. virtual ~IServerList(void) {};
  128. };
  129. class IUserinfo
  130. : public IInstanceList<IUserinfo>
  131. {
  132. public:
  133. virtual ~IUserinfo(void) {};
  134. };
  135. enum HTTPRET
  136. {
  137. http_no = 0,
  138. http_f,
  139. http_yes,
  140. http_start,
  141. http_end,
  142. };
  143. //请求网络接口
  144. class IBaseCurl
  145. : public IInstanceList<IBaseCurl>
  146. {
  147. public:
  148. virtual ~IBaseCurl(void) {};
  149. virtual HTTPRET GetHttpConnectstatus() = 0;
  150. virtual LPCSTR GetLastErrorA() = 0;
  151. };
  152. SYSMODULE IBaseGloablModule* WINAPI GetBaseGlobalInstance();
  153. SYSMODULE BOOL WINAPI ReleaseBaseGlobalInstance();
  154. #pragma pack(pop)
  155. #endif