29#define REGPATH_UNINSTALL L"Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"
31#define DB_GENINST_FILES L"Files"
32#define DB_GENINST_DIR L"Dir"
33#define DB_GENINST_ICON L"Icon"
34#define DB_GENINST_LNK L"Lnk"
35#define DB_GENINST_DELFILE L"DelFile"
36#define DB_GENINST_DELDIR L"DelDir"
37#define DB_GENINST_DELDIREMPTY L"DelDirEmpty"
38#define DB_GENINST_DELREG L"DelReg"
39#define DB_GENINST_DELREGEMPTY L"DelRegEmpty"
53 const UINT pkzefsutf8 = 1 << 11;
74 while (narrow[0] ==
'\\')
75 narrow = narrow.
Mid(1);
235 Path.ReleaseBuffer();
304 hr =
link.CoCreateInstance(CLSID_ShellLink, IID_IShellLinkW);
344 sourcedir =
BuildPath(SourceDirBase, sourcedir);
365 BOOL dots =
p[0] ==
'.' && (!
p[1] || (
p[1] ==
'.' && !
p[2]));
386 if (
Info.MainApp.IsEmpty())
412 for (
int pos = 1;
pos > 0;)
433 const BOOL PerUserModeDefault =
TRUE;
436 CStringW installdir, tempdir, files, shortcut, tmp;
439 Info.ArpKey = &arpkey;
450 Info.PerUser = PerUserModeDefault;
509 files = files.
Mid(
pos + 1);
513 if (!
Info.MainApp.IsEmpty())
530 WCHAR modechar =
Info.PerUser ?
'U' :
'M';
532 (tmp = tmp.
Mid(0,
cch)).AppendFormat(unparamsfmt,
L"", modechar, bitness, arpkeyname);
534 (tmp = tmp.
Mid(0,
cch)).AppendFormat(unparamsfmt,
L" /S", modechar, bitness, arpkeyname);
558 if (!
Info.Error &&
Info.ShortcutFile)
620 enum { DLGW = 150, DLGH = 20,
PAD = 4, PADx2 =
PAD * 2, CHILDCOUNT = 1 };
622 static const WORD DlgTmpl[] =
624 LOWORD(DlgStyle),
HIWORD(DlgStyle), 0, 0, CHILDCOUNT, 0, 0, DLGW, DLGH, 0, 0, 0,
626 'm',
's',
'c',
't',
'l',
's',
'_',
'p',
'r',
'o',
'g',
'r',
'e',
's',
's',
'3',
'2', 0, 0,
693 RegQueryInfoKey(
Info.Entries,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL, &
Info.Count,
NULL,
NULL,
NULL,
NULL);
727 if (
path.CompareNoCase(
L"HKCR") == 0)
729 else if (
path.CompareNoCase(
L"HKCU") == 0)
731 else if (
path.CompareNoCase(
L"HKLM") == 0)
734 if (
data[4] ==
'6' &&
data[5] ==
'4')
736 else if (
data[4] ==
'3' &&
data[5] ==
'2')
750 err =
key.RecurseDeleteKey(tmp);
752 key.DeleteSubKey(tmp);
PRTL_UNICODE_STRING_BUFFER Path
DWORD WINAPI ThreadProc(LPVOID lpParam)
#define GENERATE_ARPSUBKEY
#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 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
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
CStringT Right(int nCount) const
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)
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
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)
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 CreateShortcut(const CStringW &Target)
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)
static int ExtractFilesFromZip(LPCWSTR Archive, const CStringW &OutputDir, EXTRACTCALLBACK Callback, void *Cookie)
#define DB_GENINST_DELREG
static UINT ExtractCab(LPCWSTR Archive, const CStringW &OutputDir, EXTRACTCALLBACK Callback, void *Cookie)
static DWORD CALLBACK ExtractAndInstallThread(LPVOID Parameter)
#define DB_GENINST_DELDIR
static void AddUninstallOperationsFromDB(LPCWSTR Name, WCHAR UnOp, CStringW PathPrefix=CStringW(L""))
#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
static BOOL CALLBACK ExtractCallback(const EXTRACTCALLBACKINFO &, void *Cookie)
#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 DWORD CALLBACK UninstallThread(LPVOID Parameter)
static void WriteArpEntry(LPCWSTR Name, LPCWSTR Value, UINT Type=REG_SZ)
static LPCWSTR GetCommonString(LPCWSTR Name, CStringW &Output, LPCWSTR Default=L"")
static BOOL CreateUI(BOOL Silent, LPTHREAD_START_ROUTINE ThreadProc)
static UINT ExtractZip(LPCWSTR Archive, const CStringW &OutputDir, EXTRACTCALLBACK Callback, void *Cookie)
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
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)
#define FORMAT_MESSAGE_IGNORE_INSERTS
DWORD WINAPI GetCurrentProcessId(void)
#define FORMAT_MESSAGE_FROM_SYSTEM
DWORD(WINAPI * LPTHREAD_START_ROUTINE)(LPVOID)
#define GetModuleFileName
#define ERROR_PATH_NOT_FOUND
#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 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
_In_opt_ PVOID _Out_ PLARGE_INTEGER Cookie
_Inout_opt_ PVOID Parameter