瀏覽代碼

#IQRV #comment [Module] 资源监控实体在Windows下编译通过

gifur 4 年之前
父節點
當前提交
cb13462322

+ 37 - 0
Module/mod_ResourceWatcher/CMakeLists.txt

@@ -0,0 +1,37 @@
+define_module("ResourceWatcher")
+
+set(${MODULE_PREFIX}_SRCS 
+    EventLog.h
+    EventLogW.h
+    FileInfo.h
+    FileSimpleComp.h
+    mod_ResourceWatcher.h
+    ResourceWatcherFSM.h
+    ResourceWatcher_def_g.h
+    ResourceWatcher_msg_g.h
+    ResourceWatcher_server_g.h
+
+    EventLog.cpp
+    EventLogW.cpp
+    mod_ResourceWatcher.cpp
+    ResourceWatcherFSM.cpp
+)
+
+
+set(MOD_VERSION_STRING "1.0.0-dev1")
+add_module_libraries(${MODULE_PREFIX} ${MODULE_NAME} ${MOD_VERSION_STRING})
+
+set(${MODULE_PREFIX}_LIBS ${MODULE_BASE_LIBS})
+
+if(MSVC)
+set(${MODULE_PREFIX}_LIBS ${${MODULE_PREFIX}_LIBS} ws2_32 mbnapi_uuid pdh)
+endif(MSVC)
+
+target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS})  
+
+target_include_directories(${MODULE_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}
+    ${MODULE_BASE_DIR}/mod_cardswiper
+    ${DevHeadPath}
+)
+
+deploy_module(${MODULE_PREFIX} ${MODULE_NAME})

+ 0 - 9
Module/mod_ResourceWatcher/EventLogW.h

@@ -14,15 +14,6 @@
 #define EXT_EVTLOG_NAME L".evtlog"
 
 
-#define _U      0x01    /* upper */ 
-#define _L      0x02    /* lower */  
-#define _D      0x04    /* digit */ 
-#define _C      0x08    /* cntrl */ 
-#define _P      0x10    /* punct */ 
-#define _S      0x20    /* white space (space/lf/tab) */ 
-#define _X      0x40    /* hex digit */ 
-//#define _SP     0x80    /* hard space (0x20) */ 
-
 extern unsigned char _ctype[]; 
 #define isdigit(c) ((_ctype+1)[c]&(_D)) 
  

+ 6 - 0
Module/mod_ResourceWatcher/PolicyConfig.h

@@ -5,9 +5,13 @@
 // @author EreTIk
 // ----------------------------------------------------------------------------
 
+#ifndef RVC_POLICY_CONFIG_H__
+#define RVC_POLICY_CONFIG_H__
 
 #pragma once
 
+#include <mmeapi.h>
+#include <mmdeviceapi.h>
 
 interface DECLSPEC_UUID("f8679f50-850a-41cf-9c72-430f290290c8")
 	IPolicyConfig;
@@ -178,3 +182,5 @@ public:
 		INT
 		);  // not available on Windows 7, use method from IPolicyConfig
 };
+
+#endif //RVC_POLICY_CONFIG_H__

+ 3 - 4
Module/mod_ResourceWatcher/ResourceWatcherFSM.cpp

@@ -1,4 +1,4 @@
-#include "StdAfx.h"
+#include "stdafx.h"
 #include "ResourceWatcherFSM.h"
 #include "DeviceBaseClass.h"
 #include <string.h>
@@ -8,10 +8,9 @@
 #include <ShlObj.h>
 #include <Pdh.h>
 #include "fileutil.h"
-#pragma comment(lib, "pdh.lib")
-
-#include "Mmdeviceapi.h"
 #include "PolicyConfig.h"
+#include "shellapi.h"
+#include "Mmdeviceapi.h"
 #include "Propidl.h"
 #include "Functiondiscoverykeys_devpkey.h"
 

+ 4 - 7
Module/mod_ResourceWatcher/ResourceWatcherFSM.h

@@ -25,14 +25,11 @@
 
 using namespace std;
 
-#pragma comment(lib, "ws2_32.lib")
-#pragma comment(lib, "mbnapi_uuid.lib")
+#include "CardSwiper_client_g.h"
+#include "CardSwiper_msg_g.h"
+#include "CardSwiper_def_g.h"
 
-#include "../mod_cardswiper/CardSwiper_client_g.h"
-#include "../mod_cardswiper/CardSwiper_msg_g.h"
-#include "../mod_cardswiper/CardSwiper_def_g.h"
-
-#include "../EventCode.h"
+#include "EventCode.h"
 #include "FileSimpleComp.h"
 
 #define DEFAULT_INTERVAL 1000

+ 6 - 4
Module/mod_ResourceWatcher/mod_ResourceWatcher.h

@@ -1,5 +1,7 @@
 #pragma once
 
+#include "modVer.h"
+#include "SpTest.h"
 #include "ResourceWatcherFSM.h"
 
 class ResourceWatcherEntity;
@@ -40,6 +42,10 @@ public:
 		return "ResourceWatcher";
 	}
 
+    const char* GetEntityVersion() const { return MODULE_VERSION_FULL; }
+
+    ON_ENTITYT_TEST()
+
 	virtual CServerSessionBase* OnNewSession(const char* , const char * )
 	{
 		LOG_FUNCTION();
@@ -118,9 +124,6 @@ public:
 		FetchEvent* evt = new FetchEvent();
 		evt->ctx = ctx;
 		m_fsm.PostEventFIFO(evt);
-		//ctx->Ans.signal = m_fsm.GetSignalVal();
-		//ctx->Ans.status = m_fsm.GetNetStatus();
-		//ctx->Answer(Error_Succeed);
 	}
 
 	void GetDevInfo(SpReqAnsContext<ResourceWatcherService_GetDevInfo_Req, 
@@ -146,7 +149,6 @@ public:
 		SpReqAnsContext<ResourceWatcherService_OperateFile_Req, 
 		ResourceWatcherService_OperateFile_Ans>::Pointer ctx)
 	{
-		//m_fsm.ProcessFileOperation(ctx);
 		OperateFileEvent* evt = new OperateFileEvent();
 		evt->m_ctx = ctx;
 		m_fsm.PostEventFIFO(evt);