|
|
@@ -44,6 +44,7 @@
|
|
|
#include <psapi.h>
|
|
|
#include <tlhelp32.h>
|
|
|
#include <WtsApi32.h>
|
|
|
+#include <sysinfoapi.h>
|
|
|
#pragma comment(lib, "WtsApi32.lib")
|
|
|
#include "Mmdeviceapi.h"
|
|
|
#include "Propidl.h"
|
|
|
@@ -111,6 +112,25 @@ const char* STRATUP_FILENAME_FROM_SCRIPTS = "spexplorerauto.lnk";
|
|
|
|
|
|
|
|
|
#if defined(RVC_OS_WIN)
|
|
|
+//https://blog.csdn.net/aflyeaglenku/article/details/51742820
|
|
|
+typedef struct _dmi_header
|
|
|
+{
|
|
|
+ BYTE type;
|
|
|
+ BYTE length;
|
|
|
+ WORD handle;
|
|
|
+}dmi_header;
|
|
|
+
|
|
|
+typedef struct _RawSMBIOSData
|
|
|
+{
|
|
|
+
|
|
|
+ BYTE Used20CallingMethod;
|
|
|
+ BYTE SMBIOSMajorVersion;
|
|
|
+ BYTE SMBIOSMinorVersion;
|
|
|
+ BYTE DmiRevision;
|
|
|
+ DWORD Length;
|
|
|
+ BYTE SMBIOSTableData[];
|
|
|
+}RawSMBIOSData;
|
|
|
+
|
|
|
void ResourceWatcherFSM::GetAutoStartFile(std::string& userDirPath, std::vector<std::string>& userDirFiles, std::string& pubDirPath, std::vector<std::string>& pubDirFiles)
|
|
|
{
|
|
|
CSimpleStringA startMenuPublicPath(STARTUP_DIR_FULL_PATH);
|
|
|
@@ -365,8 +385,8 @@ void ResourceWatcherFSM::TriggerAtStatusChanged(bool bMStatus)
|
|
|
AutoDeleteFilesTask* autoDeleteTask = new AutoDeleteFilesTask(this);
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(autoDeleteTask);
|
|
|
|
|
|
-#if defined(RVC_OS_LINUX)
|
|
|
if (m_bFirstRunAfterBoot) {
|
|
|
+#if defined(RVC_OS_LINUX)
|
|
|
UINT sysVer = 0;
|
|
|
UploadSysVersionInfo(sysVer);
|
|
|
ConfirmWindowEffectHasBeenOpen();
|
|
|
@@ -381,8 +401,11 @@ void ResourceWatcherFSM::TriggerAtStatusChanged(bool bMStatus)
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(new DetectSoftwareInstallStatusTask(this));
|
|
|
GetEntityBase()->GetFunction()->PostThreadPoolTask(new UploadMonitorInfoTask(this));
|
|
|
AlarmSystemBasicInfo();
|
|
|
- }
|
|
|
+#else
|
|
|
+ AlarmSystemBasicInfo();
|
|
|
#endif //RVC_OS_LINUX
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -402,7 +425,6 @@ ErrorCodeEnum ResourceWatcherFSM::OnInit()
|
|
|
if (m_bFirstRunAfterBoot) {
|
|
|
DbgWithLink(LOG_LEVEL_INFO, LOG_TYPE_SYSTEM)("First time to run after system boot.");
|
|
|
}
|
|
|
-
|
|
|
#if defined(RVC_OS_WIN)
|
|
|
if (m_bFirstRunAfterBoot) {
|
|
|
//GetSystemMetrics (SM_CMONITORS) 计数仅显示可见的显示器
|
|
|
@@ -4224,6 +4246,36 @@ bool ResourceWatcherFSM::IsStartupIconExist(CSimpleStringA& strPath)
|
|
|
return false;
|
|
|
}
|
|
|
|
|
|
+const char* dmi_string(const dmi_header* dm, BYTE s)
|
|
|
+{
|
|
|
+
|
|
|
+ char* bp = (char*)dm;
|
|
|
+ size_t i, len;
|
|
|
+
|
|
|
+ if (s == 0)
|
|
|
+ return "Not Specified";
|
|
|
+
|
|
|
+ bp += dm->length;
|
|
|
+ while (s > 1 && *bp)
|
|
|
+ {
|
|
|
+
|
|
|
+ bp += strlen(bp);
|
|
|
+ bp++;
|
|
|
+ s--;
|
|
|
+ }
|
|
|
+
|
|
|
+ if (!*bp)
|
|
|
+ return "BAD_INDEX";
|
|
|
+
|
|
|
+ /* ASCII filtering */
|
|
|
+ len = strlen(bp);
|
|
|
+ for (i = 0; i < len; i++)
|
|
|
+ if (bp[i] < 32 || bp[i] == 127)
|
|
|
+ bp[i] = '.';
|
|
|
+
|
|
|
+ return bp;
|
|
|
+}
|
|
|
+
|
|
|
#endif // _MSC_VER end硬件资源监控相关系统功能 CPU、内存、硬盘、网络wifi
|
|
|
|
|
|
#ifdef RVC_OS_LINUX
|
|
|
@@ -4292,8 +4344,61 @@ void ResourceWatcherFSM::CheckDiskFileSpace()
|
|
|
ErrorCodeEnum ResourceWatcherFSM::CatchSystemBasicInfo(SystemBasicInfo& info)
|
|
|
{
|
|
|
#if defined(RVC_OS_WIN)
|
|
|
- ///**TODO(Gifur@10/10/2023): 待实现 */
|
|
|
- return Error_NotImpl;
|
|
|
+ //通过输入 ‘Get-CimInstance -ClassName Win32_ComputerSystemProduct’ 指令获取)
|
|
|
+ int ret = 0;
|
|
|
+ RawSMBIOSData* Smbios;
|
|
|
+ dmi_header* h = NULL;
|
|
|
+ int flag = 1;
|
|
|
+
|
|
|
+ ret = GetSystemFirmwareTable('RSMB', 0, 0, 0);
|
|
|
+ if (!ret)
|
|
|
+ {
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Function failed!");
|
|
|
+ return Error_Unexpect;
|
|
|
+ }
|
|
|
+
|
|
|
+ DWORD bufsize = ret;
|
|
|
+ char* buf = new char[bufsize];
|
|
|
+ memset(buf, 0, bufsize);
|
|
|
+
|
|
|
+ ret = GetSystemFirmwareTable('RSMB', 0, buf, bufsize);
|
|
|
+ if (!ret)
|
|
|
+ {
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Function failed!");
|
|
|
+ delete[]buf;
|
|
|
+ return Error_Unexpect;
|
|
|
+ }
|
|
|
+
|
|
|
+ Smbios = (RawSMBIOSData*)buf;
|
|
|
+
|
|
|
+ BYTE* p = Smbios->SMBIOSTableData;
|
|
|
+
|
|
|
+ if (Smbios->Length != bufsize - 8)
|
|
|
+ {
|
|
|
+
|
|
|
+ DbgWithLink(LOG_LEVEL_WARN, LOG_TYPE_SYSTEM)("Smbios length error");
|
|
|
+ delete[]buf;
|
|
|
+ return Error_Unexpect;
|
|
|
+ }
|
|
|
+
|
|
|
+ for (int i = 0; i < Smbios->Length; i++) {
|
|
|
+ h = (dmi_header*)p;
|
|
|
+
|
|
|
+ if (h->type == 1)
|
|
|
+ {
|
|
|
+ info.strManufacturer = dmi_string(h, p[0x4]);
|
|
|
+ info.strProductName = dmi_string(h, p[0x5]);
|
|
|
+ info.strSerialNumber = dmi_string(h, p[0x7]);
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ p += h->length;
|
|
|
+ while ((*(WORD*)p) != 0) p++;
|
|
|
+ p += 2;
|
|
|
+ }
|
|
|
+ delete[]buf;
|
|
|
+ return Error_Succeed;
|
|
|
#else
|
|
|
CSimpleStringA runCfgPath;
|
|
|
ErrorCodeEnum errCode = GetEntityBase()->GetFunction()->GetPath("RunCfg", runCfgPath);
|