Henning Gerhardt <henning.gerhardt@web.de>
- Update German resources.
Robert Shearman <rob@codeweavers.com>
- Draw a representation of a document in the page setup dialog.
- Change some FIXME's to TRACE's because everything we need is
  implemented and they fire for ones that we don't need to implement.
Remi Assailly <remi.assailly@free.fr>
- char -> const char fixes.
Jose Manuel Ferrer Ortiz <jmfo1982@yahoo.es>
- Updated Spanish resources.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Correct coordinates of a couple of controls.
- Do not forget to allocate internal OPENFILENAMEW structure for 16-bit
  GetOpenFileName, initialize it by zeros for 16/A cases.
- Make GetOpenFileNameW with an old style open file dialog work with the
  original OPENFILENAMEW structure, making sure that all changes are
  passed back to the caller.
Ulrich Czekalla <ulrich@codeweavers.com>
- GetFileName31W should call unicode version of FD31_AllocPrivate.
Jonathan Ernst <Jonathan@ErnstFamily.ch>
- Updated French resources.
Modified: trunk/reactos/lib/comdlg32/cdlg.h
Modified: trunk/reactos/lib/comdlg32/cdlg32.c
Modified: trunk/reactos/lib/comdlg32/cdlg_De.rc
Modified: trunk/reactos/lib/comdlg32/cdlg_En.rc
Modified: trunk/reactos/lib/comdlg32/cdlg_Es.rc
Modified: trunk/reactos/lib/comdlg32/cdlg_Fr.rc
Modified: trunk/reactos/lib/comdlg32/cdlg_Ru.rc
Modified: trunk/reactos/lib/comdlg32/filedlg.c
Modified: trunk/reactos/lib/comdlg32/filedlg16.c
Modified: trunk/reactos/lib/comdlg32/filedlg31.c
Modified: trunk/reactos/lib/comdlg32/filedlg31.h
Modified: trunk/reactos/lib/comdlg32/printdlg.c

Modified: trunk/reactos/lib/comdlg32/cdlg.h
--- trunk/reactos/lib/comdlg32/cdlg.h	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/cdlg.h	2005-02-12 21:03:08 UTC (rev 13514)
@@ -152,6 +152,8 @@
 #define IDS_SAVE_AS      1204
 #define IDS_OPEN_FILE    1205
 
+#define IDS_FAKEDOCTEXT  1300
+
 #include "windef.h"
 #include "winbase.h"
 #include "wingdi.h"

Modified: trunk/reactos/lib/comdlg32/cdlg32.c
--- trunk/reactos/lib/comdlg32/cdlg32.c	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/cdlg32.c	2005-02-12 21:03:08 UTC (rev 13514)
@@ -63,7 +63,7 @@
  *	FALSE if sibling could not be loaded or instantiated twice, TRUE
  *	otherwise.
  */
-static char * GPA_string = "Failed to get entry point %s for hinst = 0x%08x\n";
+static const char * GPA_string = "Failed to get entry point %s for hinst = 0x%08x\n";
 #define GPA(dest, hinst, name) \
 	if(!(dest = (void*)GetProcAddress(hinst,name)))\
 	{ \

Modified: trunk/reactos/lib/comdlg32/cdlg_De.rc
--- trunk/reactos/lib/comdlg32/cdlg_De.rc	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/cdlg_De.rc	2005-02-12 21:03:08 UTC (rev 13514)
@@ -148,7 +148,7 @@
 
 CHOOSE_FONT DIALOG DISCARDABLE  13, 54, 264, 147
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "Font"
+CAPTION "Schriftart"
 FONT 8, "MS Shell Dlg"
 {
     LTEXT           "Schrift&art:",1088 ,6,3,40,9
@@ -315,7 +315,7 @@
 PRINT32_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE  32, 32, 288, 178
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU |
       DS_CONTEXTHELP | DS_3DLOOK
-CAPTION "Print Setup"
+CAPTION "Druckereinrichtung"
 FONT 8, "MS Shell Dlg"
 BEGIN
     DEFPUSHBUTTON   "OK",IDOK,180,156,48,14,WS_GROUP
@@ -441,15 +441,25 @@
    IDS_COLOR_GREEN	"Gr³n"
    IDS_COLOR_OLIVE	"Olivgr³n"
    IDS_COLOR_NAVY	"Dunkelblau"
-   IDS_COLOR_PURPLE	"Violett"
-   IDS_COLOR_TEAL	"Teal"
+   IDS_COLOR_PURPLE	"Lila"
+   IDS_COLOR_TEAL	"Blaugr³n"
    IDS_COLOR_GRAY	"Grau"
    IDS_COLOR_SILVER	"Silber"
    IDS_COLOR_RED	"Rot"
    IDS_COLOR_LIME	"Hellgr³n"
    IDS_COLOR_YELLOW	"Gelb"
    IDS_COLOR_BLUE	"Blau"
-   IDS_COLOR_FUCHSIA	"Lila"
-   IDS_COLOR_AQUA	"Aqua"
+   IDS_COLOR_FUCHSIA	"Pink"
+   IDS_COLOR_AQUA	"Aquamarin"
    IDS_COLOR_WHITE	"Wei?"
 }
+
+STRINGTABLE DISCARDABLE
+{
+   IDS_FONT_SIZE	"Wõhlen Sie eine Schriftgr÷?e zwischen %d und %d Punkten aus."
+   IDS_SAVE_BUTTON	"&Speichern"
+   IDS_SAVE_IN		"Speichern &unter:"
+   IDS_SAVE		"Speichern"
+   IDS_SAVE_AS		"Speichern als"
+   IDS_OPEN_FILE	"Íffne Datei"
+}

Modified: trunk/reactos/lib/comdlg32/cdlg_En.rc
--- trunk/reactos/lib/comdlg32/cdlg_En.rc	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/cdlg_En.rc	2005-02-12 21:03:08 UTC (rev 13514)
@@ -470,6 +470,34 @@
     IDS_OPEN_FILE   "Open File"
 }
 
