Skip to content
This repository has been archived by the owner on Feb 20, 2021. It is now read-only.

Commit

Permalink
Fix 32-bit build
Browse files Browse the repository at this point in the history
  • Loading branch information
orangemocha committed Jun 24, 2015
1 parent 4f384b9 commit b8009c2
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 62 deletions.
106 changes: 53 additions & 53 deletions msvs/msi/RedisMsi.CustomActions/CustomAction.cs
Original file line number Diff line number Diff line change
@@ -1,42 +1,42 @@
using System;
using System.IO;
using System;
using System.IO;
using Microsoft.Deployment.WindowsInstaller;
using System.ServiceProcess;

namespace RedisMsi.CustomActions
{
/// <summary>
/// Defines actions to take during the MSI install that don't
/// come standard with WiX.
/// </summary>
public class CustomActions
{
/// <summary>
/// Overwrites settings in the Redis config file using values from the installer.
/// </summary>
/// <param name="session">The install session context</param>
/// <returns>Returns Success when the method completes. Exceptions will bubble up and
/// cause the installer to roll back.</returns>
[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
{
/// <summary>
/// Defines actions to take during the MSI install that don't
/// come standard with WiX.
/// </summary>
public class CustomActions
{
/// <summary>
/// Overwrites settings in the Redis config file using values from the installer.
/// </summary>
/// <param name="session">The install session context</param>
/// <returns>Returns Success when the method completes. Exceptions will bubble up and
/// cause the installer to roll back.</returns>
[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;
}

/// <summary>
/// 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
/// to add a firewall exception. Note that just setting the state of the
/// firewall to off does not pose a problem.
/// </summary>
/// <param name="session"></param>
/// <returns></returns>
/// <returns></returns>
[CustomAction]
public static ActionResult CheckIfFirewallServiceRunning(Session session)
{
Expand All @@ -49,25 +49,25 @@ public static ActionResult CheckIfFirewallServiceRunning(Session session)
}

return ActionResult.Success;
}

/// <summary>
/// Updates the port in the config file.
/// </summary>
/// <param name="portToUse">The port to have Redis listen at</param>
/// <param name="configFilePath">The path to the Redis config file</param>
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.");
}
}
}
}
}

/// <summary>
/// Updates the port in the config file.
/// </summary>
/// <param name="portToUse">The port to have Redis listen at</param>
/// <param name="configFilePath">The path to the Redis config file</param>
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.");
}
}
}
}
6 changes: 2 additions & 4 deletions src/Win32_Interop/Win32_Interop.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,7 @@ link.exe -dll -noentry resources/EventLog.res -out:$(TargetDir)EventLog.dll
</Link>
<Lib>
<IgnoreSpecificDefaultLibraries>MSVCRT</IgnoreSpecificDefaultLibraries>
<AdditionalDependencies>
</AdditionalDependencies>
<AdditionalDependencies>DbgHelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<CustomBuild>
<Command>
Expand Down Expand Up @@ -224,8 +223,7 @@ link.exe -dll -noentry resources/EventLog.res -out:$(TargetDir)EventLog.dll
<OptimizeReferences>true</OptimizeReferences>
</Link>
<Lib>
<AdditionalDependencies>
</AdditionalDependencies>
<AdditionalDependencies>DbgHelp.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Lib>
<CustomBuild>
<Command>
Expand Down
4 changes: 2 additions & 2 deletions src/Win32_Interop/Win32_ThreadControl.c
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ void RequestSuspension() {
if (!ResetEvent(g_hResumeFromSuspension)) {
exit(GetLastError());
}
InterlockedOr(&g_SuspensionRequested, 1);
_InterlockedOr(&g_SuspensionRequested, 1);
}
}

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());
}
Expand Down
6 changes: 3 additions & 3 deletions src/Win32_Interop/win32_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b8009c2

Please sign in to comment.