1.删除旧版app时,清理安装目录和快捷方式

2.更新版本号
This commit is contained in:
luoliangyi 2022-08-09 17:31:24 +08:00
parent 9670cb1cb7
commit aae5cc4b61
16 changed files with 91 additions and 9 deletions

View File

@ -243,6 +243,63 @@ static int UninstallDriver(const CStringA &guid)
return ret;
}
static BOOL DeleteDirectory(LPCSTR lpszDir)
{
if (NULL == lpszDir || '\0' == lpszDir[0])
{
return FALSE;
}
if (!PathFileExistsA(lpszDir))
{
return FALSE;
}
WIN32_FIND_DATAA wfd = { 0 };
CHAR szFile[MAX_PATH] = { 0 };
CHAR szDelDir[MAX_PATH] = { 0 };
lstrcpyA(szDelDir, lpszDir);
if (lpszDir[lstrlenA(lpszDir) - 1] != L'\\')
{
_snprintf_s(szDelDir, _countof(szDelDir) - 1, "%s\\", lpszDir);
}
else
{
strncpy_s(szDelDir, lpszDir, _countof(szDelDir) - 1);
}
_snprintf_s(szFile, _countof(szFile) - 1, "%s*.*", szDelDir);
HANDLE hFindFile = FindFirstFileA(szFile, &wfd);
if (INVALID_HANDLE_VALUE == hFindFile)
{
return FALSE;
}
do
{
if (lstrcmpiA(wfd.cFileName, ".") == 0 || lstrcmpiA(wfd.cFileName, "..") == 0)
{
continue;
}
_snprintf_s(szFile, _countof(szFile) - 1, "%s%s", szDelDir, wfd.cFileName);
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
{
DeleteDirectory(szFile);
}
else
{
DeleteFileA(szFile);
}
} while (FindNextFileA(hFindFile, &wfd));
FindClose(hFindFile);
RemoveDirectoryA(szDelDir);
return TRUE;
}
int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
_In_opt_ HINSTANCE hPrevInstance,
_In_ LPWSTR lpCmdLine,
@ -268,9 +325,34 @@ int APIENTRY wWinMain(_In_ HINSTANCE hInstance,
return 2;
}
CStringA strInstallPath = GetInstallLocation(strAppGuid);
int ret = UninstallApp(strAppGuid);
if (0 == ret)
{
DeleteDirectory(strInstallPath);
CHAR progPath[MAX_PATH];
SHGetSpecialFolderPathA(NULL, progPath, CSIDL_COMMON_PROGRAMS, FALSE);
CStringA strProgPath = progPath;
#if defined(OEM_HANWANG)
DeleteDirectory(strProgPath + "\\LanXum");
#elif defined(OEM_LISICHENG)
DeleteDirectory(strProgPath + "\\汉王科技股份有限公司");
#else
DeleteDirectory(strProgPath + "\\HuaGaoChina");
#endif
CHAR desktopPath[MAX_PATH];
SHGetSpecialFolderPathA(NULL, desktopPath, CSIDL_COMMON_DESKTOPDIRECTORY, FALSE);
CStringA strDesktopPath = desktopPath;
#if defined(OEM_HANWANG)
DeleteFileA(strDesktopPath + "\\HanvonScan.lnk");
#elif defined(OEM_LISICHENG)
DeleteFileA(strDesktopPath + "\\LanxumScan.lnk");
#else
DeleteFileA(strDesktopPath + "\\HuaGoScan.lnk");
#endif
CStringA strDriverGuid1, strDriverGuid2;
#if defined(OEM_HANWANG)
strDriverGuid1 = "{3D15346F-3E17-494E-B14B-5F221CD284B4}";

View File

@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "汉王扫描仪软件"
#define MyAppVersion "4.16.16000.22218"
#define MyAppVersion "4.17.16000.22218"
#define MyAppSetupName "HanvonScan_App_Setup"
#define MyAppDefSetupDir "HanvonScan"
#define MyAppPublisher "汉王科技股份有限公司"

View File

@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "汉王扫描仪软件64位"
#define MyAppVersion "4.16.16100.22218"
#define MyAppVersion "4.17.16100.22218"
#define MyAppSetupName "HanvonScan_App_Setup_x64"
#define MyAppDefSetupDir "HanvonScan"
#define MyAppPublisher "汉王科技股份有限公司"

View File

@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "华高扫描仪软件"
#define MyAppVersion "4.16.10000.22218"
#define MyAppVersion "4.17.10000.22218"
#define MyAppSetupName "HuaGoScan_App_Setup"
#define MyAppDefSetupDir "HuaGoScan"
#define MyAppPublisher "宁波华高信息科技有限公司"

View File

@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "华高扫描仪软件64位"
#define MyAppVersion "4.16.10100.22218"
#define MyAppVersion "4.17.10100.22218"
#define MyAppSetupName "HuaGoScan_App_Setup_x64"
#define MyAppDefSetupDir "HuaGoScan"
#define MyAppPublisher "宁波华高信息科技有限公司"

View File

@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "立思辰扫描仪软件"
#define MyAppVersion "4.16.14000.22218"
#define MyAppVersion "4.17.14000.22218"
#define MyAppSetupName "LanxumScan_App_Setup"
#define MyAppDefSetupDir "LanxumScan"
#define MyAppPublisher "立思辰信息科技有限公司"

View File

@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "立思辰扫描仪软件64位"
#define MyAppVersion "4.16.14100.22218"
#define MyAppVersion "4.17.14100.22218"
#define MyAppSetupName "LanxumScan_App_Setup_x64"
#define MyAppDefSetupDir "LanxumScan"
#define MyAppPublisher "立思辰信息科技有限公司"

View File

@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "汉王WEBSDK"
#define MyAppVersion "4.16.16000.22218"
#define MyAppVersion "4.17.16000.22218"
#define MyAppSetupName "HanvonWebSdk_Setup"
#define MyAppDefSetupDir "HanvonWebSdk"
#define MyAppPublisher "汉王信息科技有限公司"

View File

@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "华高WEBSDK"
#define MyAppVersion "4.16.10000.22218"
#define MyAppVersion "4.17.10000.22218"
#define MyAppSetupName "HuaGoWebSdk_Setup"
#define MyAppDefSetupDir "HuaGoWebSdk"
#define MyAppPublisher "宁波华高信息科技有限公司"

View File

@ -1,7 +1,7 @@
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyAppName "立思辰WEBSDK"
#define MyAppVersion "4.16.14000.22218"
#define MyAppVersion "4.17.14000.22218"
#define MyAppSetupName "LanxumWebSdk_Setup"
#define MyAppDefSetupDir "LanxumWebSdk"
#define MyAppPublisher "立思辰信息科技有限公司"

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.