Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
5cb4c553
Commit
5cb4c553
authored
Jan 29, 2011
by
Wolfram Sang
Committed by
Alexandre Julliard
Jan 31, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: Filedlg should not add extension if it contains a glob.
parent
08f13cbd
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
10 deletions
+26
-10
filedlg.c
dlls/comdlg32/filedlg.c
+2
-2
filedlg.c
dlls/comdlg32/tests/filedlg.c
+24
-8
No files found.
dlls/comdlg32/filedlg.c
View file @
5cb4c553
...
@@ -2491,8 +2491,8 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
...
@@ -2491,8 +2491,8 @@ BOOL FILEDLG95_OnOpen(HWND hwnd)
else
if
(
fodInfos
->
defext
)
/* attach the default file extension*/
else
if
(
fodInfos
->
defext
)
/* attach the default file extension*/
filterExt
=
fodInfos
->
defext
;
filterExt
=
fodInfos
->
defext
;
/* If extension
is .*
, ignore it */
/* If extension
contains a glob
, ignore it */
if
(
filterExt
[
0
]
!=
'*'
)
if
(
filterExt
&&
!
strchrW
(
filterExt
,
'*'
)
&&
!
strchrW
(
filterExt
,
'?'
)
)
{
{
/* Attach the dot*/
/* Attach the dot*/
lstrcatW
(
lpstrPathAndFile
,
szwDot
);
lstrcatW
(
lpstrPathAndFile
,
szwDot
);
...
...
dlls/comdlg32/tests/filedlg.c
View file @
5cb4c553
...
@@ -1052,6 +1052,15 @@ static UINT_PTR WINAPI test_extension_wndproc(HWND dlg, UINT msg, WPARAM wParam,
...
@@ -1052,6 +1052,15 @@ static UINT_PTR WINAPI test_extension_wndproc(HWND dlg, UINT msg, WPARAM wParam,
return
FALSE
;
return
FALSE
;
}
}
static
const
char
*
defext_filters
[]
=
{
"TestFilter (*.pt*)
\0
*.pt*
\0
"
,
"TestFilter (*.ab?)
\0
*.ab?
\0
"
,
"TestFilter (*.*)
\0
*.*
\0
"
,
NULL
/* is a test, not an endmark! */
};
#define ARRAY_SIZE(a) (sizeof(a)/sizeof((a)[0]))
static
void
test_extension
(
void
)
static
void
test_extension
(
void
)
{
{
OPENFILENAME
ofn
=
{
sizeof
(
OPENFILENAME
)};
OPENFILENAME
ofn
=
{
sizeof
(
OPENFILENAME
)};
...
@@ -1059,11 +1068,12 @@ static void test_extension(void)
...
@@ -1059,11 +1068,12 @@ static void test_extension(void)
char
curdir
[
MAX_PATH
];
char
curdir
[
MAX_PATH
];
char
*
filename_ptr
;
char
*
filename_ptr
;
const
char
*
test_file_name
=
"deadbeef"
;
const
char
*
test_file_name
=
"deadbeef"
;
const
char
**
cur_filter
;
DWORD
ret
;
DWORD
ret
;
BOOL
cd
ret
;
BOOL
bool
ret
;
cd
ret
=
GetCurrentDirectoryA
(
sizeof
(
curdir
),
curdir
);
bool
ret
=
GetCurrentDirectoryA
(
sizeof
(
curdir
),
curdir
);
ok
(
cd
ret
,
"Failed to get current dir err %d
\n
"
,
GetLastError
());
ok
(
bool
ret
,
"Failed to get current dir err %d
\n
"
,
GetLastError
());
/* Ignore .* extension */
/* Ignore .* extension */
ofn
.
lStructSize
=
sizeof
(
ofn
);
ofn
.
lStructSize
=
sizeof
(
ofn
);
...
@@ -1075,17 +1085,23 @@ static void test_extension(void)
...
@@ -1075,17 +1085,23 @@ static void test_extension(void)
ofn
.
lpstrInitialDir
=
curdir
;
ofn
.
lpstrInitialDir
=
curdir
;
ofn
.
lpfnHook
=
test_extension_wndproc
;
ofn
.
lpfnHook
=
test_extension_wndproc
;
ofn
.
nFileExtension
=
0
;
ofn
.
nFileExtension
=
0
;
ofn
.
lpstrFilter
=
"All Files (*.*)
\0
*.*
\0
"
;
strcpy
(
filename
,
test_file_name
);
ret
=
GetSaveFileNameA
(
&
ofn
);
for
(
cur_filter
=
defext_filters
;
cur_filter
<
defext_filters
+
ARRAY_SIZE
(
defext_filters
);
cur_filter
++
)
{
ofn
.
lpstrFilter
=
*
cur_filter
;
strcpy
(
filename
,
test_file_name
);
boolret
=
GetSaveFileNameA
(
&
ofn
);
ok
(
boolret
,
"expected true
\n
"
);
ret
=
CommDlgExtendedError
();
ok
(
!
ret
,
"CommDlgExtendedError returned %#x
\n
"
,
ret
);
filename_ptr
=
ofn
.
lpstrFile
+
strlen
(
ofn
.
lpstrFile
)
-
strlen
(
test_file_name
);
filename_ptr
=
ofn
.
lpstrFile
+
strlen
(
ofn
.
lpstrFile
)
-
strlen
(
test_file_name
);
ok
(
1
==
ret
,
"expected 1, got %d
\n
"
,
ret
);
ok
(
strlen
(
ofn
.
lpstrFile
)
>=
strlen
(
test_file_name
),
"Filename %s is too short
\n
"
,
ofn
.
lpstrFile
);
ok
(
strlen
(
ofn
.
lpstrFile
)
>=
strlen
(
test_file_name
),
"Filename %s is too short
\n
"
,
ofn
.
lpstrFile
);
ok
(
strcmp
(
filename_ptr
,
test_file_name
)
==
0
,
ok
(
strcmp
(
filename_ptr
,
test_file_name
)
==
0
,
"Filename is %s, expected %s
\n
"
,
filename_ptr
,
test_file_name
);
"Filename is %s, expected %s
\n
"
,
filename_ptr
,
test_file_name
);
}
}
}
#undef ARRAY_SIZE
START_TEST
(
filedlg
)
START_TEST
(
filedlg
)
{
{
test_DialogCancel
();
test_DialogCancel
();
...
...
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