-
Notifications
You must be signed in to change notification settings - Fork 8.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch to v5 UUIDs as profile GUIDs for the default profiles (#913)
This commit switches the GUIDs for default profiles from being randomly generated to being version 5 UUIDs. More info in #870. ## PR Checklist * [x] Closes #870 * [x] CLA signed * [x] Tests added/passed * [x] Requires documentation to be updated (#883) * [x] I've discussed this with core contributors already. ## Detailed Description of the Pull Request / Additional comments This commit has a number of changes that seem ancillary, but they're general goodness. Let me explain: * I've added a whole new Types test library with only two tests in * Since UUIDv5 generation requires SHA1, we needed to take a dependency on bcrypt * I honestly don't think we should have to link bcrypt in conhost, but LTO should take care of that * I considered adding a new Terminal-specific Utils/Types library, but that seemed like a waste * The best way to link bcrypt turned out to be in line with a discussion @miniksa and I had, where we decided we both love APISets and think that the console should link against them exclusively... so I've added `onecore_apiset.lib` to the front of the link line, where it will deflect the linker away from most of the other libs automagically. ``` StartGroup: UuidTests::TestV5UuidU8String Verify: AreEqual(uuidExpected, uuidActual) EndGroup: UuidTests::TestV5UuidU8String [Passed] StartGroup: UuidTests::TestV5UuidU16String Verify: AreEqual(uuidExpected, uuidActual) EndGroup: UuidTests::TestV5UuidU16String [Passed] ```
- Loading branch information
Showing
19 changed files
with
285 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
DIRS=lib \ | ||
|
||
ut_types \ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
//Autogenerated file name + version resource file for Device Guard whitelisting effort | ||
|
||
#include <windows.h> | ||
#include <ntverp.h> | ||
|
||
#define VER_FILETYPE VFT_UNKNOWN | ||
#define VER_FILESUBTYPE VFT2_UNKNOWN | ||
#define VER_FILEDESCRIPTION_STR ___TARGETNAME | ||
#define VER_INTERNALNAME_STR ___TARGETNAME | ||
#define VER_ORIGINALFILENAME_STR ___TARGETNAME | ||
|
||
#include "common.ver" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(SolutionDir)src\common.build.pre.props" /> | ||
<ItemGroup> | ||
<ClCompile Include="UuidTests.cpp" /> | ||
<ClCompile Include="..\precomp.cpp"> | ||
<PrecompiledHeader>Create</PrecompiledHeader> | ||
</ClCompile> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\lib\types.vcxproj"> | ||
<Project>{18d09a24-8240-42d6-8cb6-236eee820263}</Project> | ||
</ProjectReference> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ClInclude Include="..\precomp.h" /> | ||
</ItemGroup> | ||
<PropertyGroup> | ||
<ProjectGuid>{34de34d3-1cd6-4ee3-8bd9-a26b5b27ec73}</ProjectGuid> | ||
<Keyword>Win32Proj</Keyword> | ||
<RootNamespace>TypesUnitTests</RootNamespace> | ||
<ProjectName>Types.Unit.Tests</ProjectName> | ||
<TargetName>Types.Unit.Tests</TargetName> | ||
</PropertyGroup> | ||
<ItemDefinitionGroup> | ||
<ClCompile> | ||
<AdditionalIncludeDirectories>..;$(SolutionDir)src\inc;$(SolutionDir)src\inc\test;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> | ||
</ClCompile> | ||
</ItemDefinitionGroup> | ||
<!-- Careful reordering these. Some default props (contained in these files) are order sensitive. --> | ||
<Import Project="$(SolutionDir)src\common.build.dll.props" /> | ||
<Import Project="$(SolutionDir)src\common.build.post.props" /> | ||
<Import Project="$(SolutionDir)src\common.build.tests.props" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT license. | ||
|
||
#include "precomp.h" | ||
#include "WexTestClass.h" | ||
#include "..\..\inc\consoletaeftemplates.hpp" | ||
|
||
#include "..\inc\utils.hpp" | ||
|
||
using namespace WEX::Common; | ||
using namespace WEX::Logging; | ||
using namespace WEX::TestExecution; | ||
|
||
using namespace Microsoft::Console::Utils; | ||
|
||
class UuidTests | ||
{ | ||
// {AD56DE9E-5167-41B6-80EB-FB19F7927D1A} | ||
static constexpr GUID TEST_NAMESPACE_GUID{ 0xad56de9e, 0x5167, 0x41b6, | ||
{ 0x80, 0xeb, 0xfb, 0x19, 0xf7, 0x92, 0x7d, 0x1a } }; | ||
|
||
TEST_CLASS(UuidTests); | ||
|
||
TEST_METHOD(TestV5UuidU8String) | ||
{ | ||
const GUID uuidExpected{ 0x8b9d4336, 0x0c82, 0x54c4, | ||
{ 0xb3, 0x15, 0xf1, 0xd2, 0xd2, 0x7e, 0xc6, 0xda} }; | ||
|
||
std::string name{ "testing" }; | ||
auto uuidActual = CreateV5Uuid(TEST_NAMESPACE_GUID, gsl::as_bytes(gsl::make_span(name))); | ||
|
||
VERIFY_ARE_EQUAL(uuidExpected, uuidActual); | ||
} | ||
|
||
TEST_METHOD(TestV5UuidU16String) | ||
{ | ||
const GUID uuidExpected{ 0xe04fb1f7, 0x739d, 0x5d63, | ||
{ 0xbb, 0x18, 0xe0, 0xea, 0x00, 0xb1, 0x9e, 0xe8 } }; | ||
|
||
// This'll come out in little endian; the reference GUID was generated as such. | ||
std::wstring name{ L"testing" }; | ||
auto uuidActual = CreateV5Uuid(TEST_NAMESPACE_GUID, gsl::as_bytes(gsl::make_span(name))); | ||
|
||
VERIFY_ARE_EQUAL(uuidExpected, uuidActual); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<Project DefaultTargets="ProductBuild" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
<Import Project="$(NTMAKEENV)\UniversalTest\Microsoft.TestInfrastructure.UniversalTest.props" /> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
!include ..\..\project.unittest.inc | ||
|
||
# ------------------------------------- | ||
# Program Information | ||
# ------------------------------------- | ||
|
||
TARGETNAME = Microsoft.Console.Types.UnitTests | ||
TARGETTYPE = DYNLINK | ||
DLLDEF = | ||
|
||
# ------------------------------------- | ||
# Sources, Headers, and Libraries | ||
# ------------------------------------- | ||
|
||
SOURCES = \ | ||
$(SOURCES) \ | ||
UuidTests.cpp \ | ||
DefaultResource.rc \ | ||
|
||
INCLUDES = \ | ||
.. \ | ||
$(INCLUDES) \ | ||
|
||
TARGETLIBS = \ | ||
$(WINCORE_OBJ_PATH)\console\open\src\types\lib\$(O)\ConTypes.lib \ | ||
$(TARGETLIBS) \ | ||
|
||
# ------------------------------------- | ||
# Localization | ||
# ------------------------------------- | ||
|
||
# Autogenerated. Sets file name for Device Guard whitelisting effort, used in RC.exe. | ||
C_DEFINES = $(C_DEFINES) -D___TARGETNAME="""$(TARGETNAME).$(TARGETTYPE)""" | ||
MUI_VERIFY_NO_LOC_RESOURCE = 1 |
Oops, something went wrong.