Bläddra i källkod

#IQRV #comment [Module] Linux下编译通过GUI Console

gifur 5 år sedan
förälder
incheckning
78d790c766

+ 16 - 1
Module/mod_guiconsole/CMakeLists.txt

@@ -1,5 +1,6 @@
 define_module("GUIConsole")
 
+if(MSVC)
 set(${MODULE_PREFIX}_SRCS
 	GUIConsoleFSM.cpp
 	GUIConsoleFSM.h
@@ -9,10 +10,21 @@ set(${MODULE_PREFIX}_SRCS
 	mainfrm.h
 	MaterialMgrCnn.cpp
 	import_libSysInit.cpp
-	mod_GuiConsole.cpp
+	mod_guiconsole.cpp
 	stdafx2.cpp
 	mod_guiconsole.rc
 	)
+else()
+set(${MODULE_PREFIX}_SRCS
+	GUIConsoleFSM.cpp
+	GUIConsoleFSM.h
+	guitask.cpp
+	guitask.h
+	MaterialMgrCnn.cpp
+	mod_guiconsole.cpp
+	stdafx2.cpp
+	)
+endif(MSVC)
 
 set(MOD_VERSION_STRING "0.0.1-dev1")
 add_module_libraries(${MODULE_PREFIX} ${MODULE_NAME} ${MOD_VERSION_STRING})
@@ -24,11 +36,14 @@ target_include_directories(${MODULE_NAME} PRIVATE
 	${MODULE_BASE_DIR}/mod_UpgradeMgr
 	${MODULE_BASE_DIR}/mod_cardissuer
 	${MODULE_BASE_DIR}/mod_MaintainWatcher
+	${MODULE_BASE_DIR}/mod_cardissuer
 )
 
 # 添加实体需要依赖的其他共享库(包括系统库)
 set(${MODULE_PREFIX}_LIBS ${MODULE_BASE_ALL_LIBS})
 if(MSVC)
+	conan_cmake_run(REQUIRES WTL/8.1.12085@LR04.02_ThirdParty/stable BASIC_SETUP CMAKE_TARGETS)
+	add_subdirectory(${CONAN_WTL_ROOT} ${CMAKE_CURRENT_BINARY_DIR}/WTL)
 	list(APPEND ${MODULE_PREFIX}_LIBS Comdlg32 WTL)
 endif(MSVC)
 target_link_libraries(${MODULE_NAME} ${${MODULE_PREFIX}_LIBS} )

+ 1 - 1
Module/mod_guiconsole/ChangeLog

@@ -1,3 +1,3 @@
-* *TODO*: 将WTL从ThirdParty移到Conan管理
+* 将WTL从ThirdParty移到Conan管理(廖桂发,2020年11月18日)
 * 在Windows下编译通过,依赖WTL第三方开源库(仅需头文件)(廖桂发,2020年11月14日)
 * 依赖 libSysInit.dll 库

+ 9 - 16
Module/mod_guiconsole/GUIConsoleFSM.cpp

@@ -1,4 +1,4 @@
-#include "StdAfx2.h"
+#include "stdafx2.h"
 #include "GUIConsoleFSM.h"
 
 CGUIConsoleFSM::CGUIConsoleFSM()
@@ -51,16 +51,15 @@ void CGUIConsoleFSM::s1_on_entry()
 	pFunc->SetSysVar("LocalMaintain", "N");
 	
 	// 维护窗口显示到后台
-	//if (m_bTopMostWin)
-	{
-		m_pGuiTask->SetWindowPosition(false);
-		m_bTopMostWin = false;
+#if defined(RVC_OS_WIN)
+    m_pGuiTask->SetWindowPosition(false);
+    m_bTopMostWin = false;
 
-		HWND hWnd = FindWindow(_T("Shell_TrayWnd"), NULL);
-		if (hWnd != NULL) {
-			SendMessage(hWnd, WM_COMMAND, 419, 0);
-		}
-	}
+    HWND hWnd = FindWindow(_T("Shell_TrayWnd"), NULL);
+    if (hWnd != NULL) {
+        SendMessage(hWnd, WM_COMMAND, 419, 0);
+    }
+#endif //RVC_OS_WIN
 
 	//灰显“begin initial”菜单,add by zl 20170228
 	//加开关进行控制,add by zl 20170711
@@ -93,12 +92,6 @@ void CGUIConsoleFSM::s1_on_exit()
 
 unsigned int CGUIConsoleFSM::s1_on_event(FSMEvent* event)
 {
-	//if (event->iEvt == Event_UKeyInserted || event->iEvt == Event_CoverOpen)
-	//{
-	//	// 弹出维护窗口
-	//	m_pGuiTask->SetWindowPosition(true);
-	//}
-
 	return 0;
 }
 		

+ 0 - 1
Module/mod_guiconsole/GUIConsoleFSM.h

@@ -40,7 +40,6 @@ private:
 	BEGIN_FSM_RULE(CGUIConsoleFSM,s1)
 		FSM_RULE_ENTRY_ANY(s1, s2, Event_CoverOpen)
 		FSM_RULE_ENTRY_ANY(s1, s2, Event_UKeyInserted)
-		//FSM_RULE_ENTRY(s2, s3, Event_CertVerified, 0)	// 当前有会话
 		FSM_RULE_ENTRY(s2, s4, Event_CertVerified, 1)	// 当前无会话,普通权限
 		FSM_RULE_ENTRY(s2, s5, Event_CertVerified, 2)	// 当前无会话,高级权限
 		FSM_RULE_ENTRY(s3, s4, Event_SessionEnd, 1)		// 无高级权限

+ 41 - 27
Module/mod_guiconsole/MaterialMgrCnn.cpp

@@ -1,6 +1,12 @@
-#include "StdAfx2.h"
+#include "stdafx2.h"
 #include "MaterialMgrCnn.h"
+#include "md5.h"
 
+#if defined(RVC_OS_LINUX)
+
+#define strncpy_s(d, l, s, n) strcpy(d, s)
+
+#endif //RVC_OS_LINUX
 
 CMaterialMgrCnn::CMaterialMgrCnn(CEntityBase *pEntity)
 :SpSecureClient(pEntity)
@@ -12,28 +18,36 @@ CMaterialMgrCnn::~CMaterialMgrCnn()
 {
 }
 
-ErrorCodeEnum CMaterialMgrCnn::GetMD5(char *pStr, BYTE md5[16])
+ErrorCodeEnum CMaterialMgrCnn::GetMD5(char *pStr, BYTE md5v[16])
 {
-	HCRYPTPROV hCryptProv;
-	ErrorCodeEnum rc = Error_Unexpect;
-	
-	if (CryptAcquireContextA(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT|CRYPT_MACHINE_KEYSET)) 
-	{
-		HCRYPTHASH hHash;
-		if (CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, &hHash)) 
-		{
-			CryptHashData(hHash, (LPBYTE)pStr, strlen(pStr), 0);
+#if defined(_MSC_VER)
+    HCRYPTPROV hCryptProv;
+    ErrorCodeEnum rc = Error_Unexpect;
+
+    if (CryptAcquireContextA(&hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT | CRYPT_MACHINE_KEYSET)) {
+        HCRYPTHASH hHash;
+        if (CryptCreateHash(hCryptProv, CALG_MD5, 0, 0, &hHash)) {
+            CryptHashData(hHash, (LPBYTE)pStr, strlen(pStr), 0);
+
+            DWORD dwLen = 16;
+            CryptGetHashParam(hHash, HP_HASHVAL, (LPBYTE)&md5v[0], &dwLen, 0);
+            rc = Error_Succeed;
+        }
+
+        CryptDestroyHash(hHash);
+    }
+
+    CryptReleaseContext(hCryptProv, 0);
+    return rc;
+#else
+    unsigned char x[MD5_DIGESTSIZE];
+    md5_ctx_t ctx;
+    md5_init(&ctx);
+	md5(x, pStr, strlen(pStr));
+	memcpy(md5v, x, MD5_DIGESTSIZE);
+	return Error_Succeed;
 
-			DWORD dwLen = 16;
-			CryptGetHashParam(hHash, HP_HASHVAL, (LPBYTE)&md5[0], &dwLen, 0);
-			rc = Error_Succeed;
-		}
-			
-		CryptDestroyHash(hHash);		
-	}
-		
-	CryptReleaseContext(hCryptProv, 0);
-	return rc;
+#endif //_MSC_VER
 }
 
 ErrorCodeEnum CMaterialMgrCnn::ModifyEnrolInfo(const char *pszUserID, const char *pszPwd, const char *pszAddr, const char *pszGPS)
