You should not use the Unicode version of this function if you want to send additional headers.
If dwHeadersLength excludes the terminating null, the function crashes with error ERROR_HTTP_HEADER_NOT_FOUND.
If it does include the terminating null character, this null character
is also sent to the server. This works on Apache servers, but various
servers respond with HTTP 400 Bad Request errors.
You can
solve the problem by calling WideCharToMultiByte() to convert the URL
to ANSI and then calling InternetOpenUrlA(), which accepts
dwHeadersLength not including the terminating null.