diff --git a/msvs/msi/RedisMsi.CustomActions/CustomAction.cs b/msvs/msi/RedisMsi.CustomActions/CustomAction.cs index b056dffb04c..6930a0c03e9 100644 --- a/msvs/msi/RedisMsi.CustomActions/CustomAction.cs +++ b/msvs/msi/RedisMsi.CustomActions/CustomAction.cs @@ -1,34 +1,34 @@ -using System; -using System.IO; +using System; +using System.IO; using Microsoft.Deployment.WindowsInstaller; -using System.ServiceProcess; - -namespace RedisMsi.CustomActions -{ - /// - /// Defines actions to take during the MSI install that don't - /// come standard with WiX. - /// - public class CustomActions - { - /// - /// Overwrites settings in the Redis config file using values from the installer. - /// - /// The install session context - /// Returns Success when the method completes. Exceptions will bubble up and - /// cause the installer to roll back. - [CustomAction] - public static ActionResult UpdateRedisConfig(Session session) - { - // Update port - string port = session.CustomActionData["PORT"]; - string configFilePath = session.CustomActionData["CONFIG_PATH"]; - - UpdatePortSetting(port, configFilePath); - - return ActionResult.Success; - } - +using System.ServiceProcess; + +namespace RedisMsi.CustomActions +{ + /// + /// Defines actions to take during the MSI install that don't + /// come standard with WiX. + /// + public class CustomActions + { + /// + /// Overwrites settings in the Redis config file using values from the installer. + /// + /// The install session context + /// Returns Success when the method completes. Exceptions will bubble up and + /// cause the installer to roll back. + [CustomAction] + public static ActionResult UpdateRedisConfig(Session session) + { + // Update port + string port = session.CustomActionData["PORT"]; + string configFilePath = session.CustomActionData["CONFIG_PATH"]; + + UpdatePortSetting(port, configFilePath); + + return ActionResult.Success; + } + /// /// Sets a WiX property to indicate whether the Windows Firewall service is stopped. /// If the firewall service is stopped, the install will not succeed if it attempts @@ -36,7 +36,7 @@ public static ActionResult UpdateRedisConfig(Session session) /// firewall to off does not pose a problem. /// /// - /// + /// [CustomAction] public static ActionResult CheckIfFirewallServiceRunning(Session session) { @@ -49,25 +49,25 @@ public static ActionResult CheckIfFirewallServiceRunning(Session session) } return ActionResult.Success; - } - - /// - /// Updates the port in the config file. - /// - /// The port to have Redis listen at - /// The path to the Redis config file - private static void UpdatePortSetting(string portToUse, string configFilePath) - { - if (File.Exists(configFilePath)) - { - string originalContent = File.ReadAllText(configFilePath); - string updatedContent = originalContent.Replace("port 6379", "port " + portToUse); - File.WriteAllText(configFilePath, updatedContent); - } - else - { - throw new ApplicationException("UpdateRedisConfig: Config file not found. Could not update its settings."); - } - } - } -} + } + + /// + /// Updates the port in the config file. + /// + /// The port to have Redis listen at + /// The path to the Redis config file + private static void UpdatePortSetting(string portToUse, string configFilePath) + { + if (File.Exists(configFilePath)) + { + string originalContent = File.ReadAllText(configFilePath); + string updatedContent = originalContent.Replace("port 6379", "port " + portToUse); + File.WriteAllText(configFilePath, updatedContent); + } + else + { + throw new ApplicationException("UpdateRedisConfig: Config file not found. Could not update its settings."); + } + } + } +} diff --git a/src/Win32_Interop/Win32_Interop.vcxproj b/src/Win32_Interop/Win32_Interop.vcxproj index fa3625caf4a..282f797f556 100644 --- a/src/Win32_Interop/Win32_Interop.vcxproj +++ b/src/Win32_Interop/Win32_Interop.vcxproj @@ -174,8 +174,7 @@ link.exe -dll -noentry resources/EventLog.res -out:$(TargetDir)EventLog.dll MSVCRT - - + DbgHelp.lib;%(AdditionalDependencies) @@ -224,8 +223,7 @@ link.exe -dll -noentry resources/EventLog.res -out:$(TargetDir)EventLog.dll true - - + DbgHelp.lib;%(AdditionalDependencies) diff --git a/src/Win32_Interop/Win32_ThreadControl.c b/src/Win32_Interop/Win32_ThreadControl.c index 4cbe871e466..d9b0647944c 100644 --- a/src/Win32_Interop/Win32_ThreadControl.c +++ b/src/Win32_Interop/Win32_ThreadControl.c @@ -72,7 +72,7 @@ void RequestSuspension() { if (!ResetEvent(g_hResumeFromSuspension)) { exit(GetLastError()); } - InterlockedOr(&g_SuspensionRequested, 1); + _InterlockedOr(&g_SuspensionRequested, 1); } } @@ -80,7 +80,7 @@ void ResumeFromSuspension() { // This is meant to be called from the main thread only. assert(g_SuspensionRequested && SuspensionCompleted()); - InterlockedAnd(&g_SuspensionRequested, 0); + _InterlockedAnd(&g_SuspensionRequested, 0); if (!SetEvent(g_hResumeFromSuspension)) { exit(GetLastError()); } diff --git a/src/Win32_Interop/win32_types.h b/src/Win32_Interop/win32_types.h index 56b74bd0815..97698138b1c 100644 --- a/src/Win32_Interop/win32_types.h +++ b/src/Win32_Interop/win32_types.h @@ -56,9 +56,9 @@ typedef double PORT_LONGDOUBLE; typedef __int64 PORT_LONG; typedef unsigned __int64 PORT_ULONG; #else - typedef _W64 long ssize_t; - typedef _W64 long PORT_LONG; - typedef _W64 unsigned long PORT_ULONG; + typedef long ssize_t; + typedef long PORT_LONG; + typedef unsigned long PORT_ULONG; #endif #ifdef _WIN64