Jacek Caban (@jacek) commented about dlls/ieframe/navigate.c:
hres = get_window(doc_host, &tmp);
if(SUCCEEDED(hres)) {
if(!tmp)
hres = E_UNEXPECTED;
else {
hres = IHTMLWindow2_QueryInterface(tmp, &IID_IHTMLPrivateWindow, (void**)&priv_window);
IHTMLWindow2_Release(tmp);
}
}
}
if(SUCCEEDED(hres)) {
/* Error page navigation URL is a local resource (varies on native, also depending on error),
* with the fragment being the original URL of the page that failed to load. We add a query
* with the error code so the generic error page can display the actual error code there. */
static const WCHAR shdoclcW[13] = L"\\shdoclc.dll/";
WCHAR buf[INTERNET_MAX_URL_LENGTH * 2];
Please avoid using INTERNET_MAX_URL_LENGTH, restrictions on URL length were relaxed after its introduction and its remaining usage in IE components are likely wrong. In this case you dynamically allocate URL anyway.
BTW, there is IUriBuilder which is a cleaner way to construct URLs without worrying about corner cases, but I guess it's simple enough that it doesn't matter much in this case.