[PATCH 0/1] MR10137: url: Implement InetIsOffline
Sending upstream -- https://gitlab.winehq.org/wine/wine/-/merge_requests/10137
From: Si Lai <lesboyspp43@outlook.com> --- dlls/url/url_main.c | 60 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 57 insertions(+), 3 deletions(-) diff --git a/dlls/url/url_main.c b/dlls/url/url_main.c index f4f70cd7491..a2029a7f4fa 100644 --- a/dlls/url/url_main.c +++ b/dlls/url/url_main.c @@ -24,6 +24,7 @@ #include "shellapi.h" #include "shlwapi.h" #include "intshcut.h" +#include "iphlpapi.h" #include "winuser.h" #include "commctrl.h" #include "prsht.h" @@ -31,6 +32,24 @@ WINE_DEFAULT_DEBUG_CHANNEL(url); +/*********************************************************************** + * DllMain (URL.@) + */ +BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved ) +{ + switch(reason) + { +#ifndef __REACTOS__ + case DLL_WINE_PREATTACH: + return FALSE; /* prefer native version */ +#endif + case DLL_PROCESS_ATTACH: + DisableThreadLibraryCalls( inst ); + break; + } + return TRUE; +} + /*********************************************************************** * AddMIMEFileTypesPS (URL.@) * @@ -53,12 +72,42 @@ DWORD WINAPI AddMIMEFileTypesPS(VOID * unknown1, LPPROPSHEETHEADERA lppsh) /*********************************************************************** * InetIsOffline (URL.@) * + * Check the internet is offline or not + * + * PARAMS + * flags [I] Must be zero + * + * RETURNS + * Online: FALSE + * Offline: TRUE */ BOOL WINAPI InetIsOffline(DWORD flags) { - FIXME("(%08lx): stub!\n", flags); + ULONG Size = 0; + GetAdaptersAddresses(AF_UNSPEC, 0, NULL, &Size); - return FALSE; + PIP_ADAPTER_ADDRESSES Adapters = (PIP_ADAPTER_ADDRESSES)HeapAlloc(GetProcessHeap(), 0, Size); + + if (!Adapters) + return TRUE; + + GetAdaptersAddresses(AF_UNSPEC, 0, Adapters, &Size); + + PIP_ADAPTER_ADDRESSES Current = Adapters; + + while (Current) + { + if (Current->OperStatus == IfOperStatusUp) + { + HeapFree(GetProcessHeap(), 0, Adapters); + return FALSE; + } + Current = Current->Next; + } + + HeapFree(GetProcessHeap(), 0, Adapters); + + return TRUE; } /*********************************************************************** @@ -89,7 +138,12 @@ void WINAPI FileProtocolHandlerA(HWND hWnd, HINSTANCE hInst, LPCSTR pszUrl, int */ void WINAPI OpenURLA(HWND hwnd, HINSTANCE inst, LPCSTR cmdline, INT show) { +#ifdef __REACTOS__ + TRACE("(%p, %p, %s, %d)\n", hwnd, inst, debugstr_a(cmdline), show); + ShellExecuteA(hwnd, NULL, cmdline, NULL, NULL, show); +#else FIXME("(%p, %p, %s, %d): stub!\n", hwnd, inst, debugstr_a(cmdline), show); +#endif } /*********************************************************************** @@ -102,4 +156,4 @@ HRESULT WINAPI TelnetProtocolHandlerA(HWND hWnd, LPSTR lpStr) FIXME("(%p, %p): stub!\n",hWnd,lpStr); return E_NOTIMPL; -} +} \ No newline at end of file -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/10137
participants (2)
-
Si Lai -
Si Lai (@LesBoys43)