forked from Mirrors/wine-wine
shell32: Fix the logic in Control_LoadApplet determining when to use CPL_INQUIRE and when to use CPL_NEWINQUIRE.
Previously, the code would fail to get the name of an applet that didn't return an icon for CPL_NEWINQUIRE and didn't return set either idName or idIcon to a non-zero value for CPL_INQUIRE. Fix this by sending CPL_INQUIRE first and loading any strings or icon specified and then only fall back to CPL_NEWINQUIRE if any of the required members were zero (i.e. CPL_DYNAMIC_RES) and then only fill in these fields.oldstable
parent
c8b626fa1d
commit
c627a81a76
|
@ -92,45 +92,54 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
|
||||||
ZeroMemory(&newinfo, sizeof(newinfo));
|
ZeroMemory(&newinfo, sizeof(newinfo));
|
||||||
newinfo.dwSize = sizeof(NEWCPLINFOA);
|
newinfo.dwSize = sizeof(NEWCPLINFOA);
|
||||||
applet->info[i].dwSize = sizeof(NEWCPLINFOW);
|
applet->info[i].dwSize = sizeof(NEWCPLINFOW);
|
||||||
|
applet->info[i].dwFlags = 0;
|
||||||
|
applet->info[i].dwHelpContext = 0;
|
||||||
|
applet->info[i].szHelpFile[0] = '\0';
|
||||||
/* proc is supposed to return a null value upon success for
|
/* proc is supposed to return a null value upon success for
|
||||||
* CPL_INQUIRE and CPL_NEWINQUIRE
|
* CPL_INQUIRE and CPL_NEWINQUIRE
|
||||||
* However, real drivers don't seem to behave like this
|
* However, real drivers don't seem to behave like this
|
||||||
* So, use introspection rather than return value
|
* So, use introspection rather than return value
|
||||||
*/
|
*/
|
||||||
applet->proc(hWnd, CPL_NEWINQUIRE, i, (LPARAM)&newinfo);
|
applet->proc(hWnd, CPL_INQUIRE, i, (LPARAM)&info);
|
||||||
if (newinfo.hIcon == 0) {
|
applet->info[i].lData = info.lData;
|
||||||
applet->proc(hWnd, CPL_INQUIRE, i, (LPARAM)&info);
|
if (info.idIcon != CPL_DYNAMIC_RES)
|
||||||
if (info.idIcon == 0 || info.idName == 0) {
|
applet->info[i].hIcon = LoadIconW(applet->hModule,
|
||||||
WARN("Couldn't get info from sp %u\n", i);
|
MAKEINTRESOURCEW(info.idIcon));
|
||||||
applet->info[i].dwSize = 0;
|
if (info.idName != CPL_DYNAMIC_RES)
|
||||||
} else {
|
LoadStringW(applet->hModule, info.idName,
|
||||||
/* convert the old data into the new structure */
|
applet->info[i].szName, sizeof(applet->info[i].szName) / sizeof(WCHAR));
|
||||||
applet->info[i].dwFlags = 0;
|
if (info.idInfo != CPL_DYNAMIC_RES)
|
||||||
applet->info[i].dwHelpContext = 0;
|
LoadStringW(applet->hModule, info.idInfo,
|
||||||
applet->info[i].lData = info.lData;
|
applet->info[i].szInfo, sizeof(applet->info[i].szInfo) / sizeof(WCHAR));
|
||||||
applet->info[i].hIcon = LoadIconW(applet->hModule,
|
|
||||||
MAKEINTRESOURCEW(info.idIcon));
|
if ((info.idIcon == CPL_DYNAMIC_RES) || (info.idName == CPL_DYNAMIC_RES) ||
|
||||||
LoadStringW(applet->hModule, info.idName,
|
(info.idInfo == CPL_DYNAMIC_RES)) {
|
||||||
applet->info[i].szName, sizeof(applet->info[i].szName) / sizeof(WCHAR));
|
applet->proc(hWnd, CPL_NEWINQUIRE, i, (LPARAM)&newinfo);
|
||||||
LoadStringW(applet->hModule, info.idInfo,
|
|
||||||
applet->info[i].szInfo, sizeof(applet->info[i].szInfo) / sizeof(WCHAR));
|
applet->info[i].dwFlags = newinfo.dwFlags;
|
||||||
applet->info[i].szHelpFile[0] = '\0';
|
applet->info[i].dwHelpContext = newinfo.dwHelpContext;
|
||||||
|
applet->info[i].lData = newinfo.lData;
|
||||||
|
if (info.idIcon == CPL_DYNAMIC_RES) {
|
||||||
|
if (!newinfo.hIcon) WARN("couldn't get icon for applet %u\n", i);
|
||||||
|
applet->info[i].hIcon = newinfo.hIcon;
|
||||||
}
|
}
|
||||||
}
|
if (newinfo.dwSize == sizeof(NEWCPLINFOW)) {
|
||||||
else
|
if (info.idName == CPL_DYNAMIC_RES)
|
||||||
{
|
memcpy(applet->info[i].szName, newinfo.szName, sizeof(newinfo.szName));
|
||||||
CopyMemory(&applet->info[i], &newinfo, newinfo.dwSize);
|
if (info.idInfo == CPL_DYNAMIC_RES)
|
||||||
if (newinfo.dwSize != sizeof(NEWCPLINFOW))
|
memcpy(applet->info[i].szInfo, newinfo.szInfo, sizeof(newinfo.szInfo));
|
||||||
{
|
memcpy(applet->info[i].szHelpFile, newinfo.szHelpFile, sizeof(newinfo.szHelpFile));
|
||||||
applet->info[i].dwSize = sizeof(NEWCPLINFOW);
|
} else {
|
||||||
MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szName,
|
if (info.idName == CPL_DYNAMIC_RES)
|
||||||
sizeof(((LPNEWCPLINFOA)&newinfo)->szName) / sizeof(CHAR),
|
MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szName,
|
||||||
applet->info[i].szName,
|
sizeof(((LPNEWCPLINFOA)&newinfo)->szName) / sizeof(CHAR),
|
||||||
sizeof(applet->info[i].szName) / sizeof(WCHAR));
|
applet->info[i].szName,
|
||||||
MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szInfo,
|
sizeof(applet->info[i].szName) / sizeof(WCHAR));
|
||||||
sizeof(((LPNEWCPLINFOA)&newinfo)->szInfo) / sizeof(CHAR),
|
if (info.idInfo == CPL_DYNAMIC_RES)
|
||||||
applet->info[i].szInfo,
|
MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szInfo,
|
||||||
sizeof(applet->info[i].szInfo) / sizeof(WCHAR));
|
sizeof(((LPNEWCPLINFOA)&newinfo)->szInfo) / sizeof(CHAR),
|
||||||
|
applet->info[i].szInfo,
|
||||||
|
sizeof(applet->info[i].szInfo) / sizeof(WCHAR));
|
||||||
MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szHelpFile,
|
MultiByteToWideChar(CP_ACP, 0, ((LPNEWCPLINFOA)&newinfo)->szHelpFile,
|
||||||
sizeof(((LPNEWCPLINFOA)&newinfo)->szHelpFile) / sizeof(CHAR),
|
sizeof(((LPNEWCPLINFOA)&newinfo)->szHelpFile) / sizeof(CHAR),
|
||||||
applet->info[i].szHelpFile,
|
applet->info[i].szHelpFile,
|
||||||
|
|
Loading…
Reference in New Issue