Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
f0b274ba
Commit
f0b274ba
authored
Jan 24, 2012
by
Alex Henrie
Committed by
Alexandre Julliard
Jan 25, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: Correctly handle filters with invalid extensions in Save As dialogs.
parent
02b12e11
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
11 deletions
+15
-11
filedlg.c
dlls/comdlg32/filedlg.c
+14
-11
filedlg.c
dlls/comdlg32/tests/filedlg.c
+1
-0
No files found.
dlls/comdlg32/filedlg.c
View file @
f0b274ba
...
...
@@ -2549,24 +2549,27 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
if
(
lpstrFilter
!=
(
LPWSTR
)
CB_ERR
)
/* control is not empty */
{
WCHAR
*
filter
AtSemicolon
;
filterExt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lstrlenW
(
lpstrFilter
)
*
sizeof
(
WCHAR
)
+
sizeof
(
WCHAR
));
WCHAR
*
filter
SearchIndex
;
filterExt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
lpstrFilter
)
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
filterExt
,
lpstrFilter
);
/* if a semicolon-separated list of file extensions was given, do not include the
semicolon or anything after it in the extension.
example: if filterExt was "*.abc;*.def", it will become "*.abc" */
filter
AtSemicolon
=
strchrW
(
filterExt
,
';'
);
if
(
filter
AtSemicolon
)
filter
SearchIndex
=
strchrW
(
filterExt
,
';'
);
if
(
filter
SearchIndex
)
{
filter
AtSemicolon
[
0
]
=
'\0'
;
filter
SearchIndex
[
0
]
=
'\0'
;
}
/* strip the * or anything else from the extension, "*.abc" becomes "abc" */
strcpyW
(
filterExt
,
PathFindExtensionW
(
filterExt
)
+
1
);
/* if the extension contains a glob, ignore it */
if
(
strchrW
(
filterExt
,
'*'
)
||
strchrW
(
filterExt
,
'?'
))
/* if the extension is invalid or contains a glob, ignore it */
filterSearchIndex
=
PathFindExtensionW
(
filterExt
);
if
(
*
filterSearchIndex
++
&&
!
strchrW
(
filterSearchIndex
,
'*'
)
&&
!
strchrW
(
filterSearchIndex
,
'?'
))
{
strcpyW
(
filterExt
,
filterSearchIndex
);
}
else
{
HeapFree
(
GetProcessHeap
(),
0
,
filterExt
);
filterExt
=
NULL
;
...
...
@@ -2576,7 +2579,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
if
(
!
filterExt
)
{
/* use the default file extension */
filterExt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
lstrlenW
(
fodInfos
->
defext
)
*
sizeof
(
WCHAR
)
+
sizeof
(
WCHAR
));
filterExt
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
fodInfos
->
defext
)
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
filterExt
,
fodInfos
->
defext
);
}
...
...
@@ -2585,7 +2588,7 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
/* Attach the dot*/
lstrcatW
(
lpstrPathAndFile
,
szwDot
);
/* Attach the extension */
lstrcatW
(
lpstrPathAndFile
,
filterExt
);
lstrcatW
(
lpstrPathAndFile
,
filterExt
);
}
HeapFree
(
GetProcessHeap
(),
0
,
filterExt
);
...
...
dlls/comdlg32/tests/filedlg.c
View file @
f0b274ba
...
...
@@ -1086,6 +1086,7 @@ static void test_extension(void)
"TestFilter (*.pt*;*.abc)
\0
*.pt*;*.abc
\0
"
,
"TestFilter (*.ab?)
\0
*.ab?
\0
"
,
"TestFilter (*.*)
\0
*.*
\0
"
,
"TestFilter (*sav)
\0
*sav
\0
"
,
NULL
/* is a test, not an endmark! */
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment