Menu

#2432 Patch for [1866442] Broken buttons code in WinMerge 2.7.7.1

Trunk
closed-accepted
None
5
2008-01-12
2008-01-12
No

This patch fixes BUG: [1866442] Broken buttons code in WinMerge 2.7.7.1

The cause of the bug is that the size of OPENFILENAME structure has been increased in recent SVN trunk. Windows 98 doesn't support the current size of OPENFILENAME structure.

Here is the fix:

Index: FileOrFolderSelect.cpp

--- FileOrFolderSelect.cpp (revision 4896)
+++ FileOrFolderSelect.cpp (working copy)
@@ -104,7 +104,7 @@
LPTSTR filtersStr = &*filters.begin();
ConvertFilter(filtersStr);

- OPENFILENAME ofn;
+ OPENFILENAME_NT4 ofn;
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = parent;
@@ -122,9 +122,9 @@

BOOL bRetVal = FALSE;
if \(is\_open\)

- bRetVal = GetOpenFileName(&ofn);
+ bRetVal = GetOpenFileName((OPENFILENAME *)&ofn);
else
- bRetVal = GetSaveFileName(&ofn);
+ bRetVal = GetSaveFileName((OPENFILENAME *)&ofn);
// common file dialog populated sSelectedFile variable's buffer
sSelectedFile.ReleaseBuffer();
SetCurrentDirectory(paths_GetWindowsDirectory()); // Free handle held by GetOpenFileName
@@ -237,7 +237,7 @@
dirSelTag += _T("."); // Treat it as filename
sSelectedFile = dirSelTag.c_str(); // What is assignment above good for?

- OPENFILENAME ofn;
+ OPENFILENAME_NT4 ofn;
memset(&ofn, 0, sizeof(ofn));
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = parent;
@@ -251,7 +251,7 @@
ofn.lpstrFileTitle = NULL;
ofn.Flags = OFN_HIDEREADONLY | OFN_PATHMUSTEXIST | OFN_NOTESTFILECREATE;

- BOOL bRetVal = GetOpenFileName(&ofn);
+ BOOL bRetVal = GetOpenFileName((OPENFILENAME *)&ofn);
// common file dialog populated sSelectedFile variable's buffer
sSelectedFile.ReleaseBuffer();
SetCurrentDirectory(paths_GetWindowsDirectory()); // Free handle held by GetOpenFileName

Discussion

  • Kimmo Varis

    Kimmo Varis - 2008-01-12

    Logged In: YES
    user_id=631874
    Originator: NO

    Looks good. This was caused by WINVER definition change (r4823). We now default to 501 for it.

    As we don't use those extra flags added into OPENFILENAME, using OPENFILENAME_NT4 is a good solution.

     
  • Takashi Sawanaka

    • assigned_to: nobody --> sdottaka
    • status: open --> closed-accepted
     
  • Takashi Sawanaka

    Logged In: YES
    user_id=954028
    Originator: YES

    Committed to SVN trunk. Completed: At revision: 4900

     

Log in to post a comment.