[WPF bug list] (3)-dialog box for opening a file for secretly creating a file

Source: Internet
Author: User

ThisBugIt can be briefly described as follows: in useOpenfiledialogWhen you try to open a nonexistent file,OpenfiledialogIt will create a non-existent file and delete it, and then tell the user that the file does not exist.

 

Next we will write a program to reproduce thisBug. The basic principle is to useFilesystemwatcherTo monitor folders.

 

Created and used1As shown inProgram.

 

Figure1.Sample program

 

Select a folder and monitor file changes.

 

Figure2.Monitoring folder

 

Then, try to open a non-existent file in the monitored file. This file opening dialog box has been setCheckfileexistsAndCheckpathexistsIsTrue.

The method is simple.File NameEnter a non-existent file name, and click open.3.

 

Figure3.Open a nonexistent file

 

Then, in the file dialog box, a message box appears, indicating that the file does not exist.4.

 

 

Figure4.Message box does not exist in the file

 

Click Cancel. However, we will find thatOutput Message.5.

 

Figure5.Unreasonable File Creation and Deletion

 

Because the open file dialog box is actuallyAPICall. No ImageRecycltorLet's look at its implementation in the same simple way.

 

In additionSource codeAnd addedFileiopermissionTo prohibit writing to the monitoring file. But it has no effect at all. In fact, this is another security vulnerability. Because. NET FrameworkBefore callingAPIRelatedPermissionCheck. However, this check is not actually performed. (MaybeMSHave other considerations)

 

PS:WinformIn the open file dialog box also has such a problem, so it cannot be completely considered a WPF bug, but after all there is this problem in the WPF assembly, it is put in. (Not readCode, It should beAPI)

 

Others in the same seriesArticle:

[WPF bugLIST] (Collation)And(1 )--Multiple choice optionsListBox

[WPF bugLIST]Of(2) -- radiobuttonOfIscheckedBinding invalid

[WPF bugLIST]Of(4 )--ClickRadiobuttonNo response to blank

[WPF bugLIST]Of(5 )--Hide the modal dialog box and convert it to non-modal Mode

[WPF bugLIST]Of(6) -- buttonOfIscancelAttribute invalid

[WPF bugLIST]Of(7 )--StubbornError Template

[WPF bugLIST]Of(8) -- rowdefinitionMediumMaxheightInvalid under certain conditions

[WPF bugLIST]Of(9 )--Disappearing cursor

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.