+/* Translators do not need to translate this text, unless the language uses a
+ * different character set or if the distribution of characters looks wrong.
+ * It is rendered illegibly small and is used to make a mock-up of a document.
+ */
+STRINGTABLE DISCARDABLE
+{
+    IDS_FAKEDOCTEXT
+        "Lorem ipsum dolor sit amet, consectetuer adipiscing elit. \
+        Nulla a tortor. Etiam aliquet libero venenatis nunc. \n \
+        \n \
+        Sed augue ante, fermentum sit amet, imperdiet et, gravida eu, enim. \
+        Donec nibh quam, sodales in, commodo vel, facilisis id, neque. \n \
+        \n \
+        Nunc eleifend bibendum nibh. Phasellus in lorem. Ut vel odio quis \
+        libero adipiscing consequat. Donec consectetuer laoreet mauris. \n \
+        \n \
+        Maecenas tempor, ligula sed congue nonummy, arcu dolor ornare erat, \
+        egestas iaculis magna purus sed turpis. \n \
+        \n \
+        Morbi ultricies est non ipsum. Cum sociis natoque penatibus et magnis \
+        dis parturient montes, nascetur ridiculus mus. \n \
+        \n \
+        Duis sit amet nibh quis purus sollicitudin blandit. Curabitur justo. \
+        Phasellus varius, erat eu luctus pharetra, odio elit fringilla leo, \
+        non vulputate turpis elit id neque. Vestibulum sit amet tellus sed \
+        tortor fermentum consectetuer."
+}
+
 /****************************************************************/
 /* English neutral resources
 /****************************************************************/

Modified: trunk/reactos/lib/comdlg32/cdlg_Es.rc
--- trunk/reactos/lib/comdlg32/cdlg_Es.rc	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/cdlg_Es.rc	2005-02-12 21:03:08 UTC (rev 13514)
@@ -47,7 +47,7 @@
 
 SAVE_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "&Guardar como..."
+CAPTION "Guardar como..."
 FONT 8, "MS Shell Dlg"
 {
  LTEXT "Nombre de &archivo:", 1090, 6, 6, 76, 9
@@ -85,7 +85,7 @@
  LTEXT "&Hasta:", 1091, 120, 80, 30, 9
  LTEXT "Calidad de impre&si¾n:", 1092, 6, 100, 76, 9
  COMBOBOX cmb1, 80, 100, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- CHECKBOX "Impri&mir en un archivo", chx1, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ CHECKBOX "Impri&mir en archivo", chx1, 20, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
  CHECKBOX "Condensado", chx2, 160, 100, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
 }
 
