Compare commits

...

19 commits
1.1 ... master

Author SHA1 Message Date
b5df8230f0 Set version to 2.1.1
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-07-28 10:08:44 +02:00
7c31b0bca6 Add Slovenian localization
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-07-28 10:08:05 +02:00
912814c70a Cleanup VC project file
Visual Studio keeps separate settings for each Configuration|Platform
pair, exploding the project file and making it error prone to maintain.

Signed-off-by: Simon Rozman <simon@rozman.si>
2020-07-28 10:03:29 +02:00
60d4da100e Reformat the source code
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-07-28 09:53:58 +02:00
908fec06e4 Set version to 2.1
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-07-28 09:40:34 +02:00
6023e8be89 Put output binaries in solution folder
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-07-28 09:40:34 +02:00
33ac1031d9 Add documentation and samples
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-07-28 09:31:32 +02:00
ebdcc0ecab Declare open-source
Signed-off-by: Simon Rozman <simon@rozman.si>
2020-07-28 09:21:29 +02:00
eb4b3fae4c Add timestamp to warning prompt title 2020-07-28 08:51:22 +02:00
967aa86b33 svn:ignore => .gitignore 2020-07-28 08:47:54 +02:00
4dfa2ceef9 Set version to 2.0
git-svn-id: https://svn.rozman.si/svn/VS/LockIfOutOfLogonHours/trunk@25 8318ca12-60fa-704f-b1c2-085edf00c0b2
2020-07-27 13:24:54 +00:00
7ec7adf4ba Add missing colophone
git-svn-id: https://svn.rozman.si/svn/VS/LockIfOutOfLogonHours/trunk@24 8318ca12-60fa-704f-b1c2-085edf00c0b2
2020-07-27 13:10:38 +00:00
9aabd11d94 Cleanup
git-svn-id: https://svn.rozman.si/svn/VS/LockIfOutOfLogonHours/trunk@23 8318ca12-60fa-704f-b1c2-085edf00c0b2
2020-07-27 13:10:25 +00:00
c083bb6327 Add ARM64 support
git-svn-id: https://svn.rozman.si/svn/VS/LockIfOutOfLogonHours/trunk@22 8318ca12-60fa-704f-b1c2-085edf00c0b2
2020-07-27 13:05:54 +00:00
5ea3c95ad3 Display notification up to 10 minutes before lockout
git-svn-id: https://svn.rozman.si/svn/VS/LockIfOutOfLogonHours/trunk@21 8318ca12-60fa-704f-b1c2-085edf00c0b2
2020-07-27 13:03:07 +00:00
c03e3464ea Upgrade project to VisualStudio 2019
git-svn-id: https://svn.rozman.si/svn/VS/LockIfOutOfLogonHours/trunk@20 8318ca12-60fa-704f-b1c2-085edf00c0b2
2020-07-27 12:58:09 +00:00
a3fadf2e9f Switch to static RTL
git-svn-id: https://svn.rozman.si/svn/VS/LockIfOutOfLogonHours/trunk@19 8318ca12-60fa-704f-b1c2-085edf00c0b2
2020-07-27 12:04:48 +00:00
f00c5ed98e Clean project settings and revert mostly to defaults
git-svn-id: https://svn.rozman.si/svn/VS/LockIfOutOfLogonHours/trunk@18 8318ca12-60fa-704f-b1c2-085edf00c0b2
2020-07-27 12:03:57 +00:00
281c545abf Fix Debug|x64 project mapping in solution
git-svn-id: https://svn.rozman.si/svn/VS/LockIfOutOfLogonHours/trunk@17 8318ca12-60fa-704f-b1c2-085edf00c0b2
2020-07-27 11:59:04 +00:00
10 changed files with 118 additions and 120 deletions

13
.gitignore vendored Normal file
View file

