IQueryAllWinSATAssessments::get_AllXML 메서드(winsatcominterfacei.h)
[IQueryAllWinSATAssessments::AllXML은 Windows 8.1 후 릴리스에서 변경되거나 사용할 수 없습니다.]
지정된 XPath를 사용하여 공식 XML 평가 문서에서 데이터를 검색합니다. 쿼리는 WinSAT 데이터 저장소의 모든 공식 평가에 대해 실행됩니다.
이 속성은 읽기 전용입니다.
구문
HRESULT get_AllXML(
BSTR xPath,
BSTR namespaces,
IXMLDOMNodeList **ppDomNodeList
);
매개 변수
xPath
namespaces
ppDomNodeList
반환 값
없음
설명
이 메서드를 사용하여 API를 통해 제공된 요약 정보에서 사용할 수 없는 평가의 세부 정보를 검색할 수 있습니다. 평가에서 사용할 수 있는 모든 정보에 대한 자세한 내용은 WinSAT 스키마를 참조하세요.
첫 번째 공식 평가는 컴퓨터를 처음 설정할 때 실행됩니다. 초기 평가는 데이터 저장소의 수명 동안 데이터 저장소에 유지됩니다. WinSAT 데이터 저장소에는 최대 100개의 공식 평가가 포함될 수 있습니다. 저장소가 용량에 도달하면 WinSAT는 실행되는 각 새 공식 평가에 대해 데이터 저장소에서 가장 오래된 평가(초기 평가는 아님)를 삭제합니다.
WinSAT 데이터 저장소에는 공식적인 평가만 포함됩니다. 임시 평가에서 평가 데이터를 검색하려면 평가를 실행할 때 결과를 XML 파일에 저장해야 합니다(자세한 내용은 -xml 명령줄 인수 참조). 그런 다음 IXMLDOMDocument2 인터페이스의 멤버를 사용하여 임시 평가에서 데이터를 쿼리할 수 있습니다.
평가가 반환되는 순서는 임의입니다.
예제
다음 예제에서는 XPath 쿼리를 사용하여 평가 저장소의 각 공식 평가에서 데이터를 가져오는 방법을 보여 줍니다.
#include <windows.h>
#include <stdio.h>
#include <comutil.h>
#include <winsatcominterfacei.h>
#pragma comment(lib, "comsupp.lib") // For _bstr_t
void main(void)
{
HRESULT hr = S_OK;
IQueryAllWinSATAssessments* pAssessment;
IXMLDOMNodeList* pNodes = NULL;
IXMLDOMNode* pMemory = NULL;
IXMLDOMNode* pNode = NULL;
_bstr_t bstrXPath = L"WinsatAssessments/WinSAT/SystemConfig/Memory";
_bstr_t bstrAvailableRAM;
_bstr_t bstrTotalRAM;
hr = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
// Get an instance to the most recent formal assessment.
hr = CoCreateInstance(__uuidof(CQueryAllWinSAT),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IQueryAllWinSATAssessments),
(void**)&pAssessment);
if (FAILED(hr))
{
wprintf(L"Failed to create an instance of IQueryAllWinSATAssessments. Failed with 0x%x.\n", hr);
goto cleanup;
}
// Query the assessments for the memory nodes.
hr = pAssessment->get_AllXML(bstrXPath, NULL, &pNodes);
if (FAILED(hr))
{
wprintf(L"pAssessment->get_XML failed with 0x%x.\n", hr);
goto cleanup;
}
hr = pNodes->nextNode(&pMemory);
// Loop through the memory nodes and get available and total memory size
// values and print them.
while (pMemory)
{
hr = pMemory->selectSingleNode(L"TotalPhysical/Size", &pNode);
if (FAILED(hr))
{
wprintf(L"pMemory->selectSingleNode(TotalPhysical/Size) failed with 0x%x.\n", hr);
goto cleanup;
}
hr = pNode->get_text(bstrTotalRAM.GetAddress());
if (FAILED(hr))
{
wprintf(L"pNode->get_text(bstrTotalRAM) failed with 0x%x.\n", hr);
goto cleanup;
}
pNode->Release();
pNode = NULL;
hr = pMemory->selectSingleNode(L"AvailablePhysical/Size", &pNode);
if (FAILED(hr))
{
wprintf(L"pMemory->selectSingleNode(AvailablePhysical/Size) failed with 0x%x.\n", hr);
goto cleanup;
}
hr = pNode->get_text(bstrAvailableRAM.GetAddress());
if (FAILED(hr))
{
wprintf(L"pNode->get_text(bstrAvailableRAM) failed with 0x%x.\n", hr);
goto cleanup;
}
pNode->Release();
pNode = NULL;
wprintf(L"Available RAM: %s of %s\n", bstrAvailableRAM.GetBSTR(), bstrTotalRAM.GetBSTR());
pMemory->Release();
pMemory = NULL;
hr = pNodes->nextNode(&pMemory);
}
cleanup:
if (pAssessment)
pAssessment->Release();
if (pNodes)
pNodes->Release();
if (pMemory)
pMemory->Release();
if (pNode)
pNode->Release();
CoUninitialize();
}
요구 사항
지원되는 최소 클라이언트 | Windows Vista [데스크톱 앱만 해당] |
지원되는 최소 서버 | 지원되는 버전 없음 |
대상 플랫폼 | Windows |
헤더 | winsatcominterfacei.h |
DLL | Winsatapi.dll |