changeset 249:b3dbd786541a

Fix: compile errors
author Frank Benoit <benoit@tionex.de>
date Sun, 06 Jul 2008 17:23:35 +0200
parents 41a9fce66f7f
children 55591bc3974c
files dwt/graphics/GC.d dwt/graphics/TextLayout.d dwt/internal/win32/OS.d dwt/internal/win32/WINAPI.d dwt/internal/win32/WINTYPES.d dwt/widgets/Button.d dwt/widgets/DateTime.d dwt/widgets/Display.d dwt/widgets/Group.d dwt/widgets/Table.d dwt/widgets/Tree.d
diffstat 11 files changed, 270 insertions(+), 177 deletions(-) [+]
line wrap: on
line diff
--- a/dwt/graphics/GC.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/graphics/GC.d	Sun Jul 06 17:23:35 2008 +0200
@@ -1484,7 +1484,7 @@
 void drawBitmapTransparent(Image srcImage, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, int destWidth, int destHeight, bool simple, BITMAP bm, int imgWidth, int imgHeight) {
 
     /* Find the RGB values for the transparent pixel. */
-    bool isDib = bm.bmBits !is 0;
+    bool isDib = bm.bmBits !is null;
     auto hBitmap = srcImage.handle;
     auto srcHdc = OS.CreateCompatibleDC(handle);
     auto oldSrcBitmap = OS.SelectObject(srcHdc, hBitmap);
--- a/dwt/graphics/TextLayout.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/graphics/TextLayout.d	Sun Jul 06 17:23:35 2008 +0200
@@ -17,8 +17,6 @@
 import dwt.internal.Compatibility;
 import dwt.internal.gdip.Gdip;
 
-import dwt.internal.win32.EMR;
-import dwt.internal.win32.EMREXTCREATEFONTINDIRECTW;
 import dwt.internal.win32.OS;
 
 import dwt.graphics.Color;
@@ -511,8 +509,8 @@
     OS.OleUninitialize();
 }
 
