ReactOS  0.4.15-dev-985-gd905dd5
unattended.cpp File Reference
#include "rapps.h"
#include "unattended.h"
#include "winmain.h"
#include <setupapi.h>
#include <conutils.h>
Include dependency graph for unattended.cpp:

Go to the source code of this file.

Functions

BOOL MatchCmdOption (LPWSTR argvOption, LPCWSTR szOptToMacth)
 
BOOL HandleInstallCommand (LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
 
BOOL HandleSetupCommand (LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
 
BOOL CALLBACK CmdFindAppEnum (CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param)
 
BOOL HandleFindCommand (LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
 
BOOL HandleInfoCommand (LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
 
BOOL HandleHelpCommand (LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
 
BOOL ParseCmdAndExecute (LPWSTR lpCmdLine, BOOL bIsFirstLaunch, int nCmdShow)
 

Function Documentation

◆ CmdFindAppEnum()

BOOL CALLBACK CmdFindAppEnum ( CAvailableApplicationInfo Info,
BOOL  bInitialCheckState,
PVOID  param 
)

Definition at line 119 of file unattended.cpp.

120 {
121  LPCWSTR lpszSearch = (LPCWSTR)param;
122  if (!SearchPatternMatch(Info->m_szName.GetString(), lpszSearch) &&
123  !SearchPatternMatch(Info->m_szDesc.GetString(), lpszSearch))
124  {
125  return TRUE;
126  }
127 
128  ConPrintf(StdOut, (LPWSTR)L"%s (%s)\n", (LPCWSTR)(Info->m_szName), (LPCWSTR)(Info->m_szPkgName));
129  return TRUE;
130 }
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
struct TraceInfo Info
BOOL SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle)
Definition: misc.cpp:526
GLfloat param
Definition: glext.h:5796
static const WCHAR L[]
Definition: oid.c:1250
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN PCWSTR szStr,...)
Definition: outstream.c:520
HRESULT GetString(REFGUID guidKey, [out, size_is(cchBufSize)] LPWSTR pwszValue, UINT32 cchBufSize, [in, out, ptr] UINT32 *pcchLength)
#define StdOut
Definition: stream.h:82
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by HandleFindCommand().

◆ HandleFindCommand()

BOOL HandleFindCommand ( LPWSTR  szCommand,
int  argcLeft,
LPWSTR argvLeft 
)

Definition at line 132 of file unattended.cpp.

133 {
134  if (argcLeft < 1)
135  {
137  return FALSE;
138  }
139 
140  CAvailableApps apps;
141  apps.UpdateAppsDB();
142 
143  for (int i = 0; i < argcLeft; i++)
144  {
146  apps.Enum(ENUM_ALL_AVAILABLE, CmdFindAppEnum, argvLeft[i]);
147  ConPrintf(StdOut, (LPWSTR)L"\n");
148  }
149 
150  return TRUE;
151 }
#define IDS_CMD_FIND_RESULT_FOR
Definition: resource.h:227
#define TRUE
Definition: types.h:120
static BOOL UpdateAppsDB()
Definition: available.cpp:369
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
#define IDS_CMD_NEED_PARAMS
Definition: resource.h:225
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param)
Definition: available.cpp:408
static const WCHAR L[]
Definition: oid.c:1250
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN PCWSTR szStr,...)
Definition: outstream.c:520
BOOL CALLBACK CmdFindAppEnum(CAvailableApplicationInfo *Info, BOOL bInitialCheckState, PVOID param)
Definition: unattended.cpp:119
#define StdOut
Definition: stream.h:82
WCHAR * LPWSTR
Definition: xmlstorage.h:184
INT __cdecl ConResMsgPrintf(IN PCON_STREAM Stream, IN DWORD dwFlags, IN UINT uID,...)
Definition: outstream.c:1461

Referenced by ParseCmdAndExecute().

◆ HandleHelpCommand()

BOOL HandleHelpCommand ( LPWSTR  szCommand,
int  argcLeft,
LPWSTR argvLeft 
)

Definition at line 224 of file unattended.cpp.

225 {
226  if (argcLeft != 0)
227  {
228  return FALSE;
229  }
230 
231  ConPrintf(StdOut, (LPWSTR)L"\n");
233  ConPrintf(StdOut, (LPWSTR)L"\n\n");
234 
236  ConPrintf(StdOut, (LPWSTR)L"%ls\n", UsageString);
237  return TRUE;
238 }
const WCHAR UsageString[]
Definition: unattended.h:9
#define IDS_APPTITLE
Definition: resource.h:3
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static const WCHAR L[]
Definition: oid.c:1250
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN PCWSTR szStr,...)
Definition: outstream.c:520
#define IDS_CMD_USAGE
Definition: resource.h:222
#define StdOut
Definition: stream.h:82
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by ParseCmdAndExecute().

