Skip to content
/ safedlgs Public

Proof of concept to avoid random crashes from the Windows file dialog

License

Notifications You must be signed in to change notification settings

dacap/safedlgs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

safedlgs

This is a proof of concept. Use this code as you wish.

There is no safe way to use the standard file dialog to open/save files on Windows. What does this mean? It looks like there are several comctl32.dll implementations, and some third-party Windows IME (Input Method Editors) that can crash your application just by using the standard file dialog from Windows.

As the file dialog contains a EDIT control, it opens a full range of possible bugs/crashes when a third-party IME is configured. Which means that just opening the file selector is a potential source of crashes for your application.

One possible way to fix this is using a background process just to open the file dialog. If the process crashes, we can reopen it, even using the last location where the crash was produced.

Demo

This project includes the following programs:

  • dlgs.exe: Shows the native Windows file dialog using the IFileDialog interface. This process can crash. Each time the user changes to other folder, it prints that folder to STDOUT, so we can re-open the file dialog in the last location.
  • test.exe: Wrapper that (re-)executes dlgs.exe. This process shouldn't crash, if it detects that dlgs.exe crashed, it just re-open it in the last visited location.

The dlgs.exe will show the native file dialog with an extra "Crash Process" button just to test how it works in case of crash:

Screen Shot

Crashes

You can find some stack traces in the CRASHES file about real world Windows and IME bugs out there.

License

This project is released under the terms of the MIT license. Read LICENSE for more information.

About

Proof of concept to avoid random crashes from the Windows file dialog

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published