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.
25 * This is a program launcher for Windows CE, to be used as an AutoRun
26 * binary. It searches for XCSoar.exe and executes it.
28 * This has been tested on the Naviter Oudie 2. Copy this program to
29 * the Oudie's storage (right next to XCSoar.exe) and rename it to
30 * OudiePocketFMSStart.exe.
33 #include "OS/PathName.hpp"
42 LaunchExe(const TCHAR
*exe
, const TCHAR
*cmdline
)
45 _sntprintf(buffer
, 256, _T("\"%s\" %s"), exe
, cmdline
);
47 PROCESS_INFORMATION pi
;
48 if (!CreateProcess(exe
, buffer
, nullptr, nullptr, false,
49 0, nullptr, nullptr, nullptr, &pi
))
52 CloseHandle(pi
.hProcess
);
53 CloseHandle(pi
.hThread
);
58 FindAndLaunchXCSoar(const TCHAR
*cmdline
)
60 TCHAR buffer
[MAX_PATH
];
61 if (GetModuleFileName(nullptr, buffer
, MAX_PATH
) <= 0)
64 ReplaceBaseName(buffer
, _T("XCSoar.exe"));
65 return LaunchExe(buffer
, cmdline
);
69 WinMain(HINSTANCE hInstance
, HINSTANCE hPrevInstance
,
71 gcc_unused LPWSTR lpCmdLine
,
73 gcc_unused LPSTR lpCmdLine2
,
77 return FindAndLaunchXCSoar(_T("-fly")) ? 0 : 1;