◆ HandleInfoCommand()

BOOL HandleInfoCommand ( LPWSTR  szCommand,
int  argcLeft,
LPWSTR argvLeft 
)

Definition at line 153 of file unattended.cpp.

154 {
155  if (argcLeft < 1)
156  {
158  return FALSE;
159  }
160 
161  CAvailableApps apps;
162  apps.UpdateAppsDB();
164 
165  for (int i = 0; i < argcLeft; i++)
166  {
167  CAvailableApplicationInfo *AppInfo = apps.FindAppByPkgName(argvLeft[i]);
168  if (!AppInfo)
169  {
171  }
172  else
173  {
175  // TODO: code about extracting information from CAvailableApplicationInfo (in appview.cpp, class CAppRichEdit)
176  // is in a mess. It should be refactored, and should not placed in class CAppRichEdit.
177  // and the code here should reused that code after refactor.
178 
179  ConPuts(StdOut, (LPWSTR)(LPCWSTR)AppInfo->m_szName);
180 
181  if (AppInfo->m_szVersion)
182  {
184  ConPuts(StdOut, (LPWSTR)(LPCWSTR)AppInfo->m_szVersion);
185  }
186 
187  if (AppInfo->m_szLicense)
188  {
190  ConPuts(StdOut, (LPWSTR)(LPCWSTR)AppInfo->m_szLicense);
191  }
192 
193  if (AppInfo->m_szSize)
194  {
196  ConPuts(StdOut, (LPWSTR)(LPCWSTR)AppInfo->m_szSize);
197  }
198 
199  if (AppInfo->m_szUrlSite)
200  {
202  ConPuts(StdOut, (LPWSTR)(LPCWSTR)AppInfo->m_szUrlSite);
203  }
204 
205  if (AppInfo->m_szDesc)
206  {
208  ConPuts(StdOut, (LPWSTR)(LPCWSTR)AppInfo->m_szDesc);
209  }
210 
211  if (AppInfo->m_szUrlDownload)
212  {
215  }
216 
217  ConPrintf(StdOut, (LPWSTR)L"\n");
218  }
219  ConPrintf(StdOut, (LPWSTR)L"\n");
220  }
221  return TRUE;
222 }
#define IDS_AINFO_VERSION
Definition: resource.h:161
ATL::CStringW m_szLicense
Definition: available.h:49
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define TRUE
Definition: types.h:120
#define IDS_CMD_PACKAGE_INFO
Definition: resource.h:229
#define IDS_AINFO_LICENSE
Definition: resource.h:165
#define IDS_AINFO_URLSITE
Definition: resource.h:164
INT ConPuts(IN PCON_STREAM Stream, IN PCWSTR szStr)
Definition: outstream.c:427
ATL::CStringW m_szUrlSite
Definition: available.h:52
CAvailableApplicationInfo * FindAppByPkgName(const ATL::CStringW &szPkgName) const
Definition: available.cpp:533
static BOOL UpdateAppsDB()
Definition: available.cpp:369
ATL::CStringW m_szDesc
Definition: available.h:50
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
ATL::CStringW m_szUrlDownload
Definition: available.h:53
ATL::CStringW m_szSize
Definition: available.h:51
smooth NULL
Definition: ftsmooth.c:416
#define IDS_CMD_NEED_PARAMS
Definition: resource.h:225
INT __cdecl ConResPrintf(IN PCON_STREAM Stream, IN UINT uID,...)
Definition: outstream.c:781
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param)
Definition: available.cpp:408
ATL::CStringW m_szVersion
Definition: available.h:48
static const WCHAR L[]
Definition: oid.c:1250
INT __cdecl ConPrintf(IN PCON_STREAM Stream, IN PCWSTR szStr,...)
Definition: outstream.c:520
ATL::CStringW m_szName
Definition: available.h:46
#define IDS_AINFO_SIZE
Definition: resource.h:163
#define IDS_AINFO_URLDOWNLOAD
Definition: resource.h:166
#define StdOut
Definition: stream.h:82
#define IDS_CMD_PACKAGE_NOT_FOUND
Definition: resource.h:228
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define IDS_AINFO_DESCRIPTION
Definition: resource.h:162
INT __cdecl ConResMsgPrintf(IN PCON_STREAM Stream, IN DWORD dwFlags, IN UINT uID,...)
Definition: outstream.c:1461

