wine and network access

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
roderickmackenzie
Newbie
Newbie
Posts: 1
Joined: Sat Feb 05, 2022 1:43 pm

wine and network access

Post by roderickmackenzie »

Hi,
I'm on Ubuntu 20.04 and I've been trying to write a win32 app to access the web using InternetOpenA and InternetOpenUrlA. Test example copied below. On windows 7 it works fine but on Wine InternetOpenUrlA returns ERROR_INTERNET_UNRECOGNIZED_SCHEME (12006). Which does not make sense as my URL looks fine. I can only guess that something is blocking wine accessing the web. I've disabled apparmour. So, I'm now stuck for new ideas short of trying it on another distro or shifting development to real windows (which I don't want to do). My guess is something is badly configured in Ubuntu or wine but I'm not sure which. Code below:
Any help appreciated.
Thanks.

compile line:
i686-w64-mingw32-gcc -posix test.c -o go.exe -lwininet

code:
#include <stdio.h>
#include <stdlib.h>
#include <windows.h>
#include <wininet.h>

void main()
{
HINTERNET myhinternet, myhttp;
char buf[0x400];
DWORD readbytes, totalbytes=0;
BOOL ret;

myhinternet = InternetOpenA("Winetest",0,NULL,NULL,INTERNET_FLAG_NO_CACHE_WRITE);
if (myhinternet==NULL)
{
printf("Ohh\n");
}

myhttp = InternetOpenUrlA(myhinternet, "http://www.gpvdm.com/index.html", 0, 0, INTERNET_FLAG_RELOAD|INTERNET_FLAG_NO_CACHE_WRITE|INTERNET_FLAG_TRANSFER_BINARY,0);

printf("%p %d",myhttp,GetLastError()); //<<GetLastError() is ERROR_INTERNET_UNRECOGNIZED_SCHEME under wine and 0 on real win7.
getchar();
}
Locked