diff -urN wine-20040408/.cvsignore wine-bin/.cvsignore
--- wine-20040408/.cvsignore	2002-05-23 03:02:49.000000000 +0530
+++ wine-bin/.cvsignore	1970-01-01 05:30:00.000000000 +0530
@@ -1,6 +0,0 @@
-Make.rules
-Makefile
-autom4te.cache
-config.cache
-config.log
-config.status
diff -urN wine-20040408/windows/defdlg.c wine-bin/windows/defdlg.c
--- wine-20040408/windows/defdlg.c	2003-09-06 04:45:40.000000000 +0530
+++ wine-bin/windows/defdlg.c	2004-04-16 15:12:32.000000000 +0530
@@ -132,9 +132,11 @@
  * Set the new default button to be hwndNew.
  */
 static BOOL DEFDLG_SetDefButton( HWND hwndDlg, DIALOGINFO *dlgInfo,
-                                   HWND hwndNew )
+                                   WPARAM wParam )
 {
     DWORD dlgcode=0; /* initialize just to avoid a warning */
+    dlgInfo->idResult = wParam;
+    HWND hwndNew = GetDlgItem(hwndDlg, wParam);
     if (hwndNew &&
         !((dlgcode=SendMessageW(hwndNew, WM_GETDLGCODE, 0, 0 ))
             & (DLGC_UNDEFPUSHBUTTON | DLGC_BUTTON)))
@@ -143,16 +145,14 @@
     if (dlgInfo->idResult)  /* There's already a default pushbutton */
     {
         HWND hwndOld = GetDlgItem( hwndDlg, dlgInfo->idResult );
-        if (SendMessageA( hwndOld, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON)
+        if (hwndOld && (SendMessageA( hwndOld, WM_GETDLGCODE, 0, 0) & DLGC_DEFPUSHBUTTON))
             SendMessageA( hwndOld, BM_SETSTYLE, BS_PUSHBUTTON, TRUE );
     }
     if (hwndNew)
     {
         if(dlgcode==DLGC_UNDEFPUSHBUTTON)
             SendMessageA( hwndNew, BM_SETSTYLE, BS_DEFPUSHBUTTON, TRUE );
-        dlgInfo->idResult = GetDlgCtrlID( hwndNew );
     }
-    else dlgInfo->idResult = 0;
     return TRUE;
 }
 
@@ -214,7 +214,7 @@
 
         case DM_SETDEFID:
             if (dlgInfo && !(dlgInfo->flags & DF_END))
-                DEFDLG_SetDefButton( hwnd, dlgInfo, wParam ? GetDlgItem( hwnd, wParam ) : 0 );
+                DEFDLG_SetDefButton( hwnd, dlgInfo, wParam );
             return 1;
 
         case DM_GETDEFID:
@@ -235,7 +235,7 @@
                 if (!lParam)
                     hwndDest = GetNextDlgTabItem(hwnd, GetFocus(), wParam);
                 if (hwndDest) DEFDLG_SetFocus( hwnd, hwndDest );
-                DEFDLG_SetDefButton( hwnd, dlgInfo, hwndDest );
+                DEFDLG_SetDefButton( hwnd, dlgInfo, GetDlgCtrlID(hwndDest) );
             }
             return 0;
 
