2017-08-15 19:36:23 +00:00
|
|
|
#include "unattended.h"
|
|
|
|
#include "defines.h"
|
|
|
|
#include "available.h"
|
|
|
|
#include "dialogs.h"
|
|
|
|
|
|
|
|
#include "setupapi.h"
|
|
|
|
|
|
|
|
BOOL CmdParser(LPWSTR lpCmdLine)
|
|
|
|
{
|
|
|
|
INT argc;
|
|
|
|
LPWSTR* argv = CommandLineToArgvW(lpCmdLine, &argc);
|
|
|
|
ATL::CString szName;
|
|
|
|
|
|
|
|
if (!argv || argc < 2)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
// Setup key - single app expected
|
|
|
|
// TODO: use DB filenames as names because they're shorter
|
|
|
|
|
|
|
|
ATL::CSimpleArray<ATL::CStringW> arrNames;
|
|
|
|
if (!StrCmpW(argv[0], CMD_KEY_INSTALL))
|
|
|
|
{
|
2017-08-15 22:35:45 +00:00
|
|
|
for (INT i = 1; i < argc; ++i)
|
2017-08-15 19:36:23 +00:00
|
|
|
{
|
|
|
|
arrNames.Add(argv[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
if (!StrCmpW(argv[0], CMD_KEY_SETUP))
|
|
|
|
{
|
|
|
|
HINF InfHandle = SetupOpenInfFileW(argv[1], NULL, INF_STYLE_WIN4, NULL);
|
|
|
|
if (InfHandle == INVALID_HANDLE_VALUE)
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
INFCONTEXT Context;
|
2017-08-15 22:35:45 +00:00
|
|
|
if (SetupFindFirstLineW(InfHandle, L"RAPPS", L"Install", &Context))
|
2017-08-15 19:36:23 +00:00
|
|
|
{
|
2017-08-15 22:35:45 +00:00
|
|
|
WCHAR szName[MAX_PATH];
|
|
|
|
do
|
2017-08-15 19:36:23 +00:00
|
|
|
{
|
2017-08-15 22:35:45 +00:00
|
|
|
if (SetupGetStringFieldW(&Context, 1, szName, MAX_PATH, NULL))
|
|
|
|
{
|
|
|
|
arrNames.Add(szName);
|
|
|
|
}
|
|
|
|
} while (SetupFindNextLine(&Context, &Context));
|
|
|
|
}
|
2017-08-15 20:47:10 +00:00
|
|
|
SetupCloseInfFile(InfHandle);
|
2017-08-15 19:36:23 +00:00
|
|
|
}
|
2017-08-15 21:39:21 +00:00
|
|
|
else
|
2017-08-15 22:35:45 +00:00
|
|
|
{
|
2017-08-15 21:39:21 +00:00
|
|
|
return FALSE;
|
2017-08-15 22:35:45 +00:00
|
|
|
}
|
2017-08-15 19:36:23 +00:00
|
|
|
|
|
|
|
CAvailableApps apps;
|
2017-08-24 22:04:44 +00:00
|
|
|
CAvailableApps::UpdateAppsDB();
|
2017-08-15 19:36:23 +00:00
|
|
|
apps.EnumAvailableApplications(ENUM_ALL_AVAILABLE, NULL);
|
2017-08-26 22:43:05 +00:00
|
|
|
ATL::CSimpleArray<CAvailableApplicationInfo*> arrAppInfo = apps.FindInfoList(arrNames);
|
2017-08-15 19:36:23 +00:00
|
|
|
if (arrAppInfo.GetSize() > 0)
|
|
|
|
{
|
|
|
|
CDownloadManager::DownloadListOfApplications(arrAppInfo, TRUE);
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
return FALSE;
|
|
|
|
}
|