// 把WMI的初始化提前,防止被GetHardwareInfo.dll,导致初始化失败
CWmiInfo::GetInstance()->Init();
void CWmiInfo::Init() { HRESULT hRes = CoInitializeSecurity(NULL, -1, NULL, NULL, RPC_C_AUTHN_LEVEL_PKT, RPC_C_IMP_LEVEL_IMPERSONATE, NULL, EOAC_NONE, NULL); if (!(SUCCEEDED(hRes) || RPC_E_TOO_LATE == hRes)) return;
hRes = CoCreateInstance(CLSID_WbemLocator, 0,CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID*)&m_pWbemLoc); ATLVERIFY(SUCCEEDED(hRes));
InitNetDetector(); }