From e79570b3d22fa5cf4c6798887c690942f4750ef8 Mon Sep 17 00:00:00 2001 From: Brian Wilhite Date: Mon, 7 Jun 2021 14:14:43 -0400 Subject: [PATCH 1/5] addressed REG_MULTI_SZ double null term issue --- .../GPRegistryPolicyFileParser.psm1 | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/source/Modules/GPRegistryPolicyFileParser/GPRegistryPolicyFileParser.psm1 b/source/Modules/GPRegistryPolicyFileParser/GPRegistryPolicyFileParser.psm1 index 2b220d4..5763d54 100644 --- a/source/Modules/GPRegistryPolicyFileParser/GPRegistryPolicyFileParser.psm1 +++ b/source/Modules/GPRegistryPolicyFileParser/GPRegistryPolicyFileParser.psm1 @@ -305,12 +305,25 @@ function New-GPRegistrySettingsEntry # get data bytes then compute byte size based on data and type switch ($RegistryPolicy.ValueType) { - { @([RegType]::REG_SZ, [RegType]::REG_EXPAND_SZ, [RegType]::REG_MULTI_SZ) -contains $_ } + { @([RegType]::REG_SZ, [RegType]::REG_EXPAND_SZ) -contains $_ } { $dataBytes = [System.Text.Encoding]::Unicode.GetBytes($RegistryPolicy.ValueData + "`0") $dataSize = $dataBytes.Count } + ([RegType]::REG_MULTI_SZ) + { + <# + When REG_MULTI_SZ ValueData contains an array, we need to null terminate each item. Furthermore + "Data in the Data field to be interpreted as a sequence of characters terminated by two null Unicode + characters, and within that sequence zero or more null-terminated Unicode strings can exist." + https://docs.microsoft.com/en-us/openspecs/windows_protocols/ms-gpreg/5c092c22-bf6b-4e7f-b180-b20743d368f5 + #> + $valueDataNullTermJoin = $RegistryPolicy.ValueData -join "`0" + $dataBytes = [System.Text.Encoding]::Unicode.GetBytes($valueDataNullTermJoin + "`0`0") + $dataSize = $dataBytes.Count + } + ([RegType]::REG_BINARY) { $dataBytes = [System.Text.Encoding]::Unicode.GetBytes($RegistryPolicy.ValueData) From 8cb7ef541f9b8c244eb972e47b3b5e91693ad213 Mon Sep 17 00:00:00 2001 From: Brian Wilhite Date: Mon, 7 Jun 2021 14:19:02 -0400 Subject: [PATCH 2/5] updated changelog.md --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 245f175..bea4b53 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- GPRegistryPolicyDsc + - Fixed REG_MULTI_SZ double null termination issue ([issue #25](https://github.com/dsccommunity/GPRegistryPolicyDsc/issues/25)). + ## [1.2.0] - 2020-03-13 ### Added From 6243d4c53e7507ad0346519836cf7fb99f888960 Mon Sep 17 00:00:00 2001 From: Brian Wilhite Date: Mon, 7 Jun 2021 16:05:36 -0400 Subject: [PATCH 3/5] build framework updates --- RequiredModules.psd1 | 8 +++++--- build.yaml | 6 ++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/RequiredModules.psd1 b/RequiredModules.psd1 index c59e076..ae783df 100644 --- a/RequiredModules.psd1 +++ b/RequiredModules.psd1 @@ -6,15 +6,17 @@ } } - invokeBuild = 'latest' + InvokeBuild = 'latest' PSScriptAnalyzer = 'latest' - pester = 'latest' + Pester = '4.10.1' Plaster = 'latest' - ModuleBuilder = '1.0.0' + ModuleBuilder = 'latest' ChangelogManagement = 'latest' Sampler = 'latest' + 'Sampler.GitHubTasks' = 'latest' MarkdownLinkCheck = 'latest' 'DscResource.Test' = 'latest' 'DscResource.AnalyzerRules' = 'latest' xDscResourceDesigner = 'latest' + 'DscResource.DocGenerator' = 'latest' } diff --git a/build.yaml b/build.yaml index c052e03..db38677 100644 --- a/build.yaml +++ b/build.yaml @@ -2,7 +2,7 @@ #################################################### # ModuleBuilder Configuration # #################################################### -CopyDirectories: +CopyPaths: - en-US - DSCResources - Modules @@ -22,6 +22,8 @@ BuildWorkflow: - Build_Module_ModuleBuilder - Build_NestedModules_ModuleBuilder - Create_changelog_release_output + - Generate_Conceptual_Help + - Generate_Wiki_Content pack: - build @@ -36,7 +38,7 @@ BuildWorkflow: publish: - Publish_release_to_GitHub - - publish_module_to_gallery # runs if nuget is not available + - publish_module_to_gallery #################################################### From 1c4e5fb1a325841ec61524f9d28e3b73becf0c12 Mon Sep 17 00:00:00 2001 From: Brian Wilhite Date: Mon, 7 Jun 2021 16:13:11 -0400 Subject: [PATCH 4/5] removed unknown build tasks from yaml --- build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/build.yaml b/build.yaml index db38677..5469a5d 100644 --- a/build.yaml +++ b/build.yaml @@ -22,8 +22,6 @@ BuildWorkflow: - Build_Module_ModuleBuilder - Build_NestedModules_ModuleBuilder - Create_changelog_release_output - - Generate_Conceptual_Help - - Generate_Wiki_Content pack: - build From 74eb631224ec71e04d109426762bdc5b9207edb1 Mon Sep 17 00:00:00 2001 From: Brian Wilhite Date: Mon, 7 Jun 2021 16:26:02 -0400 Subject: [PATCH 5/5] updated to a supported windows based vmImage --- azure-pipelines.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index af2f76f..6c3b703 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -44,7 +44,7 @@ stages: - job: Test_HQRM displayName: 'HQRM' pool: - vmImage: 'win1803' + vmImage: 'windows-2019' timeoutInMinutes: 0 steps: - task: DownloadBuildArtifacts@0