Skip to content

Commit

Permalink
Merge pull request #34 from idietmoran/dev-win32
Browse files Browse the repository at this point in the history
fixed an issue where the program failed to start on some systems
  • Loading branch information
Stateford authored May 4, 2018
2 parents 64484d3 + 8c5bcd5 commit 9dff1be
Show file tree
Hide file tree
Showing 4 changed files with 202 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog
All notable changes to this project will be documented in this file

## [1.0.8] HOTFIX
### Fixed
- Fixed an issue where the program would fail to start on some systems.

## [1.0.8]
### Fixed
- Fixed an issue where borderless windows without fullscreen would cause the game to not work properly
Expand Down
31 changes: 31 additions & 0 deletions Display-Lock.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.27428.2027
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Display-Lock", "Display-Lock.vcxproj", "{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}.Debug|x64.ActiveCfg = Debug|x64
{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}.Debug|x64.Build.0 = Debug|x64
{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}.Debug|x86.ActiveCfg = Debug|Win32
{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}.Debug|x86.Build.0 = Debug|Win32
{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}.Release|x64.ActiveCfg = Release|x64
{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}.Release|x64.Build.0 = Release|x64
{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}.Release|x86.ActiveCfg = Release|Win32
{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {306CC9B4-3A6A-4B6A-A3A7-1A23462D1ABD}
EndGlobalSection
EndGlobal
159 changes: 159 additions & 0 deletions Display-Lock.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>15.0</VCProjectVersion>
<ProjectGuid>{D4B31B75-0BA0-4A34-94DD-84A3BE35E848}</ProjectGuid>
<Keyword>Win32Proj</Keyword>
<WindowsTargetPlatformVersion>10.0.16299.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v141</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<Optimization>Disabled</Optimization>
<SDLCheck>false</SDLCheck>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
</ClCompile>
<Link>
<TargetMachine>MachineX86</TargetMachine>
<GenerateDebugInformation>true</GenerateDebugInformation>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<AdditionalDependencies>Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ClCompile>
<WarningLevel>Level3</WarningLevel>
</ClCompile>
<ClCompile>
<SDLCheck>false</SDLCheck>
<PreprocessorDefinitions>_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Link>
<AdditionalDependencies>Shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<SubSystem>Windows</SubSystem>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="src\bin\menu.c" />
<ClCompile Include="src\bin\win.c" />
<ClCompile Include="src\displayLock-win32.c" />
<ClCompile Include="src\settings.c" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\bin\menu.h" />
<ClInclude Include="src\bin\win.h" />
<ClInclude Include="src\displayLock-win32.h" />
<ClInclude Include="src\header.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\settings.h" />
<ClInclude Include="src\targetver.h" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="src\displayLock-win32.rc" />
</ItemGroup>
<ItemGroup>
<None Include="displayLock-win32.aps" />
<None Include="src\displayLock-win32.aps" />
</ItemGroup>
<ItemGroup>
<Manifest Include="src\displayLock-win32.manifest" />
</ItemGroup>
<ItemGroup>
<Image Include="src\dl_logo_ZEB_icon.ico" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
14 changes: 8 additions & 6 deletions src/settings.c
Original file line number Diff line number Diff line change
Expand Up @@ -52,18 +52,18 @@ void writeSettings(SETTINGS settings)
if(!FAILED(SHGetKnownFolderPath(&FOLDERID_RoamingAppData, 0, NULL, &path)))
{
// create directory
PathAppend(path, TEXT("DisplayLock"));
PathAppendW(path, TEXT("DisplayLock"));
CreateDirectory(path, NULL);
// create file
PathAppend(path, TEXT("\\settings.DLOCK"));
PathAppendW(path, TEXT("\\settings.DLOCK"));
FILE *file = _wfopen(path, TEXT("w"));

if(file != NULL || file == 0)
{
fwrite(&settings, sizeof(settings), 1, file);
fclose(file);
}

fclose(file);
}
// free memory allocated by SHGetKnownFolderPath
CoTaskMemFree(path);
Expand All @@ -78,17 +78,19 @@ void readSettings(SETTINGS *settings)

if(!FAILED(SHGetKnownFolderPath(&FOLDERID_RoamingAppData, 0, NULL, &path)))
{
PathAppend(path, TEXT("DisplayLock\\settings.DLOCK"));
PathAppendW(path, TEXT("DisplayLock\\settings.DLOCK"));
FILE *file = _wfopen(path, TEXT("r"));

// if if opening file is succcessful read into struct
// otherwise use default settings
if (file != NULL || file == 0)
if (file != NULL && file == 0)
{
fread(settings, sizeof(*settings), 1, file);
fclose(file);
}
else
defaultSettings(settings);

fclose(file);
}
else
defaultSettings(settings);
Expand Down

0 comments on commit 9dff1be

Please sign in to comment.