Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Alexey Alyaev
wine
Commits
d1b77764
Commit
d1b77764
authored
22 years ago
by
Robert Shearman
Committed by
Alexandre Julliard
22 years ago
Browse files
Options
Downloads
Patches
Plain Diff
- Change launch functions to use unicode and implement Control_RunDLLW.
- Enable support for unicode in control panel applications.
parent
df357055
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/shell32/control.c
+87
-39
87 additions, 39 deletions
dlls/shell32/control.c
dlls/shell32/shell32.spec
+3
-3
3 additions, 3 deletions
dlls/shell32/shell32.spec
with
90 additions
and
42 deletions
dlls/shell32/control.c
+
87
−
39
View file @
d1b77764
...
...
@@ -27,6 +27,10 @@
#include
"winuser.h"
#include
"wine/debug.h"
#include
"cpl.h"
#include
"wine/unicode.h"
#define NO_SHLWAPI_REG
#include
"shlwapi.h"
WINE_DEFAULT_DEBUG_CHANNEL
(
shlctrl
);
...
...
@@ -36,7 +40,7 @@ typedef struct CPlApplet {
unsigned
count
;
/* number of subprograms */
HMODULE
hModule
;
/* module of loaded applet */
APPLET_PROC
proc
;
/* entry point address */
NEWCPLINFO
A
info
[
1
];
/* array of count information.
NEWCPLINFO
W
info
[
1
];
/* array of count information.
* dwSize field is 0 if entry is invalid */
}
CPlApplet
;
...
...
@@ -64,23 +68,24 @@ static CPlApplet* Control_UnloadApplet(CPlApplet* applet)
return
next
;
}
static
CPlApplet
*
Control_LoadApplet
(
HWND
hWnd
,
LPCSTR
cmd
,
CPanel
*
panel
)
static
CPlApplet
*
Control_LoadApplet
(
HWND
hWnd
,
LPC
W
STR
cmd
,
CPanel
*
panel
)
{
CPlApplet
*
applet
;
unsigned
i
;
CPLINFO
info
;
NEWCPLINFOW
newinfo
;
if
(
!
(
applet
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
sizeof
(
*
applet
))))
return
applet
;
applet
->
hWnd
=
hWnd
;
if
(
!
(
applet
->
hModule
=
LoadLibrary
A
(
cmd
)))
{
WARN
(
"Cannot load control panel applet %s
\n
"
,
cmd
);
if
(
!
(
applet
->
hModule
=
LoadLibrary
W
(
cmd
)))
{
WARN
(
"Cannot load control panel applet %s
\n
"
,
debugstr_w
(
cmd
)
)
;
goto
theError
;
}
if
(
!
(
applet
->
proc
=
(
APPLET_PROC
)
GetProcAddress
(
applet
->
hModule
,
"CPlApplet"
)))
{
WARN
(
"Not a valid control panel applet %s
\n
"
,
cmd
);
WARN
(
"Not a valid control panel applet %s
\n
"
,
debugstr_w
(
cmd
)
)
;
goto
theError
;
}
if
(
!
applet
->
proc
(
hWnd
,
CPL_INIT
,
0L
,
0L
))
{
...
...
@@ -93,17 +98,19 @@ static CPlApplet* Control_LoadApplet(HWND hWnd, LPCSTR cmd, CPanel* panel)
}
applet
=
HeapReAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
applet
,
sizeof
(
*
applet
)
+
(
applet
->
count
-
1
)
*
sizeof
(
NEWCPLINFO
A
));
sizeof
(
*
applet
)
+
(
applet
->
count
-
1
)
*
sizeof
(
NEWCPLINFO
W
));
for
(
i
=
0
;
i
<
applet
->
count
;
i
++
)
{
applet
->
info
[
i
].
dwSize
=
sizeof
(
NEWCPLINFOA
);
ZeroMemory
(
&
newinfo
,
sizeof
(
newinfo
));
newinfo
.
dwSize
=
sizeof
(
NEWCPLINFOA
);
applet
->
info
[
i
].
dwSize
=
sizeof
(
NEWCPLINFOW
);
/* proc is supposed to return a null value upon success for
* CPL_INQUIRE and CPL_NEWINQUIRE
* However, real drivers don't seem to behave like this
* So, use introspection rather than return value
*/
applet
->
proc
(
hWnd
,
CPL_NEWINQUIRE
,
i
,
(
LPARAM
)
&
applet
->
info
[
i
]
);
if
(
applet
->
info
[
i
]
.
hIcon
==
0
)
{
applet
->
proc
(
hWnd
,
CPL_NEWINQUIRE
,
i
,
(
LPARAM
)
&
new
info
);
if
(
new
info
.
hIcon
==
0
)
{
applet
->
proc
(
hWnd
,
CPL_INQUIRE
,
i
,
(
LPARAM
)
&
info
);
if
(
info
.
idIcon
==
0
||
info
.
idName
==
0
)
{
WARN
(
"Couldn't get info from sp %u
\n
"
,
i
);
...
...
@@ -113,15 +120,35 @@ static CPlApplet* Control_LoadApplet(HWND hWnd, LPCSTR cmd, CPanel* panel)
applet
->
info
[
i
].
dwFlags
=
0
;
applet
->
info
[
i
].
dwHelpContext
=
0
;
applet
->
info
[
i
].
lData
=
info
.
lData
;
applet
->
info
[
i
].
hIcon
=
LoadIcon
A
(
applet
->
hModule
,
MAKEINTRESOURCE
A
(
info
.
idIcon
));
LoadString
A
(
applet
->
hModule
,
info
.
idName
,
applet
->
info
[
i
].
szName
,
sizeof
(
applet
->
info
[
i
].
szName
));
LoadString
A
(
applet
->
hModule
,
info
.
idInfo
,
applet
->
info
[
i
].
szInfo
,
sizeof
(
applet
->
info
[
i
].
szInfo
));
applet
->
info
[
i
].
hIcon
=
LoadIcon
W
(
applet
->
hModule
,
MAKEINTRESOURCE
W
(
info
.
idIcon
));
LoadString
W
(
applet
->
hModule
,
info
.
idName
,
applet
->
info
[
i
].
szName
,
sizeof
(
applet
->
info
[
i
].
szName
)
/
sizeof
(
WCHAR
)
);
LoadString
W
(
applet
->
hModule
,
info
.
idInfo
,
applet
->
info
[
i
].
szInfo
,
sizeof
(
applet
->
info
[
i
].
szInfo
)
/
sizeof
(
WCHAR
)
);
applet
->
info
[
i
].
szHelpFile
[
0
]
=
'\0'
;
}
}
else
{
CopyMemory
(
&
applet
->
info
[
i
],
&
newinfo
,
newinfo
.
dwSize
);
if
(
newinfo
.
dwSize
!=
sizeof
(
NEWCPLINFOW
))
{
applet
->
info
[
i
].
dwSize
=
sizeof
(
NEWCPLINFOW
);
MultiByteToWideChar
(
CP_ACP
,
0
,
((
LPNEWCPLINFOA
)
&
newinfo
)
->
szName
,
sizeof
(((
LPNEWCPLINFOA
)
&
newinfo
)
->
szName
)
/
sizeof
(
CHAR
),
applet
->
info
[
i
].
szName
,
sizeof
(
applet
->
info
[
i
].
szName
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
((
LPNEWCPLINFOA
)
&
newinfo
)
->
szInfo
,
sizeof
(((
LPNEWCPLINFOA
)
&
newinfo
)
->
szInfo
)
/
sizeof
(
CHAR
),
applet
->
info
[
i
].
szInfo
,
sizeof
(
applet
->
info
[
i
].
szInfo
)
/
sizeof
(
WCHAR
));
MultiByteToWideChar
(
CP_ACP
,
0
,
((
LPNEWCPLINFOA
)
&
newinfo
)
->
szHelpFile
,
sizeof
(((
LPNEWCPLINFOA
)
&
newinfo
)
->
szHelpFile
)
/
sizeof
(
CHAR
),
applet
->
info
[
i
].
szHelpFile
,
sizeof
(
applet
->
info
[
i
].
szHelpFile
)
/
sizeof
(
WCHAR
));
}
}
}
applet
->
next
=
panel
->
first
;
...
...
@@ -198,7 +225,7 @@ static LRESULT Control_WndProc_Paint(const CPanel* panel, WPARAM wParam)
txtRect
.
right
=
x
+
XSTEP
;
txtRect
.
top
=
y
+
YICON
;
txtRect
.
bottom
=
y
+
YSTEP
;
DrawText
A
(
hdc
,
applet
->
info
[
i
].
szName
,
-
1
,
&
txtRect
,
DrawText
W
(
hdc
,
applet
->
info
[
i
].
szName
,
-
1
,
&
txtRect
,
DT_CENTER
|
DT_VCENTER
);
x
+=
XSTEP
;
}
...
...
@@ -287,22 +314,28 @@ static void Control_DoInterface(CPanel* panel, HWND hWnd, HINSTANCE hInst)
static
void
Control_DoWindow
(
CPanel
*
panel
,
HWND
hWnd
,
HINSTANCE
hInst
)
{
HANDLE
h
;
WIN32_FIND_DATAA
fd
;
char
buffer
[
MAX_PATH
];
WIN32_FIND_DATAW
fd
;
WCHAR
buffer
[
MAX_PATH
];
static
const
WCHAR
wszAllCpl
[]
=
{
'*'
,
'.'
,
'c'
,
'p'
,
'l'
,
0
};
WCHAR
*
p
;
GetSystemDirectoryW
(
buffer
,
MAX_PATH
);
p
=
buffer
+
strlenW
(
buffer
);
*
p
++
=
'\\'
;
lstrcpyW
(
p
,
wszAllCpl
);
/* FIXME: should grab path somewhere from configuration */
if
((
h
=
FindFirstFileA
(
"c:
\\
windows
\\
system
\\
*.cpl"
,
&
fd
))
!=
0
)
{
if
((
h
=
FindFirstFileW
(
buffer
,
&
fd
))
!=
0
)
{
do
{
sprintf
(
buffer
,
"c:
\\
windows
\\
system
\\
%s"
,
fd
.
cFileName
);
lstrcpyW
(
p
,
fd
.
cFileName
);
Control_LoadApplet
(
hWnd
,
buffer
,
panel
);
}
while
(
FindNextFile
A
(
h
,
&
fd
));
}
while
(
FindNextFile
W
(
h
,
&
fd
));
FindClose
(
h
);
}
if
(
panel
->
first
)
Control_DoInterface
(
panel
,
hWnd
,
hInst
);
}
static
void
Control_DoLaunch
(
CPanel
*
panel
,
HWND
hWnd
,
LPCSTR
c
md
)
static
void
Control_DoLaunch
(
CPanel
*
panel
,
HWND
hWnd
,
LPC
W
STR
wszC
md
)
/* forms to parse:
* foo.cpl,@sp,str
* foo.cpl,@sp
...
...
@@ -312,19 +345,19 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCSTR cmd)
* "a path\foo.cpl"
*/
{
char
*
buffer
;
char
*
beg
=
NULL
;
char
*
end
;
char
ch
;
char
*
ptr
;
LPWSTR
buffer
;
LPWSTR
beg
=
NULL
;
LPWSTR
end
;
WCHAR
ch
;
LPWSTR
ptr
;
unsigned
sp
=
0
;
char
*
extraPmts
=
NULL
;
LPWSTR
extraPmts
=
NULL
;
int
quoted
=
0
;
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
strlen
(
c
md
)
+
1
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
l
strlen
W
(
wszC
md
)
+
1
)
*
sizeof
(
*
wszCmd
))
;
if
(
!
buffer
)
return
;
end
=
strcpy
(
buffer
,
c
md
);
end
=
l
strcpy
W
(
buffer
,
wszC
md
);
for
(;;)
{
ch
=
*
end
;
...
...
@@ -333,7 +366,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCSTR cmd)
*
end
=
'\0'
;
if
(
beg
)
{
if
(
*
beg
==
'@'
)
{
sp
=
atoi
(
beg
+
1
);
sp
=
atoi
W
(
beg
+
1
);
}
else
if
(
*
beg
==
'\0'
)
{
sp
=
0
;
}
else
{
...
...
@@ -346,10 +379,10 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCSTR cmd)
}
end
++
;
}
while
((
ptr
=
s
tr
c
hr
(
buffer
,
(
int
)
'"'
)))
memmove
(
ptr
,
ptr
+
1
,
strlen
(
ptr
));
while
((
ptr
=
S
tr
C
hr
W
(
buffer
,
'"'
)))
memmove
(
ptr
,
ptr
+
1
,
l
strlen
W
(
ptr
));
TRACE
(
"cmd %s, extra %s, sp %d
\n
"
,
buffer
,
debugstr_
a
(
extraPmts
),
sp
);
TRACE
(
"cmd %s, extra %s, sp %d
\n
"
,
debugstr_w
(
buffer
)
,
debugstr_
w
(
extraPmts
),
sp
);
Control_LoadApplet
(
hWnd
,
buffer
,
panel
);
...
...
@@ -371,15 +404,15 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCSTR cmd)
}
/*************************************************************************
* Control_RunDLL [SHELL32.@]
* Control_RunDLL
W
[SHELL32.@]
*
*/
void
WINAPI
Control_RunDLL
(
HWND
hWnd
,
HINSTANCE
hInst
,
LPCSTR
cmd
,
DWORD
nCmdShow
)
void
WINAPI
Control_RunDLL
W
(
HWND
hWnd
,
HINSTANCE
hInst
,
LPC
W
STR
cmd
,
DWORD
nCmdShow
)
{
CPanel
panel
;
TRACE
(
"(%p,
0x%08lx
, %s, 0x%08lx)
\n
"
,
hWnd
,
(
DWORD
)
hInst
,
debugstr_
a
(
cmd
),
nCmdShow
);
TRACE
(
"(%p,
%p
, %s, 0x%08lx)
\n
"
,
hWnd
,
hInst
,
debugstr_
w
(
cmd
),
nCmdShow
);
memset
(
&
panel
,
0
,
sizeof
(
panel
));
...
...
@@ -390,6 +423,21 @@ void WINAPI Control_RunDLL(HWND hWnd, HINSTANCE hInst, LPCSTR cmd, DWORD nCmdSho
}
}
/*************************************************************************
* Control_RunDLLA [SHELL32.@]
*
*/
void
WINAPI
Control_RunDLLA
(
HWND
hWnd
,
HINSTANCE
hInst
,
LPCSTR
cmd
,
DWORD
nCmdShow
)
{
DWORD
len
=
MultiByteToWideChar
(
CP_ACP
,
0
,
cmd
,
-
1
,
NULL
,
0
);
LPWSTR
wszCmd
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
*
sizeof
(
WCHAR
));
if
(
wszCmd
&&
MultiByteToWideChar
(
CP_ACP
,
0
,
cmd
,
-
1
,
wszCmd
,
len
))
{
Control_RunDLLW
(
hWnd
,
hInst
,
wszCmd
,
nCmdShow
);
}
HeapFree
(
GetProcessHeap
(),
0
,
wszCmd
);
}
/*************************************************************************
* Control_FillCache_RunDLL [SHELL32.@]
*
...
...
This diff is collapsed.
Click to expand it.
dlls/shell32/shell32.spec
+
3
−
3
View file @
d1b77764
...
...
@@ -312,9 +312,9 @@
@ stdcall Control_FillCache_RunDLL(long long long long)Control_FillCache_RunDLL
@ stub Control_FillCache_RunDLLA
@ stub Control_FillCache_RunDLLW
@ stdcall Control_RunDLL(
long long long
long)Control_RunDLL
@ st
ub
Control_RunDLLA
@ st
ub
Control_RunDLLW
@ stdcall Control_RunDLL(
ptr ptr str
long)
Control_RunDLL
A
@ st
dcall Control_RunDLLA(ptr ptr str long)
Control_RunDLLA
@ st
dcall Control_RunDLLW(ptr ptr wstr long)
Control_RunDLLW
@ stdcall DllInstall(long wstr)SHELL32_DllInstall
@ stdcall DoEnvironmentSubstA(str str)DoEnvironmentSubstA
@ stdcall DoEnvironmentSubstW(wstr wstr)DoEnvironmentSubstW
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment