From: Vitaly Perov Date: Mon, 27 Sep 2010 11:16:52 +0000 (+0400) Subject: Hacks from CodeWeavers X-Git-Tag: 1.3.3-alt1.1~3 X-Git-Url: http://git.etersoft.ru/projects/?a=commitdiff_plain;h=487ca5ac78ac0106f275da17c5ac854f64b70d35;p=wine%2Feterwine.git Hacks from CodeWeavers Conflicts: dlls/ws2_32/socket.c --- diff --git a/dlls/kernel32/kernel_main.c b/dlls/kernel32/kernel_main.c index 387a32fe14..491c0880ff 100644 --- a/dlls/kernel32/kernel_main.c +++ b/dlls/kernel32/kernel_main.c @@ -109,6 +109,13 @@ static BOOL process_attach( HMODULE module ) { /* Securom checks for this one when version is NT */ set_entry_point( module, "FT_Thunk", 0 ); +#ifdef __i386__ + /* Bit of a CodeWeavers Hack, winehq made it so that win2k mode + * no longer did this. We need it for native dcom95. So until our + * ole implementation works right we need the shared heap*/ + /* create the shared heap for broken win95 native dlls */ + HeapCreate( HEAP_SHARED, 0, 0 ); +#endif } else LoadLibraryA( "krnl386.exe16" ); diff --git a/dlls/user32/win.c b/dlls/user32/win.c index a5761c7552..6c0d20a13a 100644 --- a/dlls/user32/win.c +++ b/dlls/user32/win.c @@ -2507,6 +2507,33 @@ LONG WINAPI SetWindowLongW( INT offset, /* [in] offset, in bytes, of location to alter */ LONG newval /* [in] new value of location */ ) { + if (GetVersion()&0x80000000 && offset == GWLP_WNDPROC) + { + /* CodeWeavers Only Hack... Needed for the Delegates tab + * in Outlook XP running in win98 mode + */ + char class[80]; + GetClassNameA(hwnd, class, sizeof(class)); + if (strcmp(class,"REListBox20W")==0) + { + char name[MAX_PATH], *p; + + GetModuleFileNameA(GetModuleHandleA(NULL),name,MAX_PATH); + p = strrchr(name, '\\'); + + if (p) + p++; + else + p = name; + + if (!strcasecmp(p,"OUTLOOK.EXE")) + { + ERR("Outlook in WIN98 calling supposedly unimplemented function, triggering bandaid for class %s\n",debugstr_a(class)); + SetLastError(ERROR_CALL_NOT_IMPLEMENTED); + return 0; + } + } + } return WIN_SetWindowLong( hwnd, offset, sizeof(LONG), newval, TRUE ); } diff --git a/dlls/ws2_32/socket.c b/dlls/ws2_32/socket.c index c96bbfbf98..6a2f161be4 100644 --- a/dlls/ws2_32/socket.c +++ b/dlls/ws2_32/socket.c @@ -331,6 +331,8 @@ int WSAIOCTL_GetInterfaceName(int intNumber, char *intName); static void WS_AddCompletion( SOCKET sock, ULONG_PTR CompletionValue, NTSTATUS CompletionStatus, ULONG Information ); +static DWORD dwBlockedThreadId; + #define MAP_OPTION(opt) { WS_##opt, opt } static const int ws_sock_map[][2] = @@ -1815,6 +1817,20 @@ SOCKET WINAPI WS_accept(SOCKET s, struct WS_sockaddr *addr, do { /* try accepting first (if there is a deferred connection) */ + if (is_blocking) + { + int fd = get_sock_fd( s, FILE_READ_DATA, NULL ); + if (fd == -1) return INVALID_SOCKET; + /* block here */ + dwBlockedThreadId = GetCurrentThreadId(); + do_block(fd, POLLIN, -1); + dwBlockedThreadId = 0; + _sync_sock_state(s); /* let wineserver notice connection */ + release_sock_fd( s, fd ); + /* retrieve any error codes from it */ + SetLastError(_get_sock_error(s, FD_ACCEPT_BIT)); + /* FIXME: care about the error? */ + } SERVER_START_REQ( accept_socket ) { req->lhandle = wine_server_obj_handle( SOCKET2HANDLE(s) ); @@ -2061,7 +2077,28 @@ int WINAPI WS_bind(SOCKET s, const struct WS_sockaddr* name, int namelen) int WINAPI WS_closesocket(SOCKET s) { TRACE("socket %04lx\n", s); - if (CloseHandle(SOCKET2HANDLE(s))) return 0; + + if (CloseHandle(SOCKET2HANDLE(s))) + { + /* CODEWEAVERS HACK: + * This is used to emulate Windows behaviour in that when you close a + * handle that is being used in a blocking operation it returns with + * EINVAL. Without this hack Wine will just hang forever. This hack + * interrupts the poll system call in do_block with a signal which will + * result in another call to poll and if the handle has been closed it + * will return EINVAL exactly as Windows does. + * NOTE: this relies on the fact that Suspend/ResumeThread are + * implemented using UNIX signals */ + if (dwBlockedThreadId) + { + HANDLE hThread = OpenThread(THREAD_SUSPEND_RESUME, FALSE, dwBlockedThreadId); + SuspendThread(hThread); + ResumeThread(hThread); + CloseHandle(hThread); + } + /* END CODEWEAVERS HACK */ + return 0; + } return SOCKET_ERROR; }