Newsgroups : Microsoft : microsoft.public.inetsdk.programming.wininet : 2006 Feb : Problem with INTERNET_BUFFERS under UNICODE

www.cryer.info
Managed Newsgroup Archive

Problem with INTERNET_BUFFERS under UNICODE

Subject:Problem with INTERNET_BUFFERS under UNICODE
Posted by:"Fred" (n..@home.com)
Date:Sun, 26 Feb 2006 05:07:44

Hi, for "fun" I am trying/testing wininet asynchronous code.

If I compile under UNICODE compile option I can only get
InternetReadFileEx() to work if I "hardcode" to the ANSI Version thus:


char lpReadBuff[256];


        INTERNET_BUFFERSA InetBuff;
        FillMemory(&InetBuff, sizeof(InetBuff), 0);
        InetBuff.dwStructSize = sizeof(InetBuff);
        InetBuff.lpvBuffer = lpReadBuff;
        InetBuff.dwBufferLength = sizeof(lpReadBuff) - 1;

        err0=InternetReadFileExA( g_hRequest,
         &InetBuff,
         0,
         (DWORD)p_rf);

this works returning 1 and accessing the callback function.

If I do:

TCHAR lpReadBuffT[256];

INTERNET_BUFFERS InetBuffX;
        FillMemory(&InetBuffX, sizeof(INTERNET_BUFFERS), 0);
        InetBuffX.dwStructSize = sizeof(INTERNET_BUFFERS);
        InetBuffX.lpvBuffer = (LPVOID)lpReadBuffT;
        InetBuffX.dwBufferLength = sizeof(lpReadBuffT) - 1;


        err0=InternetReadFileEx( g_hRequest,
         &InetBuffX,
         0,
         (DWORD)p_rf);

Then the function returns 0, the callback function isn't accessed and
GetLastError() gives:

120=INTERNET_STATUS_INTERMEDIATE_RESPONSE


If there isn't a ready fix, is it safe to stick with the ANSI version even
though the prog is compiled under UNICODE?

TIA

Replies:

www.cryer.info
Managed Newsgroup Archive