29#define REGPATH_UNINSTALL L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
32#define DB_GENINST_FILES L"Files"
33#define DB_GENINST_DIR L"Dir"
34#define DB_GENINST_ICON L"Icon"
35#define DB_GENINST_LNK L"Lnk"
36#define DB_GENINST_DELFILE L"DelFile"
37#define DB_GENINST_DELDIR L"DelDir"
38#define DB_GENINST_DELDIREMPTY L"DelDirEmpty"
39#define DB_GENINST_DELREG L"DelReg"
40#define DB_GENINST_DELREGEMPTY L"DelRegEmpty"
65 const UINT pkzefsutf8 = 1 << 11;
86 while (narrow[0] ==
'\\')
87 narrow = narrow.
Mid(1);
251 Path.ReleaseBuffer();
320 hr =
link.CoCreateInstance(CLSID_ShellLink, IID_IShellLinkW);
326 link->SetWorkingDirectory(tmp);
363 sourcedir =
BuildPath(SourceDirBase, sourcedir);
384 BOOL dots =
p[0] ==
'.' && (!
p[1] || (
p[1] ==
'.' && !
p[2]));
405 if (
Info.MainApp.IsEmpty())
431 for (
int pos = 1;
pos > 0;)
452 const BOOL PerUserModeDefault =
TRUE;
455 CStringW installdir, tempdir, files, shortcut, tmp;
458 Info.ArpKey = &arpkey;
469 Info.PerUser = PerUserModeDefault;
524 files = files.
Mid(
pos + 1);
528 if (!
Info.MainApp.IsEmpty())
545 WCHAR modechar =
Info.PerUser ?
'U' :
'M';
547 (tmp = tmp.
Mid(0,
cch)).AppendFormat(unparamsfmt,
L"", modechar, bitness, arpkeyname);
549 (tmp = tmp.
Mid(0,
cch)).AppendFormat(unparamsfmt,
L" /S", modechar, bitness, arpkeyname);
568 tmp.Format(
L"sys64=%d rapps%d",
IsSystem64Bit(),
sizeof(
void*) * 8);
573 if (!
Info.Error &&
Info.ShortcutFile)
648 enum { DLGW = 150, DLGH = 20,
PAD = 4, PADx2 =
PAD * 2, CHILDCOUNT = 1 };
650 static const WORD DlgTmpl[] =
652 LOWORD(DlgStyle),
HIWORD(DlgStyle), 0, 0, CHILDCOUNT, 0, 0, DLGW, DLGH, 0, 0, 0,
654 'm',
's',
'c',
't',
'l',
's',
'_',
'p',
'r',
'o',
'g',
'r',
'e',
's',
's',
'3',
'2', 0, 0,
721 RegQueryInfoKey(
Info.Entries,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL, &
Info.Count,
NULL,
NULL,
NULL,
NULL);
755 if (
path.CompareNoCase(
L"HKCR") == 0)
757 else if (
path.CompareNoCase(
L"HKCU") == 0)
759 else if (
path.CompareNoCase(
L"HKLM") == 0)
762 if (
data[4] ==
'6' &&
data[5] ==
'4')
764 else if (
data[4] ==
'3' &&
data[5] ==
'2')
778 err =
key.RecurseDeleteKey(tmp);
780 key.DeleteSubKey(tmp);
858 TempDir =
BuildPath(TempDirBuf, UniqueDir);
PRTL_UNICODE_STRING_BUFFER Path
DWORD WINAPI ThreadProc(LPVOID lpParam)
#define GENERATE_ARPSUBKEY
#define DB_EXEINZIPSECTION
#define DB_GENINSTSECTION
BOOL(CALLBACK * EXTRACTCALLBACK)(const EXTRACTCALLBACKINFO &Info, void *Cookie)
bool ExpandEnvStrings(CStringW &Str)
HRESULT GetSpecialPath(UINT csidl, CStringW &Path, HWND hwnd=NULL)
static CStringW BuildPath(const T &Base, LPCWSTR Append)
BOOL DeleteDirectoryTree(LPCWSTR Dir, HWND hwnd=NULL)
UINT ClassifyFile(PCWSTR Path)
UINT CreateDirectoryTree(LPCWSTR Dir)
static BOOL NotifyFileExtractCallback(const CStringW &ItemPath, UINT64 UncompressedSize, UINT FileAttributes, EXTRACTCALLBACK Callback, void *Cookie)
HRESULT RegKeyHasValues(HKEY hKey, LPCWSTR Path, REGSAM wowsam=0)
static UINT ErrorFromHResult(HRESULT hr)
LPCWSTR GetRegString(CRegKey &Key, LPCWSTR Name, CStringW &Value)
HRESULT GetProgramFilesPath(CStringW &Path, BOOL PerUser, HWND hwnd=NULL)
CStringW SplitFileAndDirectory(LPCWSTR FullPath, CStringW *pDir=NULL)
#define IDS_INSTGEN_CONFIRMUNINST
#define IDS_INSTGEN_CONFIRMINSTRUNAPP
BOOL ExtractFilesFromCab(const CStringW &szCabName, const CStringW &szCabDir, const CStringW &szOutputDir, EXTRACTCALLBACK Callback, void *Cookie)
LONG Create(HKEY hKeyParent, LPCTSTR lpszKeyName, LPTSTR lpszClass=REG_NONE, DWORD dwOptions=REG_OPTION_NON_VOLATILE, REGSAM samDesired=KEY_READ|KEY_WRITE, LPSECURITY_ATTRIBUTES lpSecAttr=NULL, LPDWORD lpdwDisposition=NULL) noexcept
LONG RecurseDeleteKey(LPCTSTR lpszKey) noexcept
bool IsEmpty() const noexcept
int GetAllocLength() const noexcept
void ReleaseBuffer(_In_ int nNewLength=-1)
PXSTR GetString() noexcept
int GetLength() const noexcept
int CompareNoCase(_In_z_ PCXSTR psz) const
int Replace(PCXSTR pszOld, PCXSTR pszNew)
CStringT Left(int nCount) const
void __cdecl Format(UINT nFormatID,...)
int Compare(_In_z_ PCXSTR psz) const
int Find(_In_ PCXSTR pszSub, _In_opt_ int iStart=0) const noexcept
CStringT Mid(int iFirst, int nCount) const
static DWORD RemoveInstalledAppFromRegistry(const CAppInfo *Info)
CAvailableApplicationInfo * FindAvailableByPackageName(const CStringW &name)
static CStringW GetDefaultPath()
CConfigParser * GetConfigParser() const
BOOL GetString(const CStringW &KeyName, CStringW &ResultString)
UINT GetSectionString(LPCWSTR Section, LPCWSTR Name, CStringW &Result)
HRESULT ReadIniValue(LPCWSTR File, LPCWSTR Section, LPCWSTR Name, CStringW &Output)
static CHAR AppName[MAX_PATH]
#define INVALID_HANDLE_VALUE
#define ERROR_NO_MORE_ITEMS
#define FILE_ATTRIBUTE_NORMAL
#define MultiByteToWideChar
#define ERROR_INVALID_NAME
DWORD WINAPI GetFileAttributesW(LPCWSTR lpFileName)
HANDLE WINAPI FindFirstFileW(IN LPCWSTR lpFileName, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI FindClose(HANDLE hFindFile)
BOOL WINAPI FindNextFileW(IN HANDLE hFindFile, OUT LPWIN32_FIND_DATAW lpFindFileData)
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
UINT WINAPI GetWindowsDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
VOID WINAPI GetSystemTime(OUT LPSYSTEMTIME lpSystemTime)
LCID WINAPI GetUserDefaultLCID(void)
INT WINAPI GetLocaleInfoW(LCID lcid, LCTYPE lctype, LPWSTR buffer, INT len)
BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE pfnThreadProc, VOID *pData, DWORD dwFlags, LPTHREAD_START_ROUTINE pfnCallback)
#define MOVEFILE_REPLACE_EXISTING
#define MOVEFILE_COPY_ALLOWED
static BOOL CALLBACK ExtractCallback(const EXTRACTCALLBACKINFO &, void *Context)
static UINT ExtractZip(LPCWSTR Archive, const CStringW &OutputDir, EXTRACTCALLBACK Callback, void *Context)
static UINT ErrorBox(UINT Error=GetLastError())
BOOL ExtractAndRunGeneratedInstaller(const CAvailableApplicationInfo &AppInfo, LPCWSTR Archive)
static HRESULT GetCustomIconPath(InstallInfo &Info, CStringW &Path)
static BOOL GetLocalizedSMFolderName(LPCWSTR WinVal, LPCWSTR RosInf, LPCWSTR RosVal, CStringW &Output)
#define DB_GENINST_DELREG
static DWORD CALLBACK ExtractAndInstallThread(LPVOID Parameter)
#define DB_GENINST_DELDIR
static UINT ExtractCab(LPCWSTR Archive, const CStringW &OutputDir, EXTRACTCALLBACK Callback, void *Context)
static void AddUninstallOperationsFromDB(LPCWSTR Name, WCHAR UnOp, CStringW PathPrefix=CStringW(L""))
static UINT ExtractArchive(LPCWSTR Archive, const CStringW &OutputDir, EXTRACTCALLBACK Callback, void *Context)
#define DB_GENINST_DELDIREMPTY
static BOOL AddEntry(WCHAR Type, LPCWSTR Value)
static INT_PTR CALLBACK UIDlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
static struct CommonInfo * g_pInfo
static LPCWSTR GetGenerateString(LPCWSTR Name, CStringW &Output, LPCWSTR Default=L"")
#define REGPATH_UNINSTALL
#define DB_GENINST_DELFILE
static BOOL InstallFiles(const CStringW &SourceDirBase, const CStringW &Spec, const CStringW &DestinationDir)
static DWORD CALLBACK WorkerThread(LPVOID Parameter)
#define DB_GENINST_DELREGEMPTY
static int ExtractFilesFromZip(LPCWSTR Archive, const CStringW &OutputDir, EXTRACTCALLBACK Callback, void *Context)
static CStringW CreateMainShortcut(const CStringW &Target)
HRESULT ExtractArchiveForExecution(PCWSTR pszArchive, const CStringW &PackageName, CStringW &TempDir, CStringW &App)
static DWORD CALLBACK UninstallThread(LPVOID Parameter)
static void WriteArpEntry(LPCWSTR Name, LPCWSTR Value, UINT Type=REG_SZ)
BOOL IsZipFile(PCWSTR Path)
static LPCWSTR GetCommonString(LPCWSTR Name, CStringW &Output, LPCWSTR Default=L"")
static BOOL CreateUI(BOOL Silent, LPTHREAD_START_ROUTINE ThreadProc)
BOOL UninstallGenerated(CInstalledApplicationInfo &AppInfo, UninstallCommandFlags Flags)
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
GLdouble GLdouble GLdouble r
GLenum GLuint GLenum GLsizei const GLchar * buf
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
void fill_win32_filefunc64W(zlib_filefunc64_def *pzlib_filefunc_def)
struct msdos_volume_info vi
#define ERROR_FILE_NOT_FOUND
static DWORD DWORD void LPSTR DWORD cch
static HMODULE MODULEINFO DWORD cb
#define REG_OPTION_NON_VOLATILE
#define FILE_SHARE_DELETE
#define FILE_ATTRIBUTE_DIRECTORY
const GUID IID_IPersistFile
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
EXTERN_C HRESULT WINAPI SHPathPrepareForWriteW(HWND hwnd, IUnknown *modless, LPCWSTR path, DWORD flags)
#define CSIDL_COMMON_PROGRAMS
#define SHPPFW_IGNOREFILENAME
#define PathParseIconLocation
CommonInfo(LPCWSTR DisplayName, BOOL IsSilent=FALSE)
InstallInfo(LPCWSTR AppName, CConfigParser &CP, LPCWSTR Archive)
UninstallInfo(CInstalledApplicationInfo &Info, BOOL IsSilent)
CInstalledApplicationInfo & AppInfo
ZPOS64_T uncompressed_size
TW_UINT32 TW_UINT16 TW_UINT16 MSG
#define CMD_KEY_UNINSTALL
unzFile ZEXPORT unzOpen2_64(const void *path, zlib_filefunc64_def *pzlib_filefunc_def)
int ZEXPORT unzGetCurrentFileInfo64(unzFile file, unz_file_info64 *pfile_info, char *szFileName, uLong fileNameBufferSize, void *extraField, uLong extraFieldBufferSize, char *szComment, uLong commentBufferSize)
int ZEXPORT unzGoToFirstFile(unzFile file)
int ZEXPORT unzOpenCurrentFile(unzFile file)
int ZEXPORT unzReadCurrentFile(unzFile file, voidp buf, unsigned len)
int ZEXPORT unzCloseCurrentFile(unzFile file)
int ZEXPORT unzGoToNextFile(unzFile file)
int ZEXPORT unzClose(unzFile file)
#define UNZ_END_OF_LIST_OF_FILE
static const WCHAR lang[]
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_In_ WDFINTERRUPT _In_ PFN_WDF_INTERRUPT_SYNCHRONIZE Callback
_Must_inspect_result_ _In_ WDFKEY _In_ PCUNICODE_STRING _Out_opt_ PUSHORT _Inout_opt_ PUNICODE_STRING Value
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
DWORD WINAPI GetCurrentProcessId(void)
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
#define GetModuleFileName
#define ERROR_PATH_NOT_FOUND
#define ERROR_CAN_NOT_COMPLETE
#define HRESULT_FROM_WIN32(x)
#define ERROR_INTERNAL_ERROR
#define HKEY_LOCAL_MACHINE
#define HKEY_CURRENT_USER
#define HKEY_CLASSES_ROOT
BOOL WINAPI TranslateMessage(_In_ const MSG *)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
BOOL WINAPI GetMessageW(_Out_ LPMSG, _In_opt_ HWND, _In_ UINT, _In_ UINT)
int WINAPIV wsprintfW(_Out_ LPWSTR, _In_ _Printf_format_string_ LPCWSTR,...)
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI DispatchMessageW(_In_ const MSG *)
#define MAKEINTRESOURCEW(i)
BOOL WINAPI DestroyWindow(_In_ HWND)
HICON WINAPI LoadIconW(_In_opt_ HINSTANCE hInstance, _In_ LPCWSTR lpIconName)
HWND WINAPI CreateDialogIndirectParamW(_In_opt_ HINSTANCE, _In_ LPCDLGTEMPLATE, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
BOOL WINAPI DestroyIcon(_In_ HICON)
_Must_inspect_result_ _In_ ULONG Flags
_Inout_opt_ PVOID Parameter