From f235cca9c532bb33f793904ff4685cd29627b067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Auger?= Date: Thu, 22 Dec 2022 09:53:48 +0100 Subject: [PATCH 1/4] Update version to 2.10.1.0 --- Agent/OCSInventory.rc | 8 ++++---- ComHTTP/HTTP.rc | 8 ++++---- Download/Download.rc | 8 ++++---- OCSInventory Front/OCSInventory Front.rc | 8 ++++---- OcsNotifyUser/OcsNotifyUser.rc | 8 ++++---- OcsSystray/OcsSystray.rc | 8 ++++---- OcsWmi/OcsWmi.rc | 8 ++++---- Service/Service.rc | 8 ++++---- SysInfo/SysInfo.rc | 8 ++++---- TestSysInfo/TestSysInfo.rc | 8 ++++---- 10 files changed, 40 insertions(+), 40 deletions(-) diff --git a/Agent/OCSInventory.rc b/Agent/OCSInventory.rc index c909b8f..ea9c02b 100644 --- a/Agent/OCSInventory.rc +++ b/Agent/OCSInventory.rc @@ -35,8 +35,8 @@ IDR_MAINFRAME ICON "res\\OCSInventory.ico" // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -54,13 +54,13 @@ BEGIN VALUE "Comments", "OCS Inventory Agent" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory Agent" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "OCSInventory.exe" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "OCSInventory.exe" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" diff --git a/ComHTTP/HTTP.rc b/ComHTTP/HTTP.rc index 5f2aebc..48b6458 100644 --- a/ComHTTP/HTTP.rc +++ b/ComHTTP/HTTP.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -44,13 +44,13 @@ BEGIN VALUE "Comments", "OCS Inventory Communication Provider" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory cURL Communication Provider" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "ComHTTP.dll" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "ComHTTP.dll" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" diff --git a/Download/Download.rc b/Download/Download.rc index fb179e6..79dbd9b 100644 --- a/Download/Download.rc +++ b/Download/Download.rc @@ -28,8 +28,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -47,13 +47,13 @@ BEGIN VALUE "Comments", "OCS Inventory Package Download and Setup Tool" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory Package Download and Setup Tool" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "Download.exe" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "Download.exe" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" diff --git a/OCSInventory Front/OCSInventory Front.rc b/OCSInventory Front/OCSInventory Front.rc index a62624e..be3508f 100644 --- a/OCSInventory Front/OCSInventory Front.rc +++ b/OCSInventory Front/OCSInventory Front.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -44,13 +44,13 @@ BEGIN VALUE "Comments", "OCS Inventory Framework Provider" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory Framework Provider" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "OCSInventory Front.dll" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "OCSInventory Front.dll" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" diff --git a/OcsNotifyUser/OcsNotifyUser.rc b/OcsNotifyUser/OcsNotifyUser.rc index e7f44a1..12ac190 100644 --- a/OcsNotifyUser/OcsNotifyUser.rc +++ b/OcsNotifyUser/OcsNotifyUser.rc @@ -386,8 +386,8 @@ IDR_MAINFRAME ICON "..\\Agent\\res\\OCSInventory.ic // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -405,13 +405,13 @@ BEGIN VALUE "Comments", "OCS Inventory User Notification Provider" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory User Notification Provider" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "OcsNotifyUser.exe" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "OcsNotifyUser.exe" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" diff --git a/OcsSystray/OcsSystray.rc b/OcsSystray/OcsSystray.rc index c5f32d6..17fefe0 100644 --- a/OcsSystray/OcsSystray.rc +++ b/OcsSystray/OcsSystray.rc @@ -388,8 +388,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -407,13 +407,13 @@ BEGIN VALUE "Comments", "OCS Inventory Systray applet" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory Systray applet" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "OcsSystray.exe" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "OcsSystray.exe" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" diff --git a/OcsWmi/OcsWmi.rc b/OcsWmi/OcsWmi.rc index 289a78a..e058c66 100644 --- a/OcsWmi/OcsWmi.rc +++ b/OcsWmi/OcsWmi.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -44,13 +44,13 @@ BEGIN VALUE "Comments", "OCS Inventory WMI Provider" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory WMI Provider" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "OcsWmi.dll" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "OcsWmi.dll" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" diff --git a/Service/Service.rc b/Service/Service.rc index 1e9eeaf..60c4192 100644 --- a/Service/Service.rc +++ b/Service/Service.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -44,13 +44,13 @@ BEGIN VALUE "Comments", "OCS Inventory Service" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory Service" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "OcsService.exe" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "OcsService.exe" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" diff --git a/SysInfo/SysInfo.rc b/SysInfo/SysInfo.rc index 6cc18d5..3dc984e 100644 --- a/SysInfo/SysInfo.rc +++ b/SysInfo/SysInfo.rc @@ -25,8 +25,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_DEFAULT // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x3fL #ifdef _DEBUG FILEFLAGS 0x1L @@ -44,13 +44,13 @@ BEGIN VALUE "Comments", "OCS Inventory System Provider" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory System Provider" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "SysInfo.dll" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "SysInfo.dll" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" diff --git a/TestSysInfo/TestSysInfo.rc b/TestSysInfo/TestSysInfo.rc index 9d757e0..2ca32bb 100644 --- a/TestSysInfo/TestSysInfo.rc +++ b/TestSysInfo/TestSysInfo.rc @@ -50,8 +50,8 @@ END // VS_VERSION_INFO VERSIONINFO - FILEVERSION 2,10,0,0 - PRODUCTVERSION 2,10,0,0 + FILEVERSION 2,10,1,0 + PRODUCTVERSION 2,10,1,0 FILEFLAGSMASK 0x17L #ifdef _DEBUG FILEFLAGS 0x1L @@ -69,13 +69,13 @@ BEGIN VALUE "Comments", "OCS Inventory System Information Testing tool" VALUE "CompanyName", "OCS Inventory" VALUE "FileDescription", "OCS Inventory System Information Testing tool" - VALUE "FileVersion", "2.10.0.0" + VALUE "FileVersion", "2.10.1.0" VALUE "InternalName", "TestSysInfo.exe" VALUE "LegalCopyright", "Open Source Software released under GNU General Public License V2" VALUE "LegalTrademarks", "http://www.ocsinventory-ng.org" VALUE "OriginalFilename", "TestSysInfo.exe" VALUE "ProductName", "OCS Inventory Windows Agent" - VALUE "ProductVersion", "2.10.0.0" + VALUE "ProductVersion", "2.10.1.0" END END BLOCK "VarFileInfo" From 508338f65e8fd535b6c8f237016e49863a84d6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Auger?= Date: Thu, 22 Dec 2022 09:54:54 +0100 Subject: [PATCH 2/4] Add changelog for 2.10.1.0 --- CHANGELOG | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/CHANGELOG b/CHANGELOG index 539fc38..c4c2b7a 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,15 @@ -2.9.2.0 +2.10.1.0 + * Fix 15 character device name limit (Thanks to @CorbinIvon) + * Fix set ACL on programdata OCS Inventory folder + +2.10.0.0 + * Add default DNS retrieving + * Add default gateway retrieving + * Add AzureAD informations retrieving + * Add uninstall parameter to remove programdata remanent files + * Remove classic user rights on programdata OCS Inventory folder + +2.9.2.0 * This release doesn't bring any feature / functionnality however it is the first fully signed revision using an EV code signing certificate Starting now all our agent releases will be signed using that certificate. From a91d402980a64979d52874091695c614d965801f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Auger?= Date: Thu, 22 Dec 2022 09:55:19 +0100 Subject: [PATCH 3/4] Fix setACL path --- NSIS_agent_setup/OCS-NG_Windows_Agent_Setup_x64.nsi | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/NSIS_agent_setup/OCS-NG_Windows_Agent_Setup_x64.nsi b/NSIS_agent_setup/OCS-NG_Windows_Agent_Setup_x64.nsi index c7d0f60..7a55ac5 100644 --- a/NSIS_agent_setup/OCS-NG_Windows_Agent_Setup_x64.nsi +++ b/NSIS_agent_setup/OCS-NG_Windows_Agent_Setup_x64.nsi @@ -13,7 +13,7 @@ setcompressor /SOLID lzma ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "OCS Inventory NG Agent" !define OLD_PRODUCT_NAME "OCS Inventory Agent" -!define PRODUCT_VERSION "2.10.0.0" +!define PRODUCT_VERSION "2.10.1.0" !define PRODUCT_PUBLISHER "OCS Inventory NG Team" !define PRODUCT_WEB_SITE "http://www.ocsinventory-ng.org" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\OCSInventory.exe" @@ -1595,14 +1595,14 @@ Section "!Working data folder" SEC01 ; Set users and power users permission to read/execute/change StrCpy $logBuffer "SetACL allowing Users / Power users read/write permissions on <$APPDATA\OCS Inventory NG\Agent>..." Call Write_Log - nsExec::ExecToLog 'SetACL -on "$APPDATA\OCS Inventory NG\Agent" -ot file -actn ace -ace "n:S-1-5-18;p:full;s:y;m:set" -ace "n:S-1-5-32-544;p:full;s:y;m:set" -ace "n:S-1-5-32-547;p:read_ex,change;s:y;m:set" -actn setprot -op "dacl:p_nc;sacl:p_nc" -actn clear -clr "dacl,sacl" -actn rstchldrn -rst "dacl,sacl"' + nsExec::ExecToLog '$PLUGINSDIR\SetACL.exe -on "$APPDATA\OCS Inventory NG\Agent" -ot file -actn ace -ace "n:S-1-5-18;p:full;s:y;m:set" -ace "n:S-1-5-32-544;p:full;s:y;m:set" -ace "n:S-1-5-32-547;p:read_ex,change;s:y;m:set" -actn setprot -op "dacl:p_nc;sacl:p_nc" -actn clear -clr "dacl,sacl" -actn rstchldrn -rst "dacl,sacl"' Pop $0 StrCpy $logBuffer "Result: $0$\r$\n" Call Write_Log ; Propagate inherited permissions to Download directory StrCpy $logBuffer "SetACL propagating inherited permissions on <$APPDATA\OCS Inventory NG\Agent\Download>..." Call Write_Log - nsExec::ExecToLog 'SetACL.exe -on "$APPDATA\OCS Inventory NG\Agent\Download" -ot file -actn setprot -op "dacl:np;sacl:np" -actn clear -clr "dacl,sacl" -actn rstchldrn -rst "dacl,sacl"' + nsExec::ExecToLog '$PLUGINSDIR\SetACL.exe -on "$APPDATA\OCS Inventory NG\Agent\Download" -ot file -actn setprot -op "dacl:np;sacl:np" -actn clear -clr "dacl,sacl" -actn rstchldrn -rst "dacl,sacl"' Pop $0 StrCpy $logBuffer "Result: $0$\r$\n" Call Write_Log From 56ec7f2ce1bf8629f7c00f7e25d40a6e427bbacb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Charl=C3=A8ne=20Auger?= Date: Thu, 22 Dec 2022 09:55:58 +0100 Subject: [PATCH 4/4] Add 2.10.0.0 uninstall options and fix setACL --- .../OCS-NG_Windows_Agent_Setup_x86.nsi | 185 +++++++++++++++++- 1 file changed, 177 insertions(+), 8 deletions(-) diff --git a/NSIS_agent_setup/OCS-NG_Windows_Agent_Setup_x86.nsi b/NSIS_agent_setup/OCS-NG_Windows_Agent_Setup_x86.nsi index c627d43..990708f 100644 --- a/NSIS_agent_setup/OCS-NG_Windows_Agent_Setup_x86.nsi +++ b/NSIS_agent_setup/OCS-NG_Windows_Agent_Setup_x86.nsi @@ -13,7 +13,7 @@ setcompressor /SOLID lzma ; HM NIS Edit Wizard helper defines !define PRODUCT_NAME "OCS Inventory NG Agent" !define OLD_PRODUCT_NAME "OCS Inventory Agent" -!define PRODUCT_VERSION "2.10.0.0" +!define PRODUCT_VERSION "2.10.1.0" !define PRODUCT_PUBLISHER "OCS Inventory NG Team" !define PRODUCT_WEB_SITE "http://www.ocsinventory-ng.org" !define PRODUCT_DIR_REGKEY "Software\Microsoft\Windows\CurrentVersion\App Paths\OCSInventory.exe" @@ -30,11 +30,11 @@ setcompressor /SOLID lzma ;!insertmacro GetParent ; Define Visual Studio Path -!define VC_PATH "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.32.31326\x86" +!define VC_PATH "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Redist\MSVC\14.34.31931\x86" !define VC_VERSION "VC143" ; Use Modern UI -!include "MUI.nsh" +!include "MUI2.nsh" ICON "install-ocs.ico" ; MUI Settings !define MUI_HEADERIMAGE @@ -66,6 +66,7 @@ Page custom AskLocalInventory ValidateLocalInventory "" !define MUI_FINISHPAGE_RUN "$INSTDIR\OcsSystray.exe" !insertmacro MUI_PAGE_FINISH ; Confirl before uninstall +UninstPage custom un.AskUninstallOptions un.ValidateUninstallOptions "" !insertmacro MUI_UNPAGE_INSTFILES ; Language files !insertmacro MUI_LANGUAGE "English" @@ -110,7 +111,12 @@ var /GLOBAL OcsNoSplash ; To store if setup must display spash screen (FALSE) or var /GLOBAL OcsUpgrade ; To store if /UPGRADE option used (TRUE) or not (FALSE) var /GLOBAL installSatus ; To store installation status var /GLOBAL OcsLocal ; To store folder where to write local inventory file - +; handle uninstall variables +var /GLOBAL hCtl +var /GLOBAL hCtl_uninstalloptions +var /GLOBAL hCtl_clean +var /GLOBAL hCtl_Label1 +var /GLOBAL uninstallOption ; To store the uninstall option ##################################################################### # GetParameters # input, none @@ -322,6 +328,121 @@ done: Exch $R1 FunctionEnd +Function un.GetParameters + Push $R0 + Push $R1 + Push $R2 + Push $R3 + + StrCpy $R2 1 + StrLen $R3 $CMDLINE + + ;Check for quote or space + StrCpy $R0 $CMDLINE $R2 + StrCmp $R0 '"' 0 +3 + StrCpy $R1 '"' + Goto loop + StrCpy $R1 " " + + loop: + IntOp $R2 $R2 + 1 + StrCpy $R0 $CMDLINE 1 $R2 + StrCmp $R0 $R1 get + StrCmp $R2 $R3 get + Goto loop + + get: + IntOp $R2 $R2 + 1 + StrCpy $R0 $CMDLINE 1 $R2 + StrCmp $R0 " " get + StrCpy $R0 $CMDLINE "" $R2 + + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 +FunctionEnd + +Function un.GetParameterValue + Exch $R0 ; get the top of the stack(default parameter) into R0 + Exch ; exchange the top of the stack(default) with + ; the second in the stack(parameter to search for) + Exch $R1 ; get the top of the stack(search parameter) into $R1 + + ;Preserve on the stack the registers used in this function + Push $R2 + Push $R3 + Push $R4 + Push $R5 + + Strlen $R2 $R1 ; store the length of the search string into R2 + + Call un.GetParameters ; get the command line parameters + Pop $R3 ; store the command line string in R3 + + # search for quoted search string + StrCpy $R5 '"' ; later on we want to search for a open quote + Push $R3 ; push the 'search in' string onto the stack + Push '"$R1' ; push the 'search for' + Call un.StrStr ; search for the quoted parameter value + Pop $R4 + StrCpy $R4 $R4 "" 1 ; skip over open quote character, "" means no maxlen + StrCmp $R4 "" "" next ; if we didn't find an empty string go to next + + # search for non-quoted search string + StrCpy $R5 ' ' ; later on we want to search for a space since we + ; didn't start with an open quote '"' we shouldn't + ; look for a close quote '"' + Push $R3 ; push the command line back on the stack for searching + Push '$R1' ; search for the non-quoted search string + Call un.StrStr + Pop $R4 + + ; $R4 now contains the parameter string starting at the search string, + ; if it was found +next: + StrCmp $R4 "" check_for_switch ; if we didn't find anything then look for + ; usage as a command line switch + # copy the value after $R1 by using StrCpy with an offset of $R2, + # the length of 'OUTPUT' + StrCpy $R0 $R4 "" $R2 ; copy commandline text beyond parameter into $R0 + # search for the next parameter so we can trim this extra text off + Push $R0 + Push $R5 ; search for either the first space ' ', or the first + ; quote '"' + ; if we found '"/output' then we want to find the + ; ending ", as in '"/output=somevalue"' + ; if we found '/output' then we want to find the first + ; space after '/output=somevalue' + Call un.StrStr ; search for the next parameter + Pop $R4 + StrCmp $R4 "" done ; if 'somevalue' is missing, we are done + StrLen $R4 $R4 ; get the length of 'somevalue' so we can copy this + ; text into our output buffer + StrCpy $R0 $R0 -$R4 ; using the length of the string beyond the value, + ; copy only the value into $R0 + goto done ; if we are in the parameter retrieval path skip over + ; the check for a command line switch + + ; See if the parameter was specified as a command line switch, like '/output' +check_for_switch: + Push $R3 ; push the command line back on the stack for searching + Push '$R1' ; search for the non-quoted search string + Call un.StrStr + Pop $R4 + StrCmp $R4 "" done ; if we didn't find anything then use the default + StrCpy $R0 "" ; otherwise copy in an empty string since we found the + ; parameter, just didn't find a value + +done: + Pop $R5 + Pop $R4 + Pop $R3 + Pop $R2 + Pop $R1 + Exch $R0 ; put the value in $R0 at the top of the stack +FunctionEnd + ##################################################################### # This function write content of logBuffer variable in log file in # a log file OcsAgentSetup.log located in install directory @@ -1346,6 +1467,39 @@ FunctionEnd Function ValidateAgent2Options FunctionEnd +Function un.AskUninstallOptions + ; === test (type: Dialog) === + nsDialogs::Create 1018 + Pop $hCtl + ${If} $hCtl == error + Abort + ${EndIf} + !insertmacro MUI_HEADER_TEXT "OCS Inventory NG Agent uninstaller" "You are about to uninstall OCS Inventory NG Agent ${PRODUCT_VERSION}, select uninstall option below..." + + ; === uninstalloptions (type: GroupBox) === + ${NSD_CreateGroupBox} 8u 7u 280u 126u "Uninstall option" + Pop $hCtl_uninstalloptions + + ; === clean (type: DropList) === + ${NSD_CreateDropList} 12u 41u 195u 13u "NONE" + Pop $hCtl_clean + ${NSD_CB_AddString} $hCtl_clean "NONE" + ${NSD_CB_AddString} $hCtl_clean "ONLY CONFIGURATION FILES" + ${NSD_CB_AddString} $hCtl_clean "ALL FILES" + ${NSD_CB_SelectString} $hCtl_clean "NONE" + + ; === Label1 (type: Label) === + ${NSD_CreateLabel} 12u 25u 205u 14u "Do you want to remove persistent files from OCS Inventory ?" + Pop $hCtl_Label1 + + nsDialogs::Show +FunctionEnd + +Function un.ValidateUninstallOptions + ${NSD_GetText} $hCtl_clean $0 + StrCpy $uninstallOption "$0" +FunctionEnd + Function AskLocalInventory ${If} ${SectionIsSelected} 4 ; Index of Local inventory section !insertmacro MUI_HEADER_TEXT "OCS Inventory NG Agent for Windows" "Choose folder to save inventory result..." @@ -1389,14 +1543,14 @@ Section "!Working data folder" SEC01 ; Set users and power users permission to read/execute/change StrCpy $logBuffer "SetACL allowing Users / Power users read/write permissions on <$APPDATA\OCS Inventory NG\Agent>..." Call Write_Log - nsExec::ExecToLog 'SetACL -on "$APPDATA\OCS Inventory NG\Agent" -ot file -actn ace -ace "n:S-1-5-32-545;p:read_ex,change;s:y;m:set" -ace "n:S-1-5-32-547;p:read_ex,change;s:y;m:set" -actn clear -clr "dacl,sacl" -actn rstchldrn -rst "dacl,sacl"' + nsExec::ExecToLog '$PLUGINSDIR\SetACL.exe -on "$APPDATA\OCS Inventory NG\Agent" -ot file -actn ace -ace "n:S-1-5-18;p:full;s:y;m:set" -ace "n:S-1-5-32-544;p:full;s:y;m:set" -ace "n:S-1-5-32-547;p:read_ex,change;s:y;m:set" -actn setprot -op "dacl:p_nc;sacl:p_nc" -actn clear -clr "dacl,sacl" -actn rstchldrn -rst "dacl,sacl"' Pop $0 StrCpy $logBuffer "Result: $0$\r$\n" Call Write_Log ; Propagate inherited permissions to Download directory StrCpy $logBuffer "SetACL propagating inherited permissions on <$APPDATA\OCS Inventory NG\Agent\Download>..." Call Write_Log - nsExec::ExecToLog 'SetACL.exe -on "$APPDATA\OCS Inventory NG\Agent\Download" -ot file -actn setprot -op "dacl:np;sacl:np" -actn clear -clr "dacl,sacl" -actn rstchldrn -rst "dacl,sacl"' + nsExec::ExecToLog '$PLUGINSDIR\SetACL.exe -on "$APPDATA\OCS Inventory NG\Agent\Download" -ot file -actn setprot -op "dacl:np;sacl:np" -actn clear -clr "dacl,sacl" -actn rstchldrn -rst "dacl,sacl"' Pop $0 StrCpy $logBuffer "Result: $0$\r$\n" Call Write_Log @@ -1935,8 +2089,6 @@ Function un.onInit Pop $R9 StrLen $0 $R9 IntCmp $0 2 unOnInit_silent 0 unOnInit_silent - MessageBox MB_ICONQUESTION|MB_YESNO|MB_DEFBUTTON2 "Are you sure to unistall $(^Name)?" IDYES +2 - Abort unOnInit_silent: FunctionEnd @@ -1973,6 +2125,23 @@ Section Uninstall DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${PRODUCT_UNINST_KEY}" DeleteRegKey ${PRODUCT_UNINST_ROOT_KEY} "${OLD_PRODUCT_UNINST_KEY}" DeleteRegKey HKLM "${PRODUCT_DIR_REGKEY}" + ; Get clean paramater + Push "/CLEAN=" ; push the search string onto the stack + Push "NONE" ; push a default value onto the stack + Call un.GetParameterValue + Pop $2 + + ${If} $2 == "ALL" + ${OrIf} $uninstallOption == "ALL FILES" + RMDir /r /REBOOTOK "$APPDATA\OCS Inventory NG" + ${EndIf} + + ${If} $2 == "FILES" + ${OrIf} $uninstallOption == "ONLY CONFIGURATION FILES" + RMDir /r /REBOOTOK "$APPDATA\OCS Inventory NG\Agent\Download" + Delete /REBOOTOK "$APPDATA\OCS Inventory NG\Agent\ocsinventory.ini" + ${EndIf} + SetAutoClose true SectionEnd