@@ -41,11 +55,7 @@ ErrorCodeEnum CMaterialMgrCnn::ModifyEnrolInfo(const char *pszUserID, const char
 	CSmartPointer<IPackage> pReqPkg = CreateNewPackage("ModInfo");
 	
 	ModifyEnrollInfoReq info = {};
-	/*strncpy_s(info.UserID, sizeof(info.UserID), pszUserID, _TRUNCATE);
-	
-	if (pszPwd != NULL)
-		GetMD5(pszPwd, info.Password);*/
-	
+
 	if (pszAddr != NULL)
 		strncpy_s(info.EnrolAddr, sizeof(info.EnrolAddr), pszAddr, _TRUNCATE);
 
@@ -450,7 +460,11 @@ ErrorCodeEnum CMaterialMgrCnn::HandleQueryMaterialInfoRet(const CSmartPointer<IP
 		CardGroove[i] = ret2[i].CardGroove;
 		CardBoxNo[i] = ret2[i].CardBoxNo;
 		char tempStr[200] = "";
-		strncpy_s(tempStr, ret2[i].PsbCode, sizeof(ret2[i].PsbCode));
+#if defined(_MSC_VER)
+        strncpy_s(tempStr, ret2[i].PsbCode, sizeof(ret2[i].PsbCode));
+#else
+		strcpy(tempStr, ret2[i].PsbCode);
+#endif //_MSC_VER
 		tempStr[4] = '\0';
 		PsbCode[i] = tempStr;
 		PsbName[i] = ret2[i].PsbName;

+ 199 - 179
Module/mod_guiconsole/guitask.cpp

@@ -22,88 +22,108 @@ GUITask::~GUITask()
 
 ErrorCodeEnum GUITask::Kickoff(CEntityBase *pEntity)
 {
-	if (m_hThread) {
-		return Error_Duplication;
-	}
+#if defined(RVC_OS_WIN)
 
-	m_pEntity = pEntity;
+    if (m_hThread) {
+        return Error_Duplication;
+    }
 
-	m_hThread = (HANDLE)_beginthreadex(0, 0, &__Process, this, 0, 0);
-	if (!m_hThread) {
-		return Error_Resource;
-	}
+    m_pEntity = pEntity;
+
+    m_hThread = (HANDLE)_beginthreadex(0, 0, &__Process, this, 0, 0);
+    if (!m_hThread) {
+        return Error_Resource;
+    }
+
+    WaitForSingleObject(m_hEventStartReady, INFINITE);
+    return RegistEntityStateEvent();
+
+#else
+
+    return Error_NotSupport;
+
+#endif //RVC_OS_WIN
 
-	WaitForSingleObject(m_hEventStartReady, INFINITE);
-	//SubscribeLog();
-	return RegistEntityStateEvent();
 }
 
 ErrorCodeEnum GUITask::Close()
 {
-	if (!m_hThread) {
-		return Error_NotInit;
-	}
-	
-	UnSubscribeLog();
-	UnregistEntityStateEvent();
+#if defined(RVC_OS_WIN)
 
-	if (m_hWndMainFrame)
-	{
-		PostMessageA(m_hWndMainFrame, WM_CLOSE, -1, -1);
-		WaitForSingleObject(m_hEventStopReady, INFINITE);
-	}
+    if (!m_hThread) {
+        return Error_NotInit;
+}
+
+    UnSubscribeLog();
+    UnregistEntityStateEvent();
+
+    if (m_hWndMainFrame) {
+        PostMessageA(m_hWndMainFrame, WM_CLOSE, -1, -1);
+        WaitForSingleObject(m_hEventStopReady, INFINITE);
+    }
+
+    WaitForSingleObject(m_hThread, INFINITE);
+    CloseHandle(m_hThread);
+    m_hThread = 0;
+
+#endif //RVC_OS_WIN
 
-	WaitForSingleObject(m_hThread, INFINITE);
-	CloseHandle(m_hThread);
-	m_hThread = 0;
 	return Error_Succeed;
 }
 
+#if defined(RVC_OS_WIN)
+
 CAppModule _Module;
 
+#endif //RVC_OS_WIN
+
 void GUITask::Process()
 {
-	ResetEvent(m_hEventStartReady);
-	m_pEntity->GetFunction()->InitLogCurrentThread();
 
-	HRESULT hRes = ::CoInitialize(NULL);
-	// If you are running on NT 4.0 or higher you can use the following call instead to 
-	// make the EXE free threaded. This means that calls come in on a random RPC thread.
-	//	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
-	ATLASSERT(SUCCEEDED(hRes));
+#if defined(RVC_OS_WIN)
 
-	// this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
-	::DefWindowProc(NULL, 0, 0, 0L);
+    ResetEvent(m_hEventStartReady);
+    m_pEntity->GetFunction()->InitLogCurrentThread();
 
-	AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES);	// add flags to support other controls	
-	hRes = _Module.Init(NULL, ModuleBase::GetModuleBase()->GetInstance());
-	ATLASSERT(SUCCEEDED(hRes));
+    HRESULT hRes = ::CoInitialize(NULL);
+    // If you are running on NT 4.0 or higher you can use the following call instead to 
+    // make the EXE free threaded. This means that calls come in on a random RPC thread.
+    //	HRESULT hRes = ::CoInitializeEx(NULL, COINIT_MULTITHREADED);
+    ATLASSERT(SUCCEEDED(hRes));
 
-	ATL::AtlAxWinInit();
+    // this resolves ATL window thunking problem when Microsoft Layer for Unicode (MSLU) is used
+    ::DefWindowProc(NULL, 0, 0, 0L);
 
-	CMessageLoop theLoop;
-	_Module.AddMessageLoop(&theLoop);
+    AtlInitCommonControls(ICC_COOL_CLASSES | ICC_BAR_CLASSES);	// add flags to support other controls	
+    hRes = _Module.Init(NULL, ModuleBase::GetModuleBase()->GetInstance());
+    ATLASSERT(SUCCEEDED(hRes));
 
-	CMainFrame wndMain(this);	
-	if(wndMain.CreateEx() == NULL)
-	{
-		ATLTRACE(_T("Main window creation failed!\n"));
-		return;
-	}
-	
-	m_hWndMainFrame = wndMain.m_hWnd;
-	SetEvent(m_hEventStartReady);
+    ATL::AtlAxWinInit();
+
+    CMessageLoop theLoop;
+    _Module.AddMessageLoop(&theLoop);
+
+    CMainFrame wndMain(this);
+    if (wndMain.CreateEx() == NULL) {
+        ATLTRACE(_T("Main window creation failed!\n"));
+        return;
+    }
 
-	wndMain.ShowWindow(SW_SHOW);
-	int nRet = theLoop.Run();
+    m_hWndMainFrame = wndMain.m_hWnd;
+    SetEvent(m_hEventStartReady);
 
-	_Module.RemoveMessageLoop();
-	_Module.Term();
-	::CoUninitialize();
+    wndMain.ShowWindow(SW_SHOW);
+    int nRet = theLoop.Run();
 
-	
-	SetEvent(m_hEventStopReady);
-	m_hWndMainFrame = NULL;
+    _Module.RemoveMessageLoop();
+    _Module.Term();
+    ::CoUninitialize();
+
+
+    SetEvent(m_hEventStopReady);
+    m_hWndMainFrame = NULL;
+
+#endif //RVC_OS_WIN
 }
 
 ErrorCodeEnum GUITask::RegistEntityStateEvent()
@@ -142,12 +162,16 @@ ErrorCodeEnum GUITask::ReqFrameworkQuit(bool bRebootOS)
 
 ErrorCodeEnum GUITask::SubscribeLog()
 {
-	return m_pEntity->GetFunction()->SubscribeLog(m_logSubID,  this, Log_Ignore, Severity_None, Error_IgnoreAll, -1, NULL, false);
+#if defined(_MSC_VER)
+    return m_pEntity->GetFunction()->SubscribeLog(m_logSubID, this, Log_Ignore, Severity_None, Error_IgnoreAll, -1, NULL, false);
+#else
+	return Error_NotSupport;
+#endif //_MSC_VER
 }
 
 ErrorCodeEnum GUITask::UnSubscribeLog()
 {
-	if ((__int64)m_logSubID != 0)
+	if (HasSubscibeLog())
 	{
 		m_pEntity->GetFunction()->UnsubscribeLog(m_logSubID);
 		m_logSubID = 0;
@@ -196,8 +220,6 @@ ErrorCodeEnum GUITask::BeginInitialize()
 	auto rc = pClient->Connect();
 	if (rc == Error_Succeed)
 	{
-		//Dbg("connect to entity [Initializer] succeed, start initialize now");
-
 		InitializerService_Initialize_Info info = {};
 		rc = pClient->Initialize(info);
 		pClient->GetFunction()->CloseSession();
@@ -219,7 +241,7 @@ ErrorCodeEnum GUITask::ShowMobileDialog()
 		MobileDial::MobileDialService_ShowDialog_Info info = {};
 		rc = pClient->ShowDialog(info);
 		if(rc != 0) {
-			LogError(Severity_Low, rc, 0, CSimpleStringA::Format("Invoke show mobile dialog failed, rc = 0x%X", rc));
+			LogError(Severity_Low, rc, 0, CSimpleStringA::Format("Invoke show mobile dialog failed, rc = %s", SpStrError(rc)));
 		}
 		pClient->GetFunction()->CloseSession();
 	}
@@ -239,19 +261,18 @@ ErrorCodeEnum GUITask::ShowMobileDialog()
 
 ErrorCodeEnum GUITask::DeleteKeySet()
 {
-	HCRYPTPROV hProv(0);
-	if (!CryptAcquireContext(&hProv, "RVC", MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_MACHINE_KEYSET | CRYPT_DELETEKEYSET))
-	{
-		Dbg("delete keyset fail: %d", GetLastError());
-		return Error_Unexpect;
-	}
-	else
-	{
-		Dbg("delete keyset succ");
-		return Error_Succeed;
-	}
-	//auto pEntity = (CGUIConsoleEntity*)m_pEntity;
-	//return pEntity->RegistSwallowedCard("6225887550008888", "4014", "20151014", "141755");
+#if defined(_MSC_VER)
+    HCRYPTPROV hProv(0);
+    if (!CryptAcquireContext(&hProv, "RVC", MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_MACHINE_KEYSET | CRYPT_DELETEKEYSET)) {
+        Dbg("delete keyset fail: %d", GetLastError());
+        return Error_Unexpect;
+    } else {
+        Dbg("delete keyset succ");
+        return Error_Succeed;
+    }
+#else
+	return Error_NotImpl;
+#endif //_MSC_VER
 }
 
 ErrorCodeEnum GUITask::GetFrameworkInfo(CSimpleStringA &strInfo)
@@ -259,9 +280,9 @@ ErrorCodeEnum GUITask::GetFrameworkInfo(CSimpleStringA &strInfo)
 	CSystemStaticInfo info;
 	memset(&info, 0, sizeof(info));
 	auto rc = m_pEntity->GetFunction()->GetSystemStaticInfo(info);
-	if (rc == Error_Succeed)
+	if (rc == Error_Succeed) {
 		strInfo = CSimpleStringA::Format("[%s] [%s]", (const char*) info.strTerminalID, (const char*)info.InstallVersion.ToString());
-
+	}
 	return rc;
 }
 
@@ -446,71 +467,69 @@ ErrorCodeEnum GUITask::GetCustomizeStartMenuList(CAutoArray<StartMenuEntry> &Sta
 
 void GUITask::OnAnswer(CSmartPointer<IAsynWaitSp> pAsynWaitSp)
 {
-	if (m_hWndMainFrame) {
-		CSmartPointer<ICallbackListener> spCallback;
-		CSmartPointer<IReleasable> pData;
-		pAsynWaitSp->GetCallback(spCallback, pData);
-		LOG_ASSERT(pData.GetRawPointer() != NULL);
-		callback_entry *entry = static_cast<callback_entry*>((IReleasable*)pData.GetRawPointer());
-		entry->ErrorResult = pAsynWaitSp->AsyncGetAnswer();
-		callback_entry *new_entry = new callback_entry();
-		new_entry->EntityName = entry->EntityName;
-		new_entry->ErrorResult = entry->ErrorResult;
-		new_entry->op = entry->op;
-		new_entry->state = entry->state;
-		PostMessage(m_hWndMainFrame, WM_GUICONSOLE, 0, (LPARAM)new_entry);
-	}
+#if defined(_MSC_VER)
+    if (m_hWndMainFrame) {
+        CSmartPointer<ICallbackListener> spCallback;
+        CSmartPointer<IReleasable> pData;
+        pAsynWaitSp->GetCallback(spCallback, pData);
+        LOG_ASSERT(pData.GetRawPointer() != NULL);
+        callback_entry* entry = static_cast<callback_entry*>((IReleasable*)pData.GetRawPointer());
+        entry->ErrorResult = pAsynWaitSp->AsyncGetAnswer();
+        callback_entry* new_entry = new callback_entry();
+        new_entry->EntityName = entry->EntityName;
+        new_entry->ErrorResult = entry->ErrorResult;
+        new_entry->op = entry->op;
+        new_entry->state = entry->state;
+        PostMessage(m_hWndMainFrame, WM_GUICONSOLE, 0, (LPARAM)new_entry);
+    }
+#endif //_MSC_VER
 }
 
 
 ErrorCodeEnum GUITask::OutputMsg(const char *pMsg)
 {
-	if (m_hWndMainFrame) {
-		PostMessage(m_hWndMainFrame, WM_SHOW_MSG, 0, (LPARAM)strdup(pMsg));
-		return Error_Succeed;
-	}
-	else
-		return Error_NotExist;
+#if defined(_MSC_VER)
+    if (m_hWndMainFrame) {
+        PostMessage(m_hWndMainFrame, WM_SHOW_MSG, 0, (LPARAM)strdup(pMsg));
+        return Error_Succeed;
+    } else
+        return Error_NotExist;
+#else
+	return Error_NotSupport;
+#endif //_MSC_VER
 }
 
 void GUITask::OnEntityStateHook(const char *pszEntityName,const char *pszTriggerEntity,EntityStateEnum eState,EntityStateEnum eLastState)
 {
-	if (m_hWndMainFrame) {
-		callback_entry *entry = new callback_entry();
-		entry->EntityName = pszEntityName;
-		entry->ErrorResult = Error_Succeed;
-		entry->op = OP_FIRE_ENTITY_STATE;
-		entry->state = eState;
-
-		DWORD dwProcessID = 0;			
-		//if (entry->state != EntityState_Close)		// 关闭状态进程号清0置后
-		{
-			CEntityRunInfo Info;
-			CSmartPointer<IEntityFunction> pFunc = m_pEntity->GetFunction();
-			pFunc->GetEntityRunInfo(entry->EntityName, Info);
-			dwProcessID = Info.dwProcessID;
-		}
+#if defined(_MSC_VER)
+    if (m_hWndMainFrame) {
+        callback_entry* entry = new callback_entry();
+        entry->EntityName = pszEntityName;
+        entry->ErrorResult = Error_Succeed;
+        entry->op = OP_FIRE_ENTITY_STATE;
+        entry->state = eState;
 
-		PostMessage(m_hWndMainFrame, WM_GUICONSOLE, dwProcessID, (LPARAM)entry);
-	}
+        DWORD dwProcessID = 0;
+        //if (entry->state != EntityState_Close)		// 关闭状态进程号清0置后
+        {
+            CEntityRunInfo Info;
+            CSmartPointer<IEntityFunction> pFunc = m_pEntity->GetFunction();
+            pFunc->GetEntityRunInfo(entry->EntityName, Info);
+            dwProcessID = Info.dwProcessID;
+        }
+
+        PostMessage(m_hWndMainFrame, WM_GUICONSOLE, dwProcessID, (LPARAM)entry);
+    }
+#endif //_MSC_VER
 }
 
 void GUITask::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogID,const LogTypeEnum eLogType, const SeverityLevelEnum eLevel,
 		const DWORD dwSysError,const DWORD dwUserCode,const DWORD dwEntityInstanceID, const WORD wEntityDevelID, 
 		const CAutoArray<DWORD> &Param, const char *pszEntityName, const char *pszModuleName,const char *pszMessage)
 {
-	//// 过滤非调试实体信息
-	//if (pszEntityName !=NULL)
-	//{
-	//	CEntityRunInfo info = {};
-	//	auto rc = m_pEntity->GetFunction()->GetEntityRunInfo(pszEntityName, info);
-	//	if (rc == Error_Succeed && info.eDebugLevel  == 0)
-	//		return;
-	//}
-	
 	// 忽略GPIO事件
 	if (dwUserCode == 0x2090000A || dwUserCode == 0x20900009)
-		return;
+			return;
 
 	if (pszMessage!=NULL && strlen(pszMessage)>2)
 	{
@@ -538,77 +557,78 @@ CEntityBase* GUITask::GetEntity()
 
 ErrorCodeEnum GUITask::ShowMaintainView(bool bShow, bool bHighLevel)
 {
-	if (m_hWndMainFrame) {
-		PostMessage(m_hWndMainFrame, WM_SHOW_MAINTAIN_VIEW, bShow?1:0, bHighLevel?1:0);
-		return Error_Succeed;
-	}
-	else
-		return Error_NotExist;
+#if defined(_MSC_VER)
+    if (m_hWndMainFrame) {
+        PostMessage(m_hWndMainFrame, WM_SHOW_MAINTAIN_VIEW, bShow ? 1 : 0, bHighLevel ? 1 : 0);
+        return Error_Succeed;
+    } else
+        return Error_NotExist;
+#else
+	return Error_NotSupport;
+#endif //_MSC_VER
 }
 
 ErrorCodeEnum GUITask::SetWindowPosition(bool bTop)
 {
-	if (m_hWndMainFrame) 
-	{
-		if (bTop)
-		{
-			ShowWindow(m_hWndMainFrame, SW_NORMAL);
-			SetWindowPos(m_hWndMainFrame, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
-			SetWindowPos(m_hWndMainFrame, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
-
-			// 启动软键盘
-			// WinExec("osk.exe", SW_NORMAL);
-			//ShellExecuteA(NULL, "open", "osk.exe", NULL, NULL, SW_SHOW);
-		}
-		else
-		{
-			SetWindowPos(m_hWndMainFrame, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
-			SetWindowPos(m_hWndMainFrame, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
-			ShowWindow(m_hWndMainFrame, SW_MINIMIZE);
-
-			// 关闭软键盘
-			//CloseSoftKeyboard();
-		}
-
-		return Error_Succeed;
-	}
-	else
-		return Error_NotExist;
+#if defined(_MSC_VER)
+    if (m_hWndMainFrame) {
+        if (bTop) {
+            ShowWindow(m_hWndMainFrame, SW_NORMAL);
+            SetWindowPos(m_hWndMainFrame, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+            SetWindowPos(m_hWndMainFrame, HWND_TOP, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+        } else {
+            SetWindowPos(m_hWndMainFrame, HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+            SetWindowPos(m_hWndMainFrame, HWND_BOTTOM, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE);
+            ShowWindow(m_hWndMainFrame, SW_MINIMIZE);
+        }
+        return Error_Succeed;
+    } else
+        return Error_NotExist;
+#else
+	return Error_NotSupport;
+#endif //_MSC_VER
 }
 
 ErrorCodeEnum GUITask::ShowBeginInit(bool bShow)
 {
-	if (m_hWndMainFrame) {
-		PostMessage(m_hWndMainFrame, WM_SHOW_BEGININIT_VIEW, bShow?1:0, -1);
-		return Error_Succeed;
-	}
-	else
-		return Error_NotExist;
+#if defined(_MSC_VER)
+    if (m_hWndMainFrame) {
+        PostMessage(m_hWndMainFrame, WM_SHOW_BEGININIT_VIEW, bShow ? 1 : 0, -1);
+        return Error_Succeed;
+    } else
+        return Error_NotExist;
+#else
+	return Error_NotSupport;
+#endif //_MSC_VER
 }
 
 ErrorCodeEnum GUITask::EnableMobileDialMenu(bool bEnable)
 {
-	if (m_hWndMainFrame) {
-		PostMessage(m_hWndMainFrame, WM_SHOW_MOBILEDIAL_VIEW, bEnable ? 1 : 0, -1);
-		return Error_Succeed;
-	}
-	else {
-		return Error_NotExist;
-	}
+#if defined(_MSC_VER)
+    if (m_hWndMainFrame) {
+        PostMessage(m_hWndMainFrame, WM_SHOW_MOBILEDIAL_VIEW, bEnable ? 1 : 0, -1);
+        return Error_Succeed;
+    } else {
+        return Error_NotExist;
+    }
+#else
+	return Error_NotSupport;
+#endif //_MSC_VER
 }
 
 void GUITask::CloseSoftKeyboard()
 {
-	HANDLE hProcessHandle;
-	ULONG nProcessID;
-	HWND kbWindow;
-	kbWindow = ::FindWindow(NULL, _T("屏幕键盘"));
-	if (NULL != kbWindow)
-	{
-		::GetWindowThreadProcessId(kbWindow, &nProcessID);
-		hProcessHandle = ::OpenProcess(PROCESS_TERMINATE, FALSE, nProcessID);
-		::TerminateProcess(hProcessHandle, 4);
-	}
+#if defined(_MSC_VER)
+    HANDLE hProcessHandle;
+    ULONG nProcessID;
+    HWND kbWindow;
+    kbWindow = ::FindWindow(NULL, _T("屏幕键盘"));
+    if (NULL != kbWindow) {
+        ::GetWindowThreadProcessId(kbWindow, &nProcessID);
+        hProcessHandle = ::OpenProcess(PROCESS_TERMINATE, FALSE, nProcessID);
+        ::TerminateProcess(hProcessHandle, 4);
+    }
+#endif //_MSC_VER
 }
 ErrorCodeEnum GUITask::ShowBlueScreen()
 {

+ 11 - 4
Module/mod_guiconsole/guitask.h

@@ -6,6 +6,10 @@
 #include "SpBase.h"
 #include "SpFSM.h"
 
+#if defined(RVC_OS_LINUX)
+#include <pthread.h>
+#endif //RVC_OS_LINUX
+
 struct EntityEntry
 {
 	CSimpleStringA Name;
@@ -62,7 +66,6 @@ public:
 
 	ErrorCodeEnum Kickoff(CEntityBase *pEntity);
 	ErrorCodeEnum Close();
-	ErrorCodeEnum EnterHighLevelMode();
 	ErrorCodeEnum AsyncStartEntity(const char *entity_name, const char *cmdline, void *pData);
 	ErrorCodeEnum AsyncStopEntity(const char *entity_name, void *pData);
 	ErrorCodeEnum AsyncPauseEntity(const char *entity_name, void *pData);
@@ -73,7 +76,7 @@ public:
 	ErrorCodeEnum GetCustomizeStartMenuList(CAutoArray<StartMenuEntry> &StartItems);
 	ErrorCodeEnum SubscribeLog();
 	ErrorCodeEnum UnSubscribeLog();
-	inline bool HasSubscibeLog(){return (__int64)m_logSubID != 0;}
+	inline bool HasSubscibeLog() const {return (u__int64_t)m_logSubID != 0;}
 	ErrorCodeEnum SetDebugLevel(const char *pszEntity, int nLevel);
 	ErrorCodeEnum GetShellDebugLevel(int &nLevel);
 	ErrorCodeEnum GetFrameworkInfo(CSimpleStringA &strInfo);
@@ -118,12 +121,16 @@ private:
 	ErrorCodeEnum UnregistEntityStateEvent();	
 
 	void Process();
+
 	static unsigned int __stdcall __Process(void *arg)
 	{
 		GUITask *pThis = static_cast<GUITask *>(arg);
 		pThis->Process();
-
-		_endthreadex(0);
+#if defined(RVC_OS_WIN)
+        _endthreadex(0);
+#else
+        pthread_exit(0);
+#endif //RVC_OS_WIN
 		return 0;
 	}
 

+ 5 - 0
Module/mod_guiconsole/import_libSysInit.h

@@ -1,4 +1,8 @@
+#ifndef LIB_SYSTEM_INIT_HEADER_
+#define LIB_SYSTEM_INIT_HEADER_
+
 #pragma once
+
 #include <windows.h>
 
 typedef enum{
@@ -128,3 +132,4 @@ void InitMessage();
 BOOL changeMessageFilter(BOOL bAllow);
 
 
+#endif //LIB_SYSTEM_INIT_HEADER_

+ 6 - 5
Module/mod_guiconsole/mainfrm.cpp

@@ -161,10 +161,6 @@ void CAboutDlg::OnOK4(UINT uNotifyCode, int nID, CWindow wndCtl)
 		return;
 	}
 
-	/*CSimpleStringA str = CSimpleStringA::Format("terminalno: %s, type: %s, model: %s, site: %s, version: %s",
-		(const char*)info.strTerminalID, (const char*)info.strMachineType, (const char*)info.strMachineModel,
-		(const char*)info.strSite, (const char*)info.InstallVersion.ToString());
-	GetDlgItem(IDC_EDIT3).SetWindowTextA(str);*/
 	CSimpleStringA str = CSimpleStringA::Format("terminalno: %s, type: %s, site: %s, version: %s",
 		(const char*)info.strTerminalID, (const char*)info.strMachineType,
 		(const char*)info.strSite, (const char*)info.InstallVersion.ToString());
@@ -2674,6 +2670,11 @@ int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct)
 	}
 
 	CenterWindow();
+
+#ifdef ALL_FUNCTION_SHOW
+	OnShowMaintainView(1, 1, 1);
+	OnShowMaintainView(1, 1, 1);
+#endif
 		
 	return 0;
 }
@@ -2998,7 +2999,7 @@ LRESULT CMainFrame::OnShowBeginInitView( UINT uMsg, WPARAM wParam, LPARAM lParam
 	{
 		menuMain.EnableMenuItem(ID_FILE_INITIALIZE, MF_GRAYED);
 	}
-		
+
 	return 0;
 }
 

+ 10 - 0
Module/mod_guiconsole/mainfrm.h

@@ -3,6 +3,8 @@
 
 #pragma once
 
+#define ALL_FUNCTION_SHOW
+
 #include "resource.h"
 #include "guitask.h"
 
@@ -34,6 +36,10 @@ struct callback_entry : public IReleasable
 	ErrorCodeEnum ErrorResult;
 };
 
+
+#if defined(_MSC_VER)
+
+
 class CMainFrame;
 
 class CCommandEdit : public ATL::CWindowImpl<CCommandEdit, WTL::CEdit>
@@ -390,7 +396,9 @@ public:
 		//MESSAGE_HANDLER_EX(WM_CLOSE, OnClose)
 		MESSAGE_HANDLER_EX(WM_GUICONSOLE, OnGuiConsole)
 		MESSAGE_HANDLER_EX(WM_SHOW_MSG, OnShowMsg)
+#ifndef ALL_FUNCTION_SHOW
 		MESSAGE_HANDLER_EX(WM_SHOW_MAINTAIN_VIEW, OnShowMaintainView)
+#endif
 		MESSAGE_HANDLER_EX(WM_SHOW_BEGININIT_VIEW, OnShowBeginInitView)
 		MESSAGE_HANDLER_EX(WM_SHOW_MOBILEDIAL_VIEW, OnShowMobileDialView)
 		NOTIFY_HANDLER_EX(IDC_LIST1, LVN_ITEMCHANGED, OnListLeftItemchanged)
@@ -511,4 +519,6 @@ private:
 	BOOL m_cansysInitRm;
 };
 
+#endif //_MSC_VER
+
 #endif // __MAIN_FRAME_H

+ 3 - 0
Module/mod_guiconsole/mod_GuiConsole.h

@@ -1,6 +1,8 @@
 #pragma once
 
 #include "SpBase.h"
+#include "modVer.h"
+#include "SpTest.h"
 #include "GUIConsoleFSM.h"
 
 #include "GUIConsole_server_g.h"
@@ -17,6 +19,7 @@ public:
 
 	virtual ~CGUIConsoleEntity() {}
 	virtual const char *GetEntityName() const { return "GUIConsole"; }
+	const char* GetEntityVersion() const { return MODULE_VERSION_FULL; }
 	virtual bool IsService()const{return true;}
 
 	virtual void OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmartPointer<ITransactionContext> pTransactionContext);

+ 7 - 16
Module/mod_guiconsole/mod_guiconsole.cpp

@@ -4,10 +4,9 @@
 #include "EventCode.h"
 #include "MaterialMgrCnn.h"
 
-#include "..\mod_cardissuer\CardIssuer_client_g.h"
+#include "CardIssuer_client_g.h"
 using namespace CardIssuer;
-
-#include "..\mod_MaintainWatcher\MaintainWatcher_client_g.h"
+#include "MaintainWatcher_client_g.h"
 using namespace MaintainWatcher;
 
 void CGUIConsoleEntity::OnPreStart(CAutoArray<CSimpleStringA> strArgs,CSmartPointer<ITransactionContext> pTransactionContext) 
@@ -134,11 +133,6 @@ void CGUIConsoleEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogI
 			Dbg("证书拨出");
 			m_FSM.PostEventFIFO(new FSMEvent(CGUIConsoleFSM::Event_UKeyPulled));
 		}
-		//else if (dwUserCode == EVENT_ACCESSAUTH_SUCCEED)		// 准入成功, 关闭运行控制台
-		//{
-		//	LogEvent(Severity_Middle, 0,  "准入成功,关闭输出控制台");
-		//	GetFunction()->GetPrivilegeFunction()->CloseOuputConsole();
-		//}
 		else if (dwUserCode == LOG_EVT_HEALTH_FIRST_ENTER_MAINPADE)
 		{
 			// IE首页打开, 关闭运行输出
@@ -153,9 +147,6 @@ void CGUIConsoleEntity::OnLog(const CAutoArray<CUUID> &SubIDs, const CUUID nLogI
 	auto rc = pFunc->SubscribeLog(m_SubLogID1, this, Log_Event, Severity_None, Error_IgnoreAll, -1, "MaintainWatcher");
 	rc = pFunc->SubscribeLog(m_SubLogID2, this, Log_Event, Severity_None, Error_IgnoreAll, -1, "Gpio");
 
-	//// 准入成功事件
-	//rc = pFunc->SubscribeLog(m_SubLogID3, this, Log_Event, Severity_None, Error_IgnoreAll, 0x50200001, "AccessAuthorization");
-
 	// 业务首页加载事件
 	rc = pFunc->SubscribeLog(m_SubLogID3, this, Log_Event, Severity_None, Error_IgnoreAll, LOG_EVT_HEALTH_FIRST_ENTER_MAINPADE, "HealthManager");
 
@@ -258,7 +249,7 @@ ErrorCodeEnum CGUIConsoleEntity::AddTradeManage(const char *pszTerminalNo, const
 	pCnn->DecRefCount();
 	pCnn = NULL;
 	if (Error_Succeed != rc)
-		Dbg("mod AddTradeManage return : %d", rc);
+		Dbg("mod AddTradeManage return : %s", SpStrError(rc));
 	return rc;
 }
 
@@ -293,7 +284,7 @@ ErrorCodeEnum CGUIConsoleEntity::AddMaterialCounter(const char *pszMaterialCode)
 	}
 	else
 	{
-		LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("重置后端计数失败(0x%X)", rc));
+		LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("add material counter failed: %s", SpStrError(rc)));
 	}
 	return rc;
 }
@@ -413,7 +404,7 @@ ErrorCodeEnum CGUIConsoleEntity::ResetMaterialCounter(const char *pszMaterial, u
 
 	if (rc != Error_Succeed)
 	{
-		LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("重置终端计数失败(0x%X)", rc));
+		LogError(Severity_Middle, rc, 0, CSimpleStringA::Format("重置终端计数失败: %s", SpStrError(rc)));
 		return rc;
 	}
 
@@ -491,7 +482,7 @@ ErrorCodeEnum CGUIConsoleEntity::RegistSwallowedCard(const char *pszCardNo, cons
 	if (rc == Error_Succeed)
 		Dbg("吞卡登记成功,cardno: %s, reason: %s", tempCardNo, pszReasonCode);
 	else
-		Dbg("吞卡登记失败(0x%X),cardno: %s, reason: %s", rc, tempCardNo, pszReasonCode);
+		Dbg("吞卡登记失败(%s),cardno: %s, reason: %s", SpStrError(rc), tempCardNo, pszReasonCode);
 	
 	return rc;
 }
@@ -549,7 +540,7 @@ ErrorCodeEnum CGUIConsoleEntity::SyncMaterialCount(const char *pszDeviceNo, DWOR
 	if (rc == Error_Succeed)
 		Dbg("计数同步成功");
 	else
-		Dbg("计数同步失败(0x%X)", rc);
+		Dbg("计数同步失败:%s", SpStrError(rc));
 
 	return rc;
 }

+ 5 - 0
Module/mod_guiconsole/stdafx2.h

@@ -1,5 +1,7 @@
 #pragma once
 
+
+#if defined(_MSC_VER)
 #include "targetver.h"
 #include <Windows.h>
 #include <WinUser.h>
@@ -26,6 +28,9 @@ extern CAppModule _Module;
 #include <atlcrack.h>
 #include <atlgdi.h>
 #include <atlddx.h>
+#endif //_MSC_VER
+
+
 
 #include "stdafx.h"