Skip to content

Commit 096c0aa

Browse files
committed
[WELCOME] Update the ExpandInstallerPath() information
Update its parameter names, SAL2 annotations, and Doxygen comment.
1 parent 064dd8f commit 096c0aa

1 file changed

Lines changed: 32 additions & 31 deletions

File tree

‎base/setup/welcome/welcome.c‎

Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -210,26 +210,27 @@ VOID TranslateEscapes(IN OUT LPTSTR lpString)
210210
}
211211
}
212212

213-
/*
213+
/**
214+
* @brief
214215
* Expands the path for the ReactOS Installer "reactos.exe".
215-
* See also base/system/userinit/userinit.c!ExpandInstallerPath()
216-
*/
217-
BOOL
216+
* See also base/system/userinit/livecd.c!ExpandInstallerPath()
217+
**/
218+
static BOOL
218219
ExpandInstallerPath(
219-
IN LPCTSTR lpInstallerName,
220-
OUT LPTSTR lpInstallerPath,
221-
IN SIZE_T PathSize)
220+
_In_ PCTSTR pInstallerName,
221+
_Out_writes_z_(PathSize) PTSTR pInstallerPath,
222+
_In_ SIZE_T PathSize)
222223
{
223224
SYSTEM_INFO SystemInfo;
224225
SIZE_T cchInstallerNameLen;
225226
PTSTR ptr;
226227
DWORD dwAttribs;
227228

228-
cchInstallerNameLen = _tcslen(lpInstallerName);
229+
cchInstallerNameLen = _tcslen(pInstallerName);
229230
if (PathSize < cchInstallerNameLen)
230231
{
231232
/* The buffer is not large enough to contain the installer file name */
232-
*lpInstallerPath = 0;
233+
*pInstallerPath = 0;
233234
return FALSE;
234235
}
235236

@@ -240,51 +241,51 @@ ExpandInstallerPath(
240241
*/
241242
GetSystemInfo(&SystemInfo);
242243

243-
*lpInstallerPath = 0;
244-
GetModuleFileName(NULL, lpInstallerPath, PathSize - cchInstallerNameLen - 1);
245-
ptr = _tcschr(lpInstallerPath, _T('\\'));
244+
*pInstallerPath = 0;
245+
GetModuleFileName(NULL, pInstallerPath, PathSize - cchInstallerNameLen - 1);
246+
ptr = _tcschr(pInstallerPath, _T('\\'));
246247
if (ptr)
247248
*++ptr = 0;
248249
else
249-
*lpInstallerPath = 0;
250+
*pInstallerPath = 0;
250251

251252
/* Append the corresponding CPU architecture */
252253
switch (SystemInfo.wProcessorArchitecture)
253254
{
254255
case PROCESSOR_ARCHITECTURE_INTEL:
255-
StringCchCat(lpInstallerPath, PathSize, TEXT("I386"));
256+
StringCchCat(pInstallerPath, PathSize, TEXT("I386"));
256257
break;
257258

258259
case PROCESSOR_ARCHITECTURE_MIPS:
259-
StringCchCat(lpInstallerPath, PathSize, TEXT("MIPS"));
260+
StringCchCat(pInstallerPath, PathSize, TEXT("MIPS"));
260261
break;
261262

262263
case PROCESSOR_ARCHITECTURE_ALPHA:
263-
StringCchCat(lpInstallerPath, PathSize, TEXT("ALPHA"));
264+
StringCchCat(pInstallerPath, PathSize, TEXT("ALPHA"));
264265
break;
265266

266267
case PROCESSOR_ARCHITECTURE_PPC:
267-
StringCchCat(lpInstallerPath, PathSize, TEXT("PPC"));
268+
StringCchCat(pInstallerPath, PathSize, TEXT("PPC"));
268269
break;
269270

270271
case PROCESSOR_ARCHITECTURE_SHX:
271-
StringCchCat(lpInstallerPath, PathSize, TEXT("SHX"));
272+
StringCchCat(pInstallerPath, PathSize, TEXT("SHX"));
272273
break;
273274

274275
case PROCESSOR_ARCHITECTURE_ARM:
275-
StringCchCat(lpInstallerPath, PathSize, TEXT("ARM"));
276+
StringCchCat(pInstallerPath, PathSize, TEXT("ARM"));
276277
break;
277278

278279
case PROCESSOR_ARCHITECTURE_IA64:
279-
StringCchCat(lpInstallerPath, PathSize, TEXT("IA64"));
280+
StringCchCat(pInstallerPath, PathSize, TEXT("IA64"));
280281
break;
281282

282283
case PROCESSOR_ARCHITECTURE_ALPHA64:
283-
StringCchCat(lpInstallerPath, PathSize, TEXT("ALPHA64"));
284+
StringCchCat(pInstallerPath, PathSize, TEXT("ALPHA64"));
284285
break;
285286

286287
case PROCESSOR_ARCHITECTURE_AMD64:
287-
StringCchCat(lpInstallerPath, PathSize, TEXT("AMD64"));
288+
StringCchCat(pInstallerPath, PathSize, TEXT("AMD64"));
288289
break;
289290

290291
// case PROCESSOR_ARCHITECTURE_MSIL: /* .NET CPU-independent code */
@@ -295,10 +296,10 @@ ExpandInstallerPath(
295296
}
296297

297298
if (SystemInfo.wProcessorArchitecture != PROCESSOR_ARCHITECTURE_UNKNOWN)
298-
StringCchCat(lpInstallerPath, PathSize, TEXT("\\"));
299-
StringCchCat(lpInstallerPath, PathSize, lpInstallerName);
299+
StringCchCat(pInstallerPath, PathSize, TEXT("\\"));
300+
StringCchCat(pInstallerPath, PathSize, pInstallerName);
300301

301-
dwAttribs = GetFileAttributes(lpInstallerPath);
302+
dwAttribs = GetFileAttributes(pInstallerPath);
302303
if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
303304
!(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
304305
{
@@ -310,12 +311,12 @@ ExpandInstallerPath(
310311
* We failed. Try to find the installer from either the current
311312
* ReactOS installation directory, or from our current directory.
312313
*/
313-
*lpInstallerPath = 0;
314-
if (GetWindowsDirectory(lpInstallerPath, PathSize - cchInstallerNameLen - 1))
315-
StringCchCat(lpInstallerPath, PathSize, TEXT("\\"));
316-
StringCchCat(lpInstallerPath, PathSize, lpInstallerName);
314+
*pInstallerPath = 0;
315+
if (GetWindowsDirectory(pInstallerPath, PathSize - cchInstallerNameLen - 1))
316+
StringCchCat(pInstallerPath, PathSize, TEXT("\\"));
317+
StringCchCat(pInstallerPath, PathSize, pInstallerName);
317318

318-
dwAttribs = GetFileAttributes(lpInstallerPath);
319+
dwAttribs = GetFileAttributes(pInstallerPath);
319320
if ((dwAttribs != INVALID_FILE_ATTRIBUTES) &&
320321
!(dwAttribs & FILE_ATTRIBUTE_DIRECTORY))
321322
{
@@ -324,7 +325,7 @@ ExpandInstallerPath(
324325
}
325326

326327
/* Installer not found */
327-
*lpInstallerPath = 0;
328+
*pInstallerPath = 0;
328329
return FALSE;
329330
}
330331

0 commit comments

Comments
 (0)