-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Rename/Update PowerShell ETW manifest to remove the Windows PowerShell dependency. #5360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line seems unnecessary.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair enough :)
|
The manifest has some windows powershell specific resources. Should this PR include the cleanup work of those resources? |
|
@daxian-dbw I think we can do the cleanup of the manifest in a separate PR |
|
@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: 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. |
| [string] $command = $null | ||
| if ($Unregister) | ||
| { | ||
| $command = [string]::Format("wevtutil um {0}", $manifest.FullName) |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
@TravisEz13 @adityapatwardhan Can you please also review this PR? |
…the ETW resources.
…arnings/errors. Replace [string]::Format with value -f
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') |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
|
@TravisEz13 @adityapatwardhan Do you have any feedback? |
|
|
||
| #define VER_FILETYPE VFT_DLL | ||
| #define VER_FILESUBTYPE VFT2_UNKNOWN | ||
| #define VER_FILEDESCRIPTION_STR "DSC" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be PowerShellCore?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed
There was a problem hiding this comment.
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.
adityapatwardhan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
|
@daxian-dbw This should be good to go. |
|
Test failure in AppVeyor is a known issue, but Travis CI hasn't finished yet. |
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.