diff options
Diffstat (limited to 'src/libs/dutil/WixToolset.DUtil/xmlutil.cpp')
| -rw-r--r-- | src/libs/dutil/WixToolset.DUtil/xmlutil.cpp | 121 |
1 files changed, 113 insertions, 8 deletions
diff --git a/src/libs/dutil/WixToolset.DUtil/xmlutil.cpp b/src/libs/dutil/WixToolset.DUtil/xmlutil.cpp index 0f1e611d..2e1a2200 100644 --- a/src/libs/dutil/WixToolset.DUtil/xmlutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/xmlutil.cpp | |||
| @@ -793,13 +793,13 @@ LExit: | |||
| 793 | 793 | ||
| 794 | 794 | ||
| 795 | /******************************************************************** | 795 | /******************************************************************** |
| 796 | XmlGetAttributeLargeNumber | 796 | XmlGetAttributeUInt16 |
| 797 | 797 | ||
| 798 | *********************************************************************/ | 798 | *********************************************************************/ |
| 799 | extern "C" HRESULT DAPI XmlGetAttributeLargeNumber( | 799 | extern "C" HRESULT DAPI XmlGetAttributeUInt16( |
| 800 | __in IXMLDOMNode* pixnNode, | 800 | __in IXMLDOMNode* pixnNode, |
| 801 | __in_z LPCWSTR pwzAttribute, | 801 | __in_z LPCWSTR pwzAttribute, |
| 802 | __out DWORD64* pdw64Value | 802 | __out WORD* pwValue |
| 803 | ) | 803 | ) |
| 804 | { | 804 | { |
| 805 | HRESULT hr = S_OK; | 805 | HRESULT hr = S_OK; |
| @@ -810,15 +810,120 @@ extern "C" HRESULT DAPI XmlGetAttributeLargeNumber( | |||
| 810 | 810 | ||
| 811 | if (S_OK == hr) | 811 | if (S_OK == hr) |
| 812 | { | 812 | { |
| 813 | LONGLONG ll = 0; | 813 | WORD w = 0; |
| 814 | hr = StrStringToInt64(bstrValue, 0, &ll); | 814 | hr = StrStringToUInt16(bstrValue, 0, &w); |
| 815 | XmlExitOnFailure(hr, "Failed to treat attribute value as number."); | 815 | XmlExitOnFailure(hr, "Failed to treat attribute value as UInt16."); |
| 816 | 816 | ||
| 817 | *pdw64Value = ll; | 817 | *pwValue = w; |
| 818 | } | 818 | } |
| 819 | else | 819 | else |
| 820 | { | 820 | { |
| 821 | *pdw64Value = 0; | 821 | *pwValue = 0; |
| 822 | } | ||
| 823 | |||
| 824 | LExit: | ||
| 825 | ReleaseBSTR(bstrValue); | ||
| 826 | return hr; | ||
| 827 | } | ||
| 828 | |||
| 829 | |||
| 830 | /******************************************************************** | ||
| 831 | XmlGetAttributeInt32 | ||
| 832 | |||
| 833 | *********************************************************************/ | ||
| 834 | extern "C" HRESULT DAPI XmlGetAttributeInt32( | ||
| 835 | __in IXMLDOMNode* pixnNode, | ||
| 836 | __in_z LPCWSTR pwzAttribute, | ||
| 837 | __out int* piValue | ||
| 838 | ) | ||
| 839 | { | ||
| 840 | HRESULT hr = S_OK; | ||
| 841 | BSTR bstrValue = NULL; | ||
| 842 | |||
| 843 | hr = XmlGetAttribute(pixnNode, pwzAttribute, &bstrValue); | ||
| 844 | XmlExitOnFailure(hr, "failed XmlGetAttribute"); | ||
| 845 | |||
| 846 | if (S_OK == hr) | ||
| 847 | { | ||
| 848 | int i = 0; | ||
| 849 | hr = StrStringToInt32(bstrValue, 0, &i); | ||
| 850 | XmlExitOnFailure(hr, "Failed to treat attribute value as Int32."); | ||
| 851 | |||
| 852 | *piValue = i; | ||
| 853 | } | ||
| 854 | else | ||
| 855 | { | ||
| 856 | *piValue = 0; | ||
| 857 | } | ||
| 858 | |||
| 859 | LExit: | ||
| 860 | ReleaseBSTR(bstrValue); | ||
| 861 | return hr; | ||
| 862 | } | ||
| 863 | |||
| 864 | |||
| 865 | /******************************************************************** | ||
| 866 | XmlGetAttributeUInt32 | ||
| 867 | |||
| 868 | *********************************************************************/ | ||
| 869 | extern "C" HRESULT DAPI XmlGetAttributeUInt32( | ||
| 870 | __in IXMLDOMNode* pixnNode, | ||
| 871 | __in_z LPCWSTR pwzAttribute, | ||
| 872 | __out DWORD* pdwValue | ||
| 873 | ) | ||
| 874 | { | ||
| 875 | HRESULT hr = S_OK; | ||
| 876 | BSTR bstrValue = NULL; | ||
| 877 | |||
| 878 | hr = XmlGetAttribute(pixnNode, pwzAttribute, &bstrValue); | ||
| 879 | XmlExitOnFailure(hr, "failed XmlGetAttribute"); | ||
| 880 | |||
| 881 | if (S_OK == hr) | ||
| 882 | { | ||
| 883 | UINT dw = 0; | ||
| 884 | hr = StrStringToUInt32(bstrValue, 0, &dw); | ||
| 885 | XmlExitOnFailure(hr, "Failed to treat attribute value as UInt32."); | ||
| 886 | |||
| 887 | *pdwValue = dw; | ||
| 888 | } | ||
| 889 | else | ||
| 890 | { | ||
| 891 | *pdwValue = 0; | ||
| 892 | } | ||
| 893 | |||
| 894 | LExit: | ||
| 895 | ReleaseBSTR(bstrValue); | ||
| 896 | return hr; | ||
| 897 | } | ||
| 898 | |||
| 899 | |||
| 900 | /******************************************************************** | ||
| 901 | XmlGetAttributeUInt64 | ||
| 902 | |||
| 903 | *********************************************************************/ | ||
| 904 | extern "C" HRESULT DAPI XmlGetAttributeUInt64( | ||
| 905 | __in IXMLDOMNode* pixnNode, | ||
| 906 | __in_z LPCWSTR pwzAttribute, | ||
| 907 | __out DWORD64* pqwValue | ||
| 908 | ) | ||
| 909 | { | ||
| 910 | HRESULT hr = S_OK; | ||
| 911 | BSTR bstrValue = NULL; | ||
| 912 | |||
| 913 | hr = XmlGetAttribute(pixnNode, pwzAttribute, &bstrValue); | ||
| 914 | XmlExitOnFailure(hr, "failed XmlGetAttribute"); | ||
| 915 | |||
| 916 | if (S_OK == hr) | ||
| 917 | { | ||
| 918 | DWORD64 qw = 0; | ||
| 919 | hr = StrStringToUInt64(bstrValue, 0, &qw); | ||
| 920 | XmlExitOnFailure(hr, "Failed to treat attribute value as UInt64."); | ||
| 921 | |||
| 922 | *pqwValue = qw; | ||
| 923 | } | ||
| 924 | else | ||
| 925 | { | ||
| 926 | *pqwValue = 0; | ||
| 822 | } | 927 | } |
| 823 | 928 | ||
| 824 | LExit: | 929 | LExit: |
