void ValidateIISSetup() { CIISMetaBase MetaBase; CComPtr<IMSAdminBase> pAdminBase; if (MetaBase.Init() != true || MetaBase.GetAdminBase(&pAdminBase) != true) { ReportError(_T("Unable to establish a connection to the IIS metabase")); return; } CIISMetaBaseData LoadOrderData; if (LoadOrderData.ReadData(pAdminBase, L"/LM/W3SVC/Filters", MD_FILTER_LOAD_ORDER)) { std::wstring sLoadOrder; if (LoadOrderData.GetAsString(sLoadOrder)) { std::wstring::size_type nPos = sLoadOrder.find(IISXPRESS_FILTERNAMEW); if (nPos != std::wstring::npos) { std::wstring::size_type expectedLocation = sLoadOrder.size(); expectedLocation -= _countof(IISXPRESS_FILTERNAMEW) - 1; if (nPos != expectedLocation) { ReportWarning(_T("The IISxpress ISAPI filter entry should be the last defined module, please run repair")); } } else { ReportError(_T("Unable to find the IISxpress ISAPI entry in the filter load order")); } } else { ReportWarning(_T("Unable to read the ISAPI filter load order")); } } else { ReportError(_T("Unable to query the ISAPI filter data")); } const std::wstring sMBFilterPath = L"/LM/W3SVC/Filters/" IISXPRESS_FILTERNAMEW; CIISMetaBaseData FilterPathData; if (FilterPathData.ReadData(pAdminBase, sMBFilterPath.c_str(), MD_FILTER_IMAGE_PATH)) { std::wstring sFilterPath; if (FilterPathData.GetAsString(sFilterPath)) { CFile file; if (!file.Open(sFilterPath.c_str(), CFile::modeRead | CFile::shareDenyNone)) { ReportWarning(_T("Unable to open the IISxpress ISAPI filter DLL ('%s'), check that the file exists"), sFilterPath.c_str()); } file.Close(); } else { ReportWarning(_T("Unable to read the IISxpress ISAPI filter path")); } } else { ReportWarning(_T("Unable to query the IISxpress ISAPI filter path")); } CIISMetaBaseData FilterStatusData; if (FilterStatusData.ReadData(pAdminBase, sMBFilterPath.c_str(), MD_FILTER_STATE) == true) { DWORD dwFilterState = 0; if (FilterStatusData.GetAsDWORD(&dwFilterState)) { if (dwFilterState != 1) { ReportWarning(_T("IIS reports that the filter state is %d"), dwFilterState); } } else { ReportWarning(_T("Unable to read the IISxpress ISAPI filter state")); } } else { ReportError(_T("Unable to query the IISxpress ISAPI filter state")); } CIISMetaBaseData FilterWin32StatusData; if (FilterWin32StatusData.ReadData(pAdminBase, sMBFilterPath.c_str(), MD_WIN32_ERROR) == true) { DWORD dwWIN32FilterState = 0; if (FilterWin32StatusData.GetAsDWORD(&dwWIN32FilterState)) { if (dwWIN32FilterState != 0) { TCHAR szErrorMessage[512] = _T(""); ::FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, dwWIN32FilterState, 0x0409, szErrorMessage, _countof(szErrorMessage), NULL); TCHAR* pchWhitespace = NULL; while ((pchWhitespace = _tcschr(szErrorMessage, '\n'))) { *pchWhitespace = ' '; } while ((pchWhitespace = _tcschr(szErrorMessage, '\r'))) { *pchWhitespace = ' '; } ReportWarning(_T("IIS reports that the filter WIN32 state is %d, the error is: '%s'"), dwWIN32FilterState, szErrorMessage); } } else { ReportWarning(_T("Unable to read the IISxpress ISAPI filter Win32 state")); } } else { ReportError(_T("Unable to query the IISxpress ISAPI filter Win32 state")); } std::vector<std::wstring> AppPools; if (MetaBase.EnumKeys(L"/LM/W3SVC/AppPools", AppPools)) { for (size_t i = 0; i < AppPools.size(); i++) { std::wstring appPoolPath = L"/LM/W3SVC/AppPools/" + AppPools[i]; CIISMetaBaseData AppPoolIdentityData; if (AppPoolIdentityData.ReadData(pAdminBase, appPoolPath.c_str(), MD_APPPOOL_IDENTITY_TYPE) == true) { DWORD dwIdentityType = 0; AppPoolIdentityData.GetAsDWORD(&dwIdentityType); ReportInfo(_T("AppPool '%s' has identity type %d"), AppPools[i].c_str(), dwIdentityType); if (dwIdentityType == MD_APPPOOL_IDENTITY_TYPE_SPECIFICUSER) { CIISMetaBaseData AppPoolUserData; if (AppPoolUserData.ReadData(pAdminBase, appPoolPath.c_str(), MD_WAM_USER_NAME) == true) { std::wstring sUserName; if (AppPoolUserData.GetAsString(sUserName)) { ReportWarning( _T("The AppPool '%s' has been configured to use user account '%s', ensure this account or IIS_WPG ") _T("has read/execute permissions to the IISxpress directory ") _T("and full permissions to the IISxpress Logs directory"), AppPools[i].c_str(), sUserName.c_str()); } else { ReportError(_T("Unable to read the user name of the AppPool")); } } else { ReportError(_T("Unable to query the user name of the AppPool")); } } } else { ReportInfo(_T("AppPool '%s' does not have an identity type"), AppPools[i].c_str()); } } } else { ReportError(_T("Unable to query the ISAPI AppPool data")); } }
void MessageBoxReporter::ReportInfo(const std::wstring& message) { ReportInfo(message, m_wsDefaultTitle); }
void MAPSJoin::Death() { // Reports this information to the RTMaps console. You can remove this line if you know when Death() is called in the component lifecycle. ReportInfo("Passing through Death() method"); }
void ReportInfo(std::wstring msg) { ReportInfo(L"Info", msg); }
void MapsTest::Core() { ReportInfo("My module"); }