-SCRIPT_ANALYSIS cloneScriptAnalysis (SCRIPT_ANALYSIS src) {
-    SCRIPT_ANALYSIS dst = new SCRIPT_ANALYSIS();
+SCRIPT_ANALYSIS cloneScriptAnalysis ( inout SCRIPT_ANALYSIS src) {
+    SCRIPT_ANALYSIS dst;
     dst.eScript = src.eScript;
     dst.fRTL = src.fRTL;
     dst.fLayoutRTL = src.fLayoutRTL;
@@ -520,7 +518,6 @@
     dst.fLinkAfter = src.fLinkAfter;
     dst.fLogicalOrder = src.fLogicalOrder;
     dst.fNoGlyphIndex = src.fNoGlyphIndex;
-    dst.s = new SCRIPT_STATE();
     dst.s.uBidiLevel = src.s.uBidiLevel; 
     dst.s.fOverrideDirection = src.s.fOverrideDirection;
     dst.s.fInhibitSymSwap = src.s.fInhibitSymSwap;
@@ -2783,16 +2780,17 @@
     this.wrapWidth = width;
 }
 
-bool shape (HDC hdc, StyleItem run, char[] chars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIES sp) {
-    wchar[] wchars = StrToWCHARs( chars );
+bool shape (HDC hdc, StyleItem run, wchar[] wchars, int[] glyphCount, int maxGlyphs, SCRIPT_PROPERTIES* sp) {
+    //wchar[] wchars = StrToWCHARs( chars );
     bool useCMAPcheck = !sp.fComplex && !run.analysis.fNoGlyphIndex;
     if (useCMAPcheck) {
-        short[] glyphs = new short[chars.length];
-        if (OS.ScriptGetCMap(hdc, run.psc, chars, chars.length, 0, glyphs) !is OS.S_OK) {
-            if (run.psc !is 0) {
+        ushort[] glyphs = new ushort[wchars.length];
+        scope(exit) delete glyphs;
+        if (OS.ScriptGetCMap(hdc, run.psc, wchars.ptr, wchars.length, 0, glyphs.ptr) !is OS.S_OK) {
+            if (run.psc !is null) {
                 OS.ScriptFreeCache(run.psc);
                 glyphCount[0] = 0;
-                OS.MoveMemory(run.psc, new int /*long*/ [1], OS.PTR_SIZEOF);
+                *cast(int*)run.psc = 1;
             }
             return false;
         }
@@ -2839,7 +2837,7 @@
     final char[] chars = new char[run.length];
     segmentsText.getChars(run.start, run.start + run.length, chars, 0);
     wchar[] wchars = StrToWCHARs( chars );
-    int maxGlyphs = (chars.length * 3 / 2) + 16;
+    int maxGlyphs = (wchars.length * 3 / 2) + 16;
     auto hHeap = OS.GetProcessHeap();
     run.glyphs = cast(ushort*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, maxGlyphs * 2);
     if (run.glyphs is null) DWT.error(DWT.ERROR_NO_HANDLES);
@@ -2849,56 +2847,47 @@
     if (run.visAttrs is null) DWT.error(DWT.ERROR_NO_HANDLES);
     run.psc = cast(SCRIPT_CACHE*)OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, (void*).sizeof);
     if (run.psc is null) DWT.error(DWT.ERROR_NO_HANDLES);
-    final short script = run.analysis.eScript;
-    final SCRIPT_PROPERTIES sp = new SCRIPT_PROPERTIES();
-    OS.MoveMemory(sp, device.scripts[script], SCRIPT_PROPERTIES.sizeof);
-    bool shapeSucceed = shape(hdc, run, chars, buffer,  maxGlyphs, sp);
+    short script = run.analysis.eScript;
+    auto sp = device.scripts[script];
+    bool shapeSucceed = shape(hdc, run, wchars, buffer,  maxGlyphs, sp);
     if (!shapeSucceed) {
-        int /*long*/ hFont = OS.GetCurrentObject(hdc, OS.OBJ_FONT);
-        int /*long*/ ssa = OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, OS.SCRIPT_STRING_ANALYSIS_sizeof());
-        int /*long*/ metaFileDc = OS.CreateEnhMetaFile(hdc, null, null, null);
-        int /*long*/ oldMetaFont = OS.SelectObject(metaFileDc, hFont);
+        auto hFont = OS.GetCurrentObject(hdc, OS.OBJ_FONT);
+        auto ssa = cast(SCRIPT_STRING_ANALYSIS*) OS.HeapAlloc(hHeap, OS.HEAP_ZERO_MEMORY, SCRIPT_STRING_ANALYSIS.sizeof);
+        auto metaFileDc = OS.CreateEnhMetaFile(hdc, null, null, null);
+        auto oldMetaFont = OS.SelectObject(metaFileDc, hFont);
         int flags = OS.SSA_METAFILE | OS.SSA_FALLBACK | OS.SSA_GLYPHS | OS.SSA_LINK;
-        if (OS.ScriptStringAnalyse(metaFileDc, chars, chars.length, 0, -1, flags, 0, null, null, 0, 0, 0, ssa) is OS.S_OK) {
+        if (OS.ScriptStringAnalyse(metaFileDc, wchars.ptr, wchars.length, 0, -1, flags, 0, null, null, null, null, null, ssa) is OS.S_OK) {
             OS.ScriptStringOut(ssa, 0, 0, 0, null, 0, 0, false);
             OS.ScriptStringFree(ssa);
         }
         OS.HeapFree(hHeap, 0, ssa);
         OS.SelectObject(metaFileDc, oldMetaFont);
-        int /*long*/ metaFile = OS.CloseEnhMetaFile(metaFileDc);
-        final EMREXTCREATEFONTINDIRECTW emr = new EMREXTCREATEFONTINDIRECTW();
-        class MetaFileEnumProc {
-            int /*long*/ metaFileEnumProc (int /*long*/ hDC, int /*long*/ table, int /*long*/ record, int /*long*/ nObj, int /*long*/ lpData) {
-                OS.MoveMemory(emr.emr, record, EMR.sizeof);
-                switch (emr.emr.iType) {
-                    case OS.EMR_EXTCREATEFONTINDIRECTW:
-                        OS.MoveMemory(emr, record, EMREXTCREATEFONTINDIRECTW.sizeof);
-                        break;
-                    case OS.EMR_EXTTEXTOUTW:
-                        return 0;
-                }
-                return 1;
+        auto metaFile = OS.CloseEnhMetaFile(metaFileDc);
+        EMREXTCREATEFONTINDIRECTW emr;
+        static extern(Windows) int metaFileEnumProc (HDC hDC, HANDLETABLE* table, ENHMETARECORD* record, int nObj, LPARAM lpData) {
+            EMREXTCREATEFONTINDIRECTW* emr_;
+            OS.MoveMemory(&emr_.emr, record, EMR.sizeof);
+            switch (emr_.emr.iType) {
+                case OS.EMR_EXTCREATEFONTINDIRECTW:
+                    OS.MoveMemory(emr_, record, EMREXTCREATEFONTINDIRECTW.sizeof);
+                    break;
+                case OS.EMR_EXTTEXTOUTW:
+                    return 0;
             }
-        };
-        MetaFileEnumProc object = new MetaFileEnumProc();
-        /* Avoid compiler warnings */
-        if (false) object.metaFileEnumProc(0, 0, 0, 0, 0);
-        Callback callback = new Callback(object, "metaFileEnumProc", 5);
-        int /*long*/ address = callback.getAddress();
-        if (address is 0) DWT.error(DWT.ERROR_NO_MORE_CALLBACKS);
-        OS.EnumEnhMetaFile(0, metaFile, address, 0, null);
+            return 1;
+        }
+        OS.EnumEnhMetaFile(null, metaFile, &metaFileEnumProc, &emr, null);
         OS.DeleteEnhMetaFile(metaFile);
-        callback.dispose();
 
-        int /*long*/ newFont = OS.CreateFontIndirectW(emr.elfw.elfLogFont);
+        auto newFont = OS.CreateFontIndirectW(&emr.elfw.elfLogFont);
         OS.SelectObject(hdc, newFont);
-        if (shapeSucceed = shape(hdc, run, chars, buffer,  maxGlyphs, sp)) {
+        if ((shapeSucceed = shape(hdc, run, wchars, buffer,  maxGlyphs, sp)) is true ) {
             run.fallbackFont = newFont;
         }
         if (!shapeSucceed) {
             if (!sp.fComplex) {
                 run.analysis.fNoGlyphIndex = true;
-                if (shapeSucceed = shape(hdc, run, chars, buffer,  maxGlyphs, sp)) {
+                if ((shapeSucceed = shape(hdc, run, wchars, buffer,  maxGlyphs, sp)) is true ) {
                     run.fallbackFont = newFont;
                 } else {
                     run.analysis.fNoGlyphIndex = false;
@@ -2917,9 +2906,9 @@
                     OS.GetObject( hNewFont, LOGFONT.sizeof, &logFont );
                     /* ReleaseFont() */
                     OS.VtblCall(8, mLangFontLink2, cast(int)hNewFont);
-                    auto mLangFont = OS.CreateFontIndirect(logFont);
+                    auto mLangFont = OS.CreateFontIndirect(&logFont);
                     auto oldFont = OS.SelectObject(hdc, mLangFont);
-                    if (shapeSucceed = shape(hdc, run, chars, buffer,  maxGlyphs, sp)) {
+                    if ((shapeSucceed = shape(hdc, run, wchars, buffer,  maxGlyphs, sp)) is true ) {
                         run.fallbackFont = mLangFont;
                     } else {
                         OS.SelectObject(hdc, oldFont);
--- a/dwt/internal/win32/OS.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/internal/win32/OS.d	Sun Jul 06 17:23:35 2008 +0200
@@ -810,6 +810,7 @@
     public static const int EDGE_SUNKEN = (BDR_SUNKENOUTER | BDR_SUNKENINNER);
     public static const int EDGE_ETCHED = (BDR_SUNKENOUTER | BDR_RAISEDINNER);
     public static const int EDGE_BUMP = (BDR_RAISEDOUTER | BDR_SUNKENINNER);
+    public static const int ELF_VENDOR_SIZE = 4;
     public static const int EM_CANUNDO = 0xc6;
     public static const int EM_CHARFROMPOS = 0xd7;
     public static const int EM_DISPLAYBAND = 0x433;
@@ -840,6 +841,8 @@
     public static const int EM_SETSEL = 0xb1;
     public static const int EM_SETTABSTOPS = 0xcb;
     public static const int EM_UNDO = 199;
+    public static const int EMR_EXTCREATEFONTINDIRECTW = 82;
+    public static const int EMR_EXTTEXTOUTW = 84;
     public static const int EN_ALIGN_LTR_EC = 0x0700;
     public static const int EN_ALIGN_RTL_EC = 0x0701;
     public static const int EN_CHANGE = 0x300;
@@ -1107,6 +1110,7 @@
     public static const int LB_SETHORIZONTALEXTENT = 0x194;
     public static const int LB_SETSEL = 0x185;
     public static const int LB_SETTOPINDEX = 0x197;
+    public static const int LF_FULLFACESIZE = 64;
     public static const int LF_FACESIZE = 32;
     public static const int LGRPID_ARABIC = 0xd;
     public static const int LGRPID_HEBREW = 0xc;
@@ -1699,6 +1703,10 @@
     public static const int SS_OWNERDRAW = 0xd;
     public static const int SS_REALSIZEIMAGE = 0x800;
     public static const int SS_RIGHT = 0x2;
+    public static const int SSA_FALLBACK = 0x00000020;
+    public static const int SSA_GLYPHS = 0x00000080;
+    public static const int SSA_METAFILE = 0x00000800;
+    public static const int SSA_LINK = 0x00001000;
     public static const int STANDARD_RIGHTS_READ = 0x20000;
     public static const int STARTF_USESHOWWINDOW = 0x1;
     public static const int STATE_SYSTEM_INVISIBLE = 0x00008000;
@@ -2328,6 +2336,7 @@
     alias WINAPI.ChooseFontA ChooseFont;
     alias WINAPI.CreateAcceleratorTableA CreateAcceleratorTable;
     alias WINAPI.CreateDCA CreateDC;
+    alias WINAPI.CreateEnhMetaFileA CreateEnhMetaFile;
     alias WINAPI.CreateEventA CreateEvent;
     alias WINAPI.CreateFileA CreateFile;
     alias WINAPI.CreateFontIndirectA CreateFontIndirect;
@@ -2433,6 +2442,7 @@
     alias WINAPI.ChooseFontW ChooseFont;
     alias WINAPI.CreateAcceleratorTableW CreateAcceleratorTable;
     alias WINAPI.CreateDCW CreateDC;
+    alias WINAPI.CreateEnhMetaFileW CreateEnhMetaFile;
     alias WINAPI.CreateEventW CreateEvent;
     alias WINAPI.CreateFileW CreateFile;
     alias WINAPI.CreateFontIndirectW CreateFontIndirect;
@@ -2824,6 +2834,8 @@
 alias WINAPI.ClientToScreen ClientToScreen;
 alias WINAPI.CloseHandle CloseHandle;
 alias WINAPI.CloseClipboard CloseClipboard;
+alias WINAPI.CloseEnhMetaFile CloseEnhMetaFile;
+alias WINAPI.CloseMetaFile CloseMetaFile;
 alias WINAPI.CombineRgn CombineRgn;
 alias WINAPI.CommDlgExtendedError CommDlgExtendedError;
 
@@ -2873,6 +2885,7 @@
 alias WINAPI.DefWindowProcW DefWindowProcW;
 alias WINAPI.DeferWindowPos DeferWindowPos;
 alias WINAPI.DeleteDC DeleteDC;
+alias WINAPI.DeleteEnhMetaFile DeleteEnhMetaFile;
 alias WINAPI.DeleteMenu DeleteMenu;
 alias WINAPI.DeleteObject DeleteObject;
 alias WINAPI.DestroyAcceleratorTable DestroyAcceleratorTable;
@@ -2906,6 +2919,7 @@
 alias WINAPI.EndPaint EndPaint;
 alias WINAPI.EndPath EndPath;
 alias WINAPI.EnumDisplayMonitors EnumDisplayMonitors;
+alias WINAPI.EnumEnhMetaFile EnumEnhMetaFile;
 alias WINAPI.EnumFontFamiliesA EnumFontFamiliesA;
 alias WINAPI.EnumFontFamiliesExA EnumFontFamiliesExA;
 alias WINAPI.EnumFontFamiliesExW EnumFontFamiliesExW;
@@ -3225,7 +3239,11 @@
 alias WINAPI.ScriptLayout ScriptLayout;
 alias WINAPI.ScriptPlace ScriptPlace;
 alias WINAPI.ScriptRecordDigitSubstitution ScriptRecordDigitSubstitution;
+alias WINAPI.ScriptGetCMap ScriptGetCMap;
 alias WINAPI.ScriptShape ScriptShape;
+alias WINAPI.ScriptStringAnalyse ScriptStringAnalyse;
+alias WINAPI.ScriptStringOut ScriptStringOut;
+alias WINAPI.ScriptStringFree ScriptStringFree;
 alias WINAPI.ScriptTextOut ScriptTextOut;
 alias WINAPI.ScriptXtoCP ScriptXtoCP;
 alias WINAPI.ScrollWindowEx ScrollWindowEx;
--- a/dwt/internal/win32/WINAPI.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/internal/win32/WINAPI.d	Sun Jul 06 17:23:35 2008 +0200
@@ -273,7 +273,7 @@
 //     HDC ResetDCA(HDC, LPDEVMODE);
 //     WINBOOL RemoveFontResourceA(LPCSTR);
 //     HENHMETAFILE CopyEnhMetaFileA(HENHMETAFILE, LPCSTR);
-//     HDC CreateEnhMetaFileA(HDC, LPCSTR, LPRECT, LPCSTR);
+    HDC CreateEnhMetaFileA(HDC, LPCSTR, LPRECT, LPCSTR);
 //     HENHMETAFILE GetEnhMetaFileA(LPCSTR);
 //     UINT GetEnhMetaFileDescriptionA(HENHMETAFILE, UINT, LPSTR);
     WINBOOL GetTextMetricsA(HDC, LPTEXTMETRIC);
@@ -664,7 +664,7 @@
 //     HDC ResetDCW(HDC, LPDEVMODE);
 //     WINBOOL RemoveFontResourceW(LPCWSTR);
 //     HENHMETAFILE CopyEnhMetaFileW(HENHMETAFILE, LPCWSTR);
-//     HDC CreateEnhMetaFileW(HDC, LPCWSTR, LPRECT, LPCWSTR);
+    HDC CreateEnhMetaFileW(HDC, LPCWSTR, LPRECT, LPCWSTR);
 //     HENHMETAFILE GetEnhMetaFileW(LPCWSTR);
 //     UINT GetEnhMetaFileDescriptionW(HENHMETAFILE, UINT, LPWSTR);
 //     WINBOOL GetTextMetricsW(HDC, LPTEXTMETRIC);
@@ -1369,7 +1369,7 @@
 //     WINBOOL BitBlt(HDC, int, int, int, int, HDC, int, int, DWORD);
 //     WINBOOL CancelDC(HDC);
 //     WINBOOL Chord(HDC, int, int, int, int, int, int, int, int);
-//     HMETAFILE CloseMetaFile(HDC);
+    HMETAFILE CloseMetaFile(HDC);
 //     int CombineRgn(HRGN, HRGN, HRGN, int);
 //     HBITMAP CreateBitmap(int, int, UINT, UINT, POINTER);
 //     HBITMAP CreateBitmapIndirect(BITMAP*);
@@ -1506,9 +1506,9 @@
 //     WINBOOL UpdateColors(HDC);
 //     WINBOOL PlayMetaFileRecord(HDC, LPHANDLETABLE, LPMETARECORD, UINT);
 //     WINBOOL EnumMetaFile(HDC, HMETAFILE, ENUMMETAFILEPROC, LPARAM);
-//     HENHMETAFILE CloseEnhMetaFile(HDC);
-//     WINBOOL DeleteEnhMetaFile(HENHMETAFILE);
-//     WINBOOL EnumEnhMetaFile(HDC, HENHMETAFILE, ENHMETAFILEPROC, LPVOID, RECT*);
+    HENHMETAFILE CloseEnhMetaFile(HDC);
+    WINBOOL DeleteEnhMetaFile(HENHMETAFILE);
+    WINBOOL EnumEnhMetaFile(HDC, HENHMETAFILE, ENHMETAFILEPROC, LPVOID, RECT*);
 //     UINT GetEnhMetaFileHeader(HENHMETAFILE, UINT, LPENHMETAHEADER);
 //     UINT GetEnhMetaFilePaletteEntries(HENHMETAFILE, UINT, LPPALETTEENTRY);
 //     UINT GetWinMetaFileBits(HENHMETAFILE, UINT, LPBYTE, WINT, HDC);
@@ -3463,6 +3463,43 @@
   SCRIPT_PROPERTIES ***ppSp,
   int *piNumScripts
 );
+HRESULT ScriptGetCMap(
+  HDC hdc,
+  SCRIPT_CACHE* psc,
+  WCHAR* pwcInChars,
+  int cChars,
+  DWORD dwFlags,
+  WORD* pwOutGlyphs
+);
+HRESULT ScriptStringAnalyse(
+  HDC hdc,
+  void* pString,
+  int cString,
+  int cGlyphs,
+  int iCharset,
+  DWORD dwFlags,
+  int iReqWidth,
+  SCRIPT_CONTROL* psControl,
+  SCRIPT_STATE* psState,
+  int* piDx,
+  SCRIPT_TABDEF* pTabdef,
+  BYTE* pbInClass,
+  SCRIPT_STRING_ANALYSIS* pssa
+);
+HRESULT ScriptStringOut(
+  SCRIPT_STRING_ANALYSIS ssa, 
+  int iX, 
+  int iY, 
+  UINT uOptions, 
+  RECT* prc, 
+  int iMinSel, 
+  int iMaxSel, 
+  BOOL fDisabled 
+);
+HRESULT ScriptStringFree(
+  SCRIPT_STRING_ANALYSIS* pssa  
+);
+
 HRESULT ScriptItemize(
   WCHAR *pwcInChars,
   int cInChars,
--- a/dwt/internal/win32/WINTYPES.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/internal/win32/WINTYPES.d	Sun Jul 06 17:23:35 2008 +0200
@@ -13454,7 +13454,7 @@
 alias NETCONNECTINFOSTRUCT* PNETCONNECTINFOSTRUCT;
 extern(Windows){
 alias int (*ENUMMETAFILEPROC)(HDC, HANDLETABLE, METARECORD, int, LPARAM);
-alias int (*ENHMETAFILEPROC)(HDC, HANDLETABLE, ENHMETARECORD, int, LPARAM);
+alias int (*ENHMETAFILEPROC)(HDC, HANDLETABLE*, ENHMETARECORD*, int, LPARAM);
 alias int (*ENUMFONTSPROC)(LPLOGFONT, LPTEXTMETRIC, DWORD, LPARAM);
 alias int (*FONTENUMPROC)(ENUMLOGFONT*, NEWTEXTMETRIC*, int, LPARAM);
 alias int (*FONTENUMEXPROC)(ENUMLOGFONTEX*, NEWTEXTMETRICEX*, int, LPARAM);
@@ -15753,3 +15753,54 @@
 };
 
 alias DWORD ASSOCF;
+
+// usp10
+//import dwt.dwthelper.bitfield;
+alias void* SCRIPT_STRING_ANALYSIS;
+struct SCRIPT_TABDEF {
+  int cTabStops;
+  int iScale;
+  int* pTabStops;
+  int iTabOrigin;
+}
+
+//struct SCRIPT_ANALYSIS {
+//    mixin(bitfields!(
+//        ushort, "eScript", 10,
+//        bool, "fRTL", 1,
+//        bool, "fLayoutRTL", 1,
+//        bool, "fLinkBefore", 1,
+//        bool, "fLinkAfter", 1,
+//        bool, "fLogicalOrder", 1,
+//        bool, "fNoGlyphIndex", 1));
+//    SCRIPT_STATE s ;
+//}
+//struct SCRIPT_STATE {
+//    mixin(bitfields!(
+//        ubyte, "uBidiLevel",  5,
+//        bool, "fOverrideDirection", 1,
+//        bool, "fInhibitSymSwap", 1,
+//        bool, "fCharShape", 1,
+//        bool, "fDigitSubstitute", 1,
+//        bool, "fInhibitLigate", 1,
+//        bool, "fDisplayZWG", 1,
+//        bool, "fArabicNumContext", 1,
+//        bool, "fGcpClusters", 1,
+//        bool, "fReserved", 1,
+//        ubyte, "fEngineReserved", 2));
+//}
+//
+//struct SCRIPT_CONTROL {
+//    mixin(bitfields!(
+//        ushort, "uDefaultLanguage", 16,
+//        bool, "fContextDigits", 1,
+//        bool, "fInvertPreBoundDir", 1,
+//        bool, "fInvertPostBoundDir", 1,
+//        bool, "fLinkStringBefore", 1,
+//        bool, "fLinkStringAfter", 1,
+//        bool, "fNeutralOverride", 1,
+//        bool, "fNumericOverride", 1,
+//        bool, "fLegacyBidiClass", 1,
+//        ubyte, "fReserved", 8));
+//}
+//
--- a/dwt/widgets/Button.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/widgets/Button.d	Sun Jul 06 17:23:35 2008 +0200
@@ -804,7 +804,7 @@
     * that WM_PRINT cannot be used all the time because it
     * fails for browser controls when the browser has focus.
     */
-    int /*long*/ hDC = gc.handle;
+    auto hDC = gc.handle;
     if (!OS.PrintWindow (hwnd, hDC, 0)) {
         int flags = OS.PRF_CLIENT | OS.PRF_NONCLIENT | OS.PRF_ERASEBKGND | OS.PRF_CHILDREN;
         OS.SendMessage (hwnd, OS.WM_PRINT, hDC, flags);
--- a/dwt/widgets/DateTime.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/widgets/DateTime.d	Sun Jul 06 17:23:35 2008 +0200
@@ -67,9 +67,9 @@
     SYSTEMTIME* lastSystemTime;
     SYSTEMTIME time; // only used in calendar mode
     static /+const+/ WNDPROC DateTimeProc;
-    static const TCHAR* DateTimeClass = OS.DATETIMEPICK_CLASS.ptr;
+    static const TCHAR[] DateTimeClass = OS.DATETIMEPICK_CLASS;
     static /+const+/ WNDPROC CalendarProc;
-    static const TCHAR* CalendarClass = OS.MONTHCAL_CLASS.ptr;
+    static const TCHAR[] CalendarClass = OS.MONTHCAL_CLASS;
 
     private static bool static_this_completed = false;
     private static void static_this() {
@@ -84,69 +84,67 @@
             icex.dwSize = INITCOMMONCONTROLSEX.sizeof;
             icex.dwICC = OS.ICC_DATE_CLASSES;
             OS.InitCommonControlsEx (&icex);
-    }
-    static { //TODO review
             WNDCLASS lpWndClass;
-            OS.GetClassInfo (null, DateTimeClass, &lpWndClass);
+            OS.GetClassInfo (null, DateTimeClass.ptr, &lpWndClass);
             DateTimeProc = lpWndClass.lpfnWndProc;
-        /*
-        * Feature in Windows.  The date time window class
-        * does not include CS_DBLCLKS.  This means that these
-        * controls will not get double click messages such as
-        * WM_LBUTTONDBLCLK.  The fix is to register a new 
-        * window class with CS_DBLCLKS.
-        * 
-        * NOTE:  Screen readers look for the exact class name
-        * of the control in order to provide the correct kind
-        * of assistance.  Therefore, it is critical that the
-        * new window class have the same name.  It is possible
-        * to register a local window class with the same name
-        * as a global class.  Since bits that affect the class
-        * are being changed, it is possible that other native
-        * code, other than DWT, could create a control with
-        * this class name, and fail unexpectedly.
-        */
-        int /*long*/ hInstance = OS.GetModuleHandle (null);
-        int /*long*/ hHeap = OS.GetProcessHeap ();
-        lpWndClass.hInstance = hInstance;
-        lpWndClass.style &= ~OS.CS_GLOBALCLASS;
-        lpWndClass.style |= OS.CS_DBLCLKS;
-        int byteCount = DateTimeClass.length () * TCHAR.sizeof;
-        int /*long*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
-        OS.MoveMemory (lpszClassName, DateTimeClass, byteCount);
-        lpWndClass.lpszClassName = lpszClassName;
-        OS.RegisterClass (lpWndClass);
-        OS.HeapFree (hHeap, 0, lpszClassName);
-            OS.GetClassInfo (null, CalendarClass, &lpWndClass);
+            /*
+            * Feature in Windows.  The date time window class
+            * does not include CS_DBLCLKS.  This means that these
+            * controls will not get double click messages such as
+            * WM_LBUTTONDBLCLK.  The fix is to register a new 
+            * window class with CS_DBLCLKS.
+            * 
+            * NOTE:  Screen readers look for the exact class name
+            * of the control in order to provide the correct kind
+            * of assistance.  Therefore, it is critical that the
+            * new window class have the same name.  It is possible
+            * to register a local window class with the same name
+            * as a global class.  Since bits that affect the class
+            * are being changed, it is possible that other native
+            * code, other than DWT, could create a control with
+            * this class name, and fail unexpectedly.
+            */
+            auto hInstance = OS.GetModuleHandle (null);
+            auto hHeap = OS.GetProcessHeap ();
+            lpWndClass.hInstance = hInstance;
+            lpWndClass.style &= ~OS.CS_GLOBALCLASS;
+            lpWndClass.style |= OS.CS_DBLCLKS;
+            int byteCount = DateTimeClass.length * TCHAR.sizeof;
+            auto lpszClassName = cast(TCHAR*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+            OS.MoveMemory (lpszClassName, DateTimeClass.ptr, byteCount);
+            lpWndClass.lpszClassName = lpszClassName;
+            OS.RegisterClass (&lpWndClass);
+            OS.HeapFree (hHeap, 0, lpszClassName);
+            OS.GetClassInfo (null, CalendarClass.ptr, &lpWndClass);
             CalendarProc = lpWndClass.lpfnWndProc;
-        /*
-        * Feature in Windows.  The date time window class
-        * does not include CS_DBLCLKS.  This means that these
-        * controls will not get double click messages such as
-        * WM_LBUTTONDBLCLK.  The fix is to register a new 
-        * window class with CS_DBLCLKS.
-        * 
-        * NOTE:  Screen readers look for the exact class name
-        * of the control in order to provide the correct kind
-        * of assistance.  Therefore, it is critical that the
-        * new window class have the same name.  It is possible
-        * to register a local window class with the same name
-        * as a global class.  Since bits that affect the class
-        * are being changed, it is possible that other native
-        * code, other than DWT, could create a control with
-        * this class name, and fail unexpectedly.
-        */
-        int /*long*/ hInstance = OS.GetModuleHandle (null);
-        int /*long*/ hHeap = OS.GetProcessHeap ();
-        lpWndClass.hInstance = hInstance;
-        lpWndClass.style &= ~OS.CS_GLOBALCLASS;
-        lpWndClass.style |= OS.CS_DBLCLKS;
-        int byteCount = CalendarClass.length () * TCHAR.sizeof;
-        int /*long*/ lpszClassName = OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
-        OS.MoveMemory (lpszClassName, CalendarClass, byteCount);
-        lpWndClass.lpszClassName = lpszClassName;
-        OS.RegisterClass (lpWndClass);
-        OS.HeapFree (hHeap, 0, lpszClassName);
+            /*
+            * Feature in Windows.  The date time window class
+            * does not include CS_DBLCLKS.  This means that these
+            * controls will not get double click messages such as
+            * WM_LBUTTONDBLCLK.  The fix is to register a new 
+            * window class with CS_DBLCLKS.
+            * 
+            * NOTE:  Screen readers look for the exact class name
+            * of the control in order to provide the correct kind
+            * of assistance.  Therefore, it is critical that the
+            * new window class have the same name.  It is possible
+            * to register a local window class with the same name
+            * as a global class.  Since bits that affect the class
+            * are being changed, it is possible that other native
+            * code, other than DWT, could create a control with
+            * this class name, and fail unexpectedly.
+            */
+            hInstance = OS.GetModuleHandle (null);
+            hHeap = OS.GetProcessHeap ();
+            lpWndClass.hInstance = hInstance;
+            lpWndClass.style &= ~OS.CS_GLOBALCLASS;
+            lpWndClass.style |= OS.CS_DBLCLKS;
+            byteCount = CalendarClass.length * TCHAR.sizeof;
+            lpszClassName = cast(TCHAR*)OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, byteCount);
+            OS.MoveMemory (lpszClassName, CalendarClass.ptr, byteCount);
+            lpWndClass.lpszClassName = lpszClassName;
+            OS.RegisterClass (&lpWndClass);
+            OS.HeapFree (hHeap, 0, lpszClassName);
             static_this_completed = true;
         }
     }
@@ -941,7 +939,7 @@
 }
 
 override String windowClass () {
-    return (style & DWT.CALENDAR) !is 0 ? TCHARzToStr(CalendarClass) : TCHARzToStr(DateTimeClass);
+    return (style & DWT.CALENDAR) !is 0 ? TCHARsToStr(CalendarClass) : TCHARsToStr(DateTimeClass);
 }
 
 override int windowProc () {
--- a/dwt/widgets/Display.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/widgets/Display.d	Sun Jul 06 17:23:35 2008 +0200
@@ -2076,7 +2076,7 @@
                     MSG* keyMsg = cast(MSG*) OS.HeapAlloc (hHeap, OS.HEAP_ZERO_MEMORY, MSG.sizeof);
                     *keyMsg = *msg;
                     OS.PostMessage (hwndMessage, SWT_KEYMSG, wParam, cast(int)keyMsg);
-                    switch ((int)/*64*/msg.wParam) {
+                    switch (msg.wParam) {
                         case OS.VK_SHIFT:
                         case OS.VK_MENU:
                         case OS.VK_CONTROL:
@@ -3052,7 +3052,7 @@
                     default:
                 }
             }
-            switch ((int)/*64*/keyMsg.wParam) {
+            switch (keyMsg.wParam) {
                 case OS.VK_SHIFT:
                 case OS.VK_MENU:
                 case OS.VK_CONTROL:
@@ -3060,6 +3060,7 @@
                 case OS.VK_NUMLOCK:
                 case OS.VK_SCROLL:
                     consumed = true;
+                default:
             }
             if (consumed) {
                 auto hHeap = OS.GetProcessHeap ();
--- a/dwt/widgets/Group.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/widgets/Group.d	Sun Jul 06 17:23:35 2008 +0200
@@ -21,6 +21,7 @@
 import dwt.graphics.Rectangle;
 import dwt.internal.win32.OS;
 import dwt.widgets.Composite;
+import dwt.widgets.Control;
 
 import dwt.dwthelper.utils;
 
@@ -320,7 +321,7 @@
     return CharacterToUpper (key) is CharacterToUpper (mnemonic);
 }
 
-void printWidget (int /*long*/ hwnd, GC gc) {
+void printWidget (HWND hwnd, GC gc) {
     /*
     * Bug in Windows.  For some reason, PrintWindow() fails
     * when it is called on a push button.  The fix is to
@@ -328,7 +329,7 @@
     * that WM_PRINT cannot be used all the time because it
     * fails for browser controls when the browser has focus.
     */
-    int /*long*/ hDC = gc.handle;
+    auto hDC = gc.handle;
     if (!OS.PrintWindow (hwnd, hDC, 0)) {
         /*
         * Bug in Windows.  For some reason, WM_PRINT when called
--- a/dwt/widgets/Table.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/widgets/Table.d	Sun Jul 06 17:23:35 2008 +0200
@@ -23,7 +23,6 @@
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
 import dwt.internal.ImageList;
-import dwt.internal.win32.BITMAPINFOHEADER;
 import dwt.internal.win32.OS;
 
 import dwt.widgets.Composite;
@@ -5442,14 +5441,14 @@
         * The fix for both cases is to create the image using PrintWindow(). 
         */
         if ((!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) || hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) {
-            int topIndex = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0);
-            int selection = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETNEXTITEM, topIndex - 1, OS.LVNI_SELECTED);
+            int topIndex = OS.SendMessage (handle, OS.LVM_GETTOPINDEX, 0, 0);
+            int selection = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, topIndex - 1, OS.LVNI_SELECTED);
             if (selection is -1) return 0;
-            POINT mousePos = new POINT ();
+            POINT mousePos;
             OS.POINTSTOPOINT (mousePos, OS.GetMessagePos ());
-            OS.MapWindowPoints(0, handle, mousePos, 1);
-            RECT clientRect = new RECT ();
-            OS.GetClientRect (handle, clientRect);
+            OS.MapWindowPoints(null, handle, &mousePos, 1);
+            RECT clientRect;
+            OS.GetClientRect (handle, &clientRect);
             TableItem item = _getItem (selection);
             RECT rect = item.getBounds (selection, 0, true, true, true);
             if ((style & DWT.FULL_SELECTION) !is 0) {
@@ -5462,22 +5461,22 @@
                     rect.left = Math.max (clientRect.left, rect.right - width);
                 }
             }
-            int /*long*/ hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
-            while ((selection = (int)/*64*/OS.SendMessage (handle, OS.LVM_GETNEXTITEM, selection, OS.LVNI_SELECTED)) !is -1) {
+            auto hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
+            while ((selection = OS.SendMessage (handle, OS.LVM_GETNEXTITEM, selection, OS.LVNI_SELECTED)) !is -1) {
                 if (rect.bottom - rect.top > DRAG_IMAGE_SIZE) break;
                 if (rect.bottom > clientRect.bottom) break;
                 RECT itemRect = item.getBounds (selection, 0, true, true, true);
-                int /*long*/ rectRgn = OS.CreateRectRgn (rect.left, itemRect.top, rect.right, itemRect.bottom);
+                auto rectRgn = OS.CreateRectRgn (rect.left, itemRect.top, rect.right, itemRect.bottom);
                 OS.CombineRgn (hRgn, hRgn, rectRgn, OS.RGN_OR);
                 OS.DeleteObject (rectRgn);
                 rect.bottom = itemRect.bottom;
             }
-            OS.GetRgnBox (hRgn, rect);
+            OS.GetRgnBox (hRgn, &rect);
             
             /* Create resources */
-            int /*long*/ hdc = OS.GetDC (handle);
-            int /*long*/ memHdc = OS.CreateCompatibleDC (hdc);
-            BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER ();
+            auto hdc = OS.GetDC (handle);
+            auto memHdc = OS.CreateCompatibleDC (hdc);
+            BITMAPINFOHEADER bmiHeader;
             bmiHeader.biSize = BITMAPINFOHEADER.sizeof;
             bmiHeader.biWidth = rect.right - rect.left;
             bmiHeader.biHeight = -(rect.bottom - rect.top);
@@ -5485,25 +5484,25 @@
             bmiHeader.biBitCount = 32;
             bmiHeader.biCompression = OS.BI_RGB;
             byte [] bmi = new byte [BITMAPINFOHEADER.sizeof];
-            OS.MoveMemory (bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
-            int /*long*/ [] pBits = new int /*long*/ [1];
-            int /*long*/ memDib = OS.CreateDIBSection (0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
-            if (memDib is 0) DWT.error (DWT.ERROR_NO_HANDLES);
-            int /*long*/ oldMemBitmap = OS.SelectObject (memHdc, memDib);
+            OS.MoveMemory (bmi.ptr, &bmiHeader, BITMAPINFOHEADER.sizeof);
+            void*[1] pBits;
+            auto memDib = OS.CreateDIBSection (null, cast(BITMAPINFO*) bmi.ptr, OS.DIB_RGB_COLORS, pBits.ptr, null, 0);
+            if (memDib is null) DWT.error (DWT.ERROR_NO_HANDLES);
+            auto oldMemBitmap = OS.SelectObject (memHdc, memDib);
             int colorKey = 0x0000FD;
-            POINT pt = new POINT();
-            OS.SetWindowOrgEx (memHdc, rect.left, rect.top, pt);
-            OS.FillRect (memHdc, rect, findBrush (colorKey, OS.BS_SOLID));
+            POINT pt;
+            OS.SetWindowOrgEx (memHdc, rect.left, rect.top, &pt);
+            OS.FillRect (memHdc, &rect, findBrush (colorKey, OS.BS_SOLID));
             OS.OffsetRgn (hRgn, -rect.left, -rect.top);
             OS.SelectClipRgn (memHdc, hRgn);
             OS.PrintWindow (handle, memHdc, 0);
             OS.SetWindowOrgEx (memHdc, pt.x, pt.y, null);
             OS.SelectObject (memHdc, oldMemBitmap);
             OS.DeleteDC (memHdc);
-            OS.ReleaseDC (0, hdc);
+            OS.ReleaseDC (null, hdc);
             OS.DeleteObject (hRgn);
             
-            SHDRAGIMAGE shdi = new SHDRAGIMAGE ();
+            SHDRAGIMAGE shdi;
             shdi.hbmpDragImage = memDib;
             shdi.crColorKey = colorKey;
             shdi.sizeDragImage.cx = bmiHeader.biWidth;
@@ -5513,7 +5512,7 @@
             if ((style & DWT.MIRRORED) !is 0) {
                 shdi.ptOffset.x = shdi.sizeDragImage.cx - shdi.ptOffset.x; 
             }
-            OS.MoveMemory (lParam, shdi, SHDRAGIMAGE.sizeof);
+            OS.MoveMemory (cast(void*)lParam, &shdi, SHDRAGIMAGE.sizeof);
             return 1;
         }
     }
--- a/dwt/widgets/Tree.d	Tue Jul 01 10:18:15 2008 +0200
+++ b/dwt/widgets/Tree.d	Sun Jul 06 17:23:35 2008 +0200
@@ -25,7 +25,6 @@
 import dwt.graphics.Point;
 import dwt.graphics.Rectangle;
 import dwt.internal.ImageList;
-import dwt.internal.win32.BITMAPINFOHEADER;
 import dwt.internal.win32.OS;
 
 import dwt.widgets.Composite;
@@ -5765,18 +5764,18 @@
         * selected.
         */
         if ((style & DWT.MULTI) !is 0 || hooks (DWT.EraseItem) || hooks (DWT.PaintItem)) {
-            int /*long*/ hItem = OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
+            auto hItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_FIRSTVISIBLE, 0);
             TreeItem [] items = new TreeItem [10];
-            TVITEM tvItem = new TVITEM ();
+            TVITEM tvItem;
             tvItem.mask = OS.TVIF_HANDLE | OS.TVIF_PARAM | OS.TVIF_STATE;
-            int count = getSelection (hItem, tvItem, items, 0, 10, false, true);
+            int count = getSelection (hItem, &tvItem, items, 0, 10, false, true);
             if (count is 0) return 0;
-            POINT mousePos = new POINT ();
+            POINT mousePos;
             OS.POINTSTOPOINT (mousePos, OS.GetMessagePos ());
-            OS.MapWindowPoints (0, handle, mousePos, 1);
-            RECT clientRect = new RECT ();
-            OS.GetClientRect(handle, clientRect);
-            RECT rect = items [0].getBounds (0, true, true, false);
+            OS.MapWindowPoints (null, handle, &mousePos, 1);
+            RECT clientRect;
+            OS.GetClientRect(handle, &clientRect);
+            RECT rect = *(items [0].getBounds (0, true, true, false));
             if ((style & DWT.FULL_SELECTION) !is 0) {
                 int width = DRAG_IMAGE_SIZE;
                 rect.left = Math.max (clientRect.left, mousePos.x - width / 2);
@@ -5787,27 +5786,27 @@
                     rect.left = Math.max (clientRect.left, rect.right - width);
                 }
             }
-            int /*long*/ hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
+            auto hRgn = OS.CreateRectRgn (rect.left, rect.top, rect.right, rect.bottom);
             for (int i = 1; i < count; i++) {
                 if (rect.bottom - rect.top > DRAG_IMAGE_SIZE) break;
                 if (rect.bottom > clientRect.bottom) break;
-                RECT itemRect = items[i].getBounds (0, true, true, false);
+                RECT itemRect = *(items[i].getBounds (0, true, true, false));
                 if ((style & DWT.FULL_SELECTION) !is 0) {
                     itemRect.left = rect.left;
                     itemRect.right = rect.right;
                 }
-                int /*long*/ rectRgn = OS.CreateRectRgn (itemRect.left, itemRect.top, itemRect.right, itemRect.bottom);
+                auto rectRgn = OS.CreateRectRgn (itemRect.left, itemRect.top, itemRect.right, itemRect.bottom);
                 OS.CombineRgn (hRgn, hRgn, rectRgn, OS.RGN_OR);
                 OS.DeleteObject (rectRgn);
                 rect.bottom = itemRect.bottom;
                 
             }
-            OS.GetRgnBox (hRgn, rect);
+            OS.GetRgnBox (hRgn, &rect);
             
             /* Create resources */
-            int /*long*/ hdc = OS.GetDC (handle);
-            int /*long*/ memHdc = OS.CreateCompatibleDC (hdc);
-            BITMAPINFOHEADER bmiHeader = new BITMAPINFOHEADER ();
+            auto hdc = OS.GetDC (handle);
+            auto memHdc = OS.CreateCompatibleDC (hdc);
+            BITMAPINFOHEADER bmiHeader;
             bmiHeader.biSize = BITMAPINFOHEADER.sizeof;
             bmiHeader.biWidth = rect.right - rect.left;
             bmiHeader.biHeight = -(rect.bottom - rect.top);
@@ -5815,25 +5814,25 @@
             bmiHeader.biBitCount = 32;
             bmiHeader.biCompression = OS.BI_RGB;
             byte [] bmi = new byte [BITMAPINFOHEADER.sizeof];
-            OS.MoveMemory (bmi, bmiHeader, BITMAPINFOHEADER.sizeof);
-            int /*long*/ [] pBits = new int /*long*/ [1];
-            int /*long*/ memDib = OS.CreateDIBSection (0, bmi, OS.DIB_RGB_COLORS, pBits, 0, 0);
-            if (memDib is 0) DWT.error (DWT.ERROR_NO_HANDLES);
-            int /*long*/ oldMemBitmap = OS.SelectObject (memHdc, memDib);
+            OS.MoveMemory (bmi.ptr, &bmiHeader, BITMAPINFOHEADER.sizeof);
+            void* [1] pBits;
+            auto memDib = OS.CreateDIBSection (null, cast(BITMAPINFO*) bmi.ptr, OS.DIB_RGB_COLORS, pBits.ptr, null, 0);
+            if (memDib is null) DWT.error (DWT.ERROR_NO_HANDLES);
+            auto oldMemBitmap = OS.SelectObject (memHdc, memDib);
             int colorKey = 0x0000FD;
-            POINT pt = new POINT ();
-            OS.SetWindowOrgEx (memHdc, rect.left, rect.top, pt);
-            OS.FillRect (memHdc, rect, findBrush (colorKey, OS.BS_SOLID));
+            POINT pt;
+            OS.SetWindowOrgEx (memHdc, rect.left, rect.top, &pt);
+            OS.FillRect (memHdc, &rect, findBrush (colorKey, OS.BS_SOLID));
             OS.OffsetRgn (hRgn, -rect.left, -rect.top);
             OS.SelectClipRgn (memHdc, hRgn);
             OS.PrintWindow (handle, memHdc, 0);
             OS.SetWindowOrgEx (memHdc, pt.x, pt.y, null);
             OS.SelectObject (memHdc, oldMemBitmap);
             OS.DeleteDC (memHdc);
-            OS.ReleaseDC (0, hdc);
+            OS.ReleaseDC (null, hdc);
             OS.DeleteObject (hRgn);
 
-            SHDRAGIMAGE shdi = new SHDRAGIMAGE ();
+            SHDRAGIMAGE shdi;
             shdi.hbmpDragImage = memDib;
             shdi.crColorKey = colorKey;
             shdi.sizeDragImage.cx = bmiHeader.biWidth;
@@ -5843,7 +5842,7 @@
             if ((style & DWT.MIRRORED) !is 0) {
                 shdi.ptOffset.x = shdi.sizeDragImage.cx - shdi.ptOffset.x; 
             }
-            OS.MoveMemory (lParam, shdi, SHDRAGIMAGE.sizeof);
+            OS.MoveMemory (cast(void*)lParam, &shdi, SHDRAGIMAGE.sizeof);
             return 1;
         }
     }
@@ -6506,7 +6505,7 @@
     dragStarted = gestureCompleted = false;
     ignoreDeselect = ignoreSelect = true;
     int /*long*/ code = callWindowProc (handle, OS.WM_LBUTTONDOWN, wParam, lParam);
-    if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.buildVERSION (6, 0)) {
+    if (!OS.IsWinCE && OS.WIN32_VERSION >= OS.VERSION (6, 0)) {
         if (OS.GetFocus () !is handle) OS.SetFocus (handle);
     }
     auto hNewItem = cast(HANDLE) OS.SendMessage (handle, OS.TVM_GETNEXTITEM, OS.TVGN_CARET, 0);