mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 01:47:03 +00:00
[RAPPS] Automatically generate installer/uninstaller for downloaded zip/cab files (#6652)
With a single database line added to applications distributed as zip/cab allows rapps.exe to act as an installer that automatically extracts the files and creates a startmenu shortcut. It can also uninstall the extracted files (and optionally other files and registry entries created by the application).
This commit is contained in:
parent
ad8392602e
commit
57b775ef6e
43 changed files with 1638 additions and 137 deletions
|
@ -25,6 +25,20 @@ struct CSectionNames
|
|||
};
|
||||
static CSectionNames g_Names;
|
||||
|
||||
HRESULT
|
||||
ReadIniValue(LPCWSTR File, LPCWSTR Section, LPCWSTR Name, CStringW &Output)
|
||||
{
|
||||
for (DWORD len = 256, ret;; len *= 2)
|
||||
{
|
||||
ret = GetPrivateProfileString(Section, Name, L"\n", Output.GetBuffer(len), len, File);
|
||||
if (ret + 1 != len)
|
||||
{
|
||||
Output.ReleaseBuffer(ret);
|
||||
return ret && Output[0] != L'\n' ? ret : HRESULT_FROM_WIN32(ERROR_NOT_FOUND);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CConfigParser::CConfigParser(const CStringW &FilePath) : szConfigPath(FilePath)
|
||||
{
|
||||
CacheINI();
|
||||
|
@ -166,3 +180,42 @@ CConfigParser::GetInt(const CStringW &KeyName, INT &iResult)
|
|||
// we only care about values > 0
|
||||
return (iResult > 0);
|
||||
}
|
||||
|
||||
UINT
|
||||
CConfigParser::GetSectionString(LPCWSTR Section, LPCWSTR Name, CStringW &Result)
|
||||
{
|
||||
HRESULT hr; // Return value; length of ini string or 0 on failure.
|
||||
CStringW SecBuf;
|
||||
WCHAR FullLoc[5], *NeutralLoc = FullLoc + 2;
|
||||
GetLocaleInfoW(GetUserDefaultLCID(), LOCALE_ILANGUAGE, FullLoc, _countof(FullLoc));
|
||||
|
||||
SecBuf.Format(L"%s.%s.%s", Section, FullLoc, CurrentArchitecture);
|
||||
if ((hr = ReadIniValue(szConfigPath, SecBuf, Name, Result)) > 0)
|
||||
return hr;
|
||||
|
||||
if (*NeutralLoc)
|
||||
{
|
||||
SecBuf.Format(L"%s.%s.%s", Section, NeutralLoc, CurrentArchitecture);
|
||||
if ((hr = ReadIniValue(szConfigPath, SecBuf, Name, Result)) > 0)
|
||||
return hr;
|
||||
}
|
||||
|
||||
SecBuf.Format(L"%s.%s", Section, CurrentArchitecture);
|
||||
if ((hr = ReadIniValue(szConfigPath, SecBuf, Name, Result)) > 0)
|
||||
return hr;
|
||||
|
||||
SecBuf.Format(L"%s.%s", Section, FullLoc);
|
||||
if ((hr = ReadIniValue(szConfigPath, SecBuf, Name, Result)) > 0)
|
||||
return hr;
|
||||
|
||||
if (*NeutralLoc)
|
||||
{
|
||||
SecBuf.Format(L"%s.%s", Section, NeutralLoc);
|
||||
if ((hr = ReadIniValue(szConfigPath, SecBuf, Name, Result)) > 0)
|
||||
return hr;
|
||||
}
|
||||
|
||||
if ((hr = ReadIniValue(szConfigPath, Section, Name, Result)) > 0)
|
||||
return hr;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue