Index: trunk/src/gdi32/dibsect.cpp
===================================================================
--- trunk/src/gdi32/dibsect.cpp	(revision 1965)
+++ trunk/src/gdi32/dibsect.cpp	(revision 1966)
@@ -1,3 +1,3 @@
-/* $Id: dibsect.cpp,v 1.10 1999-12-02 13:26:04 achimha Exp $ */
+/* $Id: dibsect.cpp,v 1.11 1999-12-04 13:53:12 hugh Exp $ */
 
 /*
@@ -101,4 +101,5 @@
    dprintf(("pOS2bmp->ulCompression %d\n", pOS2bmp->ulCompression));
    dprintf(("pOS2bmp->cbImage       %d\n", pOS2bmp->cbImage));
+   dprintf(("Bits at 0x%08X\n",bmpBits));
 
    this->handle = handle;
@@ -123,4 +124,5 @@
      dsect->next = this;
    }
+
    dprintf(("Class created"));
 }
@@ -134,14 +136,17 @@
         free(pOS2bmp);
 
-   if(section == this) {
-        section = this->next;
-   }
-   else {
-        DIBSection *dsect = section;
-
-        while(dsect->next != this) {
-                dsect = dsect->next;
-        }
-        dsect->next = this->next;
+   if(section == this)
+   {
+     section = this->next;
+   }
+   else
+   {
+     DIBSection *dsect = section;
+
+     while(dsect->next != this)
+     {
+       dsect = dsect->next;
+     }
+     dsect->next = this->next;
    }
 }
@@ -161,30 +166,32 @@
   switch(pbmi->biBitCount)
   {
-        case 1:
-                bmpsize /= 8;
-                palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
-                os2bmpsize += palsize;
-                break;
-        case 4:
-                bmpsize /= 2;
-                palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
-                os2bmpsize += palsize;
-                break;
-        case 8:
-                palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
-                os2bmpsize += palsize;
-                break;
-        case 16:
-                bmpsize *= 2;
-                break;
-        case 24:
-                bmpsize *= 3;
-                break;
-        case 32:
-                bmpsize *= 4;
-                break;
-   }
-   if(bmpsize & 3) {
-        bmpsize = (bmpsize + 3) & ~3;
+    case 1:
+      bmpsize /= 8;
+      palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
+      os2bmpsize += palsize;
+      break;
+    case 4:
+      bmpsize /= 2;
+      palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
+      os2bmpsize += palsize;
+      break;
+    case 8:
+      palsize = ((1 << pbmi->biBitCount))*sizeof(RGB2);
+      os2bmpsize += palsize;
+      break;
+    case 16:
+      bmpsize *= 2;
+      break;
+    case 24:
+      bmpsize *= 3;
+      break;
+    case 32:
+      bmpsize *= 4;
+      break;
+   }
+
+   if(bmpsize & 3)
+   {
+     bmpsize = (bmpsize + 3) & ~3;
    }
 
@@ -216,12 +223,18 @@
  int i;
 
-  if(startIdx + cEntries > (1 << pOS2bmp->cBitCount)) {
-        dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries));
-        return(0);
-  }
+  if(startIdx + cEntries > (1 << pOS2bmp->cBitCount))
+  {
+    dprintf(("DIBSection::SetDIBColorTable, invalid nr of entries %d %d\n", startIdx, cEntries));
+    return(0);
+  }
+
   memcpy(&pOS2bmp->argbColor[startIdx], rgb, cEntries*sizeof(RGB2));
-  for(i=startIdx;i<cEntries;i++) {
-        pOS2bmp->argbColor[i].fcOptions = 0;
-  }
+
+  for(i=startIdx;i<cEntries;i++)
+  {
+    pOS2bmp->argbColor[i].fcOptions = 0;
+    dprintf2(("Index %d : 0x%08X\n",i, *((ULONG*)(&pOS2bmp->argbColor[i])) ));
+  }
+
   return(cEntries);
 }
@@ -306,4 +319,5 @@
   this->hdc  = hdc;
   hwndParent = WinWindowFromDC(hdc);
+  dprintf(("SelectDIBObject(0x%08X) hwndParent = 0x%08X\n",hdc, hwndParent));
 }
 //******************************************************************************
@@ -313,9 +327,11 @@
  DIBSection *dsect = section;
 
-  while(dsect) {
-        if(dsect->handle == handle) {
-                return(dsect);
-        }
-        dsect = dsect->next;
+  while(dsect)
+  {
+    if(dsect->handle == handle)
+    {
+      return(dsect);
+    }
+    dsect = dsect->next;
   }
   return(NULL);
@@ -328,9 +344,11 @@
  DIBSection *dsect = section;
 
-  while(dsect) {
-        if(dsect->hdc == hdc) {
-                return(dsect);
-        }
-        dsect = dsect->next;
+  while(dsect)
+  {
+    if(dsect->hdc == hdc)
+    {
+      return(dsect);
+    }
+    dsect = dsect->next;
   }
   return(NULL);
@@ -343,10 +361,11 @@
 
   if(dsect)
-        delete dsect;
-
-}
-//******************************************************************************
-//******************************************************************************
-int DIBSection::GetDIBSection(int iSize , DIBSECTION *pDIBSection){
+    delete dsect;
+
+}
+//******************************************************************************
+//******************************************************************************
+int DIBSection::GetDIBSection(int iSize , DIBSECTION *pDIBSection)
+{
   if( (sizeof(DIBSECTION)==iSize) &&
       (pDIBSection !=NULL))
@@ -388,4 +407,12 @@
 //******************************************************************************
 //******************************************************************************
+char  DIBSection::GetBitCount()
+{
+   if(NULL==pOS2bmp)
+     return 0;
+   else
+     return pOS2bmp->cBitCount;
+}
+//******************************************************************************
+//******************************************************************************
 DIBSection *DIBSection::section = NULL;
-
Index: trunk/src/gdi32/dibsect.h
===================================================================
--- trunk/src/gdi32/dibsect.h	(revision 1965)
+++ trunk/src/gdi32/dibsect.h	(revision 1966)
@@ -1,3 +1,3 @@
-/* $Id: dibsect.h,v 1.7 1999-12-02 13:26:05 achimha Exp $ */
+/* $Id: dibsect.h,v 1.8 1999-12-04 13:53:14 hugh Exp $ */
 
 /*
@@ -10,5 +10,6 @@
 
 #ifdef OS2_ONLY
-typedef struct {
+typedef struct
+{
   BYTE rgbBlue;
   BYTE rgbGreen;
@@ -67,5 +68,5 @@
               char *GetDIBObject()           { return bmpBits;  };
               void  SelectDIBObject(HDC hdc);
-
+              char  GetBitCount();
               void  UnSelectDIBObject()      { this->hdc = 0;   };
 
Index: trunk/src/gdi32/font.cpp
===================================================================
--- trunk/src/gdi32/font.cpp	(revision 1965)
+++ trunk/src/gdi32/font.cpp	(revision 1966)
@@ -1,3 +1,3 @@
-/* $Id: font.cpp,v 1.6 1999-11-11 19:09:34 sandervl Exp $ */
+/* $Id: font.cpp,v 1.7 1999-12-04 13:53:12 hugh Exp $ */
 
 /*
@@ -37,7 +37,7 @@
 
 typedef struct {
-	DWORD userProc;
-	DWORD userData;
-	DWORD dwFlags;
+  DWORD userProc;
+  DWORD userData;
+  DWORD dwFlags;
 } ENUMUSERDATA;
 
@@ -72,5 +72,5 @@
   { HANGEUL_CHARSET, 949, FS(19)},
   { CHINESEBIG5_CHARSET, 950, FS(20)},
-  { JOHAB_CHARSET, 1361, FS(21)}, 
+  { JOHAB_CHARSET, 1361, FS(21)},
   /* reserved for alternate ANSI and OEM */
   { DEFAULT_CHARSET, 0, FS(0)},
@@ -266,5 +266,5 @@
 {
  ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
- FONTENUMPROCA proc = (FONTENUMPROCA)lpEnumData->userProc; 
+ FONTENUMPROCA proc = (FONTENUMPROCA)lpEnumData->userProc;
 
   return proc(lpLogFont, lpTextM, arg3, lpEnumData->userData);
@@ -276,5 +276,5 @@
 {
  ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
- FONTENUMPROCW proc = (FONTENUMPROCW)lpEnumData->userProc; 
+ FONTENUMPROCW proc = (FONTENUMPROCW)lpEnumData->userProc;
  ENUMLOGFONTW LogFont;
  NEWTEXTMETRICW textM;
@@ -321,5 +321,5 @@
 {
  ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
- FONTENUMPROCEXA proc = (FONTENUMPROCEXA)lpEnumData->userProc; 
+ FONTENUMPROCEXA proc = (FONTENUMPROCEXA)lpEnumData->userProc;
  ENUMLOGFONTEXA logFont;
  NEWTEXTMETRICEXA textM;
@@ -340,5 +340,5 @@
 {
  ENUMUSERDATA *lpEnumData = (ENUMUSERDATA *)arg4;
- FONTENUMPROCEXW proc = (FONTENUMPROCEXW)lpEnumData->userProc; 
+ FONTENUMPROCEXW proc = (FONTENUMPROCEXW)lpEnumData->userProc;
  ENUMLOGFONTEXW LogFont;
  NEWTEXTMETRICEXW textM;
@@ -598,5 +598,5 @@
  * Fills a CHARSETINFO structure for a character set, code page, or
  * font. This allows making the correspondance between different labelings
- * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges) 
+ * (character set, Windows, ANSI, and OEM codepages, and Unicode ranges)
  * of the same encoding.
  *
@@ -613,5 +613,5 @@
        if flags == TCI_SRCCHARSET: a character set value
        if flags == TCI_SRCCODEPAGE: a code page value
-		 */
+     */
   LPCHARSETINFO lpCs, /* structure to receive charset information */
   DWORD flags /* determines interpretation of lpSrc */
@@ -620,5 +620,5 @@
     switch (flags) {
     case TCI_SRCFONTSIG:
-	while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
+  while (!(*lpSrc>>index & 0x0001) && index<MAXTCIINDEX) index++;
       break;
     case TCI_SRCCODEPAGE:
Index: trunk/src/gdi32/gdi32.cpp
===================================================================
--- trunk/src/gdi32/gdi32.cpp	(revision 1965)
+++ trunk/src/gdi32/gdi32.cpp	(revision 1966)
@@ -1,3 +1,3 @@
-/* $Id: gdi32.cpp,v 1.22 1999-12-03 17:31:49 cbratschi Exp $ */
+/* $Id: gdi32.cpp,v 1.23 1999-12-04 13:53:12 hugh Exp $ */
 
 /*
@@ -149,11 +149,21 @@
 //******************************************************************************
 //******************************************************************************
+
+static hFntDefaultGui = NULL;
 HGDIOBJ WIN32API GetStockObject(int arg1)
 {
  HGDIOBJ obj;
 
-    switch(arg1) {
+    switch(arg1)
+    {
         case DEFAULT_GUI_FONT:
-                obj = NULL;
+                if(NULL==hFntDefaultGui)
+                  hFntDefaultGui = CreateFontA( 0, 0, 0, 0, FW_MEDIUM, FALSE,
+                                                FALSE, FALSE, ANSI_CHARSET,
+                                                OUT_DEFAULT_PRECIS,
+                                                CLIP_DEFAULT_PRECIS,
+                                                DEFAULT_QUALITY,
+                                                FIXED_PITCH|FF_MODERN, "WarpSans");
+                obj = hFntDefaultGui;
                 break;
         default:
@@ -168,5 +178,5 @@
 UINT WIN32API RealizePalette( HDC arg1)
 {
-    dprintf(("GDI32: RealizePalette\n"));
+    dprintf(("GDI32: RealizePalette(0x%08X)\n",arg1));
     return O32_RealizePalette(arg1);
 }
@@ -176,15 +186,15 @@
 {
 
-    if(DIBSection::getSection() != NULL)
+  if(DIBSection::getSection() != NULL)
+  {
+    DIBSection *dsect = DIBSection::find(arg1);
+    if(dsect)
     {
-      DIBSection *dsect = DIBSection::find(arg1);
-      if(dsect)
-      {
-        return dsect->GetDIBSection(arg2, (DIBSECTION*)arg3);
-      }
+      return dsect->GetDIBSection(arg2, (DIBSECTION*)arg3);
     }
-
-    dprintf(("GDI32: GetObject %X %X %X\n", arg1, arg2, arg3));
-    return O32_GetObject(arg1, arg2, arg3);
+  }
+
+  dprintf(("GDI32: GetObject %X %X %X\n", arg1, arg2, arg3));
+  return O32_GetObject(arg1, arg2, arg3);
 }
 //******************************************************************************
@@ -214,6 +224,14 @@
 HPALETTE WIN32API CreatePalette( const LOGPALETTE * arg1)
 {
+  HPALETTE rc;
     dprintf(("GDI32: CreatePalette\n"));
-    return O32_CreatePalette(arg1);
+   for(int i=0; i<arg1->palNumEntries;i++)
+   {
+     dprintf2(("Index %d : 0x%08X\n",i, *((DWORD*)(&arg1->palPalEntry[i])) ));
+   }
+   rc = O32_CreatePalette(arg1);
+   dprintf(("  returns 0x%08X\n",rc));
+
+   return rc;
 }
 //******************************************************************************
@@ -266,10 +284,21 @@
 HBITMAP WIN32API CreateDIBitmap(HDC arg1, const BITMAPINFOHEADER * arg2, DWORD arg3, const void * arg4, const BITMAPINFO * arg5, UINT  arg6)
 {
+  int iHeight;
+  HBITMAP rc;
     dprintf(("GDI32: CreateDIBitmap\n"));
-//TEMPORARY HACK TO PREVENT CRASH IN OPEN32 (WSeB GA)
-    if(arg2->biHeight < 0) {
-        ((BITMAPINFOHEADER *)arg2)->biHeight = -arg2->biHeight;
+
+    //TEMPORARY HACK TO PREVENT CRASH IN OPEN32 (WSeB GA)
+
+    iHeight = arg2->biHeight;
+    if(arg2->biHeight < 0)
+    {
+      ((BITMAPINFOHEADER *)arg2)->biHeight = -arg2->biHeight;
     }
-    return O32_CreateDIBitmap(arg1, arg2, arg3, arg4, arg5, arg6);
+
+    rc = O32_CreateDIBitmap(arg1, arg2, arg3, arg4, arg5, arg6);
+
+    ((BITMAPINFOHEADER *)arg2)->biHeight = iHeight;
+
+    return rc;
 }
 //******************************************************************************
@@ -378,5 +407,5 @@
 int WIN32API SetStretchBltMode( HDC arg1, int  arg2)
 {
-  dprintf(("GDI32: SetStretchBltMode %X, %x\n",arg1, arg2));
+  dprintf(("GDI32: SetStretchBltMode 0x%08X, 0x%08X\n",arg1, arg2));
 
   if(DIBSection::getSection() != NULL)
@@ -398,22 +427,28 @@
 ////    dprintf(("GDI32: SelectObject\n"));
 
-    if(DIBSection::getSection() != NULL) {
-        DIBSection *dsect;
-
-        dsect = DIBSection::find(hdc);
-        if(dsect) {//remove previously selected dibsection
-                dsect->UnSelectDIBObject();
-        }
-        dsect = DIBSection::find((DWORD)hObj);
-        if(dsect) {
-                dsect->SelectDIBObject(hdc);
-        }
+    if(DIBSection::getSection() != NULL)
+    {
+      DIBSection *dsect;
+
+      dsect = DIBSection::find(hdc);
+      if(dsect)
+      {
+        //remove previously selected dibsection
+        dsect->UnSelectDIBObject();
+      }
+      dsect = DIBSection::find((DWORD)hObj);
+      if(dsect)
+      {
+        dsect->SelectDIBObject(hdc);
+      }
     }
     rc = O32_SelectObject(hdc, hObj);
-    if(rc != 0 && DIBSection::getSection != NULL) {
-        DIBSection *dsect = DIBSection::find((DWORD)rc);
-        if(dsect) {
-                dsect->UnSelectDIBObject();
-        }
+    if(rc != 0 && DIBSection::getSection != NULL)
+    {
+      DIBSection *dsect = DIBSection::find((DWORD)rc);
+      if(dsect)
+      {
+        dsect->UnSelectDIBObject();
+      }
     }
     return(rc);
@@ -423,6 +458,22 @@
 HPALETTE WIN32API SelectPalette(HDC arg1, HPALETTE arg2, BOOL arg3)
 {
-    dprintf(("GDI32: SelectPalette %x", arg1));
-    return O32_SelectPalette(arg1, arg2, arg3);
+  dprintf(("GDI32: SelectPalette (0x%08X, 0x%08X, 0x%08X)\n", arg1, arg2, arg3));
+  if(DIBSection::getSection() != NULL)
+  {
+    DIBSection *dsect = DIBSection::findHDC(arg1);
+    if(dsect)
+    {
+      PALETTEENTRY Pal[256];
+      char PalSize = dsect->GetBitCount();
+      dprintf(("       - Set Palette Values in DIBSection\n"));
+      if(PalSize<=8)
+      {
+        GetPaletteEntries( arg2, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal);
+        dsect->SetDIBColorTable(0, 1<< PalSize, (RGBQUAD*)&Pal);
+      }
+
+    }
+  }
+  return O32_SelectPalette(arg1, arg2, arg3);
 }
 //******************************************************************************
@@ -651,4 +702,5 @@
     char *astring2 = UnicodeToAsciiString((LPWSTR)arg2);
     char *astring3 = UnicodeToAsciiString((LPWSTR)arg3);
+
     if(arg4)
     {
@@ -697,5 +749,4 @@
       devmode.dmReserved1        = arg4->dmReserved1;
       devmode.dmReserved2        = arg4->dmReserved2;
-
       rc = O32_CreateDC(astring1,astring2,astring3,&devmode);
     }
@@ -706,4 +757,5 @@
     FreeAsciiString(astring2);
     FreeAsciiString(astring3);
+
     if(arg4)
     {
@@ -739,8 +791,13 @@
 HENHMETAFILE WIN32API CreateEnhMetaFileW( HDC arg1, LPCWSTR arg2, const RECT * arg3, LPCWSTR  arg4)
 {
-    dprintf(("GDI32: CreateEnhMetaFileW STUB"));
-    // NOTE: This will not work as is (needs UNICODE support)
-//    return O32_CreateEnhMetaFile(arg1, arg2, arg3, arg4);
-    return 0;
+    char *astring1 = UnicodeToAsciiString((LPWSTR)arg2);
+    char *astring2 = UnicodeToAsciiString((LPWSTR)arg4);
+    HENHMETAFILE   rc;
+
+    dprintf(("GDI32: CreateMetaFileW"));
+    rc = O32_CreateEnhMetaFile(arg1,astring1,arg3,astring2);
+    FreeAsciiString(astring1);
+    FreeAsciiString(astring2);
+    return rc;
 }
 //******************************************************************************
@@ -1322,6 +1379,9 @@
 UINT WIN32API GetNearestPaletteIndex( HPALETTE arg1, COLORREF  arg2)
 {
-    dprintf(("GDI32: GetNearestPaletteIndex\n"));
-    return O32_GetNearestPaletteIndex(arg1, arg2);
+    UINT rc;
+    dprintf(("GDI32: GetNearestPaletteIndex (0x%08X ,0x%08X) ",arg1,arg2));
+    rc = O32_GetNearestPaletteIndex(arg1, arg2);
+    dprintf(("Returns %d\n",rc));
+    return rc;
 }
 //******************************************************************************
@@ -2108,25 +2168,31 @@
 //******************************************************************************
 //WINE: OBJECTS\DIB.C
-//******************************************************************************
-HBITMAP WIN32API CreateDIBSection(HDC hdc, BITMAPINFO *pbmi, UINT iUsage,
-                                     VOID **ppvBits, HANDLE hSection, DWORD dwOffset)
+//*********************************************************************************
+HBITMAP WIN32API CreateDIBSection( HDC hdc, BITMAPINFO *pbmi, UINT iUsage,
+                                   VOID **ppvBits, HANDLE hSection, DWORD dwOffset)
 {
  HBITMAP res = 0;
  BOOL    fFlip = 0;
+ int iHeight, iWidth;
 
   dprintf(("GDI32: CreateDIBSection %x %x %x %d", hdc, iUsage, hSection, dwOffset));
-  if(hSection) {
-        dprintf(("GDI32: CreateDIBSection, hSection != NULL, not supported!\n"));
-        return NULL;
+  if(hSection)
+  {
+    dprintf(("GDI32: CreateDIBSection, hSection != NULL, not supported!\n"));
+    return NULL;
   }
 
   //SvL: 13-9-98: StarCraft uses bitmap with negative height
-  if(pbmi->bmiHeader.biWidth < 0) {
-        pbmi->bmiHeader.biWidth = -pbmi->bmiHeader.biWidth;
-        fFlip = FLIP_HOR;
+  iWidth = pbmi->bmiHeader.biWidth;
+  if(pbmi->bmiHeader.biWidth < 0)
+  {
+    pbmi->bmiHeader.biWidth = -pbmi->bmiHeader.biWidth;
+    fFlip = FLIP_HOR;
   }
-  if(pbmi->bmiHeader.biHeight < 0) {
-        pbmi->bmiHeader.biHeight = -pbmi->bmiHeader.biHeight;
-        fFlip |= FLIP_VERT;
+  iHeight = pbmi->bmiHeader.biHeight;
+  if(pbmi->bmiHeader.biHeight < 0)
+  {
+    pbmi->bmiHeader.biHeight = -pbmi->bmiHeader.biHeight;
+    fFlip |= FLIP_VERT;
   }
 
@@ -2134,14 +2200,47 @@
   if (res)
   {
-        DIBSection *dsect = new DIBSection((WINBITMAPINFOHEADER *)&pbmi->bmiHeader, (DWORD)res, fFlip);
-        dprintf(("Constructor returned\n",res));
-        if(ppvBits!=NULL)
-          *ppvBits = dsect->GetDIBObject();
-        dprintf(("GDI32: return %08X\n",res));
-        return(res);
+    ULONG Pal[256];
+    char PalSize;
+    LOGPALETTE tmpPal = { 0x300,1,{0,0,0,0}};
+    HPALETTE hpalCur, hpalTmp;
+    DIBSection *dsect = new DIBSection((WINBITMAPINFOHEADER *)&pbmi->bmiHeader, (DWORD)res, fFlip);
+    dprintf(("Constructor returned\n"));
+
+    if(NULL!=dsect)
+    {
+      PalSize = dsect->GetBitCount();
+      if(PalSize<=8)
+      {
+        // Now get the current Palette from the DC
+        hpalTmp = CreatePalette(&tmpPal);
+        hpalCur = SelectPalette(hdc, hpalTmp, FALSE);
+
+        // and use it to set the DIBColorTable
+        GetPaletteEntries( hpalCur, 0, 1<<PalSize, (LPPALETTEENTRY)&Pal);
+        dsect->SetDIBColorTable(0, 1<< PalSize, (RGBQUAD*)&Pal);
+
+        // Restore the DC Palette
+        SelectPalette(hdc,hpalCur,FALSE);
+        DeleteObject(hpalTmp);
+      }
+      // Set the hdc in the DIBSection so we can update the palete if a new
+      // Paletet etc. gets selected into the DC.
+
+      dsect->SelectDIBObject(hdc);
+
+      if(ppvBits!=NULL)
+        *ppvBits = dsect->GetDIBObject();
+
+      pbmi->bmiHeader.biWidth = iWidth;
+      pbmi->bmiHeader.biHeight = iHeight;
+
+      dprintf(("GDI32: return %08X\n",res));
+      return(res);
+    }
   }
 
   /* Error.  */
-  if (res) DeleteObject(res);
+  if (res)
+    DeleteObject(res);
   *ppvBits = NULL;
 #ifdef DEBUG
@@ -2156,5 +2255,5 @@
 //******************************************************************************
 //******************************************************************************
-UINT WIN32API GetDIBColorTable(HDC hdc, UINT uStartIndex, UINT cEntries,
+UINT WIN32API GetDIBColorTable( HDC hdc, UINT uStartIndex, UINT cEntries,
                                   RGBQUAD *pColors)
 {
@@ -2188,8 +2287,10 @@
 
   dprintf(("GDI32: SetDIBColorTable\n"));
-  if(dsect) {
-        return(dsect->SetDIBColorTable(uStartIndex, cEntries, pColors));
+  if(dsect)
+  {
+    return(dsect->SetDIBColorTable(uStartIndex, cEntries, pColors));
   }
-  else  return(0);
+  else
+    return(0);
 }
 //******************************************************************************
@@ -2572,7 +2673,8 @@
  * Result    : TRUE / FALSE
  * Remark    :
- * Status    : UNTESTED STUB
+ * Status    : UNTESTED
  *
  * Author    : Patrick Haller [Mon, 1998/06/15 08:00]
+ *             Markus Montkowski [Wen, 1999/01/12 20:18]
  *****************************************************************************/
 
@@ -2581,10 +2683,32 @@
                                   CONST   XFORM *lLPXFORM2)
 {
-  dprintf(("GDI32: CombineTransform(%08xh,%08xh,%08xh) not implemented.\n",
+  dprintf(("GDI32: CombineTransform(%08xh,%08xh,%08xh).\n",
            lLPXFORMResult,
            lLPXFORM1,
            lLPXFORM2));
 
+  XFORM xfrm;
+  if( O32_IsBadWritePtr( (void*)lLPXFORMResult, sizeof(XFORM)) ||
+      O32_IsBadReadPtr(  (void*)lLPXFORM1, sizeof(XFORM)) ||
+      O32_IsBadWritePtr( (void*)lLPXFORM2, sizeof(XFORM)) )
   return (FALSE);
+
+  // Add the translations
+  lLPXFORMResult->eDx = lLPXFORM1->eDx + lLPXFORM2->eDx;
+  lLPXFORMResult->eDy = lLPXFORM1->eDy + lLPXFORM2->eDy;
+
+  // Multiply the matrixes
+  xfrm.eM11 = lLPXFORM1->eM11 * lLPXFORM2->eM11 + lLPXFORM1->eM21 * lLPXFORM1->eM12;
+  xfrm.eM12 = lLPXFORM1->eM11 * lLPXFORM2->eM12 + lLPXFORM1->eM12 * lLPXFORM1->eM22;
+  xfrm.eM21 = lLPXFORM1->eM21 * lLPXFORM2->eM11 + lLPXFORM1->eM22 * lLPXFORM1->eM21;
+  xfrm.eM22 = lLPXFORM1->eM21 * lLPXFORM2->eM12 + lLPXFORM1->eM22 * lLPXFORM1->eM22;
+
+  // Now copy to resulting XFROM as the pt must not be distinct
+  lLPXFORMResult->eM11 = xfrm.eM11;
+  lLPXFORMResult->eM12 = xfrm.eM12;
+  lLPXFORMResult->eM21 = xfrm.eM21;
+  lLPXFORMResult->eM22 = xfrm.eM22;
+
+  return (TRUE);
 }
 
