Skip to content

Conversation

@dantraMSFT
Copy link
Contributor

@dantraMSFT dantraMSFT commented Nov 7, 2017

This is the first part of the fix for #4939 and include the following changes:
1: Rename the manifest file (PowerShell.Core.Instrumentation.man)
2: Change the ETW provider GUID and name and move to outside of the Microsoft/Windows tree in the event log. The provider name is now simply PowerShellCore. [edited by @daxian-dbw: provider GUID and provider names are not changed in this PR]
3: Create a registration script for registering. (RegisterManifest.ps1)
4: Produce a binary resource-only DLL to contain the ETW manifest and associated string resources. (PowerShell.Core.Instrumentation.dll)

The second part will involve creating a nuget package that will be pulled in at build time, similar to psl-native. for Linux Additionally, tests to verify the provider registration and event raising will be included as part of the nuget package work.

build.psm1 Outdated

# Place the remoting configuration script in the same directory
# as the binary so it will get published.
Copy-Item .\Install-PowerShellRemoting.ps1 $dstPath
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bin placing Install-PowerShellRemoting.ps1 has been removed in #5330

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

build.psm1 Outdated
Start-NativeExecution { Invoke-Expression -Command:$command }

# Copy the binaries and manifest to the packaging directory
$dstPath = "$PSScriptRoot\src\powershell-win-core"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line seems unnecessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, but I don't want to assume the previous build step sets it as expected.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough :)

@daxian-dbw
Copy link
Member

The manifest has some windows powershell specific resources. Should this PR include the cleanup work of those resources?

@SteveL-MSFT
Copy link
Member

@daxian-dbw I think we can do the cleanup of the manifest in a separate PR

@dantraMSFT
Copy link
Contributor Author

@daxian-dbw I did do an initial scrub by removing all events that are not referenced in code (i.e, scanning for all PSEvents.* code references). Going further would require removing Windows-specific code which I thought would only muddle the PR.

@daxian-dbw daxian-dbw added this to the 6.0.0-RC milestone Nov 7, 2017
@dantraMSFT
Copy link
Contributor Author

@daxian-dbw: I made you the assignee; let me know if it should be someone else. I need to create a nuget package once this is merged.
Thanks,

[string] $command = $null
if ($Unregister)
{
$command = [string]::Format("wevtutil um {0}", $manifest.FullName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use "wevtutil um {0}" -f $manifest.FullName for the formatting.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

}
else
{
$command = [string]::Format("wevtutil.exe im {0} /rf:{1} /mf:{1}", $manifest.FullName, $binary.FullName)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@daxian-dbw
Copy link
Member

@TravisEz13 @adityapatwardhan Can you please also review this PR?

build.psm1 Outdated
$FilesToCopy = @(
[IO.Path]::Combine($location, $Configuration, 'PowerShell.Core.Instrumentation.dll'),
[IO.Path]::Combine($location, 'PowerShell.Core.Instrumentation.man')
[IO.Path]::Combine($location, 'RegisterManifest.ps1')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do not bin-place the .ps1 and .man file. Instead, we can copy them to publish folder directly by powershell-win-core.csproj file. See how we bin-place install-powershellremoting here.

In this way, we don't need to add a .gitignore file in the powershell-win-core folder to ignore the .man file there.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

@dantraMSFT
Copy link
Contributor Author

@TravisEz13 @adityapatwardhan Do you have any feedback?


#define VER_FILETYPE VFT_DLL
#define VER_FILESUBTYPE VFT2_UNKNOWN
#define VER_FILEDESCRIPTION_STR "DSC"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be PowerShellCore?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dantraMSFT please push your fix so that @adityapatwardhan can sign off.

Copy link
Member

@adityapatwardhan adityapatwardhan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dantraMSFT
Copy link
Contributor Author

@daxian-dbw This should be good to go.

@daxian-dbw
Copy link
Member

Test failure in AppVeyor is a known issue, but Travis CI hasn't finished yet.

@daxian-dbw daxian-dbw merged commit 3bfae4f into PowerShell:master Nov 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants