Hacks from CodeWeavers
authorVitaly Lipatov <lav@etersoft.ru>
Mon, 28 Apr 2008 14:38:34 +0000 (18:38 +0400)
committerKonstantin Kondratyuk <kondratyuk@etersoft.ru>
Mon, 28 Apr 2008 14:38:34 +0000 (18:38 +0400)
dlls/kernel32/kernel_main.c
dlls/user32/win.c
dlls/ws2_32/socket.c

index be1212f2849e8a8e4629ad2f7ca49aade27b1c62..7420b098ad7a52c0c49623b2b25fe8b072330aeb 100644 (file)
@@ -156,6 +156,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
     }
 #ifdef __i386__
     else
index a1f3024eef614b406676edbb897313b1db13a697..cd833ddc9938eed926ce191af96a49448912c092 100644 (file)
@@ -2296,6 +2296,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 );
 }
 
index 1fe0034aaf52edac4ef0008517404d35f63cd81a..eef9645209417619fe99e7e2ca4a247a850fa803 100644 (file)
@@ -243,6 +243,8 @@ int WSAIOCTL_GetInterfaceName(int intNumber, char *intName);
 UINT wsaErrno(void);
 UINT wsaHerrno(int errnr);
 
+static DWORD dwBlockedThreadId;
+
 #define MAP_OPTION(opt) { WS_##opt, opt }
 
 static const int ws_sock_map[][2] =
@@ -1364,7 +1366,9 @@ SOCKET WINAPI WS_accept(SOCKET s, struct WS_sockaddr *addr,
             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 */
@@ -1476,7 +1480,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;
 }