mirror of
https://github.com/reactos/reactos.git
synced 2025-01-05 22:12:46 +00:00
57b775ef6e
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).
117 lines
3 KiB
C++
117 lines
3 KiB
C++
#pragma once
|
|
|
|
#include <atlstr.h>
|
|
|
|
#ifdef _M_IX86
|
|
#define CurrentArchitecture L"x86"
|
|
#elif defined(_M_AMD64)
|
|
#define CurrentArchitecture L"amd64"
|
|
#elif defined(_M_ARM)
|
|
#define CurrentArchitecture L"arm"
|
|
#elif defined(_M_ARM64)
|
|
#define CurrentArchitecture L"arm64"
|
|
#elif defined(_M_IA64)
|
|
#define CurrentArchitecture L"ia64"
|
|
#elif defined(_M_PPC)
|
|
#define CurrentArchitecture L"ppc"
|
|
#endif
|
|
|
|
static inline UINT
|
|
ErrorFromHResult(HRESULT hr)
|
|
{
|
|
// Attempt to extract the original Win32 error code from the HRESULT
|
|
if (HIWORD(hr) == HIWORD(HRESULT_FROM_WIN32(!0)))
|
|
return LOWORD(hr);
|
|
else
|
|
return hr >= 0 ? ERROR_SUCCESS : hr;
|
|
}
|
|
|
|
VOID
|
|
CopyTextToClipboard(LPCWSTR lpszText);
|
|
VOID
|
|
ShowPopupMenuEx(HWND hwnd, HWND hwndOwner, UINT MenuID, UINT DefaultItem);
|
|
BOOL
|
|
StartProcess(const CStringW &Path, BOOL Wait);
|
|
BOOL
|
|
GetStorageDirectory(CStringW &lpDirectory);
|
|
|
|
VOID
|
|
InitLogs();
|
|
VOID
|
|
FreeLogs();
|
|
BOOL
|
|
WriteLogMessage(WORD wType, DWORD dwEventID, LPCWSTR lpMsg);
|
|
BOOL
|
|
GetInstalledVersion(CStringW *pszVersion, const CStringW &szRegName);
|
|
|
|
typedef struct
|
|
{
|
|
const CStringW &ItemPath;
|
|
UINT64 UncompressedSize;
|
|
UINT FileAttributes;
|
|
} EXTRACTCALLBACKINFO;
|
|
typedef BOOL (CALLBACK*EXTRACTCALLBACK)(const EXTRACTCALLBACKINFO &Info, void *Cookie);
|
|
|
|
static inline BOOL
|
|
NotifyFileExtractCallback(const CStringW &ItemPath, UINT64 UncompressedSize, UINT FileAttributes,
|
|
EXTRACTCALLBACK Callback, void *Cookie)
|
|
{
|
|
EXTRACTCALLBACKINFO eci = { ItemPath, UncompressedSize, FileAttributes };
|
|
return Callback ? Callback(eci, Cookie) : TRUE;
|
|
}
|
|
|
|
BOOL
|
|
ExtractFilesFromCab(const CStringW &szCabName, const CStringW &szCabDir, const CStringW &szOutputDir,
|
|
EXTRACTCALLBACK Callback = NULL, void *Cookie = NULL);
|
|
BOOL
|
|
ExtractFilesFromCab(LPCWSTR FullCabPath, const CStringW &szOutputDir,
|
|
EXTRACTCALLBACK Callback = NULL, void *Cookie = NULL);
|
|
|
|
BOOL
|
|
IsSystem64Bit();
|
|
|
|
INT
|
|
GetSystemColorDepth();
|
|
|
|
void
|
|
UnixTimeToFileTime(DWORD dwUnixTime, LPFILETIME pFileTime);
|
|
|
|
BOOL
|
|
SearchPatternMatch(LPCWSTR szHaystack, LPCWSTR szNeedle);
|
|
|
|
HRESULT
|
|
RegKeyHasValues(HKEY hKey, LPCWSTR Path, REGSAM wowsam = 0);
|
|
LPCWSTR
|
|
GetRegString(CRegKey &Key, LPCWSTR Name, CStringW &Value);
|
|
|
|
bool
|
|
ExpandEnvStrings(CStringW &Str);
|
|
|
|
template <class T> static CStringW
|
|
BuildPath(const T &Base, LPCWSTR Append)
|
|
{
|
|
CStringW path = Base;
|
|
SIZE_T len = path.GetLength();
|
|
if (len && path[len - 1] != L'\\' && path[len - 1] != L'/')
|
|
path += L'\\';
|
|
while (*Append == L'\\' || *Append == L'/')
|
|
++Append;
|
|
return path + Append;
|
|
}
|
|
|
|
CStringW
|
|
SplitFileAndDirectory(LPCWSTR FullPath, CStringW *pDir = NULL);
|
|
BOOL
|
|
DeleteDirectoryTree(LPCWSTR Dir, HWND hwnd = NULL);
|
|
UINT
|
|
CreateDirectoryTree(LPCWSTR Dir);
|
|
HRESULT
|
|
GetSpecialPath(UINT csidl, CStringW &Path, HWND hwnd = NULL);
|
|
HRESULT
|
|
GetKnownPath(REFKNOWNFOLDERID kfid, CStringW &Path, DWORD Flags = KF_FLAG_CREATE);
|
|
HRESULT
|
|
GetProgramFilesPath(CStringW &Path, BOOL PerUser, HWND hwnd = NULL);
|
|
|
|
template <class T> class CLocalPtr : public CHeapPtr<T, CLocalAllocator>
|
|
{
|
|
};
|