@ -0,0 +1,13 @@
# /
/ARM64
/Win32
/x64
# /LockIfOutOfLogonHours/
/LockIfOutOfLogonHours/*.user
/LockIfOutOfLogonHours/Debug.ARM64
/LockIfOutOfLogonHours/Debug.Win32
/LockIfOutOfLogonHours/Debug.x64
/LockIfOutOfLogonHours/Release.ARM64
/LockIfOutOfLogonHours/Release.Win32
/LockIfOutOfLogonHours/Release.x64

19
COPYING Normal file
View file

@ -0,0 +1,19 @@
Copyright © 2015-2020 Simon Rozman (simon@rozman.si)
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.

View file

@ -1,20 +1,28 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29728.190
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "LockIfOutOfLogonHours", "LockIfOutOfLogonHours\LockIfOutOfLogonHours.vcxproj", "{0590B123-BA85-42FB-8DED-32A1AB062B9B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|Win32 = Debug|Win32
Debug|x64 = Debug|x64
Release|ARM64 = Release|ARM64
Release|Win32 = Release|Win32
Release|x64 = Release|x64
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Debug|ARM64.ActiveCfg = Debug|ARM64
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Debug|ARM64.Build.0 = Debug|ARM64
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Debug|Win32.ActiveCfg = Debug|Win32
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Debug|Win32.Build.0 = Debug|Win32
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Debug|x64.ActiveCfg = Debug|Win32
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Debug|x64.Build.0 = Debug|Win32
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Debug|x64.ActiveCfg = Debug|x64
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Debug|x64.Build.0 = Debug|x64
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Release|ARM64.ActiveCfg = Release|ARM64
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Release|ARM64.Build.0 = Release|ARM64
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Release|Win32.ActiveCfg = Release|Win32
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Release|Win32.Build.0 = Release|Win32
{0590B123-BA85-42FB-8DED-32A1AB062B9B}.Release|x64.ActiveCfg = Release|x64
@ -23,4 +31,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {92CDF175-C3B2-43A4-8F1A-091DC4007E5C}
EndGlobalSection
EndGlobal

View file

@ -0,0 +1,10 @@
// SPDX-License-Identifier: MIT
// Copyright © 2015-2020 Simon Rozman (simon@rozman.si)
#ifndef __LOCK_IF_OUT_OF_LOGON_HOURS_H__
#define __LOCK_IF_OUT_OF_LOGON_HOURS_H__
#define IDS_WARNING_TITLE_FMT 0
#define IDS_WARNING_MSG_FMT 1
#endif

View file

@ -1,6 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|ARM64">
<Configuration>Debug</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
@ -9,6 +13,10 @@
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|ARM64">
<Configuration>Release</Configuration>
<Platform>ARM64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
@ -24,164 +32,70 @@
<RootNamespace>LockIfOutOfLogonHours</RootNamespace>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
<PlatformToolset>v142</PlatformToolset>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)'=='Debug'" Label="Configuration">
<UseDebugLibraries>true</UseDebugLibraries>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<PropertyGroup Condition="'$(Configuration)'=='Release'" Label="Configuration">
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</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 Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
<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 Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
<ImportGroup Label="PropertySheets">
<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'">
<PropertyGroup Condition="'$(Configuration)'=='Debug'">
<OutDir>$(Configuration).$(Platform)\</OutDir>
<IntDir>$(Configuration).$(Platform)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<OutDir>$(Configuration).$(Platform)\</OutDir>
<PropertyGroup Condition="'$(Configuration)'=='Release'">
<OutDir>$(SolutionDir)$(Platform)\</OutDir>
<IntDir>$(Configuration).$(Platform)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<OutDir>$(Configuration).$(Platform)\</OutDir>
<IntDir>$(Configuration).$(Platform)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<OutDir>$(Configuration).$(Platform)\</OutDir>
<IntDir>$(Configuration).$(Platform)\</IntDir>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ItemDefinitionGroup>
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<SmallerTypeCheck>true</SmallerTypeCheck>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAsManaged>false</CompileAsManaged>
<BrowseInformation>true</BrowseInformation>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>secur32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ResourceCompile>
<NullTerminateStrings>true</NullTerminateStrings>
</ResourceCompile>
<Manifest>
<EnableDpiAwareness>PerMonitorHighDPIAware</EnableDpiAwareness>
</Manifest>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Debug'">
<ClCompile>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<WarningLevel>Level4</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<StringPooling>true</StringPooling>
<SmallerTypeCheck>true</SmallerTypeCheck>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAsManaged>false</CompileAsManaged>
<BrowseInformation>true</BrowseInformation>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalDependencies>secur32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>Full</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization>
<StringPooling>true</StringPooling>
<SmallerTypeCheck>false</SmallerTypeCheck>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAsManaged>false</CompileAsManaged>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<BrowseInformation>true</BrowseInformation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreaded</RuntimeLibrary>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<AdditionalDependencies>secur32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level4</WarningLevel>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<Optimization>Full</Optimization>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<OmitFramePointers>true</OmitFramePointers>
<WholeProgramOptimization>true</WholeProgramOptimization>
<StringPooling>true</StringPooling>
<SmallerTypeCheck>false</SmallerTypeCheck>
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAsManaged>false</CompileAsManaged>
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
<BrowseInformation>true</BrowseInformation>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<BufferSecurityCheck>false</BufferSecurityCheck>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<IgnoreAllDefaultLibraries>true</IgnoreAllDefaultLibraries>
<AdditionalDependencies>secur32.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
@ -190,6 +104,9 @@
<ItemGroup>
<ResourceCompile Include="LockIfOutOfLogonHours.rc" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="LockIfOutOfLogonHours.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>

View file

@ -19,4 +19,9 @@
<Filter>Resource Files</Filter>
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="LockIfOutOfLogonHours.h">
<Filter>Source Files</Filter>
</ClInclude>
</ItemGroup>
</Project>

23
README.md Normal file
View file

@ -0,0 +1,23 @@
# LockIfOutOfLogonHours - Lock Windows User Desktop When Logon Hours Denied
LockIfOutOfLogonHours is a small utility to test if the invoking user is within permitted logon hours or not.
If not, the utility locks the user desktop, locking the user out but not killing users' work.
If logon hours are to expire within 10 minutes, a prompt is displayed encouraging the user to finish her/his work in time.
## Running
Use Task Scheduler to schedule the `LockIfOutOfLogonHours.exe` to run periodically as the interactive user.
Active Directory allows configuring logon hours rounded to the whole hours only. Therefore, it makes sense to trigger the `LockIfOutOfLogonHours.exe` to run:
- Sometime before the hour is out (up to 10 minutes before the hour is out, e.g. 0:55, 1:55, ..., 23:55). This trigger notifies the user.
- At or just after the hour is out (e.g. 0:01, 1:01, ..., 23:01). This trigger locks the user out.
A sample task XML to be imported in Task Scheduler can be found in [`samples\LockIfOutOfLogonHours.xml`](samples/LockIfOutOfLogonHours.xml).
## Building
Microsoft Visual Studio 2019 is required.

Binary file not shown.