Referenced by ParseCmdAndExecute().

◆ HandleInstallCommand()

BOOL HandleInstallCommand ( LPWSTR  szCommand,
int  argcLeft,
LPWSTR argvLeft 
)

Definition at line 39 of file unattended.cpp.

40 {
41  if (argcLeft == 0)
42  {
43  ConInitStdStreams(); // Initialize the Console Standard Streams
45  return FALSE;
46  }
47  FreeConsole();
48 
50 
51  for (int i = 0; i < argcLeft; i++)
52  {
53  PkgNameList.Add(argvLeft[i]);
54  }
55 
56  CAvailableApps apps;
57  apps.UpdateAppsDB();
59 
61  if (arrAppInfo.GetSize() > 0)
62  {
63  DownloadListOfApplications(arrAppInfo, TRUE);
64  return TRUE;
65  }
66  else
67  {
68  return FALSE;
69  }
70 }
BOOL Add(const T &t)
Definition: atlsimpcoll.h:58
#define TRUE
Definition: types.h:120
static BOOL UpdateAppsDB()
Definition: available.cpp:369
int GetSize() const
Definition: atlsimpcoll.h:104
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define ConInitStdStreams()
Definition: stream.h:128
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
ATL::CSimpleArray< CAvailableApplicationInfo > FindAppsByPkgNameList(const ATL::CSimpleArray< ATL::CStringW > &arrAppsNames) const
Definition: available.cpp:554
BOOL WINAPI FreeConsole(VOID)
Definition: console.c:153
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param)
Definition: available.cpp:408
#define IDS_CMD_NEED_PACKAGE_NAME
Definition: resource.h:223
BOOL DownloadListOfApplications(const ATL::CSimpleArray< CAvailableApplicationInfo > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:976
#define StdOut
Definition: stream.h:82
INT __cdecl ConResMsgPrintf(IN PCON_STREAM Stream, IN DWORD dwFlags, IN UINT uID,...)
Definition: outstream.c:1461

Referenced by ParseCmdAndExecute().

◆ HandleSetupCommand()

BOOL HandleSetupCommand ( LPWSTR  szCommand,
int  argcLeft,
LPWSTR argvLeft 
)

Definition at line 72 of file unattended.cpp.

73 {
74  if (argcLeft != 1)
75  {
76  ConInitStdStreams(); // Initialize the Console Standard Streams
78  return FALSE;
79  }
80  FreeConsole();
81 
83  HINF InfHandle = SetupOpenInfFileW(argvLeft[0], NULL, INF_STYLE_WIN4, NULL);
84  if (InfHandle == INVALID_HANDLE_VALUE)
85  {
86  return FALSE;
87  }
88 
90  if (SetupFindFirstLineW(InfHandle, L"RAPPS", L"Install", &Context))
91  {
92  WCHAR szPkgName[MAX_PATH];
93  do
94  {
95  if (SetupGetStringFieldW(&Context, 1, szPkgName, _countof(szPkgName), NULL))
96  {
97  PkgNameList.Add(szPkgName);
98  }
99  } while (SetupFindNextLine(&Context, &Context));
100  }
101  SetupCloseInfFile(InfHandle);
102 
103  CAvailableApps apps;
104  apps.UpdateAppsDB();
106 
108  if (arrAppInfo.GetSize() > 0)
109  {
110  DownloadListOfApplications(arrAppInfo, TRUE);
111  return TRUE;
112  }
113  else
114  {
115  return FALSE;
116  }
117 }
BOOL WINAPI SetupFindFirstLineW(IN HINF InfHandle, IN PCWSTR Section, IN PCWSTR Key, IN OUT PINFCONTEXT Context)
Definition: infsupp.c:54
BOOL Add(const T &t)
Definition: atlsimpcoll.h:58
#define INF_STYLE_WIN4
Definition: infsupp.h:41
#define TRUE
Definition: types.h:120
#define INVALID_HANDLE_VALUE
Definition: compat.h:479
HINF WINAPI SetupOpenInfFileW(PCWSTR name, PCWSTR class, DWORD style, UINT *error)
Definition: parser.c:1229
static BOOL UpdateAppsDB()
Definition: available.cpp:369
int GetSize() const
Definition: atlsimpcoll.h:104
VOID WINAPI SetupCloseInfFile(IN HINF InfHandle)
Definition: infsupp.c:43
#define ConInitStdStreams()
Definition: stream.h:128
#define FALSE
Definition: types.h:117
smooth NULL
Definition: ftsmooth.c:416
ATL::CSimpleArray< CAvailableApplicationInfo > FindAppsByPkgNameList(const ATL::CSimpleArray< ATL::CStringW > &arrAppsNames) const
Definition: available.cpp:554
BOOL WINAPI FreeConsole(VOID)
Definition: console.c:153
BOOL Enum(INT EnumType, AVAILENUMPROC lpEnumProc, PVOID param)
Definition: available.cpp:408
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
#define MAX_PATH
Definition: compat.h:34
#define IDS_CMD_NEED_FILE_NAME
Definition: resource.h:224
static const WCHAR L[]
Definition: oid.c:1250
BOOL WINAPI SetupFindNextLine(IN PINFCONTEXT ContextIn, OUT PINFCONTEXT ContextOut)
Definition: infsupp.c:80
BOOL DownloadListOfApplications(const ATL::CSimpleArray< CAvailableApplicationInfo > &AppsList, BOOL bIsModal)
Definition: loaddlg.cpp:976
#define StdOut
Definition: stream.h:82
struct tagContext Context
Definition: acpixf.h:1034
INT __cdecl ConResMsgPrintf(IN PCON_STREAM Stream, IN DWORD dwFlags, IN UINT uID,...)
Definition: outstream.c:1461
BOOL WINAPI SetupGetStringFieldW(IN PINFCONTEXT Context, IN ULONG FieldIndex, OUT PWSTR ReturnBuffer, IN ULONG ReturnBufferSize, OUT PULONG RequiredSize)
Definition: infsupp.c:184

Referenced by ParseCmdAndExecute().

◆ MatchCmdOption()

BOOL MatchCmdOption ( LPWSTR  argvOption,
LPCWSTR  szOptToMacth 
)

Definition at line 18 of file unattended.cpp.

19 {
20  WCHAR FirstCharList[] = { L'-', L'/' };
21 
22  for (UINT i = 0; i < _countof(FirstCharList); i++)
23  {
24  if (argvOption[0] == FirstCharList[i])
25  {
26  if (StrCmpIW(argvOption + 1, szOptToMacth) == 0)
27  {
28  return TRUE;
29  }
30  else
31  {
32  return FALSE;
33  }
34  }
35  }
36  return FALSE;
37 }
#define TRUE
Definition: types.h:120
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FALSE
Definition: types.h:117
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define _countof(array)
Definition: sndvol32.h:68
static const WCHAR L[]
Definition: oid.c:1250
unsigned int UINT
Definition: ndis.h:50
int WINAPI StrCmpIW(LPCWSTR lpszStr, LPCWSTR lpszComp)
Definition: string.c:353

Referenced by ParseCmdAndExecute().

◆ ParseCmdAndExecute()

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

Definition at line 240 of file unattended.cpp.

241 {
242  INT argc;
243  LPWSTR *argv = CommandLineToArgvW(lpCmdLine, &argc);
244 
245  if (!argv)
246  {
247  return FALSE;
248  }
249 
250  if (argc == 1) // RAPPS is launched without options
251  {
252  // Close the console, and open MainWindow
253  FreeConsole();
254 
255 
256  // Check for if rapps MainWindow is already launched in another process
257  HANDLE hMutex;
258 
260  if ((!hMutex) || (GetLastError() == ERROR_ALREADY_EXISTS))
261  {
262  /* If already started, it is found its window */
263  HWND hWindow = FindWindowW(szWindowClass, NULL);
264 
265  /* Activate window */
266  ShowWindow(hWindow, SW_SHOWNORMAL);
267  SetForegroundWindow(hWindow);
268  return FALSE;
269  }
270 
271  if (SettingsInfo.bUpdateAtStart || bIsFirstLaunch)
273 
274  MainWindowLoop(nCmdShow);
275 
276  if (hMutex)
278 
279  return TRUE;
280  }
281  else if (MatchCmdOption(argv[1], CMD_KEY_INSTALL))
282  {
283  return HandleInstallCommand(argv[1], argc - 2, argv + 2);
284  }
285  else if (MatchCmdOption(argv[1], CMD_KEY_SETUP))
286  {
287  return HandleSetupCommand(argv[1], argc - 2, argv + 2);
288  }
289 
290 
291  ConInitStdStreams(); // Initialize the Console Standard Streams
292 
294  {
295  return HandleFindCommand(argv[1], argc - 2, argv + 2);
296  }
297  else if (MatchCmdOption(argv[1], CMD_KEY_INFO))
298  {
299  return HandleInfoCommand(argv[1], argc - 2, argv + 2);
300  }
301  else if (MatchCmdOption(argv[1], CMD_KEY_HELP))
302  {
303  return HandleHelpCommand(argv[1], argc - 2, argv + 2);
304  }
305  else
306  {
307  // unrecognized/invalid options
309  return FALSE;
310  }
311 }
BOOL HandleInfoCommand(LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:153
BOOL bUpdateAtStart
Definition: settings.h:8
static int argc
Definition: ServiceArgs.c:12
#define CloseHandle
Definition: compat.h:487
#define CMD_KEY_INFO
Definition: unattended.h:6
#define CMD_KEY_SETUP
Definition: unattended.h:4
#define TRUE
Definition: types.h:120
#define CMD_KEY_INSTALL
Definition: unattended.h:3
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define IDS_CMD_INVALID_OPTION
Definition: resource.h:226
#define argv
Definition: mplay32.c:18
#define CMD_KEY_HELP
Definition: unattended.h:7
int32_t INT
Definition: typedefs.h:58
VOID MainWindowLoop(INT nShowCmd)
Definition: gui.cpp:862
const TCHAR szWindowClass[]
Definition: magnifier.c:28
#define ConInitStdStreams()
Definition: stream.h:128
#define FALSE
Definition: types.h:117
LPWSTR *WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int *numargs)
Definition: shell32_main.c:79
smooth NULL
Definition: ftsmooth.c:416
BOOL HandleSetupCommand(LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:72
HANDLE hMutex
Definition: mutex.c:11
#define CMD_KEY_FIND
Definition: unattended.h:5
BOOL WINAPI FreeConsole(VOID)
Definition: console.c:153
SETTINGS_INFO SettingsInfo
Definition: winmain.cpp:25
HWND WINAPI FindWindowW(_In_opt_ LPCWSTR, _In_opt_ LPCWSTR)
BOOL MatchCmdOption(LPWSTR argvOption, LPCWSTR szOptToMacth)
Definition: unattended.cpp:18
BOOL HandleHelpCommand(LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:224
BOOL HandleInstallCommand(LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:39
INT ConResPuts(IN PCON_STREAM Stream, IN UINT uID)
Definition: outstream.c:610
static BOOL ForceUpdateAppsDB()
Definition: available.cpp:402
#define SW_SHOWNORMAL
Definition: winuser.h:764
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW(IN LPSECURITY_ATTRIBUTES lpMutexAttributes OPTIONAL, IN BOOL bInitialOwner, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:576
#define StdOut
Definition: stream.h:82
BOOL WINAPI SetForegroundWindow(_In_ HWND)
BOOL HandleFindCommand(LPWSTR szCommand, int argcLeft, LPWSTR *argvLeft)
Definition: unattended.cpp:132
#define ERROR_ALREADY_EXISTS
Definition: disk.h:80
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by wmain().