ReactOS 0.4.16-dev-1946-g52006dd
unattended.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define CMD_KEY_APPWIZ   L"APPWIZ"
 
#define CMD_KEY_GENINST   L"GENINST"
 
#define CMD_KEY_UNINSTALL   L"UNINSTALL"
 
#define CMD_KEY_INSTALL   L"INSTALL"
 
#define CMD_KEY_SETUP   L"SETUP"
 
#define CMD_KEY_FIND   L"FIND"
 
#define CMD_KEY_INFO   L"INFO"
 
#define CMD_KEY_HELP   L"?"
 
#define CMD_KEY_HELP_ALT   L"HELP"
 

Functions

BOOL ParseCmdAndExecute (LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
 

Variables

const WCHAR UsageString []
 

Macro Definition Documentation

◆ CMD_KEY_APPWIZ

#define CMD_KEY_APPWIZ   L"APPWIZ"

Definition at line 3 of file unattended.h.

◆ CMD_KEY_FIND

#define CMD_KEY_FIND   L"FIND"

Definition at line 8 of file unattended.h.

◆ CMD_KEY_GENINST

#define CMD_KEY_GENINST   L"GENINST"

Definition at line 4 of file unattended.h.

◆ CMD_KEY_HELP

#define CMD_KEY_HELP   L"?"

Definition at line 10 of file unattended.h.

◆ CMD_KEY_HELP_ALT

#define CMD_KEY_HELP_ALT   L"HELP"

Definition at line 11 of file unattended.h.

◆ CMD_KEY_INFO

#define CMD_KEY_INFO   L"INFO"

Definition at line 9 of file unattended.h.

◆ CMD_KEY_INSTALL

#define CMD_KEY_INSTALL   L"INSTALL"

Definition at line 6 of file unattended.h.

◆ CMD_KEY_SETUP

#define CMD_KEY_SETUP   L"SETUP"

Definition at line 7 of file unattended.h.

◆ CMD_KEY_UNINSTALL

#define CMD_KEY_UNINSTALL   L"UNINSTALL"

Definition at line 5 of file unattended.h.

Function Documentation

◆ ParseCmdAndExecute()

BOOL ParseCmdAndExecute ( LPWSTR  lpCmdLine,
BOOL  bIsFirstLaunch,
int  nCmdShow 
)

Definition at line 349 of file unattended.cpp.

350{
351 INT argc;
352 LPWSTR *argv = CommandLineToArgvW(lpCmdLine, &argc);
353 if (!argv)
354 return FALSE;
355
357
358 BOOL bAppwizMode = (argc > 1 && MatchCmdOption(argv[1], CMD_KEY_APPWIZ));
359 if (!bAppwizMode)
360 {
362 if (SettingsInfo.bUpdateAtStart || bIsFirstLaunch)
363 db.RemoveCached();
364
365 db.UpdateAvailable();
366 }
367
368 db.UpdateInstalled();
369
370 if (argc == 1 || bAppwizMode) // RAPPS is launched without options or APPWIZ mode is requested
371 {
372 // Check whether the RAPPS MainWindow is already launched in another process
373 CStringW szWindowText(MAKEINTRESOURCEW(bAppwizMode ? IDS_APPWIZ_TITLE : IDS_APPTITLE));
374 LPCWSTR pszMutex = bAppwizMode ? L"RAPPWIZ" : MAINWINDOWMUTEX;
375
376 HANDLE hMutex = CreateMutexW(NULL, FALSE, pszMutex);
378 {
379 /* If already started, find its window */
380 HWND hWindow;
381 for (int wait = 2500, inter = 250; wait > 0; wait -= inter)
382 {
383 if ((hWindow = FindWindowW(szWindowClass, szWindowText)) != NULL)
384 break;
385 Sleep(inter);
386 }
387
388 if (hWindow)
389 {
390 /* Activate the window in the other instance */
391 ShowWindow(hWindow, SW_SHOWNA);
392 SwitchToThisWindow(hWindow, TRUE);
393 if (bAppwizMode)
395
396 if (hMutex)
398
399 return FALSE;
400 }
401 }
402 szWindowText.Empty();
403
404 CMainWindow wnd(&db, bAppwizMode);
405 MainWindowLoop(&wnd, nCmdShow);
406
407 if (hMutex)
409
410 return TRUE;
411 }
412
414 {
415 return HandleInstallCommand(&db, argv[1], argc - 2, argv + 2);
416 }
417 else if (MatchCmdOption(argv[1], CMD_KEY_SETUP))
418 {
419 return HandleSetupCommand(&db, argv[1], argc - 2, argv + 2);
420 }
422 {
423 return HandleUninstallCommand(db, argc - 2, argv + 2);
424 }
425 else if (MatchCmdOption(argv[1], CMD_KEY_GENINST))
426 {
427 return HandleGenerateInstallerCommand(db, argc - 2, argv + 2);
428 }
429
431
433 {
434 return HandleFindCommand(&db, argv[1], argc - 2, argv + 2);
435 }
436 else if (MatchCmdOption(argv[1], CMD_KEY_INFO))
437 {
438 return HandleInfoCommand(&db, argv[1], argc - 2, argv + 2);
439 }
441 {
443 return TRUE;
444 }
445 else
446 {
447 // unrecognized/invalid options
450 return FALSE;
451 }
452}
static int argc
Definition: ServiceArgs.c:12
#define StdOut
Definition: fc.c:14
void ConResPuts(FILE *fp, UINT nID)
Definition: fc.c:27
#define IDS_APPTITLE
Definition: resource.h:3
#define ID_ACTIVATE_APPWIZ
Definition: resource.h:89
#define IDS_CMD_INVALID_OPTION
Definition: resource.h:236
#define IDS_APPWIZ_TITLE
Definition: resource.h:97
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:21
Definition: appdb.h:9
static CStringW GetDefaultPath()
Definition: appdb.cpp:39
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define CloseHandle
Definition: compat.h:739
#define L(x)
Definition: resources.c:13
unsigned int BOOL
Definition: ntddk_ex.h:94
VOID MainWindowLoop(CMainWindow *wnd, INT nShowCmd)
Definition: gui.cpp:899
const TCHAR szWindowClass[]
Definition: magnifier.c:28
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
HANDLE hMutex
Definition: mutex.c:11
#define argv
Definition: mplay32.c:18
#define MAINWINDOWMUTEX
Definition: rapps.h:23
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:79
BOOL bUpdateAtStart
Definition: settings.h:8
VOID WINAPI DECLSPEC_HOTPATCH Sleep(IN DWORD dwMilliseconds)
Definition: synch.c:790
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576
rwlock_t lock
Definition: tcpcore.h:0
int32_t INT
Definition: typedefs.h:58
static BOOL HandleInfoCommand(CAppDB *db, LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:270
static BOOL HandleUninstallCommand(CAppDB &db, UINT argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:139
static BOOL MatchCmdOption(LPWSTR argvOption, LPCWSTR szOptToMacth)
Definition: unattended.cpp:16
static void InitRappsConsole()
Definition: unattended.cpp:31
static BOOL HandleFindCommand(CAppDB *db, LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:236
static VOID PrintHelpCommand()
Definition: unattended.cpp:338
static BOOL HandleInstallCommand(CAppDB *db, LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:63
static BOOL HandleGenerateInstallerCommand(CAppDB &db, UINT argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:215
static BOOL HandleSetupCommand(CAppDB *db, LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:94
#define CMD_KEY_INFO
Definition: unattended.h:9
#define CMD_KEY_INSTALL
Definition: unattended.h:6
#define CMD_KEY_SETUP
Definition: unattended.h:7
#define CMD_KEY_HELP
Definition: unattended.h:10
#define CMD_KEY_UNINSTALL
Definition: unattended.h:5
#define CMD_KEY_HELP_ALT
Definition: unattended.h:11
#define CMD_KEY_GENINST
Definition: unattended.h:4
#define CMD_KEY_APPWIZ
Definition: unattended.h:3
#define CMD_KEY_FIND
Definition: unattended.h:8
VOID WINAPI SwitchToThisWindow(HWND hwnd, BOOL fAltTab)
Definition: window.c:82
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WM_COMMAND
Definition: winuser.h:1768
#define SW_SHOWNA
Definition: winuser.h:789
#define PostMessage
Definition: winuser.h:5943
HWND WINAPI FindWindowW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR)
#define MAKEINTRESOURCEW(i)
Definition: winuser.h:582
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by wWinMain().

Variable Documentation

◆ UsageString

const WCHAR UsageString[]
Initial value:
= L"RAPPS \
[/" CMD_KEY_HELP L"] \
[/" CMD_KEY_INSTALL L" [/S] packagename] \
[/" CMD_KEY_UNINSTALL L" packagename|displayname] \
[/" CMD_KEY_SETUP L" [/S] filename] \
[/" CMD_KEY_FIND L" string] \
[/" CMD_KEY_INFO L" packagename]"

Definition at line 14 of file unattended.h.

Referenced by PrintHelpCommand().