// common_api.h #pragma once #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; // 定义Linux兼容类型 #ifndef DWORD_DEFINED #define DWORD_DEFINED typedef unsigned long DWORD; // 定义DWORD #endif // 结束条件编译 typedef int64_t __time64_t; typedef uint64_t UINT64; typedef unsigned char BYTE; typedef void* HANDLE; // 添加 GUID 类型定义(如果未定义) #ifndef GUID_DEFINED #define GUID_DEFINED typedef struct _GUID { unsigned long Data1; unsigned short Data2; unsigned short Data3; unsigned char Data4[8]; } GUID; #endif bool AddEnvPath(const char* pPath); bool DelEnvPath(const char* pPath); UINT64 GetDay(UINT64 TheTime); __time64_t GetCurrentRealTimeOfStk(); int CompareTimeByDay(UINT64 Prev, UINT64 Cur); bool string_2_guid(const char* pstr, GUID& stGuid); bool guid_2_string(GUID& stGuid, string& str); bool SplitString(const char* pString, string args, vector& nodes); bool SplitTo84422222222String(const char* pString, vector& nodes); bool CreateFileDirectory(string& FullFilePath); string FormatstdString(const char* pcFormat, ...); bool getBusIdFromFilePath(const char* pFilePath, string& BusId); bool SplitDevicePath(const char* pDevicePath, vector& nodes); void SplitDeviceList(const char* deviceList, std::vector& result); bool MergeDevicePath(vector& nodes, string& Devpath); string GetProcessDirectory(); string GetFileTitle(string& fullpath); string GetFileName(string& fullpath); string& makeLowerStr(string& src); string GetFileDirectory(string& fullpath); bool FindSubVersionDirs(string rootDir, map>& dirlist); bool FindSortedSubFiles(string rootFile, vector& filelist); void RawToHex(const char* pRaw, DWORD RawLen, string& Hex); string ReplaceSubString(string org, string& keystr, string& replacestr); string ReplaceFileTitle(string FilePath, string NewTitle); bool FindSubFiles(string rootDir, vector& filelist, bool Recursive = true, string strWildcard = "*"); template bool StrToIntT(const char* str, Type* result) { Type value = 0; Type sign = 1; Type radix; if (str == NULL) { return false; } if (strlen(str) == 0) { return false; } if (*str == '-') { sign = -1; str++; } if (*str == '0' && (*(str + 1) == 'x' || *(str + 1) == 'X')) { radix = 16; str += 2; } //else if(*str == '0') //{ // radix = 8; // str++; //} else { bool HitF = false; size_t Len = strlen(str); for (size_t i = 0; i < Len; i++) { if (str[i] >= '0' && str[i] <= '9') { continue; } HitF = true; break; } if (HitF) { radix = 16; } else { radix = 10; } } while (*str) { if (radix == 16) { if (*str >= '0' && *str <= '9') { value = value * radix + *str - '0'; } else { if ((*str | 0x20) >= 'a' && (*str | 0x20) <= 'f') { value = value * radix + (*str | 0x20) - 'a' + 10; } else { return false; } } } else { value = value * radix + *str - '0'; } str++; } *result = sign * value; return true; }; class common_api { public: common_api(void); virtual ~common_api(void); pthread_mutex_t m_NotifyMutex; }; using export_functions = std::tuple; std::vector GetDllFunctionInfo(const char* moduleName);