@@ -96,7 +96,7 @@
 FONT 8, "MS Shell Dlg"
 {
  GROUPBOX "Impresora:", grp1, 6, 10, 180, 65, BS_GROUPBOX
- RADIOBUTTON "Pre&determinada del sistema", rad1, 16, 20, 80, 12
+ RADIOBUTTON "Impresora por &defecto", rad1, 16, 20, 80, 12
  LTEXT "[ninguna]", 1088, 35, 35, 120, 9
  RADIOBUTTON "Impresora &especÝfica:", rad2, 16, 50, 80, 12
  COMBOBOX cmb1, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
@@ -187,7 +187,7 @@
 CAPTION "Buscar"
 FONT 8, "MS Shell Dlg"
 {
- LTEXT "Buscar:",  -1, 4, 8, 42, 8
+ LTEXT "Buscar:", -1, 4, 8, 42, 8
  EDITTEXT edt1, 47, 7, 128, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
  CHECKBOX "&S¾lo palabra entera", chx1, 4, 26, 100, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
  CHECKBOX "&May·sculas/min·sculas", chx2, 4, 42, 64, 12, BS_AUTOCHECKBOX | WS_TABSTOP
@@ -202,7 +202,7 @@
 
 REPLACEDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 230, 94
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
-CAPTION "R&eemplazar"
+CAPTION "Reemplazar"
 FONT 8, "MS Shell Dlg"
 {
  LTEXT "Buscar:", -1, 4, 9, 48, 8
@@ -230,7 +230,7 @@
     PUSHBUTTON      "&Ayuda",   pshHelp,  50, 161, 48,14, WS_GROUP
 
     GROUPBOX        "Impresora",      grp4,   8,  4, 272,84, WS_GROUP
-    CONTROL         "Imprimir a a&rchivo", chx1, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,212,70,64,12
+    CONTROL         "Imprimir en a&rchivo", chx1, "Button",BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP,212,70,64,12
     PUSHBUTTON      "&Propiedades",   psh2, 212, 17,  60,14, WS_GROUP
     LTEXT           "&Nombre:",       stc6,  16, 20,  36,8
     COMBOBOX                          cmb4,  52, 18, 152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
@@ -296,7 +296,7 @@
 
 PAGESETUPDLGORD DIALOG LOADONCALL MOVEABLE DISCARDABLE 32, 32, 240, 240
 STYLE DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
-CAPTION "Pßgina de configuraci¾n"
+CAPTION "Configuraci¾n de pßgina"
 FONT 8, "MS Shell Dlg"
 BEGIN
   CONTROL "", rct1, "Static", SS_WHITERECT, 80, 8, 80, 80
@@ -392,8 +392,8 @@
 pßgina.\n\ Por favor, introduzca un valor entre %d y %d."
     PD32_FROM_NOT_ABOVE_TO                "La entrada 'desde' no puede exceder \
 a la entrada 'hasta'."
-    PD32_MARGINS_OVERLAP                  "Los mßrgenes overlap o fall outside \
-los boundaries del papel.\nPor favor, reintroduzca los mßrgenes."
+    PD32_MARGINS_OVERLAP                  "Los mßrgenes se superponen o quedan \
+fuera de los lÝmites del papel.\nPor favor, reintroduzca los mßrgenes."
     PD32_NR_OF_COPIES_EMPTY               "El n·mero del valor 'N·mero de \
 copias' no puede estar vacÝo."
     PD32_TOO_LARGE_COPIES                 "Este n·mero tan grande de copias no \
@@ -421,11 +421,11 @@
     PD32_PRINTER_STATUS_PAPER_OUT         "Sin papel; "
     PD32_PRINTER_STATUS_MANUAL_FEED       "Ponga papel a mano; "
     PD32_PRINTER_STATUS_PAPER_PROBLEM     "Problema con el papel; "
-    PD32_PRINTER_STATUS_OFFLINE           "Impresora apagada; "
+    PD32_PRINTER_STATUS_OFFLINE           "Impresora desconectada; "
     PD32_PRINTER_STATUS_IO_ACTIVE         "E/S activa; "
     PD32_PRINTER_STATUS_BUSY              "Ocupada; "
     PD32_PRINTER_STATUS_PRINTING          "Imprimiendo; "
-    PD32_PRINTER_STATUS_OUTPUT_BIN_FULL   "La bandeja de salida estß llena; "
+    PD32_PRINTER_STATUS_OUTPUT_BIN_FULL   "Bandeja de salida llena; "
     PD32_PRINTER_STATUS_NOT_AVAILABLE     "No disponible; "
     PD32_PRINTER_STATUS_WAITING           "Esperando; "
     PD32_PRINTER_STATUS_PROCESSING        "Procesando; "
@@ -434,10 +434,9 @@
     PD32_PRINTER_STATUS_TONER_LOW         "T¾ner bajo; "
     PD32_PRINTER_STATUS_NO_TONER          "Sin t¾ner; "
     PD32_PRINTER_STATUS_PAGE_PUNT         "Page punt; "
-    PD32_PRINTER_STATUS_USER_INTERVENTION "Interrumpido por el usuario; "
+    PD32_PRINTER_STATUS_USER_INTERVENTION "Interrumpida por el usuario; "
     PD32_PRINTER_STATUS_OUT_OF_MEMORY     "Sin memoria; "
-    PD32_PRINTER_STATUS_DOOR_OPEN         "La puerta de la impresora estß \
-abierta; "
+    PD32_PRINTER_STATUS_DOOR_OPEN         "Puerta de la impresora abierta; "
     PD32_PRINTER_STATUS_SERVER_UNKNOWN    "Servidor de impresi¾n desconocido; "
     PD32_PRINTER_STATUS_POWER_SAVE        "Modo de ahorro de energÝa; "
 }
@@ -445,9 +444,9 @@
 STRINGTABLE DISCARDABLE /* Color names */
 {
     IDS_COLOR_BLACK     "Negro"
-    IDS_COLOR_MAROON    "Marr¾n"
+    IDS_COLOR_MAROON    "Granate"
     IDS_COLOR_GREEN     "Verde"
-    IDS_COLOR_OLIVE     "Oliva"
+    IDS_COLOR_OLIVE     "Verde oliva"
     IDS_COLOR_NAVY      "Azul marino"
     IDS_COLOR_PURPLE    "Morado"
     IDS_COLOR_TEAL      "Turquesa"
@@ -464,5 +463,10 @@
 
 STRINGTABLE DISCARDABLE
 {
-    IDS_FONT_SIZE   "Elija un tama±o de fuente entre %d and %d puntos."
+    IDS_FONT_SIZE   "Elija un tama±o de fuente entre %d y %d puntos."
+    IDS_SAVE_BUTTON "&Guardar"
+    IDS_SAVE_IN     "Guardar &en:"
+    IDS_SAVE        "Guardar"
+    IDS_SAVE_AS     "Guardar como"
+    IDS_OPEN_FILE   "Abrir archivo"
 }

Modified: trunk/reactos/lib/comdlg32/cdlg_Fr.rc
--- trunk/reactos/lib/comdlg32/cdlg_Fr.rc	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/cdlg_Fr.rc	2005-02-12 21:03:08 UTC (rev 13514)
@@ -3,6 +3,7 @@
  * French language support
  *
  * Copyright 1995 Alexandre Julliard
+ * Copyright 2005 Jonathan Ernst
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -462,3 +463,13 @@
     IDS_COLOR_AQUA      "Aqua"
     IDS_COLOR_WHITE     "Blanc"
 }
+
+STRINGTABLE DISCARDABLE
+{
+    IDS_FONT_SIZE   "SÚlectionnez une taille de police entre %d et %d points."
+    IDS_SAVE_BUTTON "&Sauver"
+    IDS_SAVE_IN     "Sauver &dans:"
+    IDS_SAVE        "Enregistrer"
+    IDS_SAVE_AS     "Enregistrer sous"
+    IDS_OPEN_FILE   "Ouvrir Fichier"
+}

Modified: trunk/reactos/lib/comdlg32/cdlg_Ru.rc
--- trunk/reactos/lib/comdlg32/cdlg_Ru.rc	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/cdlg_Ru.rc	2005-02-12 21:03:08 UTC (rev 13514)
@@ -235,9 +235,9 @@
     LTEXT           "&?ý :",         stc6,  16, 20,  36,8
     COMBOBOX                          cmb4,  52, 18, 152,152,CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_GROUP | WS_TABSTOP
     LTEXT           "Ð?Ó?¾±:",        stc8,  16, 36,  36,10, SS_NOPREFIX
-    LTEXT           "¦ý¾ÙÞ­¯ÔÓÝ",    stc12, 60, 36, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
+    LTEXT           "¦ý¾ÙÞ­¯ÔÓÝ",    stc12, 52, 36, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     LTEXT           "ÊÞ´:",          stc7,  16, 48,  36,10, SS_NOPREFIX
-    LTEXT           "¦ý¾ÙÞ­¯ÔÓÝ",     stc11, 60, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
+    LTEXT           "¦ý¾ÙÞ­¯ÔÓÝ",     stc11, 52, 48, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     LTEXT           "?Õ±?¯:",         stc10, 16, 60,  36,10, SS_NOPREFIX
     LTEXT           "¦ý¾ÙÞ­¯ÔÓݯ", stc14, 60, 60, 224,10, SS_NOPREFIX | SS_LEFTNOWORDWRAP
     LTEXT           "¤­ÞýÕ¸ÓÝÞÕ:",   stc9,  16, 72,  36,10, SS_NOPREFIX

Modified: trunk/reactos/lib/comdlg32/filedlg.c
--- trunk/reactos/lib/comdlg32/filedlg.c	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/filedlg.c	2005-02-12 21:03:08 UTC (rev 13514)
@@ -3377,7 +3377,7 @@
  */
 static BOOL FD32_GetTemplate(PFD31_DATA lfs)
 {
-    LPOPENFILENAMEW ofnW = &lfs->ofnW;
+    LPOPENFILENAMEW ofnW = lfs->ofnW;
     PFD32_PRIVATE priv = (PFD32_PRIVATE) lfs->private1632;
     HANDLE hDlgTmpl;
 
@@ -3445,9 +3445,9 @@
     if (NULL == lfs->private1632) return FALSE;
     if (IsUnicode)
     {
-        lfs->ofnW = *((LPOPENFILENAMEW) lParam);
-        if (lfs->ofnW.Flags & OFN_ENABLEHOOK)
-            if (lfs->ofnW.lpfnHook)
+        lfs->ofnW = (LPOPENFILENAMEW) lParam;
+        if (lfs->ofnW->Flags & OFN_ENABLEHOOK)
+            if (lfs->ofnW->lpfnHook)
                 lfs->hook = TRUE;
     }
     else
@@ -3456,7 +3456,8 @@
         if (priv->ofnA->Flags & OFN_ENABLEHOOK)
             if (priv->ofnA->lpfnHook)
                 lfs->hook = TRUE;
-        FD31_MapOfnStructA(priv->ofnA, &lfs->ofnW, lfs->open);
+        lfs->ofnW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*lfs->ofnW));
+        FD31_MapOfnStructA(priv->ofnA, lfs->ofnW, lfs->open);
     }
 
     if (! FD32_GetTemplate(lfs)) return FALSE;