@@ -284,6 +284,35 @@
 }
 
 /***********************************************************************
+*               DEFDLG_InitDlgInfo
+* Allocate the DIALOGINGO structure and initialize struct members     
+*/
+static DIALOGINFO* DEFDLG_InitDlgInfo(HWND hwnd)
+{
+    /* Allocate memory for DIALOGINFO structure and store in DWL_DIALOGINFO
+    structure. Also flag the window as a dialog type */
+    WND* wndPtr;
+    DIALOGINFO* dlgInfo = DIALOG_get_info( hwnd );
+    if(!dlgInfo)
+    {
+        if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return NULL;
+        dlgInfo->hwndFocus   = 0;
+        dlgInfo->hUserFont   = 0;
+        dlgInfo->hMenu       = 0;
+        dlgInfo->xBaseUnit   = 0;
+        dlgInfo->yBaseUnit   = 0;
+        dlgInfo->idResult    = 0;
+        dlgInfo->flags       = 0;
+        dlgInfo->hDialogHeap = 0;
+        wndPtr = WIN_GetPtr( hwnd );
+        wndPtr->flags |= WIN_ISDIALOG;
+        WIN_ReleasePtr( wndPtr );
+        SetWindowLongW( hwnd, DWL_WINE_DIALOGINFO, (LONG)dlgInfo );
+    }
+    return dlgInfo;
+}
+
+/***********************************************************************
  *		DefDlgProc (USER.308)
  */
 LRESULT WINAPI DefDlgProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
@@ -292,7 +321,13 @@
     WNDPROC16 dlgproc;
     HWND hwnd32 = WIN_Handle32( hwnd );
     BOOL result = FALSE;
-
+    
+    /* Handle WM_NCCREATE before control is passed to app. Here we setup
+    the DIALOGINFO structure*/
+    DIALOGINFO* dlgInfo;
+    if(!(dlgInfo = DEFDLG_InitDlgInfo(hwnd32)))
+        return -1;
+    
     SetWindowLongW( hwnd32, DWL_MSGRESULT, 0 );
 
     if ((dlgproc = (WNDPROC16)DEFDLG_GetDlgProc( hwnd32 )))
@@ -323,7 +358,7 @@
             case WM_ENTERMENULOOP:
             case WM_LBUTTONDOWN:
             case WM_NCLBUTTONDOWN:
-                return DEFDLG_Proc( hwnd32, msg, (WPARAM)wParam, lParam, DIALOG_get_info(hwnd32) );
+                return DEFDLG_Proc( hwnd32, msg, (WPARAM)wParam, lParam, dlgInfo );
             case WM_INITDIALOG:
             case WM_VKEYTOITEM:
             case WM_COMPAREITEM:
@@ -346,6 +381,12 @@
     WNDPROC dlgproc;
     BOOL result = FALSE;
 
+    /* Handle WM_NCCREATE before control is passed to app. Here we setup
+    the DIALOGINFO structure*/
+    DIALOGINFO* dlgInfo;
+    if(!(dlgInfo = DEFDLG_InitDlgInfo(hwnd)))
+        return -1;
+    
     SetWindowLongW( hwnd, DWL_MSGRESULT, 0 );
 
     if ((dlgproc = DEFDLG_GetDlgProc( hwnd )))
@@ -376,7 +417,7 @@
             case WM_ENTERMENULOOP:
             case WM_LBUTTONDOWN:
             case WM_NCLBUTTONDOWN:
-                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, DIALOG_get_info(hwnd) );
+                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
             case WM_INITDIALOG:
             case WM_VKEYTOITEM:
             case WM_COMPAREITEM:
@@ -399,6 +440,12 @@
     BOOL result = FALSE;
     WNDPROC dlgproc;
 
+    /* Handle WM_NCCREATE before control is passed to app. Here we setup
+    the DIALOGINFO structure*/
+    DIALOGINFO* dlgInfo;
+    if(!(dlgInfo = DEFDLG_InitDlgInfo(hwnd)))
+        return -1;
+    
     SetWindowLongW( hwnd, DWL_MSGRESULT, 0 );
 
     if ((dlgproc = DEFDLG_GetDlgProc( hwnd )))
@@ -429,7 +476,7 @@
             case WM_ENTERMENULOOP:
             case WM_LBUTTONDOWN:
             case WM_NCLBUTTONDOWN:
-                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, DIALOG_get_info(hwnd) );
+                 return DEFDLG_Proc( hwnd, msg, wParam, lParam, dlgInfo );
             case WM_INITDIALOG:
             case WM_VKEYTOITEM:
             case WM_COMPAREITEM:
