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
d1b77764
Commit
d1b77764
authored
Dec 13, 2002
by
Robert Shearman
Committed by
Alexandre Julliard
Dec 13, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Change launch functions to use unicode and implement Control_RunDLLW.
- Enable support for unicode in control panel applications.
parent
df357055
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
90 additions
and
42 deletions
+90
-42
control.c
dlls/shell32/control.c
+87
-39
shell32.spec
dlls/shell32/shell32.spec
+3
-3
No files found.
dlls/shell32/control.c
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
)
&
newinfo
);
if
(
newinfo
.
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
,
LPC
STR
c
md
)
static
void
Control_DoLaunch
(
CPanel
*
panel
,
HWND
hWnd
,
LPC
WSTR
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
(
cmd
)
+
1
);
buffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
lstrlenW
(
wszCmd
)
+
1
)
*
sizeof
(
*
wszCmd
)
);
if
(
!
buffer
)
return
;
end
=
strcpy
(
buffer
,
c
md
);
end
=
lstrcpyW
(
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
=
strchr
(
buffer
,
(
int
)
'"'
)))
memmove
(
ptr
,
ptr
+
1
,
strlen
(
ptr
));
while
((
ptr
=
StrChrW
(
buffer
,
'"'
)))
memmove
(
ptr
,
ptr
+
1
,
lstrlenW
(
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
,
LPC
STR
cmd
,
DWORD
nCmdShow
)
void
WINAPI
Control_RunDLL
W
(
HWND
hWnd
,
HINSTANCE
hInst
,
LPCW
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
));
...
...
@@ -391,6 +424,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.@]
*
*/
...
...
dlls/shell32/shell32.spec
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_RunDLLA
@ 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
...
...
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