From f94e47a9e1b6d4366e5d2c8e850067204d0c5dc9 Mon Sep 17 00:00:00 2001 From: Sean Hall Date: Fri, 18 Feb 2022 19:00:23 -0600 Subject: Parse the Content-Length string value to avoid the 2GB limitation. --- src/libs/dutil/WixToolset.DUtil/inetutil.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'src/libs/dutil/WixToolset.DUtil/inetutil.cpp') diff --git a/src/libs/dutil/WixToolset.DUtil/inetutil.cpp b/src/libs/dutil/WixToolset.DUtil/inetutil.cpp index 8dace55f..c4cddd11 100644 --- a/src/libs/dutil/WixToolset.DUtil/inetutil.cpp +++ b/src/libs/dutil/WixToolset.DUtil/inetutil.cpp @@ -30,16 +30,14 @@ extern "C" HRESULT DAPI InternetGetSizeByHandle( Assert(pllSize); HRESULT hr = S_OK; - DWORD dwSize = 0; - DWORD cb = 0; + LPWSTR sczValue = NULL; - cb = sizeof(dwSize); - if (!::HttpQueryInfoW(hiFile, HTTP_QUERY_CONTENT_LENGTH | HTTP_QUERY_FLAG_NUMBER, reinterpret_cast(&dwSize), &cb, NULL)) - { - InetExitOnLastError(hr, "Failed to get size for internet file handle"); - } + hr = InternetQueryInfoString(hiFile, HTTP_QUERY_CONTENT_LENGTH, &sczValue); + InetExitOnLastError(hr, "Failed to get content length string for internet file handle"); + + hr = StrStringToInt64(sczValue, 0, pllSize); + InetExitOnLastError(hr, "Failed to parse size for internet file handle: %ls", sczValue); - *pllSize = dwSize; LExit: return hr; } -- cgit v1.2.3-55-g6feb