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
8f6545cb
Commit
8f6545cb
authored
Jul 21, 2004
by
Mike McCormack
Committed by
Alexandre Julliard
Jul 21, 2004
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Unicode file dialogs send and receive unicode messages.
parent
649b78d0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
36 deletions
+95
-36
filedlg.c
dlls/commdlg/filedlg.c
+95
-36
No files found.
dlls/commdlg/filedlg.c
View file @
8f6545cb
...
...
@@ -781,27 +781,37 @@ HRESULT SendCustomDlgNotificationMessage(HWND hwndParentDlg, UINT uCode)
if
(
!
fodInfos
)
return
0
;
if
(
fodInfos
->
unicode
)
FIXME
(
"sending OPENFILENAMEA structure. Hook is expecting OPENFILENAMEW!
\n
"
);
if
(
fodInfos
->
DlgInfos
.
hwndCustomDlg
)
{
OFNOTIFYA
ofnNotify
;
HRESULT
ret
;
ofnNotify
.
hdr
.
hwndFrom
=
hwndParentDlg
;
ofnNotify
.
hdr
.
idFrom
=
0
;
ofnNotify
.
hdr
.
code
=
uCode
;
ofnNotify
.
lpOFN
=
fodInfos
->
ofnInfos
;
ofnNotify
.
pszFile
=
NULL
;
TRACE
(
"CALL NOTIFY for %x
\n
"
,
uCode
);
ret
=
SendMessageA
(
fodInfos
->
DlgInfos
.
hwndCustomDlg
,
WM_NOTIFY
,
0
,(
LPARAM
)
&
ofnNotify
);
if
(
fodInfos
->
unicode
)
{
OFNOTIFYW
ofnNotify
;
ofnNotify
.
hdr
.
hwndFrom
=
hwndParentDlg
;
ofnNotify
.
hdr
.
idFrom
=
0
;
ofnNotify
.
hdr
.
code
=
uCode
;
ofnNotify
.
lpOFN
=
(
LPOPENFILENAMEW
)
fodInfos
->
ofnInfos
;
ofnNotify
.
pszFile
=
NULL
;
ret
=
SendMessageW
(
fodInfos
->
DlgInfos
.
hwndCustomDlg
,
WM_NOTIFY
,
0
,(
LPARAM
)
&
ofnNotify
);
}
else
{
OFNOTIFYA
ofnNotify
;
ofnNotify
.
hdr
.
hwndFrom
=
hwndParentDlg
;
ofnNotify
.
hdr
.
idFrom
=
0
;
ofnNotify
.
hdr
.
code
=
uCode
;
ofnNotify
.
lpOFN
=
fodInfos
->
ofnInfos
;
ofnNotify
.
pszFile
=
NULL
;
ret
=
SendMessageA
(
fodInfos
->
DlgInfos
.
hwndCustomDlg
,
WM_NOTIFY
,
0
,(
LPARAM
)
&
ofnNotify
);
}
TRACE
(
"RET NOTIFY
\n
"
);
return
ret
;
}
return
TRUE
;
}
HRESULT
FILEDLG95_Handle_GetFilePath
(
HWND
hwnd
,
DWORD
size
,
LP
STR
buffer
)
HRESULT
FILEDLG95_Handle_GetFilePath
(
HWND
hwnd
,
DWORD
size
,
LP
VOID
buffer
)
{
UINT
sizeUsed
=
0
,
n
,
total
;
LPWSTR
lpstrFileList
=
NULL
;
...
...
@@ -820,38 +830,71 @@ HRESULT FILEDLG95_Handle_GetFilePath(HWND hwnd, DWORD size, LPSTR buffer)
TRACE
(
"path >%s< filespec >%s< %d files
\n
"
,
debugstr_w
(
lpstrCurrentDir
),
debugstr_w
(
lpstrFileList
),
n
);
total
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrCurrentDir
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
total
+=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrFileList
,
sizeUsed
,
NULL
,
0
,
NULL
,
NULL
);
/* Prepend the current path */
n
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrCurrentDir
,
-
1
,
buffer
,
size
,
NULL
,
NULL
);
if
(
fodInfos
->
unicode
)
{
LPWSTR
bufW
=
buffer
;
total
=
strlenW
(
lpstrCurrentDir
)
+
1
+
sizeUsed
;
if
(
n
<
size
)
/* Prepend the current path */
n
=
strlenW
(
lpstrCurrentDir
)
+
1
;
strncpyW
(
bufW
,
lpstrCurrentDir
,
size
);
if
(
n
<
size
)
{
/* 'n' includes trailing \0 */
bufW
[
n
-
1
]
=
'\\'
;
memcpy
(
&
bufW
[
n
],
lpstrFileList
,
(
size
-
n
)
*
sizeof
(
WCHAR
)
);
}
TRACE
(
"returned -> %s
\n
"
,
debugstr_wn
(
bufW
,
total
));
}
else
{
/* 'n' includes trailing \0 */
buffer
[
n
-
1
]
=
'\\'
;
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrFileList
,
sizeUsed
,
&
buffer
[
n
],
size
-
n
,
NULL
,
NULL
);
LPSTR
bufA
=
buffer
;
total
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrCurrentDir
,
-
1
,
NULL
,
0
,
NULL
,
NULL
);
total
+=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrFileList
,
sizeUsed
,
NULL
,
0
,
NULL
,
NULL
);
/* Prepend the current path */
n
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrCurrentDir
,
-
1
,
bufA
,
size
,
NULL
,
NULL
);
if
(
n
<
size
)
{
/* 'n' includes trailing \0 */
bufA
[
n
-
1
]
=
'\\'
;
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrFileList
,
sizeUsed
,
&
bufA
[
n
],
size
-
n
,
NULL
,
NULL
);
}
TRACE
(
"returned -> %s
\n
"
,
debugstr_an
(
bufA
,
total
));
}
MemFree
(
lpstrFileList
);
TRACE
(
"returned -> %s
\n
"
,
debugstr_a
(
buffer
));
return
total
;
}
HRESULT
FILEDLG95_Handle_GetFileSpec
(
HWND
hwnd
,
DWORD
size
,
LP
STR
buffer
)
HRESULT
FILEDLG95_Handle_GetFileSpec
(
HWND
hwnd
,
DWORD
size
,
LP
VOID
buffer
)
{
UINT
sizeUsed
=
0
;
LPWSTR
lpstrFileList
=
NULL
;
FileOpenDlgInfos
*
fodInfos
=
(
FileOpenDlgInfos
*
)
GetPropA
(
hwnd
,
FileOpenDlgInfosStr
);
TRACE
(
"CDM_GETSPEC:
\n
"
);
FILEDLG95_FILENAME_GetFileNames
(
hwnd
,
&
lpstrFileList
,
&
sizeUsed
);
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrFileList
,
sizeUsed
,
buffer
,
size
,
NULL
,
NULL
);
if
(
fodInfos
->
unicode
)
{
LPWSTR
bufW
=
buffer
;
memcpy
(
bufW
,
lpstrFileList
,
sizeof
(
WCHAR
)
*
sizeUsed
);
}
else
{
LPSTR
bufA
=
buffer
;
sizeUsed
=
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrFileList
,
sizeUsed
,
NULL
,
0
,
NULL
,
NULL
);
WideCharToMultiByte
(
CP_ACP
,
0
,
lpstrFileList
,
sizeUsed
,
bufA
,
size
,
NULL
,
NULL
);
}
MemFree
(
lpstrFileList
);
return
sizeUsed
;
...
...
@@ -864,29 +907,45 @@ HRESULT FILEDLG95_Handle_GetFileSpec(HWND hwnd, DWORD size, LPSTR buffer)
*/
HRESULT
FILEDLG95_HandleCustomDialogMessages
(
HWND
hwnd
,
UINT
uMsg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
char
lpstrPath
[
MAX_PATH
];
FileOpenDlgInfos
*
fodInfos
=
(
FileOpenDlgInfos
*
)
GetPropA
(
hwnd
,
FileOpenDlgInfosStr
);
if
(
!
fodInfos
)
return
-
1
;
switch
(
uMsg
)
{
case
CDM_GETFILEPATH
:
return
FILEDLG95_Handle_GetFilePath
(
hwnd
,
(
UINT
)
wParam
,
(
LP
STR
)
lParam
);
return
FILEDLG95_Handle_GetFilePath
(
hwnd
,
(
UINT
)
wParam
,
(
LP
VOID
)
lParam
);
case
CDM_GETFOLDERPATH
:
TRACE
(
"CDM_GETFOLDERPATH:
\n
"
);
SHGetPathFromIDListA
(
fodInfos
->
ShellInfos
.
pidlAbsCurrent
,
lpstrPath
);
if
((
LPSTR
)
lParam
!=
NULL
)
lstrcpynA
((
LPSTR
)
lParam
,
lpstrPath
,(
int
)
wParam
);
return
strlen
(
lpstrPath
);
if
(
fodInfos
->
unicode
)
{
WCHAR
lpstrPath
[
MAX_PATH
],
*
bufW
=
(
LPWSTR
)
lParam
;
SHGetPathFromIDListW
(
fodInfos
->
ShellInfos
.
pidlAbsCurrent
,
lpstrPath
);
if
(
bufW
)
lstrcpynW
(
bufW
,
lpstrPath
,(
int
)
wParam
);
return
strlenW
(
lpstrPath
);
}
else
{
char
lpstrPath
[
MAX_PATH
],
*
bufA
=
(
LPSTR
)
lParam
;
SHGetPathFromIDListA
(
fodInfos
->
ShellInfos
.
pidlAbsCurrent
,
lpstrPath
);
if
(
bufA
)
lstrcpynA
(
bufA
,
lpstrPath
,(
int
)
wParam
);
return
strlen
(
lpstrPath
);
}
case
CDM_GETSPEC
:
return
FILEDLG95_Handle_GetFileSpec
(
hwnd
,
(
UINT
)
wParam
,
(
LPSTR
)
lParam
);
case
CDM_SETCONTROLTEXT
:
TRACE
(
"CDM_SETCONTROLTEXT:
\n
"
);
if
(
0
!=
lParam
)
SetDlgItemTextA
(
hwnd
,
(
UINT
)
wParam
,
(
LPSTR
)
lParam
);
if
(
lParam
)
{
if
(
fodInfos
->
unicode
)
SetDlgItemTextW
(
hwnd
,
(
UINT
)
wParam
,
(
LPWSTR
)
lParam
);
else
SetDlgItemTextA
(
hwnd
,
(
UINT
)
wParam
,
(
LPSTR
)
lParam
);
}
return
TRUE
;
case
CDM_HIDECONTROL
:
...
...
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