GDI separation patch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi all,

this one resolves
"550 [NEW] - DLL Separation: gdi32 from ntdll (DOSFS_GetFullName)"
http://bugs.winehq.com/long_list.cgi?buglist=550
and tackles
"551 [NEW] - DLL Separation: gdi32 from ntdll (misc)"
http://bugs.winehq.com/long_list.cgi?buglist=551

- replace DOSFS_GetFullName with wine_get_unix_file_name
- replace SELECTOR_AllocBlock and SELECTOR_FreeBlock with standard Win16
  selector calls and some (IMHO ugly) duplicated selector glue code
- slight optimization in SELECTOR_SetEntries

BTW, does anyone have an idea how to get rid of the remaining LOCAL_xxx()
calls in gdiobj.c ?
We need those because we do
    GDI_HeapSel = instance | 7;
, so we directly use the GDI instance plus 7 as the heap selector
for GDI objects (thus we can't do a standard LocalInit, as this would
allocate a *new* selector for the new heap instead of using the implicit
GDI module one, and thus we need to pass the GDI_HeapSel to LOCAL_Alloc instead)

I guess the GDI object heap really *needs* to use GDI module instance|7
as selector (how many apps would break if we didn't do that ??),
so we need to have a way to use a "special" selector with standard Win16
local heap functions...

Any thoughts ?

-- 
Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
Determining best CVS host...
Using CVSROOT :pserver:cvs@rhlx01.fht-esslingen.de:/home/wine
Index: dlls/gdi/printdrv.c
===================================================================
RCS file: /home/wine/wine/dlls/gdi/printdrv.c,v
retrieving revision 1.22
diff -u -r1.22 printdrv.c
--- dlls/gdi/printdrv.c	29 Apr 2002 18:48:56 -0000	1.22
+++ dlls/gdi/printdrv.c	5 May 2002 11:36:46 -0000
@@ -530,7 +530,7 @@
     }
     else
     {
-        DOS_FULL_NAME fullName;
+	char buffer[MAX_PATH];
 
         TRACE("Just assume it's a file\n");
 
@@ -538,12 +538,12 @@
          * The file name can be dos based, we have to find its
          * Unix correspondant file name
          */
-        DOSFS_GetFullName(psCmdP, FALSE, &fullName);
+	wine_get_unix_file_name(psCmdP, buffer, sizeof(buffer));
 
-        if ((fd = open(fullName.long_name, O_CREAT | O_TRUNC | O_WRONLY , 0600)) < 0)
+        if ((fd = open(buffer, O_CREAT | O_TRUNC | O_WRONLY , 0600)) < 0)
         {
-            ERR("Failed to create spool file %s (%s)\n", 
-                fullName.long_name, strerror(errno));
+            ERR("Failed to create spool file '%s' ('%s'). (error %s)\n", 
+                buffer, psCmdP, strerror(errno));
         }
     }
     return fd;
@@ -584,7 +584,7 @@
     {
 	int fd;
 
-	/* Try an create a spool file */
+	/* Try and create a spool file */
 	fd = CreateSpoolFile(lpOutput);
 	if (fd >= 0)
 	{
Index: memory/selector.c
===================================================================
RCS file: /home/wine/wine/memory/selector.c,v
retrieving revision 1.46
diff -u -r1.46 selector.c
--- memory/selector.c	4 May 2002 18:37:08 -0000	1.46
+++ memory/selector.c	5 May 2002 11:36:47 -0000
@@ -161,15 +161,18 @@
     WORD i, count;
 
     wine_ldt_set_base( &entry, base );
-    wine_ldt_set_limit( &entry, size - 1 );
+    if (!base && size == 1)
+        /* Make sure base and limit are not 0 together if the size is not 0 */
+	wine_ldt_set_limit( &entry, 1 );
+    else /* default case */
+        wine_ldt_set_limit( &entry, size - 1 );
     wine_ldt_set_flags( &entry, flags );
-    /* Make sure base and limit are not 0 together if the size is not 0 */
-    if (!base && size == 1) wine_ldt_set_limit( &entry, 1 );
     count = (size + 0xffff) / 0x10000;
     for (i = 0; i < count; i++)
     {
         wine_ldt_set_entry( sel + (i << __AHSHIFT), &entry );
         wine_ldt_set_base( &entry, wine_ldt_get_base(&entry) + 0x10000 );
+	/* yep, Windows sets limit like that, not 64K sel units instead ! */
         wine_ldt_set_limit( &entry, wine_ldt_get_limit(&entry) - 0x10000 );
     }
 }
Index: objects/bitmap.c
===================================================================
RCS file: /home/wine/wine/objects/bitmap.c,v
retrieving revision 1.47
diff -u -r1.47 bitmap.c
--- objects/bitmap.c	28 Mar 2002 22:22:07 -0000	1.47
+++ objects/bitmap.c	5 May 2002 11:36:47 -0000
@@ -443,7 +443,15 @@
         }
         HeapFree(GetProcessHeap(), 0, dib);
         bmp->dib = NULL;
-        if (bmp->segptr_bits) SELECTOR_FreeBlock( SELECTOROF(bmp->segptr_bits) );
+        if (bmp->segptr_bits)
+	{ /* free its selector array */
+		WORD sel = SELECTOROF(bmp->segptr_bits);
+		WORD count = (GetSelectorLimit16(sel) + 1) + 0xffff / 0x10000;
+		int i;
+		
+		for (i = 0; i < count; i++)
+		    FreeSelector16(sel + (i << __AHSHIFT));
+	}
     }
     return GDI_FreeObject( hbitmap, bmp );
 }
Index: objects/dib.c
===================================================================
RCS file: /home/wine/wine/objects/dib.c,v
retrieving revision 1.64
diff -u -r1.64 dib.c
--- objects/dib.c	28 Mar 2002 22:22:07 -0000	1.64
+++ objects/dib.c	5 May 2002 11:36:48 -0000
@@ -895,7 +895,21 @@
             INT size  = (bi->biSizeImage && bi->biCompression != BI_RGB) ?
                          bi->biSizeImage : width_bytes * height;
 
-            WORD sel = SELECTOR_AllocBlock( bits32, size, WINE_LDT_FLAGS_DATA );
+	    /* calculate number of sel's needed for size with 64K steps */
+	    WORD count = (size + 0xffff) / 0x10000;
+	    WORD sel = AllocSelectorArray16(count);
+	    DWORD sizeRemain;
+	    int i;
+
+	    sizeRemain = size;
+	    for (i = 0; i < count; i++)
+	    {
+	        SetSelectorBase(sel + (i << __AHSHIFT),
+			(DWORD)bits32 + i * 0x10000);
+	        SetSelectorLimit16(sel + (i << __AHSHIFT),
+			sizeRemain - 1); /* yep, this limit */
+		sizeRemain -= 0x10000;   /* is correct */
+	    }
             bmp->segptr_bits = MAKESEGPTR( sel, 0 );
             if (bits16) *bits16 = bmp->segptr_bits;
         }

[Index of Archives]     [Gimp for Windows]     [Red Hat]     [Samba]     [Yosemite Camping]     [Graphics Cards]     [Wine Home]

  Powered by Linux