@@ -3472,18 +3473,25 @@
 BOOL CALLBACK FD32_CallWindowProc(PFD31_DATA lfs, UINT wMsg, WPARAM wParam,
                                  LPARAM lParam)
 {
+    BOOL ret;
     PFD32_PRIVATE priv = (PFD32_PRIVATE) lfs->private1632;
 
     if (priv->ofnA)
     {
-        return (BOOL) CallWindowProcA(
-          (WNDPROC)priv->ofnA->lpfnHook, lfs->hwnd,
-          wMsg, wParam, lParam);
+        TRACE("Call hookA %p (%p, %04x, %08x, %08lx)\n",
+               priv->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
+        ret = priv->ofnA->lpfnHook(lfs->hwnd, wMsg, wParam, lParam);
+        TRACE("ret hookA %p (%p, %04x, %08x, %08lx)\n",
+               priv->ofnA->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
+        return ret;
     }
 
-    return (BOOL) CallWindowProcW(
-          (WNDPROC)lfs->ofnW.lpfnHook, lfs->hwnd,
-          wMsg, wParam, lParam);
+    TRACE("Call hookW %p (%p, %04x, %08x, %08lx)\n",
+           lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
+    ret = lfs->ofnW->lpfnHook(lfs->hwnd, wMsg, wParam, lParam);
+    TRACE("Ret hookW %p (%p, %04x, %08x, %08lx)\n",
+           lfs->ofnW->lpfnHook, lfs->hwnd, wMsg, wParam, lParam);
+    return ret;
 }
 
 /***********************************************************************
@@ -3493,7 +3501,7 @@
 static void CALLBACK FD32_UpdateResult(PFD31_DATA lfs)
 {
     PFD32_PRIVATE priv = (PFD32_PRIVATE) lfs->private1632;
-    LPOPENFILENAMEW ofnW = &lfs->ofnW;
+    LPOPENFILENAMEW ofnW = lfs->ofnW;
 
     if (priv->ofnA)
     {
@@ -3513,7 +3521,7 @@
 static void CALLBACK FD32_UpdateFileTitle(PFD31_DATA lfs)
 {
     PFD32_PRIVATE priv = (PFD32_PRIVATE) lfs->private1632;
-    LPOPENFILENAMEW ofnW = &lfs->ofnW;
+    LPOPENFILENAMEW ofnW = lfs->ofnW;
 
     if (priv->ofnA)
     {
@@ -3544,7 +3552,10 @@
 
     /* if ofnW has been allocated, have to free everything in it */
     if (NULL != priv && NULL != priv->ofnA)
-        FD31_FreeOfnW(&lfs->ofnW);
+    {
+        FD31_FreeOfnW(lfs->ofnW);
+        HeapFree(GetProcessHeap(), 0, lfs->ofnW);
+    }
 }
 
 static void FD32_SetupCallbacks(PFD31_CALLBACKS callbacks)
@@ -3667,7 +3678,7 @@
     if (!lpofn || !FD31_Init()) return FALSE;
 
     FD32_SetupCallbacks(&callbacks);
-    lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, &callbacks, (DWORD) FALSE);
+    lfs = FD31_AllocPrivate((LPARAM) lpofn, dlgType, &callbacks, (DWORD) TRUE);
     if (lfs)
     {
         hInst = (HINSTANCE)GetWindowLongPtrW( lpofn->hwndOwner, GWLP_HINSTANCE );
@@ -3676,7 +3687,8 @@
         FD31_DestroyPrivate(lfs);
     }
 
-    TRACE("return lpstrFile=%s !\n", debugstr_w(lpofn->lpstrFile));
+    TRACE("file %s, file offset %d, ext offset %d\n",
+          debugstr_w(lpofn->lpstrFile), lpofn->nFileOffset, lpofn->nFileExtension);
     return bRet;
 }
 