diff -urN wine-20040408/windows/dialog.c wine-bin/windows/dialog.c
--- wine-20040408/windows/dialog.c	2004-03-21 00:55:12.000000000 +0530
+++ wine-bin/windows/dialog.c	2004-04-13 11:53:02.000000000 +0530
@@ -490,32 +490,25 @@
 {
     HWND hwnd;
     RECT rect;
-    WND * wndPtr;
     DLG_TEMPLATE template;
-    DIALOGINFO * dlgInfo;
+    DIALOGINFO * dlgInfo = 0;
     DWORD units = GetDialogBaseUnits();
     BOOL ownerEnabled = TRUE;
 
+    HMENU hMenu = 0;
+    HFONT hUserFont = 0;
+    UINT flags = 0;
+    UINT xBaseUnit = LOWORD(units);
+    UINT yBaseUnit = HIWORD(units);
+    
       /* Parse dialog template */
 
     if (!dlgTemplate) return 0;
     dlgTemplate = DIALOG_ParseTemplate32( dlgTemplate, &template );
 
-      /* Initialise dialog extra data */
-
-    if (!(dlgInfo = HeapAlloc( GetProcessHeap(), 0, sizeof(*dlgInfo) ))) return 0;
-    dlgInfo->hwndFocus   = 0;
-    dlgInfo->hUserFont   = 0;
-    dlgInfo->hMenu       = 0;
-    dlgInfo->xBaseUnit   = LOWORD(units);
-    dlgInfo->yBaseUnit   = HIWORD(units);
-    dlgInfo->idResult    = 0;
-    dlgInfo->flags       = 0;
-    dlgInfo->hDialogHeap = 0;
-
       /* Load menu */
 
-    if (template.menuName) dlgInfo->hMenu = LoadMenuW( hInst, template.menuName );
+    if (template.menuName) hMenu = LoadMenuW( hInst, template.menuName );
 
       /* Create custom font if needed */
 
@@ -527,33 +520,33 @@
         int pixels;
 	dc = GetDC(0);
 	pixels = MulDiv(template.pointSize, GetDeviceCaps(dc , LOGPIXELSY), 72);
-        dlgInfo->hUserFont = CreateFontW( -pixels, 0, 0, 0, template.weight,
+        hUserFont = CreateFontW( -pixels, 0, 0, 0, template.weight,
                                           template.italic, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
                                           PROOF_QUALITY, FF_DONTCARE,
                                           template.faceName );
-        if (dlgInfo->hUserFont)
+        if (hUserFont)
         {
             SIZE charSize;
-            if (DIALOG_GetCharSize( dc, dlgInfo->hUserFont, &charSize ))
+            if (DIALOG_GetCharSize( dc, hUserFont, &charSize ))
             {
-                dlgInfo->xBaseUnit = charSize.cx;
-                dlgInfo->yBaseUnit = charSize.cy;
+                xBaseUnit = charSize.cx;
+                yBaseUnit = charSize.cy;
             }
         }
         ReleaseDC(0, dc);
-        TRACE("units = %d,%d\n", dlgInfo->xBaseUnit, dlgInfo->yBaseUnit );
+        TRACE("units = %d,%d\n", xBaseUnit, yBaseUnit );
     }
 
     /* Create dialog main window */
 
     rect.left = rect.top = 0;
-    rect.right = MulDiv(template.cx, dlgInfo->xBaseUnit, 4);
-    rect.bottom =  MulDiv(template.cy, dlgInfo->yBaseUnit, 8);
+    rect.right = MulDiv(template.cx, xBaseUnit, 4);
+    rect.bottom =  MulDiv(template.cy, yBaseUnit, 8);
     if (template.style & WS_CHILD)
         template.style &= ~(WS_CAPTION|WS_SYSMENU);
     if (template.style & DS_MODALFRAME)
         template.exStyle |= WS_EX_DLGMODALFRAME;
-    AdjustWindowRectEx( &rect, template.style, (dlgInfo->hMenu != 0), template.exStyle );
+    AdjustWindowRectEx( &rect, template.style, (hMenu != 0), template.exStyle );
     rect.right -= rect.left;
     rect.bottom -= rect.top;
 
@@ -570,8 +563,8 @@
         }
         else
         {
-            rect.left += MulDiv(template.x, dlgInfo->xBaseUnit, 4);
-            rect.top += MulDiv(template.y, dlgInfo->yBaseUnit, 8);
+            rect.left += MulDiv(template.x, xBaseUnit, 4);
+            rect.top += MulDiv(template.y, yBaseUnit, 8);
         }
         if ( !(template.style & WS_CHILD) )
         {
@@ -594,7 +587,7 @@
     if (modal)
     {
         ownerEnabled = DIALOG_DisableOwner( owner );
-        if (ownerEnabled) dlgInfo->flags |= DF_OWNERENABLED;
+        if (ownerEnabled) flags |= DF_OWNERENABLED;
     }
 
     if (unicode)
@@ -602,7 +595,7 @@
         hwnd = CreateWindowExW(template.exStyle, template.className, template.caption,
                                template.style & ~WS_VISIBLE,
                                rect.left, rect.top, rect.right, rect.bottom,
-                               owner, dlgInfo->hMenu, hInst, NULL );
+                               owner, hMenu, hInst, NULL );
     }
     else
     {
@@ -624,25 +617,33 @@
         hwnd = CreateWindowExA(template.exStyle, class, caption,
                                template.style & ~WS_VISIBLE,
                                rect.left, rect.top, rect.right, rect.bottom,
-                               owner, dlgInfo->hMenu, hInst, NULL );
+                               owner, hMenu, hInst, NULL );
         if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
         if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
     }
 
     if (!hwnd)
     {
-        if (dlgInfo->hUserFont) DeleteObject( dlgInfo->hUserFont );
-        if (dlgInfo->hMenu) DestroyMenu( dlgInfo->hMenu );
-        if (modal && (dlgInfo->flags & DF_OWNERENABLED)) DIALOG_EnableOwner(owner);
-        HeapFree( GetProcessHeap(), 0, dlgInfo );
+        if (hUserFont) DeleteObject( hUserFont );
+        if (hMenu) DestroyMenu( hMenu );
+        if (modal && (flags & DF_OWNERENABLED)) DIALOG_EnableOwner(owner);
 	return 0;
     }
