xref: /reactos/dll/cpl/appwiz/appwiz.c (revision 1734f297)
1 /*
2  * PROJECT:                 ReactOS Software Control Panel
3  * FILE:                    dll/cpl/appwiz/appwiz.c
4  * PURPOSE:                 ReactOS Software Control Panel
5  * PROGRAMMERS:             Gero Kuehn (reactos.filter@gkware.com)
6  *                          Dmitry Chapyshev (dmitry@reactos.org)
7  */
8 
9 #include "appwiz.h"
10 
11 #include <shellapi.h>
12 #include <cpl.h>
13 #include <wine/unicode.h>
14 
15 HINSTANCE hApplet = NULL;
16 
17 static LONG start_params(const WCHAR *params, HWND hwnd_parent)
18 {
19     static const WCHAR install_geckoW[] = {'i','n','s','t','a','l','l','_','g','e','c','k','o',0};
20     static const WCHAR install_monoW[] = {'i','n','s','t','a','l','l','_','m','o','n','o',0};
21 
22     if(!params)
23         return FALSE;
24 
25     if(!strcmpW(params, install_geckoW)) {
26         install_addon(ADDON_GECKO, hwnd_parent);
27         return TRUE;
28     }
29 
30     if(!strcmpW(params, install_monoW)) {
31         install_addon(ADDON_MONO, hwnd_parent);
32         return TRUE;
33     }
34 
35     WARN("unknown param %s\n", debugstr_w(params));
36     return FALSE;
37 }
38 
39 /* Control Panel Callback */
40 LONG CALLBACK
41 CPlApplet(HWND hwndCPl, UINT uMsg, LPARAM lParam1, LPARAM lParam2)
42 {
43     CPLINFO *CPlInfo;
44 
45     switch (uMsg)
46     {
47         case CPL_INIT:
48             return TRUE;
49 
50         case CPL_GETCOUNT:
51             return 1;
52 
53         case CPL_STARTWPARMSW:
54             return start_params((const WCHAR *)lParam2, hwndCPl);
55 
56         case CPL_INQUIRE:
57             CPlInfo = (CPLINFO*)lParam2;
58             CPlInfo->lData = 0;
59             CPlInfo->idIcon = IDI_CPLSYSTEM;
60             CPlInfo->idName = IDS_CPLSYSTEMNAME;
61             CPlInfo->idInfo = IDS_CPLSYSTEMDESCRIPTION;
62             break;
63 
64         case CPL_DBLCLK:
65             ShellExecuteW(NULL,
66                           NULL,
67                           L"rapps.exe",
68                           NULL,
69                           NULL,
70                           1);
71             break;
72     }
73 
74     return FALSE;
75 }
76 
77 BOOL WINAPI
78 DllMain(HINSTANCE hinstDLL, DWORD dwReason, LPVOID lpvReserved)
79 {
80     UNREFERENCED_PARAMETER(lpvReserved);
81 
82     switch (dwReason)
83     {
84         case DLL_PROCESS_ATTACH:
85         case DLL_THREAD_ATTACH:
86             CoInitialize(NULL);
87             hApplet = hinstDLL;
88             break;
89     }
90 
91     return TRUE;
92 }
93