Discussion:
Problem with INTERNET_BUFFERS under UNICODE
(too old to reply)
Fred
2006-02-26 05:07:44 UTC
Permalink
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
Scherbina Vladimir
2006-02-26 19:37:20 UTC
Permalink
Fred, forget about UNICODE variant of InternetReadFileEx. It's not
implemented.

I remember that I met simular problem, and noticed that InternetReadFileExW
simply calls SetLastError to 120. After deep investigation I found that
functions body is simply:

.text:771F88D6 InternetWriteFileExW proc near
.text:771F88D6 push 78h ; InternetReadFileExW
.text:771F88D8 call ds:SetLastError
.text:771F88DE xor eax, eax
.text:771F88E0 retn 10h
.text:771F88E0 InternetWriteFileExW endp
--
Vladimir
Post by Fred
Hi, for "fun" I am trying/testing wininet asynchronous code.
If I compile under UNICODE compile option I can only get
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.
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
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
Fred
2006-02-26 19:46:12 UTC
Permalink
Post by Scherbina Vladimir
Fred, forget about UNICODE variant of InternetReadFileEx. It's not
implemented.
Thanks for the info. Spent a few hours trying to get it to work!

and no joking ;)

Loading...