shell32: Convert the control panel list to a standard list.
This commit is contained in:
parent
c1e40a8bf4
commit
6f9f6b1aa6
|
@ -45,10 +45,9 @@
|
||||||
|
|
||||||
WINE_DEFAULT_DEBUG_CHANNEL(shlctrl);
|
WINE_DEFAULT_DEBUG_CHANNEL(shlctrl);
|
||||||
|
|
||||||
CPlApplet* Control_UnloadApplet(CPlApplet* applet)
|
void Control_UnloadApplet(CPlApplet* applet)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
CPlApplet* next;
|
|
||||||
|
|
||||||
for (i = 0; i < applet->count; i++) {
|
for (i = 0; i < applet->count; i++) {
|
||||||
if (!applet->info[i].valid) continue;
|
if (!applet->info[i].valid) continue;
|
||||||
|
@ -56,10 +55,9 @@ CPlApplet* Control_UnloadApplet(CPlApplet* applet)
|
||||||
}
|
}
|
||||||
if (applet->proc) applet->proc(applet->hWnd, CPL_EXIT, 0L, 0L);
|
if (applet->proc) applet->proc(applet->hWnd, CPL_EXIT, 0L, 0L);
|
||||||
FreeLibrary(applet->hModule);
|
FreeLibrary(applet->hModule);
|
||||||
next = applet->next;
|
list_remove( &applet->entry );
|
||||||
HeapFree(GetProcessHeap(), 0, applet->cmd);
|
HeapFree(GetProcessHeap(), 0, applet->cmd);
|
||||||
HeapFree(GetProcessHeap(), 0, applet);
|
HeapFree(GetProcessHeap(), 0, applet);
|
||||||
return next;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
|
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
|
||||||
|
@ -168,9 +166,7 @@ CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
applet->next = panel->first;
|
list_add_head( &panel->applets, &applet->entry );
|
||||||
panel->first = applet;
|
|
||||||
|
|
||||||
return applet;
|
return applet;
|
||||||
|
|
||||||
theError:
|
theError:
|
||||||
|
@ -278,7 +274,8 @@ static void Control_WndProc_Create(HWND hWnd, const CREATESTRUCTW* cs)
|
||||||
hSubMenu = GetSubMenu(hMenu, 0);
|
hSubMenu = GetSubMenu(hMenu, 0);
|
||||||
menucount = 0;
|
menucount = 0;
|
||||||
|
|
||||||
for (applet = panel->first; applet; applet = applet->next) {
|
LIST_FOR_EACH_ENTRY( applet, &panel->applets, CPlApplet, entry )
|
||||||
|
{
|
||||||
for (i = 0; i < applet->count; i++) {
|
for (i = 0; i < applet->count; i++) {
|
||||||
if (!applet->info[i].valid)
|
if (!applet->info[i].valid)
|
||||||
continue;
|
continue;
|
||||||
|
@ -450,9 +447,9 @@ static LRESULT WINAPI Control_WndProc(HWND hWnd, UINT wMsg,
|
||||||
return 0;
|
return 0;
|
||||||
case WM_DESTROY:
|
case WM_DESTROY:
|
||||||
{
|
{
|
||||||
CPlApplet* applet = panel->first;
|
CPlApplet *applet, *next;
|
||||||
while (applet)
|
LIST_FOR_EACH_ENTRY_SAFE( applet, next, &panel->applets, CPlApplet, entry )
|
||||||
applet = Control_UnloadApplet(applet);
|
Control_UnloadApplet(applet);
|
||||||
}
|
}
|
||||||
Control_FreeCPlItems(hWnd, panel);
|
Control_FreeCPlItems(hWnd, panel);
|
||||||
PostQuitMessage(0);
|
PostQuitMessage(0);
|
||||||
|
@ -717,6 +714,7 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
|
||||||
LPWSTR extraPmtsBuf = NULL;
|
LPWSTR extraPmtsBuf = NULL;
|
||||||
LPWSTR extraPmts = NULL;
|
LPWSTR extraPmts = NULL;
|
||||||
int quoted = 0;
|
int quoted = 0;
|
||||||
|
CPlApplet *applet;
|
||||||
|
|
||||||
buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
|
buffer = HeapAlloc(GetProcessHeap(), 0, (lstrlenW(wszCmd) + 1) * sizeof(*wszCmd));
|
||||||
if (!buffer) return;
|
if (!buffer) return;
|
||||||
|
@ -783,13 +781,9 @@ static void Control_DoLaunch(CPanel* panel, HWND hWnd, LPCWSTR wszCmd)
|
||||||
|
|
||||||
TRACE("cmd %s, extra %s, sp %d\n", debugstr_w(buffer), debugstr_w(extraPmts), sp);
|
TRACE("cmd %s, extra %s, sp %d\n", debugstr_w(buffer), debugstr_w(extraPmts), sp);
|
||||||
|
|
||||||
Control_LoadApplet(hWnd, buffer, panel);
|
applet = Control_LoadApplet(hWnd, buffer, panel);
|
||||||
|
if (applet)
|
||||||
if (panel->first) {
|
{
|
||||||
CPlApplet* applet = panel->first;
|
|
||||||
|
|
||||||
assert(applet && applet->next == NULL);
|
|
||||||
|
|
||||||
/* we've been given a textual parameter (or none at all) */
|
/* we've been given a textual parameter (or none at all) */
|
||||||
if (sp == -1) {
|
if (sp == -1) {
|
||||||
while ((++sp) != applet->count) {
|
while ((++sp) != applet->count) {
|
||||||
|
@ -830,6 +824,7 @@ void WINAPI Control_RunDLLW(HWND hWnd, HINSTANCE hInst, LPCWSTR cmd, DWORD nCmdS
|
||||||
hWnd, hInst, debugstr_w(cmd), nCmdShow);
|
hWnd, hInst, debugstr_w(cmd), nCmdShow);
|
||||||
|
|
||||||
memset(&panel, 0, sizeof(panel));
|
memset(&panel, 0, sizeof(panel));
|
||||||
|
list_init( &panel.applets );
|
||||||
|
|
||||||
if (!cmd || !*cmd) {
|
if (!cmd || !*cmd) {
|
||||||
Control_DoWindow(&panel, hWnd, hInst);
|
Control_DoWindow(&panel, hWnd, hInst);
|
||||||
|
|
|
@ -21,6 +21,7 @@
|
||||||
#ifndef __WINE_SHELL_CPANEL_H
|
#ifndef __WINE_SHELL_CPANEL_H
|
||||||
#define __WINE_SHELL_CPANEL_H
|
#define __WINE_SHELL_CPANEL_H
|
||||||
|
|
||||||
|
#include "wine/list.h"
|
||||||
#include "cpl.h"
|
#include "cpl.h"
|
||||||
|
|
||||||
struct applet_info
|
struct applet_info
|
||||||
|
@ -34,7 +35,7 @@ struct applet_info
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct CPlApplet {
|
typedef struct CPlApplet {
|
||||||
struct CPlApplet* next; /* linked list */
|
struct list entry;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
LPWSTR cmd; /* path to applet */
|
LPWSTR cmd; /* path to applet */
|
||||||
unsigned count; /* number of subprograms */
|
unsigned count; /* number of subprograms */
|
||||||
|
@ -44,7 +45,7 @@ typedef struct CPlApplet {
|
||||||
} CPlApplet;
|
} CPlApplet;
|
||||||
|
|
||||||
typedef struct CPanel {
|
typedef struct CPanel {
|
||||||
CPlApplet* first;
|
struct list applets;
|
||||||
HWND hWnd;
|
HWND hWnd;
|
||||||
HINSTANCE hInst;
|
HINSTANCE hInst;
|
||||||
unsigned total_subprogs;
|
unsigned total_subprogs;
|
||||||
|
@ -61,6 +62,6 @@ typedef struct CPlItem {
|
||||||
} CPlItem;
|
} CPlItem;
|
||||||
|
|
||||||
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) DECLSPEC_HIDDEN;
|
CPlApplet* Control_LoadApplet(HWND hWnd, LPCWSTR cmd, CPanel* panel) DECLSPEC_HIDDEN;
|
||||||
CPlApplet* Control_UnloadApplet(CPlApplet* applet) DECLSPEC_HIDDEN;
|
void Control_UnloadApplet(CPlApplet* applet) DECLSPEC_HIDDEN;
|
||||||
|
|
||||||
#endif /* __WINE_SHELL_CPANEL_H */
|
#endif /* __WINE_SHELL_CPANEL_H */
|
||||||
|
|
|
@ -302,7 +302,7 @@ static BOOL SHELL_RegisterCPanelApp(IEnumIDListImpl *list, LPCSTR path)
|
||||||
|
|
||||||
MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, MAX_PATH);
|
MultiByteToWideChar(CP_ACP, 0, path, -1, wpath, MAX_PATH);
|
||||||
|
|
||||||
panel.first = NULL;
|
list_init( &panel.applets );
|
||||||
applet = Control_LoadApplet(0, wpath, &panel);
|
applet = Control_LoadApplet(0, wpath, &panel);
|
||||||
|
|
||||||
if (applet)
|
if (applet)
|
||||||
|
|
Loading…
Reference in New Issue