#include "precomp.h"
#include "xmldomparser.hpp"
#include "utils.h"
#include "stringutils.h"
Go to the source code of this file.
◆ ConvertUTF8StringToBSTR()
Definition at line 16 of file xmldomparser.cpp.
17{
20
21 if (!pSrc)
return NULL;
22
23
25 if (cwch == 0)
return NULL;
26
27
29 if (!wsOut)
30 {
33 }
34
35
37 {
38
40
43
45 }
46
47 return wsOut;
48}
void WINAPI _com_issue_error(HRESULT hr)
#define MultiByteToWideChar
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
DWORD WINAPI GetLastError(void)
#define HRESULT_FROM_WIN32(x)
Referenced by LoadXMLDocumentFromResource().
◆ CreateAndInitXMLDOMDocument()
Definition at line 64 of file xmldomparser.cpp.
65{
68 CLSCTX_INPROC_SERVER,
72
73
74 (*ppDoc)->put_async(VARIANT_FALSE);
75 (*ppDoc)->put_validateOnParse(VARIANT_FALSE);
76 (*ppDoc)->put_resolveExternals(VARIANT_FALSE);
77
79}
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
#define IID_PPV_ARG(Itype, ppType)
Referenced by FillListView().
◆ LoadXMLDocumentFromFile()
Definition at line 143 of file xmldomparser.cpp.
146{
148 _variant_t varFileName(lpszFilename);
149
150 if (!pDoc)
152
154 {
156 LONG lErrorCode = 0
L;
157
158 if (
SUCCEEDED(pDoc->get_parseError(&pXMLErr)) &&
159 SUCCEEDED(pXMLErr->get_errorCode(&lErrorCode)))
160 {
161 if ( !bIgnoreErrorsIfNonExistingFile ||
164 {
165 _bstr_t bstrErr;
166
167 if (
SUCCEEDED(pXMLErr->get_reason(&bstrErr.GetBSTR())))
168 {
169 LPWSTR lpszStr =
FormatString(
L"Failed to load DOM from '%wS': %wS", lpszFilename, (
wchar_t*)bstrErr);
172 }
173 }
174 }
175
177 }
178
179 return (
Success == VARIANT_TRUE);
180}
BOOL MemFree(IN PVOID lpMem)
DWORD FormatString(DWORD dwFlags, HINSTANCE hInstance, DWORD dwStringId, DWORD dwLanguageId, LPWSTR lpBuffer, DWORD nSize, va_list *Arguments)
HRESULT load([in] VARIANT xmlSource, [out, retval] VARIANT_BOOL *isSuccessful)
#define ERROR_FILE_NOT_FOUND
#define _HRESULT_TYPEDEF_(x)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
Referenced by FillListView().
◆ LoadXMLDocumentFromResource()
Definition at line 82 of file xmldomparser.cpp.
84{
86 HRSRC hRes;
89 _bstr_t bstrXMLRes;
90
91 if (!pDoc)
93
94
98
102
104 if (lpXMLRes ==
NULL)
106
107
110 else
111 bstrXMLRes = (
LPCWSTR)lpXMLRes;
112
114 {
116 _bstr_t bstrErr;
117
118 if (
SUCCEEDED(pDoc->get_parseError(&pXMLErr)) &&
119 SUCCEEDED(pXMLErr->get_reason(&bstrErr.GetBSTR())))
120 {
122
124 lpszStr =
FormatString(
L"Failed to load DOM from resource '#%u': %wS", lpszXMLResName, (
wchar_t*)bstrErr);
125 else
126 lpszStr =
FormatString(
L"Failed to load DOM from resource '%wS': %wS", lpszXMLResName, (
wchar_t*)bstrErr);
127
129
131 }
132
134 }
135
138
139 return (
Success == VARIANT_TRUE);
140}
BOOL WINAPI IsTextUnicode(IN CONST VOID *lpv, IN INT iSize, IN OUT LPINT lpiResult OPTIONAL)
BOOL WINAPI FreeResource(HGLOBAL handle)
HRSRC WINAPI FindResourceW(HINSTANCE hModule, LPCWSTR name, LPCWSTR type)
DWORD WINAPI SizeofResource(HINSTANCE hModule, HRSRC hRsrc)
LPVOID WINAPI LockResource(HGLOBAL handle)
HGLOBAL WINAPI LoadResource(HINSTANCE hModule, HRSRC hRsrc)
static const WCHAR Cleanup[]
HRESULT loadXML([in] BSTR bstrXML, [out, retval] VARIANT_BOOL *isSuccessful)
#define IS_INTRESOURCE(i)
static BSTR ConvertUTF8StringToBSTR(const char *pSrc)
Referenced by FillListView().
◆ UninitXMLDOMParser()
◆ InitXMLDOMParser