SectorZone: add attribute arc_boundary
[xcsoar.git] / src / XCSoarSetup.cpp
blob0ce915eec4ed5d881c5b4e595555e3d324e026a6
1 /*
2 Copyright_License {
4 XCSoar Glide Computer - http://www.xcsoar.org/
5 Copyright (C) 2000-2013 The XCSoar Project
6 A detailed list of copyright holders can be found in the file "AUTHORS".
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 /**
25 * Defines the entry point for the DLL application.
26 * @file XCSoarSetup.cpp
27 * @see http://www.codeguru.com/Cpp/W-P/ce/networking/article.php/c9269/
30 #include <windows.h>
32 #ifdef __GNUC__
33 /* cegcc doesn't provide ce_setup.h; the following enum values are
34 taken from MSDN */
35 typedef enum {
36 codeINSTALL_INIT_CONTINUE = 0,
37 codeINSTALL_INIT_CANCEL
38 } codeINSTALL_INIT;
40 typedef enum {
41 codeINSTALL_EXIT_DONE = 0,
42 codeINSTALL_EXIT_UNINSTALL
43 } codeINSTALL_EXIT;
45 typedef enum {
46 codeUNINSTALL_INIT_CONTINUE = 0,
47 codeUNINSTALL_INIT_CANCEL
48 } codeUNINSTALL_INIT;
50 typedef enum {
51 codeUNINSTALL_EXIT_DONE = 0
52 } codeUNINSTALL_EXIT;
54 /* disable C++ name mangling for exported functions */
55 extern "C" {
56 DECLSPEC_EXPORT codeINSTALL_INIT
57 Install_Init(HWND hwndparent, BOOL ffirstcall, BOOL fpreviouslyinstalled,
58 LPCTSTR pszinstalldir);
60 DECLSPEC_EXPORT codeINSTALL_EXIT
61 Install_Exit(HWND hwndparent, LPCTSTR pszinstalldir,
62 WORD cfaileddirs, WORD cfailedfiles, WORD cfailedregkeys,
63 WORD cfailedregvals, WORD cfailedshortcuts);
65 DECLSPEC_EXPORT codeUNINSTALL_INIT
66 Uninstall_Init(HWND hwndparent, LPCTSTR pszinstalldir);
68 DECLSPEC_EXPORT codeUNINSTALL_EXIT
69 Uninstall_Exit(HWND hwndparent);
71 DECLSPEC_EXPORT APIENTRY BOOL
72 DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved);
75 #else
76 #if (WIN32_PLATFORM_PSPC == 1)
77 #include <..\support\ActiveSync\inc\ce_setup.h>
78 #else
79 #include <ce_setup.h>
80 #endif
81 #endif
83 /**
84 * Handles tasks done at start of installation
86 codeINSTALL_INIT
87 Install_Init(HWND hwndparent, BOOL ffirstcall, BOOL fpreviouslyinstalled,
88 LPCTSTR pszinstalldir)
90 HKEY hKey = NULL;
92 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
93 TEXT("\\Software\\Microsoft\\Today\\Items\\XCSoar"),
94 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) {
95 RegDeleteValue(hKey, TEXT("DLL"));
96 SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
97 RegCloseKey(hKey);
100 return codeINSTALL_INIT_CONTINUE;
104 * Handles tasks done at end of installation
106 codeINSTALL_EXIT
107 Install_Exit(HWND hwndparent, LPCTSTR pszinstalldir, WORD cfaileddirs,
108 WORD cfailedfiles, WORD cfailedregkeys, WORD cfailedregvals,
109 WORD cfailedshortcuts)
111 SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
112 return codeINSTALL_EXIT_DONE;
116 * Handles tasks done at beginning of uninstallation
118 codeUNINSTALL_INIT
119 Uninstall_Init(HWND hwndparent, LPCTSTR pszinstalldir)
121 HKEY hKey = NULL;
123 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
124 TEXT("\\Software\\Microsoft\\Today\\Items\\XCSoar"),
125 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) {
126 RegDeleteValue(hKey, TEXT("DLL"));
127 RegCloseKey(hKey);
128 SendMessage(HWND_BROADCAST, WM_WININICHANGE, 0xF2, 0);
131 if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
132 TEXT("\\Software\\Microsoft\\Today\\Items"),
133 0, KEY_ALL_ACCESS, &hKey) == ERROR_SUCCESS) {
134 RegDeleteKey(hKey, TEXT("XCSoar"));
135 RegCloseKey(hKey);
138 return codeUNINSTALL_INIT_CONTINUE;
142 * Handles tasks done at end of uninstallation
144 codeUNINSTALL_EXIT
145 Uninstall_Exit(HWND hwndparent)
147 return codeUNINSTALL_EXIT_DONE;
150 BOOL APIENTRY
151 DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved)
153 return TRUE;