-    wndPtr = WIN_GetPtr( hwnd );
-    wndPtr->flags |= WIN_ISDIALOG;
-    WIN_ReleasePtr( wndPtr );
-
+   
+    /* moved this from the top of the method to here as DIALOGINFO structure
+    will be valid only after WM_CREATE message has been handled in DefDlgProc
+    All the members of the structure get filled here using temp variables */
+    dlgInfo = DIALOG_get_info(hwnd);
+    dlgInfo->hwndFocus   = 0;
+    dlgInfo->hUserFont   = hUserFont;
+    dlgInfo->hMenu       = hMenu;
+    dlgInfo->xBaseUnit   = xBaseUnit;
+    dlgInfo->yBaseUnit   = yBaseUnit;
+    dlgInfo->idResult    = 0;
+    dlgInfo->flags       = flags;
+    dlgInfo->hDialogHeap = 0;
+    
     if (template.helpId) SetWindowContextHelpId( hwnd, template.helpId );
-    SetWindowLongW( hwnd, DWL_WINE_DIALOGINFO, (LONG)dlgInfo );
 
     if (unicode) SetWindowLongW( hwnd, DWL_DLGPROC, (LONG)dlgProc );
     else SetWindowLongA( hwnd, DWL_DLGPROC, (LONG)dlgProc );
