Hi
I am writing code for smartphone 2003 SE to access internet asynchronously. After 2 days of headbanging with asynchronous logic in wininet, I m facing this utterly unexpected problem when I call InternetReadFileEx function. Earlier I was getting error 120 when I called it. After a few painful hours of googling I found out that the unicode version of this function hasnt been implemented by the guys at MSFT. Huh. So i resorted to the ascii version InternetReadFileA(). Accordingly I m also using INTERNET_BUFFERSA now. Now this function is failing miserably with error code 12018 which translates to ERROR_SXS_MANIFEST_MISSING_REQUIRED_DEFAULT_NAMESPACE and texted as "The manifest is missing the required default namespace specification on the assembly element." as per winerror.h file.
Hey MSFT guys!!Absolutely ANY clue for such an delightful error
A "now frustated with windows smartphone" coder
Vishal

InternetReadFileEx() returns error code 12018
Sunil Muktibodh
Hi,
I am no wininit expert but looking at http://msdn.microsoft.com/library/default.asp url=/library/en-us/wcewinet/html/cerefinternetreadfile.asp IntrnetReadFileExW seems to be supported on devices, and so is INTERNET_BUFFERS http://msdn.microsoft.com/library/default.asp url=/library/en-us/wcewinet/html/cerefinternet_buffers.asp !! Intellisense also shows that these two are supported on SP2003, so atleast thery are there in the headers. Did the unicode version give some problem at link time
Thanks
Alan joe
My code is really simple..I think this wud be handy..
The url i pass is http://10.20.40.1/foo.html and my synchronous version of the same function works well with this URL..
The hRequest handle is a private member of CInternetData and is supposedly handled by the callback function; else the function wud loop indefinitely in the endless while loop..
int CInternetData::IssueHttpRequestAsync(LPCTSTR lpszUrl,LPTSTR lpResponse)
{
TCHAR lpCanonicalUrl[500];
DWORD dwSize = 0;
char lpBufferA[32000];
TCHAR lpBuffer[32000],lpBufferW[32000];
DWORD dwLastError;
// Initialize the use of the Windows CE Internet functions.
hOpen = InternetOpen (TEXT("CeHttp"), INTERNET_OPEN_TYPE_PRECONFIG,
NULL, 0, INTERNET_FLAG_ASYNC);
if (!hOpen)
{
wsprintf (szErrMsg, TEXT("%s: %d"), TEXT("InternetApi : InternetOpen : "),
GetLastError());
return ERROR_INTERNET_OPEN;
}
INTERNET_STATUS_CALLBACK statusCallback = InternetSetStatusCallback(hOpen,InternetCallbackFunc);if(statusCallback == INTERNET_INVALID_STATUS_CALLBACK)
{
wsprintf (szErrMsg, TEXT("%s: %d"), TEXT("InternetData : InternetSetStatusCallback: "),
GetLastError());
return ERROR_INTERNETCANONICALIZEURL;
}
DWORD_PTR dwContext = (DWORD_PTR)this;
if (!(hRequest = InternetOpenUrl (hOpen, lpszUrl, NULL, 0,
INTERNET_FLAG_RELOAD, dwContext )))
{
dwLastError=GetLastError();
if(dwLastError != ERROR_IO_PENDING)
{
wsprintf (szErrMsg, TEXT("%s:%d"), TEXT("InternetData : InternetOpenUrl : "),dwLastError);
InternetCloseHandle(hOpen);
return ERROR_INTERNET_OPEN_URL;
}
}
while(!hRequest);
char buffer[4096];
TCHAR bufferW[4096];
INTERNET_BUFFERSA ib = {sizeof(INTERNET_BUFFERSA)};
ib.dwStructSize = sizeof(ib);
ib.lpvBuffer = (LPVOID)buffer;
ib.dwBufferLength = 4096*sizeof(char);
bool bOk;
do
{
ZeroMemory(&ib,sizeof(INTERNET_BUFFERSA));
bOk = InternetReadFileExA(hRequest,&ib,IRF_ASYNC, dwContext);
if(bOk)
{
dwSize = MultiByteToWideChar (CP_ACP, 0, buffer, -1, NULL, 0);
MultiByteToWideChar (CP_ACP, 0, buffer, -1, bufferW, dwSize);
_tcscat(lpResponse,(LPCTSTR)bufferW);
}
else
{
dwLastError = GetLastError();
flag=0;
if(dwLastError == ERROR_IO_PENDING)
while(!flag);
else
{
wsprintf (szErrMsg, TEXT("%s: %d"), TEXT("InternetData : InternetReadFileEx: "),
dwLastError);
return ERROR_INTERNETREADFILEEX;
}
}
}while( bOk && ib.dwBufferLength!=0 );
InternetCloseHandle(hRequest);
InternetSetStatusCallback(hOpen,NULL);
InternetCloseHandle(hOpen);
return SUCCESSFUL;
}
ZebSoft
rcook349
Can you send me the code to prdkv@hotmail.com.
thanks
Pradeep
kk302999
Hi Vishal,
Can you post the code that you got working A snippet of the part that made your code work would be great.
Thanks in advance
quadcell
BleskiMan
Thanx avinash for replying. Just that I m having some bad coding days.
This thread would answer your doubts.
http://groups.google.com/group/microsoft.public.inetsdk.programming.wininet/browse_thread/thread/38d21ac578734cd7
Now the problem as it seems to me is that I m not able to get hold of the HINTERNET handle returned by InternetOpenUrl() function. It still returns ERROR_IO_PENDING error code. Now even if I handle the INTERNET_STATUS_HANDLE_CREATED message in the callback function, I still dont have a clue how this callback function receives the handle that was supposed to be returned by InternetOpenUrl() function. The first argument of the callback function is a HINTERNET handle. But its now clear to me that it is the handle that is returned by the InternetOpen() function. And that isnt what is required. So now I am back to the point from where the previous thread started.
Perhaps i think it is the other arguments of the callback function that requires some elaboration which I am afraid is missing on MSDN. Mayb that holds the key to all the questions.
I hope you have understood my problem. Have any input on this
DrScheme
Hello Vishal,
I am having similar problem with asynchronous internet access, could you please send me your sample code to madhubabu.goka@gmail.com
arv_6363
Hello Vishal,
Gkeramidas
Hi Vishal,
Its my turn for the head banging.. I am 2 days into it.. and no respite. I have my asynchronous code working on my PC.. but when I port it to the device(WM5.0 PPC), I get ERROR_IO_PENDING notification from HttpSendRequest and my callback function never gets called. !!
Could you please send me your test code for asynchronous connection to vishuonline_at_hotmail.com.
Thanks in advance.
Best Regards,
joe123
Hi,
May be having a look at the following links shall help.
http://msdn.microsoft.com/library/default.asp url=/archive/en-us/dnarwebtool/html/msdn_advftp.asp (look at the callback section and the meaning of function parameters for the callback)
http://www.codeproject.com/internet/asyncwininet.asp
Hope this helps.
SKX
A little addendum...Patch up rather
I serched n found this link
http://msdn.microsoft.com/library/default.asp url=/library/en-us/wininet/wininet/wininet_errors.asp
It tells that 12018 error is coz of incorrect type of handle..
Any comments now
Kevin Herring
Finally after 3 days of headscrewing i have been able to write and test code for asynchronous internet access. This thread can be considered to be closed now. Anybody if needs the code can get it from me.
Vishal
the_real_joc
Hi Vishal,
I saw your posts on MSDN and currently I'm also struggling with asynchronous WinInet requests on Windows Mobile while synchronous is working.
My callback function is never called after the request.
May I ask you to send me your working code as you mentioned in your posts
My email address is harreld_at_mobilaria_dot_com
Thank you in advance and best regards,
Harreld Kuiper