@@ -3697,6 +3709,10 @@
 {
     BOOL win16look = FALSE;
 
+    /* OFN_FILEMUSTEXIST implies OFN_PATHMUSTEXIST */
+    if (ofn->Flags & OFN_FILEMUSTEXIST)
+        ofn->Flags |= OFN_PATHMUSTEXIST;
+
     if (ofn->Flags & (OFN_ALLOWMULTISELECT|OFN_ENABLEHOOK|OFN_ENABLETEMPLATE))
         win16look = (ofn->Flags & OFN_EXPLORER) ? FALSE : TRUE;
 

Modified: trunk/reactos/lib/comdlg32/filedlg16.c
--- trunk/reactos/lib/comdlg32/filedlg16.c	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/filedlg16.c	2005-02-12 21:03:08 UTC (rev 13514)
@@ -170,7 +170,8 @@
         if (priv->ofn16->lpfnHook)
             lfs->hook = TRUE;
 
-    FD16_MapOfnStruct16(priv->ofn16, &lfs->ofnW, lfs->open);
+    lfs->ofnW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*lfs->ofnW));
+    FD16_MapOfnStruct16(priv->ofn16, lfs->ofnW, lfs->open);
 
     if (! FD16_GetTemplate(lfs)) return FALSE;
 
@@ -204,7 +205,7 @@
 static void CALLBACK FD16_UpdateResult(PFD31_DATA lfs)
 {
     PFD16_PRIVATE priv = (PFD16_PRIVATE) lfs->private1632;
-    LPOPENFILENAMEW ofnW = &lfs->ofnW;
+    LPOPENFILENAMEW ofnW = lfs->ofnW;
 
     if (priv->ofn16)
     { /* we have to convert to short (8.3) path */
@@ -240,7 +241,7 @@
 static void CALLBACK FD16_UpdateFileTitle(PFD31_DATA lfs)
 {
     PFD16_PRIVATE priv = (PFD16_PRIVATE) lfs->private1632;
-    LPOPENFILENAMEW ofnW = &lfs->ofnW;
+    LPOPENFILENAMEW ofnW = lfs->ofnW;
 
     if (priv->ofn16)
     {
@@ -279,7 +280,8 @@
             GlobalUnlock16(priv->hGlobal16);
             GlobalFree16(priv->hGlobal16);
         }
-        FD31_FreeOfnW(&lfs->ofnW);
+        FD31_FreeOfnW(lfs->ofnW);
+        HeapFree(GetProcessHeap(), 0, lfs->ofnW);
     }
 }
 

Modified: trunk/reactos/lib/comdlg32/filedlg31.c
--- trunk/reactos/lib/comdlg32/filedlg31.c	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/filedlg31.c	2005-02-12 21:03:08 UTC (rev 13514)
@@ -38,6 +38,7 @@
 #include "cderr.h"
 #include "winreg.h"
 #include "winternl.h"
+#include "shlwapi.h"
 
 WINE_DEFAULT_DEBUG_CHANNEL(commdlg);
 
@@ -305,9 +306,9 @@
 void FD31_UpdateResult(PFD31_DATA lfs, WCHAR *tmpstr)
 {
     int lenstr2;
-    LPOPENFILENAMEW ofnW = &lfs->ofnW;
+    LPOPENFILENAMEW ofnW = lfs->ofnW;
     WCHAR tmpstr2[BUFFILE];
-    WCHAR *bs;
+    WCHAR *p;
 
     TRACE("%s\n", debugstr_w(tmpstr));
     if(ofnW->Flags & OFN_NOVALIDATE)
@@ -320,17 +321,18 @@
     lstrcpynW(tmpstr2+lenstr2, tmpstr, BUFFILE-lenstr2);
     if (ofnW->lpstrFile)
         lstrcpynW(ofnW->lpstrFile, tmpstr2, ofnW->nMaxFile);
-    if((bs = strrchrW(tmpstr2, '\\')) != NULL)
-        ofnW->nFileOffset = bs - tmpstr2 +1;
-    else
-        ofnW->nFileOffset = 0;
-    ofnW->nFileExtension = 0;
-    while(tmpstr2[ofnW->nFileExtension] != '.' && tmpstr2[ofnW->nFileExtension] != '\0')
-        ofnW->nFileExtension++;
-    if (tmpstr2[ofnW->nFileExtension] == '\0')
-        ofnW->nFileExtension = 0;
-    else
-        ofnW->nFileExtension++;
+
+    /* set filename offset */
+    p = PathFindFileNameW(ofnW->lpstrFile);
+    ofnW->nFileOffset = (p - ofnW->lpstrFile);
+
+    /* set extension offset */
+    p = PathFindExtensionW(ofnW->lpstrFile);
+    ofnW->nFileExtension = (*p) ? (p - ofnW->lpstrFile) + 1 : 0;
+
+    TRACE("file %s, file offset %d, ext offset %d\n",
+          debugstr_w(ofnW->lpstrFile), ofnW->nFileOffset, ofnW->nFileExtension);
+
     /* update the real client structures if any */
     lfs->callbacks->UpdateResult(lfs);
 }
@@ -342,7 +344,7 @@
 void FD31_UpdateFileTitle(PFD31_DATA lfs)
 {
   LONG lRet;
-  LPOPENFILENAMEW ofnW = &lfs->ofnW;
+  LPOPENFILENAMEW ofnW = lfs->ofnW;
   if (ofnW->lpstrFileTitle != NULL)
   {
     lRet = SendDlgItemMessageW(lfs->hwnd, lst1, LB_GETCURSEL, 0, 0);
@@ -447,14 +449,14 @@
 	else
 	{
 	    strcpyW(tmpstr2, path);
-            if(!(lfs->ofnW.Flags & OFN_NOVALIDATE))
+            if(!(lfs->ofnW->Flags & OFN_NOVALIDATE))
                 *path = 0;
         }
 
         TRACE("path=%s, tmpstr2=%s\n", debugstr_w(path), debugstr_w(tmpstr2));
         SetDlgItemTextW( hWnd, edt1, tmpstr2 );
         FD31_ScanDir(hWnd, path);
-        return (lfs->ofnW.Flags & OFN_NOVALIDATE) ? TRUE : FALSE;
+        return (lfs->ofnW->Flags & OFN_NOVALIDATE) ? TRUE : FALSE;
     }
 
     /* no wildcards, we might have a directory or a filename */
@@ -501,7 +503,7 @@
     LONG lRet;
     HWND hWnd = lfs->hwnd;
     OPENFILENAMEW ofnsav;
-    LPOPENFILENAMEW ofnW = &lfs->ofnW;
+    LPOPENFILENAMEW ofnW = lfs->ofnW;
     WCHAR filename[BUFFILE];
 
     ofnsav = *ofnW; /* for later restoring */
@@ -610,9 +612,7 @@
         FD31_StripEditControl(hWnd);
         if (notification == LBN_DBLCLK)
         {
-            if (FD31_Validate( lfs, NULL, control, 0, FALSE ))
-                EndDialog(hWnd, TRUE);
-            return TRUE;
+            return SendMessageW(hWnd, WM_COMMAND, IDOK, 0);
         }
         else if (notification == LBN_SELCHANGE)
             return FD31_FileListSelect( lfs );
@@ -700,7 +700,7 @@
  *                              FD31_MapOfnStructA          [internal]
  *      map a 32 bits Ansi structure to an Unicode one
  */
-void FD31_MapOfnStructA(LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open)
+void FD31_MapOfnStructA(const LPOPENFILENAMEA ofnA, LPOPENFILENAMEW ofnW, BOOL open)
 {
     UNICODE_STRING usBuffer;
 
@@ -828,7 +828,7 @@
   if (!lfs) return FALSE;
   SetPropA(hWnd, FD31_OFN_PROP, (HANDLE)lfs);
   lfs->hwnd = hWnd;
-  ofn = &lfs->ofnW;
+  ofn = lfs->ofnW;
 
   TRACE("flags=%lx initialdir=%s\n", ofn->Flags, debugstr_w(ofn->lpstrInitialDir));
 

Modified: trunk/reactos/lib/comdlg32/filedlg31.h
--- trunk/reactos/lib/comdlg32/filedlg31.h	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/filedlg31.h	2005-02-12 21:03:08 UTC (rev 13514)
@@ -44,7 +44,8 @@
     LPARAM lParam; /* save original lparam */
     LPCVOID template; /* template for 32 bits resource */
     BOOL open; /* TRUE if open dialog, FALSE if save dialog */
-    OPENFILENAMEW ofnW; /* copy of original structure or work struct */
+    LPOPENFILENAMEW ofnW; /* pointer either to the original structure or
+                             a W copy for A/16 API */
     LPVOID private1632; /* 16/32 bit caller private data */
     PFD31_CALLBACKS callbacks; /* callbacks to handle 16/32 bit differences */
 } FD31_DATA;

Modified: trunk/reactos/lib/comdlg32/printdlg.c
--- trunk/reactos/lib/comdlg32/printdlg.c	2005-02-12 20:51:20 UTC (rev 13513)
+++ trunk/reactos/lib/comdlg32/printdlg.c	2005-02-12 21:03:08 UTC (rev 13514)
@@ -71,6 +71,11 @@
   {-1, NULL}
 };
 
+/* address of wndproc for subclassed Static control */
+static WNDPROC lpfnStaticWndProc;
+/* the text of the fake document to render for the Page Setup dialog */
+static WCHAR wszFakeDocumentText[1024];
+
 /***********************************************************************
  *    PRINTDLG_OpenDefaultPrinter
  *
@@ -2551,6 +2556,8 @@
 PRINTDLG_PS_WMCommandA(
     HWND hDlg, WPARAM wParam, LPARAM lParam, PageSetupDataA *pda
 ) {
+    TRACE("loword (lparam) %d, wparam 0x%x, lparam %08lx\n",
+	    LOWORD(lParam),wParam,lParam);
     switch (LOWORD(wParam))  {
     case IDOK:
         if (!PRINTDLG_PS_UpdateDlgStructA(hDlg, pda))
@@ -2570,9 +2577,6 @@
 	return TRUE;
     }
     }
-    FIXME("loword (lparam) %d, wparam 0x%x, lparam %08lx, STUB mostly.\n",
-	    LOWORD(lParam),wParam,lParam
-    );
     return FALSE;
 }
 
@@ -2580,6 +2584,8 @@
 PRINTDLG_PS_WMCommandW(
     HWND hDlg, WPARAM wParam, LPARAM lParam, PageSetupDataW *pda
 ) {
+    TRACE("loword (lparam) %d, wparam 0x%x, lparam %08lx\n",
+	    LOWORD(lParam),wParam,lParam);
     switch (LOWORD(wParam))  {
     case IDOK:
         if (!PRINTDLG_PS_UpdateDlgStructW(hDlg, pda))
@@ -2599,13 +2605,114 @@
 	return TRUE;
     }
     }
-    FIXME("loword (lparam) %d, wparam 0x%x, lparam %08lx, STUB mostly.\n",
-	    LOWORD(lParam),wParam,lParam
-    );
     return FALSE;
 }
 
 
+static LRESULT CALLBACK
+PagePaintProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
+{
+    if (uMsg == WM_PAINT)
+    {
+        PAINTSTRUCT ps;
+        RECT rcClient;
+        HPEN hpen, holdpen;
+        HDC hdc;
+        HFONT hfont, holdfont;
+        LOGFONTW lf;
+        HBRUSH hbrush, holdbrush;
+        INT oldbkmode;
+
+        hdc = BeginPaint(hWnd, &ps);
+
+        GetClientRect(hWnd, &rcClient);
+
+        /* fill background */
+        hbrush = GetSysColorBrush(COLOR_3DHIGHLIGHT);
+        FillRect(hdc, &rcClient, hbrush);
+        holdbrush = SelectObject(hdc, hbrush);
+
+        hpen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DSHADOW));
+        holdpen = SelectObject(hdc, hpen);
+
+        /* paint left edge */
+        MoveToEx(hdc, rcClient.left, rcClient.top, NULL);
+        LineTo(hdc, rcClient.left, rcClient.bottom-1);
+
+        /* paint top edge */
+        MoveToEx(hdc, rcClient.left, rcClient.top, NULL);
+        LineTo(hdc, rcClient.right, rcClient.top);
+
+        hpen = CreatePen(PS_SOLID, 1, GetSysColor(COLOR_3DDKSHADOW));
+        DeleteObject(SelectObject(hdc, hpen));
+
+        /* paint right edge */
+        MoveToEx(hdc, rcClient.right-1, rcClient.top, NULL);
+        LineTo(hdc, rcClient.right-1, rcClient.bottom);
+
+        /* paint bottom edge */
+        MoveToEx(hdc, rcClient.left, rcClient.bottom-1, NULL);
+        LineTo(hdc, rcClient.right, rcClient.bottom-1);
+
+        hpen = CreatePen(PS_DASH, 1, GetSysColor(COLOR_3DSHADOW));
+        DeleteObject(SelectObject(hdc, hpen));
+
+        /* draw dashed rectangle showing margins */
+
+        /* FIXME: use real margin values */
+        rcClient.left += 5;
+        rcClient.top += 5;
+        rcClient.right -= 5;
+        rcClient.bottom -= 5;
+
+        /* if the space is too small then we make sure to not draw anything */
+        rcClient.left = min(rcClient.left,rcClient.right);
+        rcClient.top = min(rcClient.top,rcClient.bottom);
+
+        Rectangle(hdc, rcClient.left, rcClient.top, rcClient.right, rcClient.bottom);
+
+        DeleteObject(SelectObject(hdc, holdpen));
+
+        /* draw the fake document */
+
+        /* give text a bit of a space from the frame */
+        rcClient.left += 2;
+        rcClient.top += 2;
+        rcClient.right -= 2;
+        rcClient.bottom -= 2;
+
+        /* if the space is too small then we make sure to not draw anything */
+        rcClient.left = min(rcClient.left,rcClient.right);
+        rcClient.top = min(rcClient.top,rcClient.bottom);
+
+        /* select a nice scalable font, because we want the text really small */
+        SystemParametersInfoW(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, 0);
+        lf.lfHeight = 6; /* value chosen based on visual effect */
+        hfont = CreateFontIndirectW(&lf);
+        holdfont = SelectObject(hdc, hfont);
+
+        /* if text not loaded, then do so now */
+        if (wszFakeDocumentText[0] == '\0')
+            LoadStringW(COMDLG32_hInstance,
+                        IDS_FAKEDOCTEXT,
+                        wszFakeDocumentText,
+                        sizeof(wszFakeDocumentText)/sizeof(wszFakeDocumentText[0]));
+
+        oldbkmode = SetBkMode(hdc, TRANSPARENT);
+        DrawTextW(hdc, wszFakeDocumentText, -1, &rcClient, DT_TOP|DT_LEFT|DT_NOPREFIX|DT_WORDBREAK);
+        SetBkMode(hdc, oldbkmode);
+
+        DeleteObject(SelectObject(hdc, holdfont));
+
+        SelectObject(hdc, holdbrush);
+
+        EndPaint(hWnd, &ps);
+        return 0;
+    }
+    else
+        return CallWindowProcW(lpfnStaticWndProc, hWnd, uMsg, wParam, lParam);
+}
+
 static INT_PTR CALLBACK
 PageDlgProcA(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
 {
@@ -2613,6 +2720,10 @@
     INT_PTR		res = FALSE;
 
     if (uMsg==WM_INITDIALOG) {
+        lpfnStaticWndProc = (WNDPROC)SetWindowLongPtrW(
+            GetDlgItem(hDlg, rct1),
+            GWLP_WNDPROC,
+            (ULONG_PTR)PagePaintProc);
 	res = TRUE;
         pda = (PageSetupDataA*)lParam;
 	SetPropA(hDlg,"__WINE_PAGESETUPDLGDATA",pda);