InternetOpenUrl fails on WinCE7

HI,
I’m trying to run this piece of code which I know works fine on a VF61 1.2B with WEC6 as it did its job for many years.
It fails on the InternetOpenUrl, and the strange part is it fails with GetLastError returning a code 12200, which is not mapped for error codes related to wininet lib.
Can someone help me understand what is happening? Does the WEC7 have something known wrong for this feature that could explain why it happen?
I have a fealing it might be the header I’m passing (“Accept /\r\n\r\n”), but I don’t really know.

Thank you

CString GetRemoteFileContent( const CString& file_url, size_t dataBufferSize /*= 4096*/ )
{
	HINTERNET m_hSession;
	HINTERNET m_hRequest;
	DWORD m_dwByteToRead;
	DWORD m_dwByteRead;
	DWORD m_dwError;
	CString m_strFileName;

	//WSADATA wsaData;
	//int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
	WsaSingleton::GetInstance(); // does WSAStartup inside

	const TCHAR szHeader[] = _T("Accept: */*\r\n\r\n"); // see Q149413
	BOOL bSuccess = FALSE;
	LPBYTE pbBuffer = NULL;
	DWORD dwByteRead;
	DWORD dwSize;
	CString result_string;

	m_dwError = ERROR_SUCCESS;

	m_hSession = InternetOpen(_T("iCancel/1.0"), 
							  INTERNET_OPEN_TYPE_DIRECT,
							  NULL, NULL, 0);

	if (m_hSession == NULL)
	{
		m_dwError = GetLastError();
		return L"";
	}

	m_hRequest = InternetOpenUrl(m_hSession, file_url, 
								szHeader, _tcslen(szHeader),
								INTERNET_FLAG_NO_CACHE_WRITE |
								INTERNET_FLAG_PRAGMA_NOCACHE |
								INTERNET_FLAG_RAW_DATA       |
								INTERNET_FLAG_RELOAD , 0);

	if (m_hRequest == NULL)
	{
		m_dwError = GetLastError();
		if (m_hRequest)
		{
			InternetCloseHandle(m_hRequest);
			m_hRequest = NULL;
		}

		if (m_hSession)
		{
			InternetCloseHandle(m_hSession);
			m_hSession = NULL;
		}
		return L"";
	}

	pbBuffer = new BYTE[dataBufferSize];

	if (NULL == pbBuffer)
	{
		m_dwError = ERROR_NOT_ENOUGH_MEMORY;
	}

	m_dwByteToRead = 0;
	m_dwByteRead = 0;

	dwSize = sizeof(DWORD);

	if (!HttpQueryInfo(m_hRequest, HTTP_QUERY_CONTENT_LENGTH | 
						HTTP_QUERY_FLAG_NUMBER, 
                      (LPVOID)&m_dwByteToRead, &dwSize, NULL))
    {
		m_dwByteToRead = 0;
	}

	do{
		if (!InternetReadFile(m_hRequest, pbBuffer, dataBufferSize, &dwByteRead))
		{
			m_dwError = GetLastError();
			break;
		}

		m_dwByteRead += dwByteRead;

		if (dwByteRead == 0)
		{
			bSuccess = TRUE;
			break;
		}
		try
		{
			char* buf_content = new char[dwByteRead + 8];
			memset(buf_content, 0, dwByteRead + 8);
			memcpy(buf_content, pbBuffer, dwByteRead);
			result_string += CString(CStringA(buf_content));
			delete[] buf_content;
		}
		catch(...)
		{
			break;
		}
	}while( dwByteRead != 0 );

	if (pbBuffer)
		delete [] pbBuffer;
	if (m_hRequest)
	{
		InternetCloseHandle(m_hRequest);
		m_hRequest = NULL;
	}

	if (m_hSession)
	{
		InternetCloseHandle(m_hSession);
		m_hSession = NULL;
	}
	//WSACleanup();
	return result_string;
}

Colibri T20 256MB IT V1.2A
Custom Board
WEC7 BSP 2.1

For whoever might ever care for an answer, here’s mine:
I did not solve this issue and went for a complete workaround instead.

We put Toradex .NET CF 3.5 cab installer on our devices and developed a small C# application (“service” from here forward) with the sole job of listening as a TCP server for the input from our main C++ application via a TCP socket on the local address on a custom port and react on that.

Now. how does the service know what to do? We built a small in-house JSON format for the main app to instruct the service on what to do.
Since the service job is to download the content of an URL (we went for WebClient DownloadString and DownloadFIle), it needs to include all the info for the web request:
Url, headers, local file path, and so on, everything the service would need to replace InternetOpenUrl.

We went for this approach because we had this solution already available in another service implemented for handling HTTPS requests and responses, and it just seemed natural to follow through.

Hope this can help