diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..09f2419b9c9 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,162 @@ +# editorconfig.org + +# This file should be kept in sync across https://www.github.com/dotnet/wpf and dotnet-wpf-int repos. + +# top-most EditorConfig file +root = true + +# Default settings: +# A newline ending every file +# Use 4 spaces as indentation +[*] +insert_final_newline = true +indent_style = space +indent_size = 4 + +[project.json] +indent_size = 2 + +# C# files +[*.cs] +# New line preferences +csharp_new_line_before_open_brace = all +csharp_new_line_before_else = true +csharp_new_line_before_catch = true +csharp_new_line_before_finally = true +csharp_new_line_before_members_in_object_initializers = true +csharp_new_line_before_members_in_anonymous_types = true +csharp_new_line_between_query_expression_clauses = true + +# Indentation preferences +csharp_indent_block_contents = true +csharp_indent_braces = false +csharp_indent_case_contents = true +csharp_indent_switch_labels = true +csharp_indent_labels = one_less_than_current + +# avoid this. unless absolutely necessary +dotnet_style_qualification_for_field = false:suggestion +dotnet_style_qualification_for_property = false:suggestion +dotnet_style_qualification_for_method = false:suggestion +dotnet_style_qualification_for_event = false:suggestion + +# only use var when it's obvious what the variable type is +csharp_style_var_for_built_in_types = false:none +csharp_style_var_when_type_is_apparent = false:none +csharp_style_var_elsewhere = false:suggestion + +# use language keywords instead of BCL types +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion +dotnet_style_predefined_type_for_member_access = true:suggestion + +# name all constant fields using PascalCase +dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion +dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields +dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style + +dotnet_naming_symbols.constant_fields.applicable_kinds = field +dotnet_naming_symbols.constant_fields.required_modifiers = const + +dotnet_naming_style.pascal_case_style.capitalization = pascal_case + +# static fields should have s_ prefix +dotnet_naming_rule.static_fields_should_have_prefix.severity = suggestion +dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields +dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style + +dotnet_naming_symbols.static_fields.applicable_kinds = field +dotnet_naming_symbols.static_fields.required_modifiers = static + +dotnet_naming_style.static_prefix_style.required_prefix = s_ +dotnet_naming_style.static_prefix_style.capitalization = camel_case + +# internal and private fields should be _camelCase +dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion +dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields +dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style + +dotnet_naming_symbols.private_internal_fields.applicable_kinds = field +dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal + +dotnet_naming_style.camel_case_underscore_style.required_prefix = _ +dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case + +# Code style defaults +dotnet_sort_system_directives_first = true +csharp_preserve_single_line_blocks = true +csharp_preserve_single_line_statements = false + +# Expression-level preferences +dotnet_style_object_initializer = true:suggestion +dotnet_style_collection_initializer = true:suggestion +dotnet_style_explicit_tuple_names = true:suggestion +dotnet_style_coalesce_expression = true:suggestion +dotnet_style_null_propagation = true:suggestion + +# Expression-bodied members +csharp_style_expression_bodied_methods = false:none +csharp_style_expression_bodied_constructors = false:none +csharp_style_expression_bodied_operators = false:none +csharp_style_expression_bodied_properties = true:none +csharp_style_expression_bodied_indexers = true:none +csharp_style_expression_bodied_accessors = true:none + +# Pattern matching +csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion +csharp_style_pattern_matching_over_as_with_null_check = true:suggestion +csharp_style_inlined_variable_declaration = true:suggestion + +# Null checking preferences +csharp_style_throw_expression = true:suggestion +csharp_style_conditional_delegate_call = true:suggestion + +# Space preferences +csharp_space_after_cast = false +csharp_space_after_colon_in_inheritance_clause = true +csharp_space_after_comma = true +csharp_space_after_dot = false +csharp_space_after_keywords_in_control_flow_statements = true +csharp_space_after_semicolon_in_for_statement = true +csharp_space_around_binary_operators = before_and_after +csharp_space_around_declaration_statements = do_not_ignore +csharp_space_before_colon_in_inheritance_clause = true +csharp_space_before_comma = false +csharp_space_before_dot = false +csharp_space_before_open_square_brackets = false +csharp_space_before_semicolon_in_for_statement = false +csharp_space_between_empty_square_brackets = false +csharp_space_between_method_call_empty_parameter_list_parentheses = false +csharp_space_between_method_call_name_and_opening_parenthesis = false +csharp_space_between_method_call_parameter_list_parentheses = false +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +csharp_space_between_method_declaration_name_and_open_parenthesis = false +csharp_space_between_method_declaration_parameter_list_parentheses = false +csharp_space_between_parentheses = false +csharp_space_between_square_brackets = false + +# C++ Files +[*.{cpp,h,in}] +curly_bracket_next_line = true +indent_brace_style = Allman + +# Xml project files +[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}] +indent_size = 2 + +# Xml build files +[*.builds] +indent_size = 2 + +# Xml files +[*.{xml,stylecop,resx,ruleset}] +indent_size = 2 + +# Xml config files +[*.{props,targets,config,nuspec}] +indent_size = 2 + +# Shell scripts +[*.sh] +end_of_line = lf +[*.{cmd, bat}] +end_of_line = crlf \ No newline at end of file diff --git a/.gitignore b/.gitignore index fbe9c3b4616..48f24dfd99a 100644 --- a/.gitignore +++ b/.gitignore @@ -26,6 +26,7 @@ bld/ # Visual Studio 2015/2017 cache/options directory .vs/ +.vscode/ # Uncomment if you have tasks that create the project's static files in wwwroot #wwwroot/ diff --git a/Directory.Build.props b/Directory.Build.props index f9fb5bdf628..dee717a01f6 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -1,15 +1,25 @@ - - - + + + $(TestWpfArcadeSdkPath) + $(TestWpfArcadeSdkPath)\ + - - $(CopyrightNetFoundation) - MIT + + $(MSBuildThisFileDirectory)eng\WpfArcadeSdk\ - - - true - full + + + $(WpfArcadeSdkPath)Sdk\Sdk.props + $(WpfArcadeSdkPath)Sdk\Sdk.targets + + + + + diff --git a/Directory.Build.targets b/Directory.Build.targets index fcdc2c1ad0a..1394a206741 100644 --- a/Directory.Build.targets +++ b/Directory.Build.targets @@ -1,6 +1,9 @@ - - - - + + + + diff --git a/Documentation/images/configurations.png b/Documentation/images/configurations.png new file mode 100644 index 00000000000..36c4b6178da Binary files /dev/null and b/Documentation/images/configurations.png differ diff --git a/Documentation/packaging.md b/Documentation/packaging.md new file mode 100644 index 00000000000..e1b938b29b8 --- /dev/null +++ b/Documentation/packaging.md @@ -0,0 +1,71 @@ +# Packaging + +Packaging is implemented in the following files: + +``` + $(WpfArcadeSdkToolsDir)\Packaging.props + $(WpfArcadeSdkToolsDir)\Packaging.targets + $(RepoRoot)\packaging\**\* + │ + ├───Microsoft.DotNet.Arcade.Wpf.Sdk + │ Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral.csproj + │ + ├───Microsoft.DotNet.Wpf.DncEng + │ Microsoft.DotNet.Wpf.DncEng.ArchNeutral.csproj + │ Microsoft.DotNet.Wpf.DncEng.csproj + │ + └───Microsoft.DotNet.Wpf.GitHub + Microsoft.DotNet.Wpf.GitHub.ArchNeutral.csproj + Microsoft.DotNet.Wpf.GitHub.csproj + +``` + + - The `ArchNeutral` packages are built only during the `x86` (i.e., `AnyCPU`) build phase + - Normally, the `ArchNeutral` packages will contain a `runtime.json` file that incorporates the *Bait & Switch* technique for referencing RID-specific packages automatically. + - `runtime.json` functionality is turned off when a packaging project requests so by setting `$(PlatformIndependentPackage)=true`. + - See [Improve documentation - bait and switch pattern, other #1282 ](https://github.com/NuGet/docs.microsoft.com-nuget/issues/1282) + + + - The packages that are not `ArchNeutral` are architecture-specific, and will produce packages containing the RID (`win-x86`, `win-x64`) as a prefix + - The arch-specific packages are produced in each of the build phases. + +#### Package Names + +There are two packages produced out of this repo, a *transport* package and an *MsBuild Sdk* package: + +- `Microsoft.DotNet.Wpf.Github` + - This contains assemblies and corresponding reference binaries that are currently built out of this repo ([https://www.github.com/dotnet/wpf](https://www.github.com/dotnet/wpf)). +- `Microsoft.DotNet.Arcade.Wpf.Sdk` + - This is an *MsBuild Sdk*, and is and extension to [Microsoft.DotNet.Arcade.Sdk](https://www.github.com/dotnet/arcade). + - This Sdk contains all the build props, targets and scripts needed to build WPF. + - Since WPF's build is split across two repos, we build this Sdk out of one repo, and consume it as an *MsBuild Sdk* in the other repo. + +#### Opting into a package + +- An assembly opts-into a package in `$(WpfArcadeSdkToolsDir)\Packaging.props` by simply setting the `PackageName` property, for e.g., like this: + + `$(DncEngTransportPackageName)` + +In practice, this is not needed. *Shipping* assemblies are already enumerated in detail within `$(WpfArcadeSdkToolsDir)ShippingProjects.props`, and each one of them is marked for packaging correctly within `Packaging.props` based on its `$(RepoLocation)` value (possible values are `{Internal, External}`) + +- These package names that various assembly projects can opt to be packaged into are defined in `$(WpfArcadeSdkToolsDir)\Packaging.props`. The project names under `$(RepoRoot)\packaging\` must match these. + +#### How Packaging Works + +##### Preparing Package Assets (*`PreparePackageAssets`* target) + +- *`PreparePackageAssets`* target is defined in `$(WpfArcadeSdkToolsDir)Packaging.targets` +- It runs after *`Build`*, and copies all project outputs, symbols, reference assemblies, satellite assemblies, and content files (defined in *`@(PackageContent)`* `ItemGroup`) to `$(ArtifactsPackagingDir)$(PackageName)\lib\$(TargetFrameworkOrRuntimeIdentifier)\` +- If `@(PackagingAssemblyContent)` is populated, then only those files from `$(OutDir)` would be copied and packaged further - and none others would be included. +- At the end of this target, all files that need to be packed would have been laid out in the right folder hierarchy, and ready to be packed. + +##### Populate the `@(Content)` itemgroup with custom lsit of package-assets (*`CreateContentFolder`* target) + +- *`CreateContentFolder`* is defined in `$(WpfArcadeSdkToolsDir)Packaging.targets` +- It runs just before *`GenerateNuspec`* target, and populates `@(Content)` with files that were copied during *`PreparePackageAssets`* +- This is consume by NuGet `PackTask` to create the package. + +##### Create a Nuget Package + +- The projects under `$(RepoRoot)\packaging` are the only ones with `$(IsPackable)=true` +- The layout of the generated package is identical to the layout under `$(ArtifactsPackagindir)$(PackageName)\` diff --git a/Documentation/solution-and-project-configurations.md b/Documentation/solution-and-project-configurations.md new file mode 100644 index 00000000000..bce209044ad --- /dev/null +++ b/Documentation/solution-and-project-configurations.md @@ -0,0 +1,53 @@ +# Solution and Project Configuration + +Solutions configurations are mapped to Project configurations in the following manner. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
SolutionManaged ProjectsNative Projects
Debug|AnyCPUDebug|AnyCPUDebug|Win32
Debug|x86Debug|AnyCPUDebug|Win32
Debug|x64Debug|x64Debug|x64
Release|AnyCPURelease|AnyCPURelease|Win32
Release|x86Release|AnyCPURelease|Win32
Release|x64Release|x64Release|x64
+
+ + +- `AnyCPU` **solution** configuration is intended for developer-builds only. +- Official build would *always* specify `x86` or `x64` solution configurations explicitly. +- Native projects should map `AnyCPU` solution-configuration to `x86` project configuration +- Managed projects should map `x86` solution-configuration to `AnyCPU` project configuration +- Use Solution->Properties->Configuration view to ensure that the mapping between solution-configuration and project configuration is consistent for every possible configuration. +- Note that packaging projects under `nupkg` folder have only one (`AnyCPU`) configuration + +![](images/configurations.png) diff --git a/Microsoft.Dotnet.Wpf.sln b/Microsoft.Dotnet.Wpf.sln index fe16fae857b..a9bf0453bb5 100644 --- a/Microsoft.Dotnet.Wpf.sln +++ b/Microsoft.Dotnet.Wpf.sln @@ -1,10 +1,22 @@  Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28010.2048 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.28407.52 MinimumVisualStudioVersion = 10.0.40219.1 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "System.Xaml", "src\Microsoft.DotNet.Wpf\src\System.Xaml\System.Xaml.csproj", "{9AC36357-34B7-40A1-95CA-FE9F46D089A7}" EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "packaging", "packaging", "{0159B0F1-0626-4BED-8D1B-CBFF4F12C369}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.DotNet.Wpf.GitHub", "Microsoft.DotNet.Wpf.GitHub", "{BF20132A-191F-4D34-9A1B-831772A6DFCF}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Wpf.GitHub", "packaging\Microsoft.DotNet.Wpf.GitHub\Microsoft.DotNet.Wpf.GitHub.csproj", "{C847934A-828C-4EBB-A004-B0E97C8313F4}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Wpf.GitHub.ArchNeutral", "packaging\Microsoft.DotNet.Wpf.GitHub\Microsoft.DotNet.Wpf.GitHub.ArchNeutral.csproj", "{9A7E395B-E859-40E2-809D-EFB72CF3A2EE}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Microsoft.DotNet.Arcade.Wpf.Sdk", "Microsoft.DotNet.Arcade.Wpf.Sdk", "{8A2ABE39-2D50-48CA-AC32-078BBA32757A}" +EndProject +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral", "packaging\Microsoft.DotNet.Arcade.Wpf.Sdk\Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral.csproj", "{B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -27,11 +39,54 @@ Global {9AC36357-34B7-40A1-95CA-FE9F46D089A7}.Release|x64.Build.0 = Release|x64 {9AC36357-34B7-40A1-95CA-FE9F46D089A7}.Release|x86.ActiveCfg = Release|Any CPU {9AC36357-34B7-40A1-95CA-FE9F46D089A7}.Release|x86.Build.0 = Release|Any CPU + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Debug|x64.ActiveCfg = Debug|x64 + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Debug|x64.Build.0 = Debug|x64 + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Debug|x86.ActiveCfg = Debug|Any CPU + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Debug|x86.Build.0 = Debug|Any CPU + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Release|Any CPU.Build.0 = Release|Any CPU + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Release|x64.ActiveCfg = Release|x64 + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Release|x64.Build.0 = Release|x64 + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Release|x86.ActiveCfg = Release|Any CPU + {C847934A-828C-4EBB-A004-B0E97C8313F4}.Release|x86.Build.0 = Release|Any CPU + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Debug|Any CPU.Build.0 = Debug|Any CPU + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Debug|x64.ActiveCfg = Debug|x64 + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Debug|x64.Build.0 = Debug|x64 + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Debug|x86.ActiveCfg = Debug|Any CPU + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Debug|x86.Build.0 = Debug|Any CPU + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Release|Any CPU.ActiveCfg = Release|Any CPU + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Release|Any CPU.Build.0 = Release|Any CPU + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Release|x64.ActiveCfg = Release|x64 + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Release|x64.Build.0 = Release|x64 + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Release|x86.ActiveCfg = Release|Any CPU + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE}.Release|x86.Build.0 = Release|Any CPU + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Debug|x64.ActiveCfg = Debug|x64 + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Debug|x64.Build.0 = Debug|x64 + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Debug|x86.ActiveCfg = Debug|Any CPU + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Debug|x86.Build.0 = Debug|Any CPU + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Release|Any CPU.Build.0 = Release|Any CPU + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Release|x64.ActiveCfg = Release|x64 + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Release|x64.Build.0 = Release|x64 + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Release|x86.ActiveCfg = Release|Any CPU + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {BF20132A-191F-4D34-9A1B-831772A6DFCF} = {0159B0F1-0626-4BED-8D1B-CBFF4F12C369} + {C847934A-828C-4EBB-A004-B0E97C8313F4} = {BF20132A-191F-4D34-9A1B-831772A6DFCF} + {9A7E395B-E859-40E2-809D-EFB72CF3A2EE} = {BF20132A-191F-4D34-9A1B-831772A6DFCF} + {8A2ABE39-2D50-48CA-AC32-078BBA32757A} = {0159B0F1-0626-4BED-8D1B-CBFF4F12C369} + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3} = {8A2ABE39-2D50-48CA-AC32-078BBA32757A} + EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {671D19D1-5F0E-4453-9D18-3A28AC0E8DEF} + SolutionGuid = {D4D12991-F531-4FC3-849D-29946BCA818A} EndGlobalSection EndGlobal diff --git a/NuGet.config b/NuGet.config index 147ecfda1f0..cbb9e795108 100644 --- a/NuGet.config +++ b/NuGet.config @@ -1,9 +1,18 @@ + + + + + + diff --git a/Packaging.targets b/Packaging.targets deleted file mode 100644 index c9854c7806b..00000000000 --- a/Packaging.targets +++ /dev/null @@ -1,26 +0,0 @@ - - - \ No newline at end of file diff --git a/Restore.cmd b/Restore.cmd new file mode 100644 index 00000000000..f9b8e80f15e --- /dev/null +++ b/Restore.cmd @@ -0,0 +1,2 @@ +@echo off +powershell -ExecutionPolicy ByPass -NoProfile -command "& """%~dp0eng\common\Build.ps1""" -restore %*" \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 56c980d7f0d..578cf26c331 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -1,14 +1,22 @@ -# This is a simple wrapper for eng/ci.yml to get around the limitation of +# This is a simple wrapper for eng/pipeline.yml to get around the limitation of # user-defined variables not being available in yaml template expressions. # Parameters ARE available in template expressions, and parameters can have default values, # so they can be used to control yaml flow. +# +# TODO: +# BuildMsBuildSdkPackages, _BuildMsBuildSdkPackages, _BuildMsBuildSdkPackagesArgs should be removed eventually, when +# Microsoft.DotNet.Arcade.Wpf.Sdk is moved from dnceng/dotnet-wpf-int to github/dotnet/wpf. +# When that move happens, there would be no need to suppress the Sdk build by default. Currently, +# allowing the Sdk to build every time will result in an infinite loop that triggers a dotnet/wpf built, variables: # clean the local repo on the build agents Build.Repository.Clean: true - + # When set to true in a manual built, it produces and publishes + # Microsoft.DotNet.Arcade.Wpf.Sdk + BuildMsBuildSdkPackages: false _PublishUsingPipelines: false _DotNetArtifactsCategory: .NETCore @@ -16,6 +24,7 @@ variables: trigger: - master - release/3.0 +- arcade # To be added in the future when VSTS supports this feature # only trigger pull request builds for the master branch @@ -28,6 +37,6 @@ jobs: parameters: ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: # agent pool can't be read from a user-defined variable (Azure DevOps limitation) - agentPool: dotnet-internal-temp-vs2019 + agentPool: dotnet-internal-vs2019-preview # runAsPublic is used in expressions, which can't read from user-defined variables runAsPublic: false diff --git a/build.sh b/build.sh new file mode 100644 index 00000000000..8477d5af881 --- /dev/null +++ b/build.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash + +source="${BASH_SOURCE[0]}" + +# resolve $SOURCE until the file is no longer a symlink +while [[ -h $source ]]; do + scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" + source="$(readlink "$source")" + + # if $source was a relative symlink, we need to resolve it relative to the path where the + # symlink file was located + [[ $source != /* ]] && source="$scriptroot/$source" +done + +scriptroot="$( cd -P "$( dirname "$source" )" && pwd )" +"$scriptroot/eng/common/build.sh" --build --restore $@ diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml index b4b28e0f4e3..459cb3f5680 100644 --- a/eng/Version.Details.xml +++ b/eng/Version.Details.xml @@ -1,57 +1,77 @@ - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 - + + https://github.com/dotnet/core-setup + 963e3e430dd51963894b065ee637fb372079f17c + + https://github.com/dotnet/corefx - 7f5db5154e0cb653275d8dad5bc7030221446c17 + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 + 5589 - - https://github.com/dotnet/core-setup - afd454e4fa78e615f7501c8eddf24af579f7719d + + https://github.com/dotnet/winforms + 666ca26fa9c98fbb86b158d30870bd2350ea6f1c + 6173 + + + https://github.com/dotnet/corefx + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 + 5589 + + + https://github.com/dotnet/corefx + 82dc96bfbf1d55716e4e0b516bea115644e32cd1 + 5589 - + + https://github.com/dotnet/arcade + 04b492d62263fe2b1523506f92d0fe4c3fd1c4ad + + https://github.com/dotnet/arcade 69f276904fdd6d8f81404b857f295537894b81d3 diff --git a/eng/Versions.props b/eng/Versions.props index c4e588ca778..40bde031c30 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -4,35 +4,51 @@ 4.8.0 preview4 4.0.0.0 + 4.6.0-preview4.19178.1 + 4.8.0-preview4.19170.4 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19178.1 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 - 4.6.0-preview4.19177.9 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19176.11 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19178.1 + 4.6.0-preview4.19178.1 + + 1.0.0-beta.19177.11 0.1.0-preview2-181205-2 4.4.0 - 4.6.0-alpha-27128-8 15.9.20 15.9.20 + 5.28.1.1-1 2.4.0 2.4.0 2.4.0 - - $(RestoreSources);https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json + + $(RestoreSources); + https://dotnet.myget.org/F/dotnet-corefxlab/api/v3/index.json; + https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json + + + + + System.Reflection.MetadataLoadContext + Microsoft.Private.Winforms + System.Drawing.Common + System.DirectoryServices diff --git a/eng/WpfArcadeSdk/Sdk/Sdk.props b/eng/WpfArcadeSdk/Sdk/Sdk.props new file mode 100644 index 00000000000..62404b8fc42 --- /dev/null +++ b/eng/WpfArcadeSdk/Sdk/Sdk.props @@ -0,0 +1,63 @@ + + + + + + $([System.IO.Directory]::GetParent("$(MSBuildThisFileDirectory.TrimEnd('\'))"))\ + $(WpfArcadeSdkRoot)tools\ + + + + + + + $(WpfArcadeSdkToolsDir)AvTrace\GenTraceSources.pl + $(WpfArcadeSdkToolsDir)GenXmlStringTable.pl + + true + + 8.0 + true + true + + Open + + + + + + + + + + + + + + + + full + "$(RepoRoot).tools\native\bin\strawberry-perl\$(StrawberryPerlVersion)\portableshell.bat" + + $(WpfArcadeSdkToolsDir)Wpf.Cpp.props + $(WpfArcadeSdkToolsDir)GenerateModuleDefinitionFile.targets + + + + $(WpfArcadeSdkToolsDir)NoTargets.props + $(WpfArcadeSdkToolsDir)NoTargets.targets + + + + + $(NoWarn);NU3027 + + + + + diff --git a/eng/WpfArcadeSdk/Sdk/Sdk.targets b/eng/WpfArcadeSdk/Sdk/Sdk.targets new file mode 100644 index 00000000000..9ca41359ebc --- /dev/null +++ b/eng/WpfArcadeSdk/Sdk/Sdk.targets @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/WpfArcadeSdk/tools/AvTrace/GenTraceSources.pl b/eng/WpfArcadeSdk/tools/AvTrace/GenTraceSources.pl new file mode 100644 index 00000000000..593c43dd5a0 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/AvTrace/GenTraceSources.pl @@ -0,0 +1,136 @@ +######################################################## +# Generate the enum used for retrieving wrapper classes for managed debug tracing. +# +# This scripts reads an input file with the trace information, +# and generates a cs file with the enum containing trace area values. +# +######################################################## +use File::Copy; +use Getopt::Std; + +sub usage() +{ + print "Usage: $0 -i [Inputfile1,Inputfile2,...] -o [output.cs] \n\n"; +} + +#hash to store all the arguements. +my %args +; +#error header. +my $error_msg = "GenTraceSources.pl: error:"; + +#get the switches values. +getopts('i:o:', \%args); + +#all these switches are required. + +my $outfile = $args{o}; +my @inputfilelist = split(/,/, $args{i}); + +print "\n"; + + +# +# The header for the file +# + +my $header = <<"END_OF_HEADER"; +//------------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All Rights Reserved. +// Information Contained Herein is Proprietary and Confidential. +// +// +// This file is generated from AvTraceMessages.txt by gentracesources.pl - do not modify this file directly +//------------------------------------------------------------------------------- + +using MS.Internal; + +namespace System.Diagnostics +{ + /// Access point for TraceSources + public static partial class PresentationTraceSources + { +END_OF_HEADER + + +# +# The footer for the file +# + +my $footer = <<"END_OF_FOOTER"; + } +}//endof namespace +END_OF_FOOTER + + +# +# Initialize the output file +# + +open(OUT, '>'.$outfile) or die "$error_msg Cannot create $outfile. $!\n"; + +print OUT $header or die "$error_msg Cannot write to $outfile. $! \n"; + +{ + # Now we read the trace areas from the files + + for $inputfile (@inputfilelist) + { + + open(IN, $inputfile) or die "$error_msg Cannot open $inputfile. $!\n"; + + + # Loop through the strings + + my $traceArea; + my $traceClass; + my $traceName; + my $traceSourceName; + + while ($stringIn = ) + { + chomp; + + # Find the beginning of a section, with the trace source name + # and the name of the trace area. + # E.g. "[System.Windows.ComponentModel.Events,RoutedEvent]" + + if (($traceName, $traceArea, $traceClass) = ($stringIn =~ /^\[(.*),(.*),(.*)\]/)) + { + # append "Source" for the TraceSource name + $traceSourceName = $traceArea."Source"; + + # Write out the property + + print OUT +" + /// $traceSourceName for $traceArea + public static TraceSource $traceSourceName + { + get + { + if (_$traceSourceName == null) + { + _$traceSourceName = CreateTraceSource(\"$traceName\"); + } + return _$traceSourceName; + } + } + internal static TraceSource _$traceSourceName; +" + or die "$error_msg Cannot write to $outfile. $! \n"; + + } + } + + #close files + close (IN) or die "$error_msg Cannot close $infile. $!\n"; + } +} + +print OUT "\n".$footer or die "$error_msg Cannot write to $outfile. $! \n"; + +#close files +close (OUT) or die "$error_msg Cannot close $outfile. $!\n"; + diff --git a/eng/WpfArcadeSdk/tools/AvTrace/GenTraceStrings.pl b/eng/WpfArcadeSdk/tools/AvTrace/GenTraceStrings.pl new file mode 100644 index 00000000000..937e125b562 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/AvTrace/GenTraceStrings.pl @@ -0,0 +1,297 @@ +######################################################## +# Generate the wrapper classes for managed debug tracing. +# +# This scripts reads an input file with the trace information, +# and generates a cs file with the wrapper classes. +# +######################################################## +use File::Copy; +use Getopt::Std; + +sub usage() +{ + print "Usage: $0 -i [Inputfile1] -o [output.cs] \n\n"; +} + +#hash to store all the arguements. +my %args +; +#error header. +my $error_msg = "GenTraceStrings.pl: error:"; + +#get the switches values. +getopts('i:o:', \%args); + +#all these switches are required. + +my $outfile = $args{o}; +my $inputfile = $args{i}; + +print "\n"; + + +# +# The header for the file +# + +my $header = <<"END_OF_HEADER"; + +using System; +using System.Diagnostics; + +namespace MS.Internal +{ +END_OF_HEADER + + +# +# The footer for the file +# + +my $footer = <<"END_OF_FOOTER"; +}//endof namespace +END_OF_FOOTER + + +# +# The footer section for each class +# + +my $classFooter = <<"END_OF_FOOTER"; + + // Send a single trace output + static public void Trace( TraceEventType type, AvTraceDetails traceDetails, params object[] parameters ) + { + _avTrace.Trace( type, traceDetails.Id, traceDetails.Message, traceDetails.Labels, parameters ); + } + + // these help delay allocation of object array + static public void Trace( TraceEventType type, AvTraceDetails traceDetails ) + { + _avTrace.Trace( type, traceDetails.Id, traceDetails.Message, traceDetails.Labels, new object[0] ); + } + static public void Trace( TraceEventType type, AvTraceDetails traceDetails, object p1 ) + { + _avTrace.Trace( type, traceDetails.Id, traceDetails.Message, traceDetails.Labels, new object[] { p1 } ); + } + static public void Trace( TraceEventType type, AvTraceDetails traceDetails, object p1, object p2 ) + { + _avTrace.Trace( type, traceDetails.Id, traceDetails.Message, traceDetails.Labels, new object[] { p1, p2 } ); + } + static public void Trace( TraceEventType type, AvTraceDetails traceDetails, object p1, object p2, object p3 ) + { + _avTrace.Trace( type, traceDetails.Id, traceDetails.Message, traceDetails.Labels, new object[] { p1, p2, p3 } ); + } + + // Send a singleton "activity" trace (really, this sends the same trace as both a Start and a Stop) + static public void TraceActivityItem( AvTraceDetails traceDetails, params Object[] parameters ) + { + _avTrace.TraceStartStop( traceDetails.Id, traceDetails.Message, traceDetails.Labels, parameters ); + } + + // these help delay allocation of object array + static public void TraceActivityItem( AvTraceDetails traceDetails ) + { + _avTrace.TraceStartStop( traceDetails.Id, traceDetails.Message, traceDetails.Labels, new object[0] ); + } + static public void TraceActivityItem( AvTraceDetails traceDetails, object p1 ) + { + _avTrace.TraceStartStop( traceDetails.Id, traceDetails.Message, traceDetails.Labels, new object[] { p1 } ); + } + static public void TraceActivityItem( AvTraceDetails traceDetails, object p1, object p2 ) + { + _avTrace.TraceStartStop( traceDetails.Id, traceDetails.Message, traceDetails.Labels, new object[] { p1, p2 } ); + } + static public void TraceActivityItem( AvTraceDetails traceDetails, object p1, object p2, object p3 ) + { + _avTrace.TraceStartStop( traceDetails.Id, traceDetails.Message, traceDetails.Labels, new object[] { p1, p2, p3 } ); + } + + // Is tracing enabled here? + static public bool IsEnabled + { + get { return _avTrace != null && _avTrace.IsEnabled; } + } + + // Is there a Tracesource? (See comment on AvTrace.IsEnabledOverride.) + static public bool IsEnabledOverride + { + get { return _avTrace.IsEnabledOverride; } + } + + // Re-read the configuration for this trace source + static public void Refresh() + { + _avTrace.Refresh(); + } + + }//endof class $srclass +END_OF_FOOTER + + + +# +# Initialize the output file +# + +open(OUT, '>'.$outfile) or die "$error_msg Cannot create $outfile. $!\n"; + +print OUT $header or die "$error_msg Cannot write to $outfile. $! \n"; + + + +{ + # Now we read the trace information from the file + + open(IN, $inputfile) or die "$error_msg Cannot open $inputfile. $!\n"; + + + # Loop through the strings + + my $prev_id = 0; + my $max_id = 0; + my $inClass = 0; + my $traceArea; + my $traceClass; + my $traceName; + my $traceSourceName; + + while ($stringIn = ) + { + chomp; + next if ($stringIn =~ /^;/); # ignore all comments + next if ($stringIn =~ /^\r/); # ignore newline + + # Handle the beginning of a section, with the trace source name, + # the name of the area, and the name of the class to be generated. + # E.g. "[System.Windows.ComponentModel.Events,RoutedEvent,TraceRoutedEvent]" + + if (($traceName, $traceArea, $traceClass) = ($stringIn =~ /^\[(.*),(.*),(.*)\]/)) + { + # append "Source" for the property name to be used in PresentationTraceSources + + $traceSourceName = $traceArea."Source"; + + # Write out the class header + + print OUT +" + static internal partial class $traceClass + { + static private AvTrace _avTrace = new AvTrace( + delegate() { return PresentationTraceSources.$traceSourceName; }, + delegate() { PresentationTraceSources._$traceSourceName = null; } + ); + +" + or die "$error_msg Cannot write to $outfile. $! \n"; + + # reset id auto-generation counters + $max_id = $prev_id = 0; + $inClass = 1; + next; + } + + # Check for the end of a section, e.g. "[end]" + + if ($stringIn =~ /^\[end]/) + { + print OUT $classFooter or die "$error_msg Cannot write to $outfile. $! \n"; + $inClass = 0; + next; + } + + + # Handle a line within a section, which has the trace strings + # E.g. MyEvent=AUTO,FORMAT,{"Basic message or format string", "Param1", "Param2"} + + if (($name, $id, $shouldFormat, $labels) = ($stringIn =~ /^(\w+)=(\w*)\,(\w*)\,(.*)/)) + { + $inClass or die "Trace string '$stringIn' is not inside a section."; + + # auto-generate id if int is not specified + if ($id =~ /^\d+$/) + { + $max_id = $id if $id > $max_id; + } + elsif ($id == "" || $id == "AUTO") + { + $id = ++$max_id; + } + elsif ($id == "PREVIOUS") + { + $id = $prev_id; + } + else + { + die "invalid id '$id' for trace string."; + } + + if ($shouldFormat) + { + # create a method that passes args for the format string + + # TODO: calculate number of parameters and create precise method signature + + print OUT +" + static AvTraceDetails _$name; + static public AvTraceDetails $name(params object[] args) + { + if ( _$name == null ) + { + _$name = new AvTraceDetails( $id, new string[] $labels ); + } + + return new AvTraceFormat(_$name, args); + } +" + or die "$error_msg Cannot write to $outfile. $! \n"; + + } + elsif ($shouldFormat == "" || $shouldFormat =~ /false/i) + { + # create a property + print OUT +" + static AvTraceDetails _$name; + static public AvTraceDetails $name + { + get + { + if ( _$name == null ) + { + _$name = new AvTraceDetails( $id, new string[] $labels ); + } + + return _$name; + } + } +" + or die "$error_msg Cannot write to $outfile. $! \n"; + + } + else + { + die "invalid value '$id' for trace string ShouldFormat boolean."; + } + + $prev_id = $id; + next; + } + + + next if ($stringIn =~ /^$/); + + die "Invalid trace string '$stringIn'"; + } + + #close files + close (IN) or die "$error_msg Cannot close $infile. $!\n"; +} + +print OUT "\n".$footer or die "$error_msg Cannot write to $outfile. $! \n"; + +#close files +close (OUT) or die "$error_msg Cannot close $outfile. $!\n"; + diff --git a/eng/WpfArcadeSdk/tools/CodeAnalysis.props b/eng/WpfArcadeSdk/tools/CodeAnalysis.props new file mode 100644 index 00000000000..438a69b9745 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/CodeAnalysis.props @@ -0,0 +1,15 @@ + + + + $(MSBuildThisFileDirectory)CodeAnalysis\WpfCodeAnalysis.ruleset + + + + + + + + + + + diff --git a/eng/WpfArcadeSdk/tools/CodeAnalysis/WpfCodeAnalysis.ruleset b/eng/WpfArcadeSdk/tools/CodeAnalysis/WpfCodeAnalysis.ruleset new file mode 100644 index 00000000000..4b42f390946 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/CodeAnalysis/WpfCodeAnalysis.ruleset @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/CopyRedistFile.targets b/eng/WpfArcadeSdk/tools/CopyRedistFile.targets new file mode 100644 index 00000000000..31f2dc555a3 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/CopyRedistFile.targets @@ -0,0 +1,23 @@ + + + + $(PreparePackageAssetsDependsOn); + CopyRedistFile + + + + + + + + + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/ExtendedAssemblyInfo.props b/eng/WpfArcadeSdk/tools/ExtendedAssemblyInfo.props new file mode 100644 index 00000000000..493e6ecdb95 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/ExtendedAssemblyInfo.props @@ -0,0 +1,50 @@ + + + + + true + true + + + + $(AssemblyComVisible) + true + + + + DllImportSearchPath.AssemblyDirectory | DllImportSearchPath.System32 + true + + + + $(AssemblyName) + + + + $(AssemblyDescription) + + + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/ExtendedAssemblyInfo.targets b/eng/WpfArcadeSdk/tools/ExtendedAssemblyInfo.targets new file mode 100644 index 00000000000..813675e1be4 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/ExtendedAssemblyInfo.targets @@ -0,0 +1,330 @@ + + + + + + + + + $(AssemblyName) + + $(AssemblyTitle) + $(Description) + + $(InformationalVersion) + $(Version) + + + + + $(FileVersion) + + + + $(COMPUTERNAME) + + + + $(ScmRepositoryUrl) + + + + $(SourceRevisionId) + + + + + + + + <_GeneratedAssemblyInfoFile Remove="@(_GeneratedAssemblyInfoFile)" /> + <_GeneratedAssemblyInfoFile Include="$(GeneratedAssemblyInfoFile)" /> + + + <_GeneratedExtendedAssemblyInfoFile Remove="@(_GeneratedExtendedAssemblyInfoFile)" /> + <_GeneratedExtendedAssemblyInfoFile Include="%(_GeneratedAssemblyInfoFile.RootDir)%(_GeneratedAssemblyInfoFile.Directory)%(_GeneratedAssemblyInfoFile.Filename).Extended%(_GeneratedAssemblyInfoFile.Extension)" /> + + + + @(_GeneratedExtendedAssemblyInfoFile) + + + + + + + + + + + + + + + + + + + + + + + + + 0) + { + Result = new TaskItem[ExtendedAssemblyInfo.Length]; + for (int i = 0; i < ExtendedAssemblyInfo.Length; i++) + { + ITaskItem item = ExtendedAssemblyInfo[i]; + string attr = item.GetMetadata("Identity"); // This is the Attribute type + + List parameters = new List(); + + var metadataNames = item.MetadataNames.Cast().ToList(); // Obtain all the Metadata names + + // Parameter names are of the form Parameter1, Parameter2, etc. + // Parameter0 is not allowed. + var parameterNames = metadataNames.Where((m) => Regex.IsMatch(m, @"Parameter\d+", RegexOptions.IgnoreCase | RegexOptions.CultureInvariant)); + parameterNames = parameterNames.Where((m) => !m.Equals("Parameter0", StringComparison.InvariantCultureIgnoreCase)); + + // Order the parameter names in ascending order, then iterate through them + var parameterNamesAscending = parameterNames.OrderBy((m) => Int32.Parse(m.Replace("Parameter", string.Empty))); + foreach (var parameter in parameterNamesAscending) + { + string paramValue = item.GetMetadata(parameter); + + bool isLiteral = false; + string isLiteralMetadataName = parameter.Replace("Parameter", "IsLiteral"); + if (metadataNames.Contains(isLiteralMetadataName)) + { + Boolean.TryParse(item.GetMetadata(isLiteralMetadataName), out isLiteral); + } + + if (isLiteral) + { + // The parameter is a literal, include it as-is + parameters.Add(paramValue); + } + else + { + // The parameter is NOT a litera, included it surrounded by double-quotes + parameters.Add("\"" + paramValue + "\""); ; + } + } + + // Separate the parameters by commas + string p = string.Join(",", parameters); + + // Construct the resolved attribute declaration + // [assembly: ] + // For e.g., + // [assembly: ComVisible(true)] + // [assembly: MetadataAttribute("Servicing","true")] + // Save the result and continue + string assemblyAttribute = string.Format("[assembly: {0}({1})]", attr, p); + Result[i] = new TaskItem(assemblyAttribute); + } + } +]]> + + + + + + + + + + + + + + <_ExtendedAssemblyMetadata Remove="@(_ExtendedAssemblyMetadata)" /> + <_ExtendedAssemblyMetadata Include="@(AssemblyMetadata)" + Condition="'@(AssemblyMetadata)'!=''" + AttributeName="AssemblyMetadata"> + %(Identity) + %(Value) + + + + + + + + + + + + + + + + + + +// This code was generated by a tool +// Target: GenerateExtendedAssemblyInfo +// Filename: $(MSBuildThisFile) +// +// Changes to this file may cause incorrect behavior and will be lost if +// the code is regenerated. +// +//------------------------------------------------------------------------------ +]]> + + + + + + + + + + + +//------------------------------------------------------------------------------ + ]]> + + + + + + + + + + + + diff --git a/eng/WpfArcadeSdk/tools/FixupProjectReferences.targets b/eng/WpfArcadeSdk/tools/FixupProjectReferences.targets new file mode 100644 index 00000000000..5fd73aa0cc5 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/FixupProjectReferences.targets @@ -0,0 +1,48 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + <_ProjectReferenceWithConfiguration Remove="@(_ProjectReferenceWithConfiguration)" /> + <_ProjectReferenceWithConfiguration Include="@(_filtered_ProjectReferenceWithConfiguration)" /> + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/FolderPaths.props b/eng/WpfArcadeSdk/tools/FolderPaths.props new file mode 100644 index 00000000000..7498073ee5a --- /dev/null +++ b/eng/WpfArcadeSdk/tools/FolderPaths.props @@ -0,0 +1,7 @@ + + + $(RepoRoot)src\Microsoft.DotNet.Wpf\cycle-breakers\ + $(RepoRoot)src\Microsoft.DotNet.Wpf\src\ + $(WpfSourceDir)shared\ + + diff --git a/eng/WpfArcadeSdk/tools/GenXmlStringTable.pl b/eng/WpfArcadeSdk/tools/GenXmlStringTable.pl new file mode 100644 index 00000000000..9b733ade3ef --- /dev/null +++ b/eng/WpfArcadeSdk/tools/GenXmlStringTable.pl @@ -0,0 +1,427 @@ +######################################################## +# Generate the XmlStringTable handling class. +# This tool generates enums for xml strings that are +# used to index into the xml string table +# The entries in the xml string table: +# Index Name String Value Type +# This tool also generates XML Name table +######################################################## +use File::Copy; +use Getopt::Std; + +######################################################## +# usage: Print out usage +######################################################## + +sub usage() +{ + print "Usage: $0 -n [Namespacefile] -x [XmlStringfile] -e [fullenumclassname] -c [fullxmlstringclassname] -o [output.cs]\n\n"; + print "Example: perl $0 -n XmlNamespaceStringTable.txt -x xmlStringTable.txt -e XmlNamespaceId -c MS.Internal.IO.Packaging.XmlStringTable\n"; +} + +######################################################## +# Variables +######################################################## + +#hash to store all the arguements. +my %args +; +#error header. +my $error_msg = "GenXmlStringTable.pl: error:"; + + +########################################################## +# get the switches values do some minimum validataion +########################################################## + +getopts('c:e:n:o:x:', \%args); + +#all these switches are required. +if (!$args{c} || !$args{e} || !$args{n} || !$args{o} | !$args{x}) +{ + usage(); + exit; +} + +my $outfile = $args{o}; +my $fullxmlnsenumclassname = $args{e}; +my $fullxmlstrclassname = $args{c}; +my $xmlnsfile = $args{n}; +my $xmlstrfile = $args{x}; + +######################################################## +# Print out switch value information +######################################################## + +print "\n"; +print "Xml namespaces file: $xmlnsfile\n"; +print "Xml strings file: $xmlstrfile\n"; +print "Output .cs file: $outfile\n"; +print "Enum class name for all strings: $fullxmlnsenumclassname\n"; +print "Xml string table class name: $fullxmlstrclassname\n"; + + +######################################################## +# Parse class names and their namespaces +######################################################## + +#extract the namespace and enum class name +my ($enumnamespace, $enumsrclass) = ($fullxmlnsenumclassname =~ /^(.+)\.(.+)$/); +my $srid = $srclass."ID"; + +#extract the namespace and table class name +my ($tablenamespace, $tablesrclass) = ($fullxmlstrclassname =~ /^(.+)\.(.+)$/); +my $srid = $srclass."ID"; + +######################################################## +# Print out class information +######################################################## + +print "enum namespace: $enumnamespace\n"; +print "enum class name: $enumsrclass\n\n"; + +print "xml string table namespace: $tablenamespace\n"; +print "xml string class name: $tablesrclass\n"; + +######################################################## +# Count all xml namespaces and xml strings +######################################################## + +# Need to start from 1 since the first item is NotDefined +my $tableSize = 1; + +open(IN, $xmlnsfile) or die "$error_msg Cannot open $infile. $!\n"; + +while ($string = ) +{ + if ($string =~ /^(\w+)=/o) + { + $tableSize += 1; + } +} + +#### close files +close (IN) or die "$error_msg Cannot close $infile. $!\n"; + + +open(IN, $xmlstrfile) or die "$error_msg Cannot open $infile. $!\n"; + +while ($string = ) +{ + if ($string =~ /^(\w+)=/o) + { + $tableSize += 1; + } +} + +#### close files +close (IN) or die "$error_msg Cannot close $infile. $!\n"; + + +######################################################## +# Header of the generated cs file +# 1. Copyright information +# 2. Begining of the enum class +######################################################## + +my $header = <<"END_OF_HEADER"; +//------------------------------------------------------------------------------- +// +// Copyright (c) Microsoft Corporation. All Rights Reserved. +// Information Contained Herein is Proprietary and Confidential. +// +// +// This file is generated from $xmlnsfile and $xmlstrfile by GenXmlStringTable.pl +// - do not modify this file directly +//------------------------------------------------------------------------------- + + +using System; +using System.Collections; +using System.Diagnostics; +using System.Xml; + +using $enumnamespace; + +namespace $enumnamespace +{ + + //an enums for xml string identifiers. + internal enum $enumsrclass : int + { + NotDefined = 0, +END_OF_HEADER + + +######################################################## +# Middle part of the generated cs file +# 1. Closing brakets for the enum class and the namespace +# 2. Begining of the enum class +# 3. Begining of the string table class +######################################################## + +my $tableclassheader = <<"END_OF_TABLE_CLASS_HEADER"; + } // end of enum $enumsrclass +} // end of namespace + +namespace $tablenamespace +{ + internal static class $tablesrclass + { + static $tablesrclass() + { + Object str; + +END_OF_TABLE_CLASS_HEADER + +######################################################## +# Footer of the generated cs file +# 1. Helper functions for the xml string table +# 2. Definition of the item entry in the xml string table +# 3. Private member variables +# 4. Closing brakets for the xml string class and the namespace +######################################################## + +my $footer = <<"END_OF_FOOTER"; + } + + internal static $enumsrclass GetEnumOf(Object xmlString) + { + Debug.Assert(xmlString is String); + + // Index 0 is reserved for NotDefined and doesn't have a table entry + // so start from 1 + for (int i = 1; i < _xmlstringtable.GetLength(0) ; ++i) + { + if (Object.ReferenceEquals(_xmlstringtable[i].Name, xmlString)) + { + return ((PackageXmlEnum) i); + } + } + + return PackageXmlEnum.NotDefined; + } + + internal static string GetXmlString($enumsrclass id) + { + CheckIdRange(id); + + return (string) _xmlstringtable[(int) id].Name; + } + + internal static Object GetXmlStringAsObject($enumsrclass id) + { + CheckIdRange(id); + + return _xmlstringtable[(int) id].Name; + } + + internal static $enumsrclass GetXmlNamespace($enumsrclass id) + { + CheckIdRange(id); + + return _xmlstringtable[(int) id].Namespace; + } + + internal static string GetValueType($enumsrclass id) + { + CheckIdRange(id); + + return _xmlstringtable[(int) id].ValueType; + } + + internal static NameTable NameTable + { + get + { + return _nameTable; + } + } + +#if false + internal static IEqualityComparer EqualityComparer + { + get + { + return _referenceComparer; + } + } +#endif + + private static void CheckIdRange($enumsrclass id) + { + // Index 0 is reserved for NotDefined and doesn't have a table entry + if ((int) id <= 0 || (int) id >= $tableSize) + { + throw new ArgumentOutOfRangeException("id"); + } + } + + internal static NameTable CloneNameTable() + { + NameTable nameTable = new NameTable(); + + // Index 0 is reserved for NotDefined and doesn't have a table entry + for (int i=1; i<$tableSize; ++i) + { + nameTable.Add((string)_xmlstringtable[i].Name); + } + + return nameTable; + } + + private struct XmlStringTableStruct + { + private Object _nameString; + private $enumsrclass _namespace; + private string _valueType; + + internal XmlStringTableStruct(Object nameString, $enumsrclass ns, string valueType) + { + _nameString = nameString; + _namespace = ns; + _valueType = valueType; + } + + internal Object Name { get { return (String) _nameString; } } + internal $enumsrclass Namespace { get { return _namespace; } } + internal string ValueType { get { return _valueType; } } + } + +#if false + // The Hashtable comparer that takes advantage of the fact + // that we know the object identities of all keys to find. + private class ReferenceComparer : IEqualityComparer + { + // Perform reference comparison. + // Explicit implementation to avoid conflict with object.Equals. + bool IEqualityComparer.Equals(object x, object y) + { + return object.ReferenceEquals(x, y); + } + + // Hash on object identity. + public int GetHashCode(object obj) + { + return System.Runtime.CompilerServices.RuntimeHelpers.GetHashCode(obj); + } + } + +#endif + + private static XmlStringTableStruct[] _xmlstringtable = new XmlStringTableStruct[$tableSize]; + private static NameTable _nameTable = new NameTable(); +#if false + private static ReferenceComparer _referenceComparer = new ReferenceComparer(); +#endif + } //endof class $tablesrclass + +} // end of namespace + +END_OF_FOOTER + + +######################################################## +# +# Generate cs file +# +######################################################## + +#### open output c# file. + +open(OUT, '>'.$outfile) or die "$error_msg Cannot create $outfile. $!\n"; + +######################################################## +# Write out the predefined header +######################################################## + +print OUT $header or die "$error_msg Cannot write to $outfile. $! \n"; + +######################################################## +# Read in all xml namespace list and declare them in the enum class +######################################################## + +open(IN, $xmlnsfile) or die "$error_msg Cannot open $infile. $!\n"; + +while ($string = ) +{ + if ($string =~ /^(\w+)=/o) + { + print OUT " $1,\n" or die "$error_msg Cannot write to $outfile. $! \n"; + } +} + +#### close files +close (IN) or die "$error_msg Cannot close $infile. $!\n"; + +######################################################## +# Read in all xml strings and declare them in the enum class +######################################################## + +open(IN, $xmlstrfile) or die "$error_msg Cannot open $infile. $!\n"; + +while ($string = ) +{ + if ($string =~ /^(\w+)=/o) + { + print OUT " $1,\n" or die "$error_msg Cannot write to $outfile. $! \n"; + } +} + +#### close files +close (IN) or die "$error_msg Cannot close $infile. $!\n"; + + +######################################################## +# Write out the end of the enum class and the start of the xml string table +######################################################## + +print OUT $tableclassheader or die "$error_msg Cannot write to $outfile. $! \n"; + + +######################################################## +# Add all the xml namespaces to the xml string table +######################################################## + +open(IN, $xmlnsfile) or die "$error_msg Cannot open $infile. $!\n"; + +#### insert all namespaces and prefixes strings + +while ($string = ) +{ + if ($string =~ /^(\w+)=(\S+)/o) + { + print OUT " str = _nameTable.Add(\"$2\");\n" or die "$error_msg Cannot write to $outfile. $! \n"; + print OUT " _xmlstringtable[(int) $enumsrclass.$1] = new XmlStringTableStruct(str, $enumsrclass.NotDefined, null);\n" or die "$error_msg Cannot write to $outfile. $! \n"; + } +} + +print OUT "\n" or die "$error_msg Cannot write to $outfile. $! \n"; + +######################################################## +# Add all the xml strings to the xml string table +######################################################## + +open(IN, $xmlstrfile) or die "$error_msg Cannot open $infile. $!\n"; + +#### insert all xml strings + +while ($string = ) +{ + if ($string =~ /^(\w+)=(\S+)\s+(\S+)(?:\s+(\S+))?/o) + { + print OUT " str = _nameTable.Add(\"$2\");\n" or die "$error_msg Cannot write to $outfile. $! \n"; + print OUT " _xmlstringtable[(int) $enumsrclass.$1] = new XmlStringTableStruct(str, $enumsrclass.$3, \"$4\");\n" or die "$error_msg Cannot write to $outfile. $! \n"; + } +} + +######################################################## +# Write out the end of the xml string table +######################################################## + +print OUT "\n".$footer or die "$error_msg Cannot write to $outfile. $! \n"; + +#### close files + +close (OUT) or die "$error_msg Cannot close $outfile. $!\n"; + diff --git a/eng/WpfArcadeSdk/tools/GenerateAvTraceMessages.targets b/eng/WpfArcadeSdk/tools/GenerateAvTraceMessages.targets new file mode 100644 index 00000000000..a69a220cd94 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/GenerateAvTraceMessages.targets @@ -0,0 +1,18 @@ + + + + + + + + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/GenerateModuleDefinitionFile.targets b/eng/WpfArcadeSdk/tools/GenerateModuleDefinitionFile.targets new file mode 100644 index 00000000000..b14dba899a0 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/GenerateModuleDefinitionFile.targets @@ -0,0 +1,85 @@ + + + + + + true + false + + + true + + + + + + + + + + + + + + + + + + + + + + NotUsing + CompileAsCpp + TurnOffAllWarnings + true + true + $(AdditionalOptions) /DDLL_NAME=$(TargetName) + + + + false + false + + + + + + + + + + + + + + + diff --git a/eng/WpfArcadeSdk/tools/GenerateProgramFileForTests.props b/eng/WpfArcadeSdk/tools/GenerateProgramFileForTests.props new file mode 100644 index 00000000000..e9a19b5e30b --- /dev/null +++ b/eng/WpfArcadeSdk/tools/GenerateProgramFileForTests.props @@ -0,0 +1,6 @@ + + + false + true + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/GenerateProgramFileForTests.targets b/eng/WpfArcadeSdk/tools/GenerateProgramFileForTests.targets new file mode 100644 index 00000000000..1ff69760a46 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/GenerateProgramFileForTests.targets @@ -0,0 +1,16 @@ + + + + true + false + + + + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/InlineTasks.targets b/eng/WpfArcadeSdk/tools/InlineTasks.targets new file mode 100644 index 00000000000..3ba2d43f029 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/InlineTasks.targets @@ -0,0 +1,84 @@ + + + RoslynCodeTaskFactory + CodeTaskFactory + + $(MSBuildToolsPath)\Microsoft.Build.Tasks.Core.dll + $(MSBuildToolsPath)\Microsoft.Build.Tasks.v4.0.dll + + + + + + + + + + + + + + + + + (); + var unmatched = new List(); + + foreach (var item1 in Item1) + { + bool matched = false; + foreach (var item2 in Item2) + { + if (item2.MetadataNames.Cast().Contains(Metadata2)) + { + string str1 = item1.ItemSpec; + string str2 = item2.GetMetadata(Metadata2); + + bool cmp = + !TreatItemsAsPaths ? + str1.Equals(str2, StringComparison.OrdinalIgnoreCase) + : Path.Equals(str1, str2); + + if (cmp) + { + var resultItem = new TaskItem(item2.GetMetadata(Metadata2)); + if (PreserveItem1Metadata) + { + var metadata = item1.CloneCustomMetadata(); + foreach (object m in metadata.Keys) + { + resultItem.SetMetadata((string)m, (string)metadata[m]); + } + } + + if (PreserveItem2Metadata) + { + var metadata = item2.CloneCustomMetadata(); + foreach (object m in metadata.Keys) + { + resultItem.SetMetadata((string)m, (string)metadata[m]); + } + } + + result.Add(resultItem); + matched = true; + } + } + } + + if (!matched) + { + unmatched.Add(new TaskItem(item1)); + } + } + + Result = result.ToArray(); + UnmatchedReferences = unmatched.ToArray(); + ]]> + + + + diff --git a/eng/WpfArcadeSdk/tools/NoInternalTypeHelper.targets b/eng/WpfArcadeSdk/tools/NoInternalTypeHelper.targets new file mode 100644 index 00000000000..e1c33ebafc4 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/NoInternalTypeHelper.targets @@ -0,0 +1,17 @@ + + + + + + <_GeneratedCodeFiles Remove="@(_GeneratedCodeFiles)" Condition="'%(FileName)%(Extension)' == 'GeneratedInternalTypeHelper.g.cs'" /> + + + + + <_GeneratedCodeFiles Include="@(EmbeddedResource->'%(StronglyTypedFileName)');" /> + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/NoTargets.props b/eng/WpfArcadeSdk/tools/NoTargets.props new file mode 100644 index 00000000000..01dbbe2d7b7 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/NoTargets.props @@ -0,0 +1,25 @@ + + + + + + + + + + $(MSBuildToolsPath)\Microsoft.Common.targets + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/NoTargets.targets b/eng/WpfArcadeSdk/tools/NoTargets.targets new file mode 100644 index 00000000000..3cfab63c93e --- /dev/null +++ b/eng/WpfArcadeSdk/tools/NoTargets.targets @@ -0,0 +1,37 @@ + + + + + + + + + + + + + + + + + BuildOnlySettings; + PrepareForBuild; + PreBuildEvent; + ResolveReferences; + GetTargetPath; + PrepareForRun; + IncrementalClean; + PostBuildEvent + + + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/Packaging.props b/eng/WpfArcadeSdk/tools/Packaging.props new file mode 100644 index 00000000000..844837f5286 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/Packaging.props @@ -0,0 +1,67 @@ + + + $(ArtifactsDir)packaging\$(Configuration)\$(Platform)\ + $(ArtifactsDir)packaging\$(Configuration)\ + + + runtime.win-$(Platform) + runtime.win-x86 + + + + + false + + + + false + + MIT + $(CopyrightNetFoundation) + + false + + + + Microsoft.DotNet.Wpf.GitHub + Microsoft.DotNet.Wpf.DncEng + + + Microsoft.NET.Sdk.WindowsDesktop + + + + + + $(DncEngTransportPackageName) + + + $(GitHubTransportPackageName) + + + $(WindowsDesktopSdkPackageName) + + https://dev.azure.com/dnceng/internal/_git/dotnet-wpf-int + + + + + + + + + All + + + + + + + false + + diff --git a/eng/WpfArcadeSdk/tools/Packaging.targets b/eng/WpfArcadeSdk/tools/Packaging.targets new file mode 100644 index 00000000000..da8b44f844e --- /dev/null +++ b/eng/WpfArcadeSdk/tools/Packaging.targets @@ -0,0 +1,378 @@ + + + + + + + lib + + + + $(PackageRuntimeIdentifierPrefix).$(PackageName) + $(PackageName.Replace('$(PackageRuntimeIdentifierPrefix).','')) + $(PackageName) + true + MSBuildSdk + + + + + + + + $(TargetFramework) + + + + win-x86 + win-x64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + $(NormalizedPackageName) + + + + + + + + + + + + + + $(TargetCulture) + $(NeutralLanguage) + + + + + + + + + + + + true + $(LibFolder) + + + + true + $(LibFolder) + + + + true + $(LibFolder) + + + + true + ref + + + + true + content + + + + true + + + + + true + . + + + + true + %(PackagingRootFolderSubFolders.Identity) + + + + + + + + + + CreateContentFolder; + $(GenerateNuspecDependsOn) + + + + + + + + + + + + + $(ArtifactsPackagingDir)$(NormalizedPackageName)\ + $(RepoCommitVersionFileDir)version.txt + + + + + + + + + + + + + + + + + + + + + + + + $(ArtifactsPackagingDir)$(NormalizedPackageName)\ + $(RuntimeJsonFileDir)runtime.json + + + + + + + + diff --git a/eng/WpfArcadeSdk/tools/Pbt.props b/eng/WpfArcadeSdk/tools/Pbt.props new file mode 100644 index 00000000000..0f7d3718132 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/Pbt.props @@ -0,0 +1,11 @@ + + + netcoreapp2.1 + net472 + + + + $(ArtifactsTmpDir)PresentationBuildTasks\$(PbtTfm)\ + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/Pbt.targets b/eng/WpfArcadeSdk/tools/Pbt.targets new file mode 100644 index 00000000000..f6e391706a0 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/Pbt.targets @@ -0,0 +1,78 @@ + + + + <_PresentationBuildTasksAssembly Condition="'$(InternalMarkupCompilation)'=='true'">$(PbtDir)PresentationBuildTasks.dll + + + + + + + + + + $(PrepareResourceNamesDependsOn); + EnsurePbtPath + + + + $(MarkupCompilePass1DependsOn); + EnsurePbtPath + + + + + + + + + + + + + + + false + false + + + + + + diff --git a/eng/WpfArcadeSdk/tools/ProjectReferences.props b/eng/WpfArcadeSdk/tools/ProjectReferences.props new file mode 100644 index 00000000000..5b77909d41d --- /dev/null +++ b/eng/WpfArcadeSdk/tools/ProjectReferences.props @@ -0,0 +1,21 @@ + + + + false + + + + true + + + + + + false + + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/ProjectReferences.targets b/eng/WpfArcadeSdk/tools/ProjectReferences.targets new file mode 100644 index 00000000000..f79f2d713e6 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/ProjectReferences.targets @@ -0,0 +1,15 @@ + + + + ClearReferenceCopyLocalPaths; + $(PrepareForRunDependsOn) + + + + + + + + diff --git a/Publishing.targets b/eng/WpfArcadeSdk/tools/Publishing.targets similarity index 100% rename from Publishing.targets rename to eng/WpfArcadeSdk/tools/Publishing.targets diff --git a/eng/WpfArcadeSdk/tools/Redist.props b/eng/WpfArcadeSdk/tools/Redist.props new file mode 100644 index 00000000000..bbb2e2d9513 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/Redist.props @@ -0,0 +1,15 @@ + + + + vcruntime + 140 + + msvcp + 140 + + D3DCompiler + _47 + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/Redist.targets b/eng/WpfArcadeSdk/tools/Redist.targets new file mode 100644 index 00000000000..4a6424ad8a8 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/Redist.targets @@ -0,0 +1,28 @@ + + + + $(PreparePackageAssetsDependsOn); + CopyRedistFile + + + + + + + + + + + + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/ReferenceAssembly.props b/eng/WpfArcadeSdk/tools/ReferenceAssembly.props new file mode 100644 index 00000000000..5be9423c416 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/ReferenceAssembly.props @@ -0,0 +1,12 @@ + + + + false + $(ArtifactsDir)ref\ + + + + true + true + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/ReferenceAssembly.targets b/eng/WpfArcadeSdk/tools/ReferenceAssembly.targets new file mode 100644 index 00000000000..e635488340d --- /dev/null +++ b/eng/WpfArcadeSdk/tools/ReferenceAssembly.targets @@ -0,0 +1,46 @@ + + + + EnsureReferenceDestination; + $(CoreBuildDependsOn) + + + EnsureReferenceDestination; + $(ResolveReferencesDependsOn) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @(RefAssemblies) + + + diff --git a/eng/WpfArcadeSdk/tools/ResourceLinking.targets b/eng/WpfArcadeSdk/tools/ResourceLinking.targets new file mode 100644 index 00000000000..a0d338f1a38 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/ResourceLinking.targets @@ -0,0 +1,20 @@ + + + + + + $(ConfigurationType) + lib + false + + + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/SdkReferences.targets b/eng/WpfArcadeSdk/tools/SdkReferences.targets new file mode 100644 index 00000000000..6544fe441ce --- /dev/null +++ b/eng/WpfArcadeSdk/tools/SdkReferences.targets @@ -0,0 +1,139 @@ + + + + + + + + + + + + + <_netCoreAppSdkReference Remove="@(_netCoreAppSdkReference)" /> + <_netCoreAppSdkReference Include="@(ReferencePath)" Condition="'%(ReferencePath.NuGetPackageId)'=='Microsoft.NETCore.App'"/> + + + + + + + <_netCoreAppSdkUnwantedRefNormalized Remove="@(_netCoreAppSdkUnwantedRefNormalized)" /> + <_netCoreAppSdkUnwantedRefNormalized Include="@(_netCoreAppSdkReference->'%(FileName)')" /> + <_netCoreAppSdkUnwantedRefNormalized Remove="@(NetCoreReference)" /> + + + + + <_netCoreAppSdkUnwantedRef Remove="@(_netCoreAppSdkUnwantedRef)" /> + <_netCoreAppSdkUnwantedRef Include="@(_netCoreAppSdkUnwantedRefNormalized->'%(OriginalItemSpec)')" /> + + + + + + + + + + + + + + <_windowsDesktopAppSdkReference Remove="@(_windowsDesktopAppSdkReference)" /> + <_windowsDesktopAppSdkReference Include="@(ReferencePath)" Condition="'%(ReferencePath.NuGetPackageId)'=='Microsoft.WindowsDesktop.App'"/> + + + + + + + <_windowsDesktopAppSdkUnwantedRefNormalized Remove="@(_windowsDesktopAppSdkUnwantedRefNormalized)" /> + <_windowsDesktopAppSdkUnwantedRefNormalized Include="@(_windowsDesktopAppSdkReference->'%(FileName)')" /> + <_windowsDesktopAppSdkUnwantedRefNormalized Remove="@(WindowsDesktopReference)" /> + + + + + <_windowsDesktopAppSdkUnwantedRef Remove="@(_windowsDesktopAppSdkUnwantedRef)" /> + <_windowsDesktopAppSdkUnwantedRef Include="@(_windowsDesktopAppSdkUnwantedRefNormalized->'%(OriginalItemSpec)')" /> + + + + + + + + + + + + ResolveMicrosoftDotNetWpfGitHubReferences; + ResolveWinFormsReferences; + $(ResolveAssemblyReferencesDependsOn) + + + + + + + + + + + + + + + + + + diff --git a/eng/WpfArcadeSdk/tools/ShippingProjects.props b/eng/WpfArcadeSdk/tools/ShippingProjects.props new file mode 100644 index 00000000000..63d71786b27 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/ShippingProjects.props @@ -0,0 +1,75 @@ + + + + System.Xaml + + + + PresentationBuildTasks; + PresentationCore; + DirectWriteForwarder; + PresentationCore-CommonResources; + PresentationFramework; + PresentationFramework-SystemCore; + PresentationFramework-SystemData; + PresentationFramework-SystemDrawing; + PresentationFramework-SystemXml; + PresentationFramework-SystemXmlLinq; + PresentationUI; + ReachFramework; + System.Printing; + System.Windows.Controls.Ribbon; + System.Windows.Input.Manipulations; + System.Windows.Presentation; + PresentationFramework.Aero; + PresentationFramework.Aero2; + PresentationFramework.AeroLite; + PresentationFramework.Classic; + PresentationFramework.Luna; + PresentationFramework.Royale; + UIAutomationClient; + UIAutomationClientSideProviders; + UIAutomationProvider; + UIAutomationTypes; + WindowsBase; + WindowsFormsIntegration; + PenImc; + PresentationNative; + WpfGfx; + D3DCompiler; + VCRuntime + + + + $(ExternalShippingProjects); + $(InternalShippingProjects) + + + + PresentationBuildTasks; + D3DCompiler; + VCRuntime + + + + PresentationBuildTasks + + + + + + false + true + true + + false + true + + Internal + External + + + WindowsDesktopSdk + + + diff --git a/eng/WpfArcadeSdk/tools/ShippingProjects.targets b/eng/WpfArcadeSdk/tools/ShippingProjects.targets new file mode 100644 index 00000000000..1072ca3a6cd --- /dev/null +++ b/eng/WpfArcadeSdk/tools/ShippingProjects.targets @@ -0,0 +1,8 @@ + + + tools + true + true + true + + diff --git a/SystemResources.props b/eng/WpfArcadeSdk/tools/SystemResources.props similarity index 100% rename from SystemResources.props rename to eng/WpfArcadeSdk/tools/SystemResources.props diff --git a/eng/WpfArcadeSdk/tools/TargetFrameworks.props b/eng/WpfArcadeSdk/tools/TargetFrameworks.props new file mode 100644 index 00000000000..237929e4c40 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/TargetFrameworks.props @@ -0,0 +1,5 @@ + + + $(DefineConstants);NETFX + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/VersionSuffix.props b/eng/WpfArcadeSdk/tools/VersionSuffix.props new file mode 100644 index 00000000000..8c0ebfad64b --- /dev/null +++ b/eng/WpfArcadeSdk/tools/VersionSuffix.props @@ -0,0 +1,5 @@ + + + _cor3 + + \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/Wpf.Cpp.props b/eng/WpfArcadeSdk/tools/Wpf.Cpp.props new file mode 100644 index 00000000000..0e5004d3638 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/Wpf.Cpp.props @@ -0,0 +1,329 @@ + + + 15.0 + Unicode + + + v142 + + + 10.0.17134.0 + + DynamicLibrary + + + $(WindowsSdkDir_10) + $(WindowsSdkDir) + $(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Kits\Installed Roots@KitsRoot10) + + $(Platform) + x86 + x64 + + $(Windows10SdkPath)bin\$(WindowsTargetPlatformVersion)\$(Architecture)\tracewpp.exe + + $(ManagedCxx) + true + + 1 + + 0x0700 + + 0x0A00 + + 0x0A000005 + + $(Win32WinNt) + + + + + + $(MsBuildThisFileDirectory)WppConfig\ + + false + + + + false + true + true + + + + + $(SDK40ToolsPath) + $(TargetFrameworkSDKToolsDirectory)$(Platform)\ + + + + true + true + false + Default + false + + + false + true + false + UseLinkTimeCodeGeneration + + + + + $(ManagedCxxSuppressions);4679 + + $(ManagedCxxSuppressions);4691 + + $(ManagedCxxSuppressions);4945 + + $(ManagedCxxSuppressions);4947 + + $(ManagedCxxSuppressions);4995 + + + + true + + 0.0.0.3 + $(RepoRoot).tools\native\bin\msvcurt-c1xx\$(MsvcurtC1xxVersion)\$(Architecture)\ + $(MsvcurtC1xxToolsPath)msvcurt$(LibSuffix)_netcore.lib + + + + + %(AdditionalDependencies);$(MsvcurtNetCoreLib) + + + + + + + + true + + + true + false + + + true + + + $(VCToolsInstallDir)lib\$(Architecture)\ + $(UniversalCRTSdkDir)Lib\$(WindowsTargetPlatformVersion)\UCRT\$(Architecture)\ + + d + + + oldnames.lib + legacy_stdio_wide_specifiers.lib + + + libucrt$(LibSuffix).lib + libvcruntime$(LibSuffix).lib + libcmt$(LibSuffix).lib + libcpmt$(LibSuffix).lib + + + ucrt$(LibSuffix).lib + vcruntime$(LibSuffix).lib + msvcrt$(LibSuffix).lib + msvcprt$(LibSuffix).lib + + $(DisallowLibClause) /disallowlib:ucrt$(LibSuffix).lib + $(DisallowLibClause) /disallowlib:vcruntime$(LibSuffix).lib + $(DisallowLibClause) /disallowlib:msvcrt$(LibSuffix).lib + $(DisallowLibClause) /disallowlib:msvcprt$(LibSuffix).lib + $(DisallowLibClause) /disallowlib:libucrt$(LibSuffix).lib + $(DisallowLibClause) /disallowlib:libvcruntime$(LibSuffix).lib + $(DisallowLibClause) /disallowlib:libcmt$(LibSuffix).lib + $(DisallowLibClause) /disallowlib:libcpmt$(LibSuffix).lib + + + /dllrename:$(VCRuntimeDllBaseName)$(VCRuntimeVersion)$(LibSuffix)=$(VCRuntimeDllBaseName)$(VCRuntimeVersion)$(LibSuffix)$(WpfVersionSuffix) + + + $(StaticUCRTLibrary);$(StaticVCRTLibrary);$(StaticCRTStartupLibrary);$(StaticStandardCppLibrary);$(DynamicUCRTLibrary);$(DynamicVCRTLibrary);$(DynamicCRTStartupLibrary);$(DynamicStandardCppLibrary) + $(StandardLibrariesForNativeCpp);$(OldNamesLib);$(LegacyStdioWideSpecifiersLib) + + + $(NoDefaultLibClauseForRuntimeLibs) /nodefaultlib:ucrt$(LibSuffix).lib /nodefaultlib:libucrt$(LibSuffix).lib /nodefaultlib:msvcrt$(LibSuffix).lib /nodefaultlib:libcmt$(LibSuffix).lib + + + false + + + false + + + $(BaseOutputPath)$(Configuration)\$(TargetFramework)\ + $(BaseOutputPath)$(Architecture)\$(Configuration)\$(TargetFramework)\ + + $(BaseIntermediateOutputPath)$(Configuration)\$(TargetFramework)\ + $(BaseIntermediateOutputPath)$(Architecture)\$(Configuration)\$(TargetFramework)\ + + false + false + + + + + $(ComputeCompileInputsTargets); + SetMscorlibAdditionalUsingDirectory; + + + + + + Level3 + true + + %(DisableSpecificWarnings);$(ManagedCxxSuppressions);4960;4961;4603;4627;4838;4456;4457;4458;4459;4091 + + + %(PreprocessorDefinitions);WIN32;_UNICODE;UNICODE;_WINDOWS;STRICT;_WIN32_WINNT=$(Win32WinNt);_WIN32_IE=$(Win32Ie);WINNT=$(WinNt);WINVER=$(WinVer) + %(PreprocessorDefinitions);_LIB; + %(PreprocessorDefinitions);SAL_NO_ATTRIBUTE_DECLARATIONS + + + + + %(PreprocessorDefinitions);ARGITERATOR_SUPPORTED=0 + + + %(PreprocessorDefinitions);_AMD64_; + %(PreprocessorDefinitions);_X86_; + %(PreprocessorDefinitions);_ARM_; + %(PreprocessorDefinitions);_ARM64_; + + ProgramDatabase + + + $(IntermediateOutputPath)$(TargetName)-compile.pdb + + false + Async + Default + + true + OnlyExplicitInline + true + + false + + true + false + + false + + Guard + false + + + StdCall + + + %(AdditionalIncludeDirectories);$(WpfSharedDir)inc\ + %(AdditionalIncludeDirectories);$(WpfCommonDir)inc\ + + ddbanned.h + + + + + + %(AdditionalOptions) /clr:netcore + + + Windows + + true + DebugFull + + %(AdditionalOptions) /DEBUGTYPE:CV,PDATA,FIXUP + + + + + /ignore:4221 %(AdditionalOptions) + %(AdditionalOptions) /MACHINE:$(Architecture) + Machine$(Architecture) + + + $(VcrtLibDir);$(UcrtLibDir);%(AdditionalLibraryDirectories) + %(AdditionalDependencies);$(StandardLibrariesForNativeCpp) + %(AdditionalOptions) $(NoDefaultLibClauseForRuntimeLibs) $(DisallowLibClause) + %(AdditionalOptions) $(DllRenameClause) + true + %(AdditionalOptions) /keyfile:$(AssemblyOriginatorKeyFile) /delaysign + + $(IntermediateOutputPath)$(TargetName).pdb + + + + + + /ignore:4221 %(AdditionalOptions) + %(AdditionalOptions) /MACHINE:$(Architecture) + + + %(AdditionalIncludeDirectories);$(IntermediateOutputPath) + + + + + + Disabled + _DEBUG;DEBUG;%(PreprocessorDefinitions) + + %(PreprocessorDefinitions);DBG=1 + MultiThreadedDebug + MultiThreadedDebugDLL + + + + + + + MaxSpeed + true + true + NDEBUG;%(PreprocessorDefinitions) + + MultiThreaded + MultiThreadedDLL + + + true + true + + + + + + %(AdditionalOptions) /linkrepro:$(IntermediateOutputPath)LinkRepro + + + diff --git a/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets b/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets new file mode 100644 index 00000000000..537f71fc07f --- /dev/null +++ b/eng/WpfArcadeSdk/tools/Wpf.Cpp.targets @@ -0,0 +1,333 @@ + + + $(IntermediateOutputPath)NativeVersion.rc + $([System.IO.Path]::GetDirectoryName($(NativeVersionFile))) + + + + + $(MsvcurtC1xxToolsPath)HostX86\c1xx.dll + $(MsvcurtC1xxToolsPath)HostX64\c1xx.dll + + + + %(AdditionalOptions) /Bx"$(FrontEndPath)" + + + %(AdditionalOptions) /fe:"$(FrontEndPath)" + + + + + + + %(AdditionalIncludeDirectories);$(NativeVersionFileDirectory) + + + %(AdditionalIncludeDirectories);$(NativeVersionFileDirectory) + + + + + + + %(AdditionalOptions) /linkrepro:$(IntermediateOutputPath)LinkRepro + + + + + + $(BeforeLinkTargets); + CreateLinkReproFolder + + + + + + $(IntermediateOutputPath)LinkRepro\ + + + + + + + + + + + + + + + + + + + +using namespace System; +using namespace System::Reflection; +using namespace System::Runtime::InteropServices; +using namespace System::Runtime::Versioning; + +[assembly:AssemblyTitle("$(AssemblyTitle)")]; +[assembly:AssemblyDescription("$(AssemblyDescription)")]; +[assembly:AssemblyDefaultAlias("$(AssemblyName)")]; +[assembly:AssemblyCompany("$(Company)")]; +[assembly:AssemblyProduct("$(Product)")]; +[assembly:AssemblyCopyright("$(Copyright)")]; +[assembly:AssemblyVersion("$(AssemblyVersion)")]; +[assembly:AssemblyFileVersion("$(FileVersion)")]; +[assembly:AssemblyInformationalVersion("$(AssemblyInformationalVersion)")]; +[assembly:TargetFramework("$(TargetFrameworkMoniker)", FrameworkDisplayName="$(TargetFrameworkMonikerDisplayName)")]; + ]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + NotUsing + + + + + + + + <_AdditionalExplicitAssemblyReferences Include="$(AdditionalExplicitAssemblyReferences)" /> + <_AdditionalExplicitAssemblyReferences Remove="mscorlib" /> + + + @(_AdditionalExplicitAssemblyReferences) + + + + + + + <_mscorlibDirectory Condition="'%(ReferencePath.FileName)%(ReferencePath.Extension)' == 'mscorlib.dll'">%(ReferencePath.RootDir)%(ReferencePath.Directory) + + + + + %(CLCompile.AdditionalUsingDirectories);$(_mscorlibDirectory) + + + + + + + CppCliHelper; + $(ResolveReferencesDependsOn) + + + $(EnsureWpfProjectReferenceDependsOn); + CppCliHelper + + + + + + + + $(IntermediateOutputPath)CppCliSupport\CppClrSupport_$(MSBuildProjectName).csproj + + + + + + + + + netcoreapp3.0 + AnyCPU%3Bx64 + + + + + + + + + true + + + + + <_AdditionalPackages Remove="%40(_AdditionalPackages)" /> + <_AdditionalPackages Include="%24(AdditionalPackages)" /> + + + + + + + + + + + + + + + + + + + + + + + + + ]]> + + + + + + + + + + + + + AdditionalPackages=@(AdditionalPackageReference->'%(Identity)+%(Version)') + + + + + + + + + + False + + + + + + + + + + + $(BeforeLinkTargets); + EnsureLinkReproFolder + + + + + + + + + + + + + diff --git a/eng/WpfArcadeSdk/tools/WpfProjectReference.targets b/eng/WpfArcadeSdk/tools/WpfProjectReference.targets new file mode 100644 index 00000000000..86438390b80 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WpfProjectReference.targets @@ -0,0 +1,152 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + EnsureWpfProjectReference; + $(PrepareForBuildDependsOn) + + + EnsureWpfProjectReference; + $(CoreBuildDependsOn) + + + EnsureWpfProjectReference; + $(CoreCompileDependsOn) + + + EnsureWpfProjectReference; + $(ResolveReferencesDependsOn) + + + EnsureWpfProjectReference; + $(MarkupCompilePass1DependsOn) + + + + + + + + + <_wpfProjectPath Include="@(WpfProjectPath)"> + %(WpfProjectPath.Identity) + + <_wpfProjectPathAvailableLocally Include="@(WpfProjectPath)" + Condition="Exists('%(ProjectPath)')" /> + + + + + + + + + + + + + <_unmatchedProjectReferenceWithConfiguration Remove="@(_unmatchedProjectReferenceWithConfiguration)" /> + <_unmatched_ProjectReferenceWithConfiguration Remove="@(_unmatched_ProjectReferenceWithConfiguration)" /> + + + + + + + + + + <_ProjectReferenceWithConfiguration Remove="@(_unmatched_ProjectReferenceWithConfiguration)" /> + <_MSBuildProjectReferenceNonExistent Remove="@(_unmatchedProjectReferenceWithConfiguration)" /> + + + + + + + + + + + + + + + + + + + + + + + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/CodeTags.txt b/eng/WpfArcadeSdk/tools/WppConfig/rev1/CodeTags.txt new file mode 100644 index 00000000000..f4741b6637a --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/CodeTags.txt @@ -0,0 +1,21 @@ +# Nominal timestamp: 2004/11/17-21:38:31 +# +# Auto-generated from winmain-450k-newerupdatedlist.txt dated 2004/10/20 +# with additional 13288 files from Vikram dated 2004/11/06 +# See DavePr or LisaGra or RajeshM or JFeltis for questions. +# +FILE r1defwpp.ini +$TAG ENGR +$MODULE: build_tools_wppconfig +$OWNER: jtolman +$KEYWORDS: +$ENDTAG + +FILE * +$TAG ENGR +$MODULE: build_tools_wppconfig +$OWNER: josesua +$KEYWORDS: +$ENDTAG + +# checksum: 0020-008292397-00 diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/TCHARUNIwpp.ini b/eng/WpfArcadeSdk/tools/WppConfig/rev1/TCHARUNIwpp.ini new file mode 100644 index 00000000000..eb849aab1e8 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/TCHARUNIwpp.ini @@ -0,0 +1,218 @@ +# +# Default types for WPP for users who are using TCHAR's and have Unicode defined. +# 2004 Revision 0.0 +# + +# our basic arithmetic types + +DEFINE_SIMPLE_TYPE( XINT64, signed __int64, ItemLongLongX, "I64x", x, 8); +DEFINE_SIMPLE_TYPE( XXINT64, signed __int64, ItemLongLongXX, "I64X", X, 8); +DEFINE_SIMPLE_TYPE( OINT64, signed __int64, ItemLongLongO, "I64o", o, 8); + +DEFINE_SIMPLE_TYPE( SBYTE, signed char, ItemChar, "c", c, 1); +DEFINE_SIMPLE_TYPE( SSHORT, signed short, ItemShort, "hd", h, 2); +DEFINE_SIMPLE_TYPE( SINT, signed int, ItemLong, "d", d, 4); +DEFINE_SIMPLE_TYPE( SLONG, signed long, ItemLong, "ld", l, 4); +DEFINE_SIMPLE_TYPE( SINT64, signed __int64, ItemLongLong, "I64d", i, 8); + +DEFINE_SIMPLE_TYPE( UBYTE, unsigned char, ItemChar, "c", C, 1); +DEFINE_SIMPLE_TYPE( USHORT, unsigned short, ItemShort, "hu", H, 2); +DEFINE_SIMPLE_TYPE( UINT, unsigned int, ItemLong, "u", D, 4); +DEFINE_SIMPLE_TYPE( ULONG, unsigned long, ItemLong, "lu", L, 4); +DEFINE_SIMPLE_TYPE( UINT64, unsigned __int64, ItemULongLong, "I64u", I, 8); + + + +DEFINE_SIMPLE_TYPE( DOUBLE, double, ItemDouble, "s", g, 8); + +# arch dependent types + +DEFINE_SIMPLE_TYPE( SLONGPTR, LONG_PTR, ItemPtr, "Id", p, 6); +DEFINE_SIMPLE_TYPE( ULONGPTR, ULONG_PTR, ItemPtr, "Iu", P, 6); +DEFINE_SIMPLE_TYPE( PTR, const void*, ItemPtr, "p", q, 6); +DEFINE_SIMPLE_TYPE( HANDLE, const void*, ItemPtr, "p", Q, 6); + +# predefined constants + +DEFINE_SIMPLE_TYPE( COMPNAME,,, "__COMPNAME__",,); +DEFINE_SIMPLE_TYPE( FILE,,, "__FILE__",,); +DEFINE_SIMPLE_TYPE( LINE,,, "__LINE__",,); +DEFINE_SIMPLE_TYPE( FUNC,,, "%!FUNC!",,); // traceprt now understands %!FUNC! +DEFINE_SIMPLE_TYPE( LEVEL,,, "%!LEVEL!",,); // and %!LEVEL% + +DEFINE_SIMPLE_TYPE( STDPREFIX,,, "%0",,); +DEFINE_SIMPLE_TYPE( MOD,,, "%1!s!",,); +DEFINE_SIMPLE_TYPE( TYP,,, "%2!s!",,); +DEFINE_SIMPLE_TYPE( TID,,, "%3!x!",,); +DEFINE_SIMPLE_TYPE( NOW,,, "%4!s!",,); +DEFINE_SIMPLE_TYPE( SEQ,,, "%7!x!",,); +DEFINE_SIMPLE_TYPE( PID,,, "%8!x!",,); +DEFINE_SIMPLE_TYPE( CPU,,, "%9!x!",,); +DEFINE_SIMPLE_TYPE( SPACE,,, " ",,); + +DEFINE_SIMPLE_TYPE_PTR(GUID, LPCGUID, ItemGuid, "s", _guid_, 0); // simple type, passed by addr + +DEFINE_FLAVOR( UCHAR, SBYTE, ItemUChar, "c" ); +DEFINE_FLAVOR( SCHAR, SBYTE, ItemChar, "c" ); +DEFINE_FLAVOR( BOOLEAN, SBYTE, ItemListByte(FALSE,TRUE), "s"); + + +# all strings require custom processing +# Note that in the TCHAR Unicode verions ASTR is wide and WSTR is mapped to single + +DEFINE_CPLX_TYPE(ASTR, WPP_LOGWSTR, LPCWSTR, ItemWString, "s", s, 0); +DEFINE_CPLX_TYPE(ARSTR, WPP_LOGASTR, LPCSTR, ItemRString, "s", t, 0); +DEFINE_CPLX_TYPE(ARWSTR, WPP_LOGWSTR, LPCWSTR, ItemRWString, "s", S, 0); +DEFINE_CPLX_TYPE(WSTR, WPP_LOGASTR, const char *, ItemString, "s", S, 0); +DEFINE_CPLX_TYPE(CSTR, WPP_LOGPCSTR, PCSTRING, ItemPString, "s", z, 0, 2); +DEFINE_CPLX_TYPE(USTR, WPP_LOGPUSTR, PCUNICODE_STRING,ItemPWString,"s", Z, 0, 2); + +DEFINE_CPLX_TYPE(sid, WPP_LOGPSID, PSID, ItemSid,"s", _sid_, 0); +DEFINE_CPLX_TYPE(str, WPP_LOGSTDSTR, const std::string&, ItemString,"s", _str_, 0); + + +#kludge for printf like statements + +DEFINE_FLAVOR(e, DOUBLE,,); +DEFINE_FLAVOR(E, DOUBLE,,); +DEFINE_FLAVOR(f, DOUBLE,,); +DEFINE_FLAVOR(g, DOUBLE,,); +DEFINE_FLAVOR(G, DOUBLE,,); + +DEFINE_FLAVOR(c, SBYTE,,); +DEFINE_FLAVOR(hc, SBYTE,,); +DEFINE_FLAVOR(lc, SSHORT,,); +DEFINE_FLAVOR(wc, SSHORT,,); +DEFINE_FLAVOR(C, SSHORT,,); + +DEFINE_FLAVOR(s, ASTR,,); +DEFINE_FLAVOR(hs, ASTR,,); +DEFINE_FLAVOR(S, WSTR,,); +DEFINE_FLAVOR(ws, WSTR,,); +DEFINE_FLAVOR(ls, ASTR,,); + +DEFINE_FLAVOR(hi, SSHORT,,); +DEFINE_FLAVOR(hd, SSHORT,,); +DEFINE_FLAVOR(hu, USHORT,,"u"); +DEFINE_FLAVOR(hx, USHORT,,"x"); +DEFINE_FLAVOR(hX, USHORT,,"X"); +DEFINE_FLAVOR(ho, USHORT,,"o"); + +DEFINE_FLAVOR(Id, ULONGPTR,,"Id"); +DEFINE_FLAVOR(Iu, ULONGPTR,,"Iu"); +DEFINE_FLAVOR(Ix, ULONGPTR,,"Ix"); +DEFINE_FLAVOR(IX, ULONGPTR,,"IX"); +DEFINE_FLAVOR(Io, ULONGPTR,,"Io"); + +DEFINE_FLAVOR(i, SINT,,); +DEFINE_FLAVOR(d, SINT,,); +DEFINE_FLAVOR(u, UINT,,"u"); +DEFINE_FLAVOR(x, UINT,,"x"); +DEFINE_FLAVOR(X, UINT,,"X"); +DEFINE_FLAVOR(o, UINT,,"o"); +DEFINE_FLAVOR(cccc, SINT, ItemChar4, "s"); + +DEFINE_FLAVOR(li, SLONG,,); +DEFINE_FLAVOR(ld, SLONG,,); +DEFINE_FLAVOR(lu, ULONG,,"u"); +DEFINE_FLAVOR(lx, ULONG,,"x"); +DEFINE_FLAVOR(lX, ULONG,,"X"); +DEFINE_FLAVOR(lo, ULONG,,"o"); + +DEFINE_FLAVOR(I64d, SINT64,,); +DEFINE_FLAVOR(I64u, UINT64,,); +DEFINE_FLAVOR(I64x, XINT64,,"I64x"); +DEFINE_FLAVOR(I64X, XXINT64,,"I64X"); +DEFINE_FLAVOR(I64o, OINT64,,"I64o"); + +DEFINE_FLAVOR(p, PTR,,); + +DEFINE_FLAVOR(Z, USTR,,); +DEFINE_FLAVOR(wZ, USTR,,); +DEFINE_FLAVOR(z, CSTR,,); +DEFINE_FLAVOR(hZ, CSTR,,); + +# default formats for those who don't care to provide their own strings + +DEFINE_FLAVOR(XBYTE, SBYTE,, "02x"); +DEFINE_FLAVOR(OBYTE, SBYTE,, "o"); + +DEFINE_FLAVOR(XSHORT, SSHORT,, "04hX"); +DEFINE_FLAVOR(OSHORT, SSHORT,, "ho"); + +DEFINE_FLAVOR(XINT, SINT,, "08x"); +DEFINE_FLAVOR(OINT, SINT,, "o"); + +DEFINE_FLAVOR(XLONG, SLONG,, "08lX"); +DEFINE_FLAVOR(OLONG, SLONG,, "lo"); + + +DEFINE_FLAVOR(XLONGPTR, SLONGPTR,,"Ix"); +DEFINE_FLAVOR(OLONGPTR, SLONGPTR,,"Ox"); + +# special formats + +DEFINE_FLAVOR(IPADDR, UINT, ItemIPAddr, "s"); +DEFINE_FLAVOR(PORT, USHORT, ItemPort, "s"); +DEFINE_FLAVOR(STATUS, SINT, ItemNTSTATUS, "s"); +DEFINE_FLAVOR(WINERROR, UINT, ItemWINERROR, "s"); +DEFINE_FLAVOR(HRESULT, SINT, ItemHRESULT, "s"); + +DEFINE_FLAVOR(ipaddr,IPADDR,,); +DEFINE_FLAVOR(port,PORT,,); +DEFINE_FLAVOR(status,STATUS,,); +DEFINE_FLAVOR(hresult,HRESULT,,); +DEFINE_FLAVOR(winerr,WINERROR,,); +DEFINE_FLAVOR(guid,GUID,,); + +# time related stuff + +DEFINE_FLAVOR(TIMESTAMP, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(TIME, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(DATE, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(WAITTIME, SINT64, ItemTimestamp, "s"); + +DEFINE_FLAVOR(due, SINT64, ItemWaitTime, "s"); +DEFINE_FLAVOR(delta, SINT64, ItemTimeDelta, "s"); +DEFINE_FLAVOR(datetime, SINT64, ItemTimestamp, "s"); + +# enumeration types + +DEFINE_FLAVOR(ItemListByte, SBYTE, ItemListByte, "s"); +DEFINE_FLAVOR(ItemListShort, SSHORT, ItemListShort,"s"); +DEFINE_FLAVOR(ItemListLong, SLONG, ItemListLong, "s"); + +DEFINE_FLAVOR(ItemSetByte, UBYTE, ItemSetByte, "s"); +DEFINE_FLAVOR(ItemSetShort, USHORT, ItemSetShort,"s"); +DEFINE_FLAVOR(ItemSetLong, ULONG, ItemSetLong, "s"); +DEFINE_FLAVOR(ItemEnum, ULONG, ItemEnum, "s"); + +DEFINE_FLAVOR(CLSID, GUID, ItemCLSID, "s"); +DEFINE_FLAVOR(LIBID, GUID, ItemLIBID, "s"); +DEFINE_FLAVOR(IID, GUID, ItemIID, "s"); + +CUSTOM_TYPE(b1, ItemSetByte(1,2,3,4,5,6,7,8) ); +CUSTOM_TYPE(b2, ItemSetShort(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ); +CUSTOM_TYPE(b4, ItemSetLong(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32) ); + + +CUSTOM_TYPE(bool, ItemListLong(false,true) ); +CUSTOM_TYPE(bool16, ItemListShort(false,true) ); +CUSTOM_TYPE(bool8, ItemListByte(false,true) ); + +CUSTOM_TYPE(irql, ItemListByte(Low,APC,DPC) ); + +CUSTOM_TYPE(pnpmn, ItemListByte(IRP_MN_START_DEVICE,IRP_MN_QUERY_REMOVE_DEVICE,IRP_MN_REMOVE_DEVICE,IRP_MN_CANCEL_REMOVE_DEVICE,IRP_MN_STOP_DEVICE,IRP_MN_QUERY_STOP_DEVICE,IRP_MN_CANCEL_STOP_DEVICE,IRP_MN_QUERY_DEVICE_RELATIONS,IRP_MN_QUERY_INTERFACE,IRP_MN_QUERY_CAPABILITIES,IRP_MN_QUERY_RESOURCES,IRP_MN_QUERY_RESOURCE_REQUIREMENTS,IRP_MN_QUERY_DEVICE_TEXT,IRP_MN_FILTER_RESOURCE_REQUIREMENTS,IRP_MN_PNP_14,IRP_MN_READ_CONFIG,IRP_MN_WRITE_CONFIG,IRP_MN_EJECT,IRP_MN_SET_LOCK,IRP_MN_QUERY_ID,IRP_MN_QUERY_PNP_DEVICE_STATE,IRP_MN_QUERY_BUS_INFORMATION,IRP_MN_DEVICE_USAGE_NOTIFICATION,IRP_MN_SURPRISE_REMOVAL) ); +CUSTOM_TYPE(sysctrl, ItemListByte(IRP_MN_QUERY_ALL_DATA,IRP_MN_QUERY_SINGLE_INSTANCE, IRP_MN_CHANGE_SINGLE_INSTANCE, IRP_MN_CHANGE_SINGLE_ITEM, IRP_MN_ENABLE_EVENTS, IRP_MN_DISABLE_EVENTS, IRP_MN_ENABLE_COLLECTION, IRP_MN_DISABLE_COLLECTION, IRP_MN_REGINFO, IRP_MN_EXECUTE_METHOD, IRP_MN_Reserved_0a, IRP_MN_REGINFO_EX) ); + +# default tracing macro + +FUNC DoTraceMessage(LEVEL,MSG,...); +FUNC DoDebugTrace(TRACELEVEL,MSG,...); + + +# default prefix (use traceprt default) + +USEPREFIX(*,"%!STDPREFIX!"); // traceprt will add standard prefix + +WPP_FLAGS(-lookfor:WPP_INIT_TRACING); // the same flags that can be passed on the command line to tracewpp diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/control.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/control.tpl new file mode 100644 index 00000000000..f945211cf5d --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/control.tpl @@ -0,0 +1,192 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` +#ifndef WPP_ALREADY_INCLUDED + +#define WPP_EVAL(x) x +#define WPP_STR(x) #x +#define WPP_STRINGIZE(x) WPP_STR(x) +#define WPP_GLUE(a, b) a ## b +#define WPP_GLUE3(a, b, c) a ## b ## c +#define WPP_GLUE4(a, b, c, d) a ## b ## c ## d +#define WPP_XGLUE(a, b) WPP_GLUE(a, b) +#define WPP_XGLUE3(a, b, c) WPP_GLUE3(a, b, c) +#define WPP_XGLUE4(a, b, c, d) WPP_GLUE4(a, b, c, d) + +// template `TemplateFile` +// +// Defines a set of macro that expand control model specified +// with WPP_CONTROL_GUIDS (example shown below) +// into an enum of trace levels and required structures that +// contain the mask of levels, logger handle and some information +// required for registration. +// + +/////////////////////////////////////////////////////////////////////////////////// +// +// #define WPP_CONTROL_GUIDS \ +// WPP_DEFINE_CONTROL_GUID(Regular,(81b20fea,73a8,4b62,95bc,354477c97a6f), \ +// WPP_DEFINE_BIT(Error) \ +// WPP_DEFINE_BIT(Unusual) \ +// WPP_DEFINE_BIT(Noise) \ +// ) \ +// WPP_DEFINE_CONTROL_GUID(HiFreq,(91b20fea,73a8,4b62,95bc,354477c97a6f), \ +// WPP_DEFINE_BIT(Entry) \ +// WPP_DEFINE_BIT(Exit) \ +// WPP_DEFINE_BIT(ApiCalls) \ +// WPP_DEFINE_BIT(RandomJunk) \ +// WPP_DEFINE_BIT(LovePoem) \ +// ) + +#if defined(__cplusplus) +extern "C" { +#endif + +#if !defined(WPP_NO_CONTROL_GUIDS) + +#if defined(WPP_DEFAULT_CONTROL_GUID) +# if defined(WPP_CONTROL_GUIDS) +# pragma message(__FILE__ " : error : WPP_DEFAULT_CONTROL_GUID cannot be used together with WPP_CONTROL_GUIDS") +# stop +# else +# define WPP_CONTROL_GUIDS \ + WPP_DEFINE_CONTROL_GUID(Default,(WPP_DEFAULT_CONTROL_GUID), \ + WPP_DEFINE_BIT(Error) \ + WPP_DEFINE_BIT(Unusual) \ + WPP_DEFINE_BIT(Noise) \ + ) +# endif +#endif + +#if !defined(WPP_CONTROL_GUIDS) +# pragma message(__FILE__ " : error : Please define control model via WPP_CONTROL_GUIDS or WPP_DEFAULT_CONTROL_GUID macros") +# pragma message(__FILE__ " : error : don't forget to call WPP_INIT_TRACING and WPP_CLEANUP in your main, DriverEntry or DllInit") +# pragma message(__FILE__ " : error : see tracewpp.doc for further information") +stop. +#endif +// a set of macro to convert a guid in a form x(81b20fea,73a8,4b62,95bc,354477c97a6f) +// into either a a struct or text string + +#define _WPPW(x) WPP_GLUE(L, x) + +#define WPP_GUID_TEXT(l,w1,w2,w3,ll) #l "-" #w1 "-" #w2 "-" #w3 "-" #ll +#define WPP_GUID_WTEXT(l,w1,w2,w3,ll) _WPPW(#l) L"-" _WPPW(#w1) L"-" _WPPW(#w2) L"-" _WPPW(#w3) L"-" _WPPW(#ll) +#define WPP_EXTRACT_BYTE(val,n) (((ULONGLONG)(0x ## val) >> (8 * n)) & 0xFF) +#define WPP_GUID_STRUCT(l,w1,w2,w3,ll) {0x ## l, 0x ## w1, 0x ## w2,\ + {WPP_EXTRACT_BYTE(w3, 1), WPP_EXTRACT_BYTE(w3, 0),\ + WPP_EXTRACT_BYTE(ll, 5), WPP_EXTRACT_BYTE(ll, 4),\ + WPP_EXTRACT_BYTE(ll, 3), WPP_EXTRACT_BYTE(ll, 2),\ + WPP_EXTRACT_BYTE(ll, 1), WPP_EXTRACT_BYTE(ll, 0)} } + +#ifndef WPP_FORCEINLINE +#if !defined(WPP_OLDCC) +#define WPP_FORCEINLINE __forceinline +#else +#define WPP_FORCEINLINE __inline +#endif +#endif + + +// define an enum of control block names +////// +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) WPP_XGLUE(WPP_CTL_, WPP_EVAL(Name)), +enum WPP_CTL_NAMES { WPP_CONTROL_GUIDS WPP_LAST_CTL}; +#undef WPP_DEFINE_CONTROL_GUID + +// define control guids +////// +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) \ +extern __declspec(selectany) const GUID WPP_XGLUE4(WPP_, ThisDir, _CTLGUID_, WPP_EVAL(Name)) = WPP_GUID_STRUCT Guid; +WPP_CONTROL_GUIDS +#undef WPP_DEFINE_CONTROL_GUID + +// define enums of individual bits +///// +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) \ + WPP_XGLUE(WPP_BLOCK_START_, WPP_EVAL(Name)) = WPP_XGLUE(WPP_CTL_, WPP_EVAL(Name)) * 0x10000, Bits WPP_XGLUE(WPP_BLOCK_END_, WPP_EVAL(Name)), +# define WPP_DEFINE_BIT(Name) WPP_BIT_ ## Name, +enum WPP_DEFINE_BIT_NAMES { WPP_CONTROL_GUIDS }; +# undef WPP_DEFINE_BIT +#undef WPP_DEFINE_CONTROL_GUID + +#define WPP_MASK(CTL) (1 << ( ((CTL)-1) & 31 )) +#define WPP_FLAG_NO(CTL) ( (0xFFFF & ((CTL)-1) ) / 32) +#define WPP_CTRL_NO(CTL) ((CTL) >> 16) + +// calculate how many DWORDs we need to get the required number of bits +// upper estimate. Sometimes will be off by one +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) | WPP_XGLUE(WPP_BLOCK_END_, WPP_EVAL(Name)) +enum _WPP_FLAG_LEN_ENUM { WPP_FLAG_LEN = 1 | ((0 WPP_CONTROL_GUIDS) & 0xFFFF) / 32 }; +#undef WPP_DEFINE_CONTROL_GUID + +#ifndef WPP_CB +# define WPP_CB WPP_GLOBAL_Control +#endif +#ifndef WPP_CB_TYPE +#define WPP_CB_TYPE WPP_PROJECT_CONTROL_BLOCK +#endif + +typedef union { + WPP_TRACE_CONTROL_BLOCK Control; + UCHAR ReserveSpace[ sizeof(WPP_TRACE_CONTROL_BLOCK) + sizeof(ULONG) * (WPP_FLAG_LEN - 1) ]; +} WPP_CB_TYPE ; + + +extern __declspec(selectany) WPP_CB_TYPE *WPP_CB = (WPP_CB_TYPE*)&WPP_CB; + +#define WPP_CONTROL(CTL) (WPP_CB[WPP_CTRL_NO(CTL)].Control) + +#ifndef WPP_USE_TRACE_LEVELS +// For historical reasons the use of LEVEL could imply flags, this was a bad choice but very difficult +// to undo. +#if !defined(WPP_LEVEL_LOGGER) +# define WPP_LEVEL_LOGGER(CTL) (WPP_CONTROL(WPP_BIT_ ## CTL).Logger), +#endif + +#if !defined(WPP_LEVEL_ENABLED) +# define WPP_LEVEL_ENABLED(CTL) (WPP_CONTROL(WPP_BIT_ ## CTL).Flags[WPP_FLAG_NO(WPP_BIT_ ## CTL)] & WPP_MASK(WPP_BIT_ ## CTL)) +#endif +#else // #ifndef WPP_USE_TRACE_LEVELS +#if !defined(WPP_LEVEL_LOGGER) +#define WPP_LEVEL_LOGGER(lvl) (WPP_CONTROL(WPP_BIT_ ## DUMMY).Logger), +#endif + +#if !defined(WPP_LEVEL_ENABLED) +#define WPP_LEVEL_ENABLED(lvl) (WPP_CONTROL(WPP_BIT_ ## DUMMY).Level >= lvl) +#endif +#endif // #ifndef WPP_USE_TRACE_LEVELS + +#if !defined(WPP_FLAG_LOGGER) +# define WPP_FLAG_LOGGER(CTL) (WPP_CONTROL(WPP_BIT_ ## CTL).Logger), +#endif + + +#if !defined(WPP_FLAG_ENABLED) +# define WPP_FLAG_ENABLED(CTL) (WPP_CONTROL(WPP_BIT_ ## CTL).Flags[WPP_FLAG_NO(WPP_BIT_ ## CTL)] & WPP_MASK(WPP_BIT_ ## CTL)) +#endif + +#if !defined(WPP_LOGGER_ARG) +# define WPP_LOGGER_ARG TRACEHANDLE Logger, +#endif + +#if !defined(WPP_GET_LOGGER) +# define WPP_GET_LOGGER Logger +#endif + +#ifndef WPP_ENABLED +# define WPP_ENABLED() 1 +#endif +#ifndef WPP_LOGGER +# define WPP_LOGGER() (WPP_CB[0].Control.Logger), +#endif + +#endif // WPP_NO_CONTROL_GUIDS + +#if defined(__cplusplus) +}; +#endif + +#endif // #ifndef WPP_ALREADY_INCLUDED + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/defaultwpp.ini b/eng/WpfArcadeSdk/tools/WppConfig/rev1/defaultwpp.ini new file mode 100644 index 00000000000..71f75402efc --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/defaultwpp.ini @@ -0,0 +1,219 @@ +# +# Default types for WPP +# + +# our basic arithmetic types + +DEFINE_SIMPLE_TYPE( XINT64, signed __int64, ItemLongLongX, "I64x", x, 8); +DEFINE_SIMPLE_TYPE( XXINT64, signed __int64, ItemLongLongXX, "I64X", X, 8); +DEFINE_SIMPLE_TYPE( OINT64, signed __int64, ItemLongLongO, "I64o", o, 8); + +DEFINE_SIMPLE_TYPE( SBYTE, signed char, ItemChar, "c", c, 1); +DEFINE_SIMPLE_TYPE( SSHORT, signed short, ItemShort, "hd", h, 2); +DEFINE_SIMPLE_TYPE( SINT, signed int, ItemLong, "d", d, 4); +DEFINE_SIMPLE_TYPE( SLONG, signed long, ItemLong, "ld", l, 4); +DEFINE_SIMPLE_TYPE( SINT64, signed __int64, ItemLongLong, "I64d", i, 8); + +DEFINE_SIMPLE_TYPE( UBYTE, unsigned char, ItemChar, "c", C, 1); +DEFINE_SIMPLE_TYPE( USHORT, unsigned short, ItemShort, "hu", H, 2); +DEFINE_SIMPLE_TYPE( UINT, unsigned int, ItemLong, "u", D, 4); +DEFINE_SIMPLE_TYPE( ULONG, unsigned long, ItemLong, "lu", L, 4); +DEFINE_SIMPLE_TYPE( UINT64, unsigned __int64, ItemULongLong, "I64u", I, 8); + + + +DEFINE_SIMPLE_TYPE( DOUBLE, double, ItemDouble, "s", g, 8); + +# arch dependent types + +DEFINE_SIMPLE_TYPE( SLONGPTR, LONG_PTR, ItemPtr, "Id", p, 6); +DEFINE_SIMPLE_TYPE( ULONGPTR, ULONG_PTR, ItemPtr, "Iu", P, 6); +DEFINE_SIMPLE_TYPE( PTR, const void*, ItemPtr, "p", q, 6); +DEFINE_SIMPLE_TYPE( HANDLE, const void*, ItemPtr, "p", Q, 6); + +# predefined constants + +DEFINE_SIMPLE_TYPE( COMPNAME,,, "__COMPNAME__",,); +DEFINE_SIMPLE_TYPE( FILE,,, "__FILE__",,); +DEFINE_SIMPLE_TYPE( LINE,,, "__LINE__",,); +DEFINE_SIMPLE_TYPE( FUNC,,, "%!FUNC!",,); // traceprt now understands %!FUNC! +DEFINE_SIMPLE_TYPE( LEVEL,,, "%!LEVEL!",,); // and %!LEVEL% + +DEFINE_SIMPLE_TYPE( STDPREFIX,,, "%0",,); +DEFINE_SIMPLE_TYPE( MOD,,, "%1!s!",,); +DEFINE_SIMPLE_TYPE( TYP,,, "%2!s!",,); +DEFINE_SIMPLE_TYPE( TID,,, "%3!x!",,); +DEFINE_SIMPLE_TYPE( NOW,,, "%4!s!",,); +DEFINE_SIMPLE_TYPE( SEQ,,, "%7!x!",,); +DEFINE_SIMPLE_TYPE( PID,,, "%8!x!",,); +DEFINE_SIMPLE_TYPE( CPU,,, "%9!x!",,); +DEFINE_SIMPLE_TYPE( SPACE,,, " ",,); + +DEFINE_SIMPLE_TYPE_PTR(GUID, LPCGUID, ItemGuid, "s", _guid_, 0); // simple type, passed by addr + +DEFINE_FLAVOR( UCHAR, SBYTE, ItemUChar, "c" ); +DEFINE_FLAVOR( SCHAR, SBYTE, ItemChar, "c" ); +DEFINE_FLAVOR( BOOLEAN, SBYTE, ItemListByte(FALSE,TRUE), "s"); + + +# all strings require custom processing + +DEFINE_CPLX_TYPE(ASTR, WPP_LOGASTR, const char*, ItemString, "s", s, 0); +DEFINE_CPLX_TYPE(ARSTR, WPP_LOGASTR, LPCSTR, ItemRString, "s", t, 0); +DEFINE_CPLX_TYPE(ARWSTR, WPP_LOGWSTR, LPCWSTR, ItemRWString, "s", S, 0); +DEFINE_CPLX_TYPE(WSTR, WPP_LOGWSTR, LPCWSTR, ItemWString, "s", S, 0); +DEFINE_CPLX_TYPE(CSTR, WPP_LOGPCSTR, PCSTRING, ItemPString, "s", z, 0, 2); +DEFINE_CPLX_TYPE(USTR, WPP_LOGPUSTR, PCUNICODE_STRING,ItemPWString,"s", Z, 0, 2); +DEFINE_CPLX_TYPE(ANSTR, WPP_LOGPCSTR, PCANSI_STRING, ItemPString, "s", aZ, 0, 2); + +DEFINE_CPLX_TYPE(sid, WPP_LOGPSID, PSID, ItemSid,"s", _sid_, 0); +DEFINE_CPLX_TYPE(str, WPP_LOGSTDSTR, const std::string&, ItemString,"s", _str_, 0); + + +#kludge for printf like statements + +DEFINE_FLAVOR(e, DOUBLE,,); +DEFINE_FLAVOR(E, DOUBLE,,); +DEFINE_FLAVOR(f, DOUBLE,,); +DEFINE_FLAVOR(g, DOUBLE,,); +DEFINE_FLAVOR(G, DOUBLE,,); + +DEFINE_FLAVOR(c, SBYTE,,); +DEFINE_FLAVOR(hc, SBYTE,,); +DEFINE_FLAVOR(lc, SSHORT,,); +DEFINE_FLAVOR(wc, SSHORT,,); +DEFINE_FLAVOR(C, SSHORT,,); + +DEFINE_FLAVOR(s, ASTR,,); +DEFINE_FLAVOR(hs, ASTR,,); +DEFINE_FLAVOR(S, WSTR,,); +DEFINE_FLAVOR(ws, WSTR,,); +DEFINE_FLAVOR(ls, WSTR,,); + +DEFINE_FLAVOR(hi, SSHORT,,); +DEFINE_FLAVOR(hd, SSHORT,,); +DEFINE_FLAVOR(hu, USHORT,,"u"); +DEFINE_FLAVOR(hx, USHORT,,"x"); +DEFINE_FLAVOR(hX, USHORT,,"X"); +DEFINE_FLAVOR(ho, USHORT,,"o"); + +DEFINE_FLAVOR(Id, ULONGPTR,,"Id"); +DEFINE_FLAVOR(Iu, ULONGPTR,,"Iu"); +DEFINE_FLAVOR(Ix, ULONGPTR,,"Ix"); +DEFINE_FLAVOR(IX, ULONGPTR,,"IX"); +DEFINE_FLAVOR(Io, ULONGPTR,,"Io"); + +DEFINE_FLAVOR(i, SINT,,); +DEFINE_FLAVOR(d, SINT,,); +DEFINE_FLAVOR(u, UINT,,"u"); +DEFINE_FLAVOR(x, UINT,,"x"); +DEFINE_FLAVOR(X, UINT,,"X"); +DEFINE_FLAVOR(o, UINT,,"o"); +DEFINE_FLAVOR(cccc, SINT, ItemChar4, "s"); + +DEFINE_FLAVOR(li, SLONG,,); +DEFINE_FLAVOR(ld, SLONG,,); +DEFINE_FLAVOR(lu, ULONG,,"u"); +DEFINE_FLAVOR(lx, ULONG,,"x"); +DEFINE_FLAVOR(lX, ULONG,,"X"); +DEFINE_FLAVOR(lo, ULONG,,"o"); + +DEFINE_FLAVOR(I64d, SINT64,,); +DEFINE_FLAVOR(I64u, UINT64,,); +DEFINE_FLAVOR(I64x, XINT64,,"I64x"); +DEFINE_FLAVOR(I64X, XXINT64,,"I64X"); +DEFINE_FLAVOR(I64o, OINT64,,"I64o"); + +DEFINE_FLAVOR(p, PTR,,); + +DEFINE_FLAVOR(Z, ANSTR,,); +DEFINE_FLAVOR(wZ, USTR,,); +DEFINE_FLAVOR(z, CSTR,,); +DEFINE_FLAVOR(hZ, CSTR,,); + +# default formats for those who don't care to provide their own strings + +DEFINE_FLAVOR(XBYTE, SBYTE,, "02x"); +DEFINE_FLAVOR(OBYTE, SBYTE,, "o"); + +DEFINE_FLAVOR(XSHORT, SSHORT,, "04hX"); +DEFINE_FLAVOR(OSHORT, SSHORT,, "ho"); + +DEFINE_FLAVOR(XINT, SINT,, "08x"); +DEFINE_FLAVOR(OINT, SINT,, "o"); + +DEFINE_FLAVOR(XLONG, SLONG,, "08lX"); +DEFINE_FLAVOR(OLONG, SLONG,, "lo"); + + +DEFINE_FLAVOR(XLONGPTR, SLONGPTR,,"Ix"); +DEFINE_FLAVOR(OLONGPTR, SLONGPTR,,"Ox"); + +# special formats + +DEFINE_FLAVOR(IPADDR, UINT, ItemIPAddr, "s"); +DEFINE_FLAVOR(PORT, USHORT, ItemPort, "s"); +DEFINE_FLAVOR(STATUS, SINT, ItemNTSTATUS, "s"); +DEFINE_FLAVOR(WINERROR, UINT, ItemWINERROR, "s"); +DEFINE_FLAVOR(HRESULT, SINT, ItemHRESULT, "s"); + +DEFINE_FLAVOR(ipaddr,IPADDR,,); +DEFINE_FLAVOR(port,PORT,,); +DEFINE_FLAVOR(status,STATUS,,); +DEFINE_FLAVOR(hresult,HRESULT,,); +DEFINE_FLAVOR(winerr,WINERROR,,); +DEFINE_FLAVOR(guid,GUID,,); + +# time related stuff + +DEFINE_FLAVOR(TIMESTAMP, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(TIME, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(DATE, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(WAITTIME, SINT64, ItemTimestamp, "s"); + +DEFINE_FLAVOR(due, SINT64, ItemWaitTime, "s"); +DEFINE_FLAVOR(delta, SINT64, ItemTimeDelta, "s"); +DEFINE_FLAVOR(datetime, SINT64, ItemTimestamp, "s"); + +# enumeration types + +DEFINE_FLAVOR(ItemListByte, SBYTE, ItemListByte, "s"); +DEFINE_FLAVOR(ItemListShort, SSHORT, ItemListShort,"s"); +DEFINE_FLAVOR(ItemListLong, SLONG, ItemListLong, "s"); + +DEFINE_FLAVOR(ItemSetByte, UBYTE, ItemSetByte, "s"); +DEFINE_FLAVOR(ItemSetShort, USHORT, ItemSetShort,"s"); +DEFINE_FLAVOR(ItemSetLong, ULONG, ItemSetLong, "s"); + +DEFINE_FLAVOR(ItemEnum, ULONG, ItemEnum, "s"); + +DEFINE_FLAVOR(CLSID, GUID, ItemCLSID, "s"); +DEFINE_FLAVOR(LIBID, GUID, ItemLIBID, "s"); +DEFINE_FLAVOR(IID, GUID, ItemIID, "s"); + + +CUSTOM_TYPE(b1, ItemSetByte(1,2,3,4,5,6,7,8) ); +CUSTOM_TYPE(b2, ItemSetShort(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16) ); +CUSTOM_TYPE(b4, ItemSetLong(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32) ); + + +CUSTOM_TYPE(bool, ItemListLong(false,true) ); +CUSTOM_TYPE(bool16, ItemListShort(false,true) ); +CUSTOM_TYPE(bool8, ItemListByte(false,true) ); + +CUSTOM_TYPE(irql, ItemListByte(Low,APC,DPC) ); + +CUSTOM_TYPE(pnpmn, ItemListByte(IRP_MN_START_DEVICE,IRP_MN_QUERY_REMOVE_DEVICE,IRP_MN_REMOVE_DEVICE,IRP_MN_CANCEL_REMOVE_DEVICE,IRP_MN_STOP_DEVICE,IRP_MN_QUERY_STOP_DEVICE,IRP_MN_CANCEL_STOP_DEVICE,IRP_MN_QUERY_DEVICE_RELATIONS,IRP_MN_QUERY_INTERFACE,IRP_MN_QUERY_CAPABILITIES,IRP_MN_QUERY_RESOURCES,IRP_MN_QUERY_RESOURCE_REQUIREMENTS,IRP_MN_QUERY_DEVICE_TEXT,IRP_MN_FILTER_RESOURCE_REQUIREMENTS,IRP_MN_PNP_14,IRP_MN_READ_CONFIG,IRP_MN_WRITE_CONFIG,IRP_MN_EJECT,IRP_MN_SET_LOCK,IRP_MN_QUERY_ID,IRP_MN_QUERY_PNP_DEVICE_STATE,IRP_MN_QUERY_BUS_INFORMATION,IRP_MN_DEVICE_USAGE_NOTIFICATION,IRP_MN_SURPRISE_REMOVAL) ); +CUSTOM_TYPE(sysctrl, ItemListByte(IRP_MN_QUERY_ALL_DATA,IRP_MN_QUERY_SINGLE_INSTANCE, IRP_MN_CHANGE_SINGLE_INSTANCE, IRP_MN_CHANGE_SINGLE_ITEM, IRP_MN_ENABLE_EVENTS, IRP_MN_DISABLE_EVENTS, IRP_MN_ENABLE_COLLECTION, IRP_MN_DISABLE_COLLECTION, IRP_MN_REGINFO, IRP_MN_EXECUTE_METHOD, IRP_MN_Reserved_0a, IRP_MN_REGINFO_EX) ); + +# default tracing macro + +FUNC DoTraceMessage(LEVEL,MSG,...); +FUNC DoDebugTrace(TRACELEVEL,MSG,...); + + +# default prefix (use traceprt default) + +USEPREFIX(*,"%!STDPREFIX!"); // traceprt will add standard prefix + +WPP_FLAGS(-lookfor:WPP_INIT_TRACING); // the same flags that can be passed on the command line to tracewpp diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/header.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/header.tpl new file mode 100644 index 00000000000..25c0c52e130 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/header.tpl @@ -0,0 +1,70 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +// template `TemplateFile` + +`* Dump defintions specified via -D on the command line to WPP *` + +`FORALL def IN MacroDefinitions` +#define `def.Name` `def.Alias` +`ENDFOR` + +#define WPP_THIS_FILE `SourceFile.CanonicalName` + +#if !defined(WPP_KERNEL_MODE) +# include +# pragma warning(disable: 4201) +# include +# include +# define WPP_TRACE TraceMessage +#else +#define WPP_TRACE WmiTraceMessage +#endif + +#if !defined(WPP_PRIVATE) +# define WPP_INLINE __inline +# define WPP_SELECT_ANY extern "C" __declspec(selectany) +#else +# define WPP_INLINE static +# define WPP_SELECT_ANY static +#endif + +__inline TRACEHANDLE WppQueryLogger(__in_opt PCWSTR LoggerName) +{ + { +#if defined(WPP_KERNEL_MODE) + ULONG ReturnLength ; + NTSTATUS Status ; + TRACEHANDLE TraceHandle ; + UNICODE_STRING Buffer ; + + RtlInitUnicodeString(&Buffer, LoggerName ? LoggerName : L"stdout"); + + if ((Status = WmiQueryTraceInformation(TraceHandleByNameClass, + (PVOID)&TraceHandle, + sizeof(TraceHandle), + &ReturnLength, + (PVOID)&Buffer)) == STATUS_SUCCESS) { + return TraceHandle ; + } +#else + ULONG status; + EVENT_TRACE_PROPERTIES LoggerInfo; + + ZeroMemory(&LoggerInfo, sizeof(LoggerInfo)); + LoggerInfo.Wnode.BufferSize = sizeof(LoggerInfo); + LoggerInfo.Wnode.Flags = WNODE_FLAG_TRACED_GUID; + + status = QueryTraceW(0, LoggerName ? LoggerName : L"stdout", &LoggerInfo); + if (status == ERROR_SUCCESS || status == ERROR_MORE_DATA) { + return (TRACEHANDLE) LoggerInfo.Wnode.HistoricalContext; + } +#endif + } + return 0; +} + + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorControl.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorControl.tpl new file mode 100644 index 00000000000..e823a0cc406 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorControl.tpl @@ -0,0 +1,248 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright 1999-2000 Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +// template `TemplateFile` +// +// Defines a set of macro that expand control model specified +// with WPP_CONTROL_GUIDS (example shown below) +// into an enum of trace levels and required structures that +// contain the mask of levels, logger handle and some information +// required for registration. +// + +/////////////////////////////////////////////////////////////////////////////////// +// +// #define WPP_CONTROL_GUIDS \ +// WPP_DEFINE_CONTROL_GUID(Regular,(81b20fea,73a8,4b62,95bc,354477c97a6f), \ +// WPP_DEFINE_BIT(Error) \ +// WPP_DEFINE_BIT(Unusual) \ +// WPP_DEFINE_BIT(Noise) \ +// ) \ +// WPP_DEFINE_CONTROL_GUID(HiFreq,(91b20fea,73a8,4b62,95bc,354477c97a6f), \ +// WPP_DEFINE_BIT(Entry) \ +// WPP_DEFINE_BIT(Exit) \ +// WPP_DEFINE_BIT(ApiCalls) \ +// WPP_DEFINE_BIT(RandomJunk) \ +// WPP_DEFINE_BIT(LovePoem) \ +// ) + + +#if !defined(WPP_NO_CONTROL_GUIDS) + +#if defined(WPP_DEFAULT_CONTROL_GUID) +# if defined(WPP_CONTROL_GUIDS) +# pragma message(__FILE__ " : error : WPP_DEFAULT_CONTROL_GUID cannot be used together with WPP_CONTROL_GUIDS") +# stop +# else +# define WPP_CONTROL_GUIDS \ + WPP_DEFINE_CONTROL_GUID(Default,(WPP_DEFAULT_CONTROL_GUID), \ + WPP_DEFINE_BIT(Error) \ + WPP_DEFINE_BIT(Unusual) \ + WPP_DEFINE_BIT(Noise) \ + ) +# endif +#endif + +#if !defined(WPP_CONTROL_GUIDS) +# pragma message(__FILE__ " : error : Please define control model via WPP_CONTROL_GUIDS or WPP_DEFAULT_CONTROL_GUID macros") +# pragma message(__FILE__ " : error : don't forget to call WPP_INIT_TRACING and WPP_CLEANUP in your main, DriverEntry or DllInit") +# pragma message(__FILE__ " : error : see tracewpp.doc for further information") +stop. +#endif +// a set of macro to convert a guid in a form x(81b20fea,73a8,4b62,95bc,354477c97a6f) +// into either a a struct or text string + +#define _WPPW(x) L ## x + +#define WPP_GUID_TEXT(l,w1,w2,w3,ll) #l "-" #w1 "-" #w2 "-" #w3 "-" #ll +#define WPP_GUID_WTEXT(l,w1,w2,w3,ll) _WPPW(#l) L"-" _WPPW(#w1) L"-" _WPPW(#w2) L"-" _WPPW(#w3) L"-" _WPPW(#ll) +#define WPP_EXTRACT_BYTE(val,n) ( ((0x ## val) >> (8 * n)) & 0xFF ) +#define WPP_GUID_STRUCT(l,w1,w2,w3,ll) {0x ## l, 0x ## w1, 0x ## w2,\ + {WPP_EXTRACT_BYTE(w3, 1), WPP_EXTRACT_BYTE(w3, 0), \ + WPP_EXTRACT_BYTE(ll, 5), WPP_EXTRACT_BYTE(ll, 4), \ + WPP_EXTRACT_BYTE(ll, 3), WPP_EXTRACT_BYTE(ll, 2), \ + WPP_EXTRACT_BYTE(ll, 1), WPP_EXTRACT_BYTE(ll, 0)} } + +// define annotation record that will carry control intormation to pdb (in case somebody needs it) +__forceinline void WPP_CONTROL_ANNOTATION() { +#if !defined(WPP_NO_ANNOTATIONS) +#if !defined(WPP_ANSI_ANNOTATION) +# define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) __annotation(L"TMC:", WPP_GUID_WTEXT Guid, _WPPW(#Name) Bits); +# define WPP_DEFINE_BIT(Name) , _WPPW(#Name) +#else +# define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) __annotation("TMC:", WPP_GUID_TEXT Guid, #Name Bits); +# define WPP_DEFINE_BIT(Name) , #Name +#endif + WPP_CONTROL_GUIDS +# undef WPP_DEFINE_BIT +# undef WPP_DEFINE_CONTROL_GUID +#endif +} + +// define an enum of control block names +////// +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) WPP_CTL_ ## Name, +enum WPP_CTL_NAMES { WPP_CONTROL_GUIDS WPP_LAST_CTL}; +#undef WPP_DEFINE_CONTROL_GUID + +// define control guids +////// +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) \ +extern __declspec(selectany) const GUID WPP_ ## ThisDir ## _CTLGUID_ ## Name = WPP_GUID_STRUCT Guid; +WPP_CONTROL_GUIDS +#undef WPP_DEFINE_CONTROL_GUID + +// define enums of individual bits +///// +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) \ + WPP_BLOCK_START_ ## Name = WPP_CTL_ ## Name * 0x10000, Bits WPP_BLOCK_END_ ## Name, +# define WPP_DEFINE_BIT(Name) WPP_BIT_ ## Name, +enum WPP_DEFINE_BIT_NAMES { WPP_CONTROL_GUIDS }; +# undef WPP_DEFINE_BIT +#undef WPP_DEFINE_CONTROL_GUID + +#define WPP_MASK(CTL) (1 << ( ((CTL)-1) & 31 )) +#define WPP_FLAG_NO(CTL) ( (0xFFFF & ((CTL)-1) ) / 32) +#define WPP_CTRL_NO(CTL) ((CTL) >> 16) + +// calculate how many DWORDs we need to get the required number of bits +// upper estimate. Sometimes will be off by one +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) | WPP_BLOCK_END_ ## Name +enum _WPP_FLAG_LEN_ENUM { WPP_FLAG_LEN = 1 | ((0 WPP_CONTROL_GUIDS) & 0xFFFF) / 32 }; +#undef WPP_DEFINE_CONTROL_GUID + +#ifndef WPP_CB +# define WPP_CB WPP_GLOBAL_Control +#endif +#ifndef WPP_CB_TYPE +#define WPP_CB_TYPE WPP_PROJECT_CONTROL_BLOCK +#endif + +typedef union { + WPP_REGISTRATION_BLOCK Registration; // need this only to register + WPP_TRACE_CONTROL_BLOCK Control; + UCHAR ReserveSpace[ sizeof(WPP_TRACE_CONTROL_BLOCK) + sizeof(ULONG) * (WPP_FLAG_LEN - 1) ]; +} WPP_CB_TYPE ; + +#define WPP_NEXT(Name) ((WPP_REGISTRATION_BLOCK*) \ + (WPP_CTL_ ## Name + 1 == WPP_LAST_CTL ? 0:WPP_CB + WPP_CTL_ ## Name + 1)) + +// WPP_CONTROL structure has two extra fields in the kernel +// mode. We will use WPPKM_NULL to initalize them + +#if defined(WPP_KERNEL_MODE) +# define WPPKM_NULL 0, +#else +# define WPPKM_NULL +#endif + +#if defined(WPP_DLL) + +extern __declspec(selectany) WPP_CB_TYPE WPP_CB[WPP_LAST_CTL]; + +__inline void WPP_INIT_CONTROL_ARRAY(WPP_CB_TYPE* Arr) { +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) \ + Arr->Registration.Next = WPP_NEXT(Name); \ + Arr->Registration.ControlGuid = &WPP_ ## ThisDir ## _CTLGUID_ ## Name; \ + Arr->Registration.FriendlyName = L ## #Name; \ + Arr->Registration.BitNames = Bits; \ + Arr->Registration.FlagsLen = WPP_FLAG_LEN; \ + Arr->Registration.RegBlockLen = WPP_LAST_CTL; ++Arr; +#define WPP_DEFINE_BIT(BitName) L" " L ## #BitName +WPP_CONTROL_GUIDS +#undef WPP_DEFINE_BIT +#undef WPP_DEFINE_CONTROL_GUID +} +#define WPP_INIT_STATIC_DATA WPP_INIT_CONTROL_ARRAY(WPP_CB) + +#else + +extern __declspec(selectany) WPP_CB_TYPE WPP_CB[WPP_LAST_CTL] = { +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) {{WPPKM_NULL WPP_NEXT(Name), \ + &WPP_ ## ThisDir ## _CTLGUID_ ## Name, L ## #Name, Bits, WPPKM_NULL WPP_FLAG_LEN, WPP_LAST_CTL}}, +#define WPP_DEFINE_BIT(BitName) L" " L ## #BitName +WPP_CONTROL_GUIDS +#undef WPP_DEFINE_BIT +#undef WPP_DEFINE_CONTROL_GUID +}; +#define WPP_INIT_STATIC_DATA 0 + +#endif + +#define WPP_CONTROL(CTL) (WPP_CB[WPP_CTRL_NO(CTL)].Control) +#define WPP_REGISTRATION(CTL) (WPP_CB[WPP_CTRL_NO(CTL)].Registration) + +#define WPP_SET_FORWARD_PTR(CTL, FLAGS, PTR) (\ + (WPP_REGISTRATION(WPP_BIT_ ## CTL ).Options = (FLAGS)),\ + (WPP_REGISTRATION(WPP_BIT_ ## CTL ).Ptr = (PTR)) ) + +#if !defined(WPP_LEVEL_LOGGER) +# define WPP_LEVEL_LOGGER(CTL) (WPP_CONTROL(WPP_BIT_ ## CTL).Logger), +#endif + +#if !defined(WPP_LEVEL_ENABLED) +# define WPP_LEVEL_ENABLED(CTL) (WPP_CONTROL(WPP_BIT_ ## CTL).Flags[WPP_FLAG_NO(WPP_BIT_ ## CTL)] & WPP_MASK(WPP_BIT_ ## CTL)) +#endif + +#if !defined(WPP_LOGGER_ARG) +# define WPP_LOGGER_ARG TRACEHANDLE Logger, +#endif + +#if !defined(WPP_GET_LOGGER) +# define WPP_GET_LOGGER Logger +#endif + +#ifndef WPP_ENABLED +# define WPP_ENABLED() 1 +#endif +#ifndef WPP_LOGGER +# define WPP_LOGGER() (WPP_CB[0].Control.Logger), +#endif + +#endif // WPP_NO_CONTROL_GUIDS + + +#if defined(__cplusplus) +extern "C" { +#endif +#if !defined(WPP_TRACE_W2K_COMPATABILITY) + VOID WppInitKm(PVOID DrvContext, PVOID InitInfo, PWPP_REGISTRATION_BLOCK Registration); + VOID WppCleanupKm(PVOID TraceContext, PWPP_REGISTRATION_BLOCK Registration); +#else // #if !defined(WPP_TRACE_W2K_COMPATABILITY) + // W2K Compatable versions + VOID WppInitKm(PDEVICE_OBJECT pDevObj, PUNICODE_STRING RegistryPath, PWPP_REGISTRATION_BLOCK Registration); + VOID WppCleanupKm(PDEVICE_OBJECT pDeviceObject); +#endif // #if !defined(WPP_TRACE_W2K_COMPATABILITY) + +#if defined(__cplusplus) +}; +#endif + +#if !defined(WPP_TRACE_W2K_COMPATABILITY) +# define WPP_INIT_TRACING(DrvObj, Regpath, InitInfo) (WPP_CONTROL_ANNOTATION(),WPP_INIT_STATIC_DATA,WppInitKm(DrvObj, InitInfo, &WPP_CB[0].Registration)) + +# define WPP_CLEANUP(DrvObj, TraceContext) WppCleanupKm(TraceContext, &WPP_CB[0].Registration) + +#else // #if !defined(WPP_TRACE_W2K_COMPATABILITY) +# define WPP_INIT_TRACING(DevObj, RegPath) (WPP_CONTROL_ANNOTATION(),WPP_INIT_STATIC_DATA,WppInitKm(DevObj, RegPath, &WPP_CB[0].Registration)) + +# define WPP_CLEANUP(DevObj) WppCleanupKm(DevObj) + +NTSTATUS +WppTraceCallback( + IN UCHAR minorFunction, + IN PVOID DataPath, + IN ULONG BufferLength, + IN PVOID Buffer, + IN PVOID Context, + OUT PULONG Size + ) ; + +#define WPP_TRACE_CONTROL(Function,Buffer,BufferSize,ReturnSize) WppTraceCallback(Function,NULL,BufferSize,Buffer,&WPP_CB[0],&ReturnSize); + +#endif // #if !defined(WPP_TRACE_W2K_COMPATABILITY) + + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorDefault.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorDefault.tpl new file mode 100644 index 00000000000..d7ac9f6764a --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorDefault.tpl @@ -0,0 +1,30 @@ +`**********************************************************************` +`* This is a template file for tracewpp preprocessor *` +`* If you need to use a custom version of this file in your project *` +`* Please clone it from this one and point WPP to it by specifying *` +`* -gen:{yourfile} option on RUN_WPP line in your sources file *` +`* *` +`* Copyright 1999-2000 Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` +//`Compiler.Checksum` Generated File. Do not edit. +// File created by `Compiler.Name` compiler version `Compiler.Version`-`Compiler.Timestamp` +// on `System.Date` at `System.Time` UTC from a template `TemplateFile` + +typedef +ULONG +(*PFN_WPPTRACEMESSAGE)( + IN ULONG64 LoggerHandle, + IN ULONG MessageFlags, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + IN ... + ); + +`INCLUDE km-StorHeader.tpl` +`INCLUDE km-StorControl.tpl` +`INCLUDE trmacro.tpl` + +`IF FOUND WPP_INIT_TRACING` +#define WPPINIT_EXPORT + `INCLUDE km-StorInit.tpl` +`ENDIF` diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorHeader.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorHeader.tpl new file mode 100644 index 00000000000..e49c9fefd97 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorHeader.tpl @@ -0,0 +1,319 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright 1999-2000 Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +// template `TemplateFile` + +`* Dump the definitions specified via -D on the command line to WPP *` + +`FORALL def IN MacroDefinitions` +#define `def.Name` `def.Alias` +`ENDFOR` + +#define WPP_THIS_FILE `SourceFile.CanonicalName` + +#include +#include +#include + +#if defined(WPP_TRACE_W2K_COMPATABILITY) +DEFINE_GUID(WPP_TRACE_CONTROL_NULL_GUID, 0x00000000L, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +ULONG +__inline +NullTraceFunc ( + IN ULONG64 LoggerHandle, + IN ULONG MessageFlags, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + IN ... + ) +{ + return 0; +} + +__declspec(selectany) PFN_WPPTRACEMESSAGE pfnWppTraceMessage = NullTraceFunc; + +#if defined(__cplusplus) +}; +#endif + +#if !defined(_NTRTL_) + // fake RTL_TIME_ZONE_INFORMATION // + typedef int RTL_TIME_ZONE_INFORMATION; +# define _WMIKM_ +#endif +#ifndef WPP_TRACE +#define WPP_TRACE pfnWppTraceMessage +#endif + +#ifndef WPP_OLDCC +#define WPP_OLDCC +#endif + +/////////////////////////////////////////////////////////////////////////////// +// +// B O R R O W E D D E F I N I T I O N S +// +/////////////////////////////////////////////////////////////////////////////// + +# define WPP_LOGGER_ARG ULONG64 Logger, + +#if ((_MSC_VER >= 800) || defined(_STDCALL_SUPPORTED)) && !defined(_M_AMD64) +#define NTAPI __stdcall +#else +#define _cdecl +#define NTAPI +#endif + +// +// Define API decoration for direct importing system DLL references. +// + +#if !defined(_NTSYSTEM_) +#define NTSYSAPI DECLSPEC_IMPORT +#define NTSYSCALLAPI DECLSPEC_IMPORT +#else +#define NTSYSAPI +#if defined(_NTDLLBUILD_) +#define NTSYSCALLAPI +#else +#define NTSYSCALLAPI DECLSPEC_ADDRSAFE +#endif + +#endif + +int __cdecl swprintf ( + wchar_t *string, + const wchar_t *format, + ... + ); + +typedef struct _UNICODE_STRING { + USHORT Length; + USHORT MaximumLength; +#ifdef MIDL_PASS + [size_is(MaximumLength / 2), length_is((Length) / 2) ] USHORT * Buffer; +#else // MIDL_PASS + PWSTR Buffer; +#endif // MIDL_PASS +} UNICODE_STRING; +typedef UNICODE_STRING *PUNICODE_STRING; +typedef const UNICODE_STRING *PCUNICODE_STRING; + +#define TRACE_MESSAGE_SEQUENCE 1 // Message should include a sequence number +#define TRACE_MESSAGE_GUID 2 // Message includes a GUID +#define TRACE_MESSAGE_COMPONENTID 4 // Message has no GUID, Component ID instead +#define TRACE_MESSAGE_TIMESTAMP 8 // Message includes a timestamp +#define TRACE_MESSAGE_PERFORMANCE_TIMESTAMP 16 // *Obsolete* Clock type is controlled by + // the logger +#define TRACE_MESSAGE_SYSTEMINFO 32 // Message includes system information TID,PID +#define TRACE_MESSAGE_FLAG_MASK 0xFFFF // Only the lower 16 bits of flags are + // placed in the message those above 16 + // bits are reserved for local processing +#define TRACE_MESSAGE_MAXIMUM_SIZE 8*1024 // the maximum size allowed for a single trace + // message + +#define RtlFillMemory(Destination,Length,Fill) StorMemSet((Destination),(Fill),(Length)) +#define RtlZeroMemory(Destination,Length) StorMemSet((Destination),0,(Length)) + +typedef LONG NTSTATUS; + +// +// Generic test for success on any status value (non-negative numbers +// indicate success). +// + +#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0) + +#define STATUS_SUCCESS ((NTSTATUS)0x00000000L) // ntsubauth +#define STATUS_WMI_GUID_NOT_FOUND ((NTSTATUS)0xC0000295L) +#define STATUS_BUFFER_TOO_SMALL ((NTSTATUS)0xC0000023L) +#define STATUS_INVALID_PARAMETER ((NTSTATUS)0xC000000DL) +#define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS)0xC0000010L) + +typedef ULONG64 TRACEHANDLE, *PTRACEHANDLE; + +typedef enum _TRACE_INFORMATION_CLASS { + TraceIdClass, + TraceHandleClass, + TraceEnableFlagsClass, + TraceEnableLevelClass, + GlobalLoggerHandleClass, + EventLoggerHandleClass, + AllLoggerHandlesClass, + TraceHandleByNameClass +} TRACE_INFORMATION_CLASS; + +typedef PVOID PDEVICE_OBJECT; + +// +// Action code for IoWMIRegistrationControl api +// + +#define WMIREG_ACTION_REGISTER 1 +#define WMIREG_ACTION_DEREGISTER 2 +#define WMIREG_ACTION_REREGISTER 3 +#define WMIREG_ACTION_UPDATE_GUIDS 4 +#define WMIREG_ACTION_BLOCK_IRPS 5 + +#define REG_DWORD ( 4 ) // 32-bit number + +// +// Subroutines for dealing with the Registry +// + +typedef NTSTATUS (NTAPI * PRTL_QUERY_REGISTRY_ROUTINE)( + IN PWSTR ValueName, + IN ULONG ValueType, + IN PVOID ValueData, + IN ULONG ValueLength, + IN PVOID Context, + IN PVOID EntryContext + ); + +typedef struct _RTL_QUERY_REGISTRY_TABLE { + PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine; + ULONG Flags; + PWSTR Name; + PVOID EntryContext; + ULONG DefaultType; + PVOID DefaultData; + ULONG DefaultLength; + +} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE; + +// +// The following flags specify how the Name field of a RTL_QUERY_REGISTRY_TABLE +// entry is interpreted. A NULL name indicates the end of the table. +// + +#define RTL_QUERY_REGISTRY_SUBKEY 0x00000001 // Name is a subkey and remainder of + // table or until next subkey are value + // names for that subkey to look at. + +#define RTL_QUERY_REGISTRY_TOPKEY 0x00000002 // Reset current key to original key for + // this and all following table entries. + +#define RTL_QUERY_REGISTRY_REQUIRED 0x00000004 // Fail if no match found for this table + // entry. + +#define RTL_QUERY_REGISTRY_NOVALUE 0x00000008 // Used to mark a table entry that has no + // value name, just wants a call out, not + // an enumeration of all values. + +#define RTL_QUERY_REGISTRY_NOEXPAND 0x00000010 // Used to suppress the expansion of + // REG_MULTI_SZ into multiple callouts or + // to prevent the expansion of environment + // variable values in REG_EXPAND_SZ + +#define RTL_QUERY_REGISTRY_DIRECT 0x00000020 // QueryRoutine field ignored. EntryContext + // field points to location to store value. + // For null terminated strings, EntryContext + // points to UNICODE_STRING structure that + // that describes maximum size of buffer. + // If .Buffer field is NULL then a buffer is + // allocated. + // + +#define RTL_QUERY_REGISTRY_DELETE 0x00000040 // Used to delete value keys after they + // are queried. + +#if (NTDDI_VERSION >= NTDDI_WIN2K) +NTSYSAPI +NTSTATUS +NTAPI +RtlQueryRegistryValues( + IN ULONG RelativeTo, + IN PCWSTR Path, + IN PRTL_QUERY_REGISTRY_TABLE QueryTable, + IN PVOID Context, + IN OPTIONAL PVOID Environment + ); +#endif + +// +// The following values for the RelativeTo parameter determine what the +// Path parameter to RtlQueryRegistryValues is relative to. +// + +#define RTL_REGISTRY_ABSOLUTE 0 // Path is a full path +#define RTL_REGISTRY_SERVICES 1 // \Registry\Machine\System\CurrentControlSet\Services +#define RTL_REGISTRY_CONTROL 2 // \Registry\Machine\System\CurrentControlSet\Control +#define RTL_REGISTRY_WINDOWS_NT 3 // \Registry\Machine\Software\Microsoft\Windows NT\CurrentVersion +#define RTL_REGISTRY_DEVICEMAP 4 // \Registry\Machine\Hardware\DeviceMap +#define RTL_REGISTRY_USER 5 // \Registry\User\CurrentUser +#define RTL_REGISTRY_MAXIMUM 6 +#define RTL_REGISTRY_HANDLE 0x40000000 // Low order bits are registry handle +#define RTL_REGISTRY_OPTIONAL 0x80000000 // Indicates the key node is optional + +/////////////////////////////////////////////////////////////////////////////// + +__inline TRACEHANDLE WppQueryLogger(__in_opt PWSTR LoggerName) + +{ +#ifndef WPP_TRACE_W2K_COMPATABILITY + ULONG ReturnLength; + NTSTATUS Status; + TRACEHANDLE TraceHandle; + UNICODE_STRING Buffer; + + StorRtlInitUnicodeString(&Buffer, LoggerName ? LoggerName : L"stdout"); + + + if ((Status = StorWmiQueryTraceInformation(TraceHandleByNameClass, + (PVOID)&TraceHandle, + sizeof(TraceHandle), + &ReturnLength, + (PVOID)&Buffer)) != STATUS_SUCCESS) { + return 0; + } + + return TraceHandle; +#else + return (TRACEHANDLE) 0; +#endif // #ifdef WPP_TRACE_W2K_COMPATABILITY + +} + +typedef NTSTATUS (*WMIENTRY_NEW)( + IN UCHAR ActionCode, + IN PVOID DataPath, + IN ULONG BufferSize, + IN OUT PVOID Buffer, + IN PVOID Context, + OUT PULONG Size + ); + +typedef struct _WPP_TRACE_CONTROL_BLOCK +{ + WMIENTRY_NEW Callback; + struct _WPP_TRACE_CONTROL_BLOCK *Next; + + __int64 Logger; + UCHAR FlagsLen; UCHAR Level; USHORT Reserved; + ULONG Flags[1]; +} WPP_TRACE_CONTROL_BLOCK, *PWPP_TRACE_CONTROL_BLOCK; + +typedef struct _WPP_REGISTRATION_BLOCK +{ + WMIENTRY_NEW Callback; + struct _WPP_REGISTRATION_BLOCK *Next; + + LPCGUID ControlGuid; + LPCWSTR FriendlyName; + LPCWSTR BitNames; + PUNICODE_STRING RegistryPath; + + UCHAR FlagsLen, RegBlockLen; +} WPP_REGISTRATION_BLOCK, *PWPP_REGISTRATION_BLOCK; + + + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorInit.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorInit.tpl new file mode 100644 index 00000000000..3d3a872f34a --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-StorInit.tpl @@ -0,0 +1,410 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright 1999-2001 Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +// template `TemplateFile` +// +// Defines a set of functions that simplifies +// kernel mode registration for tracing +// + +#if !defined(WppDebug) +# define WppDebug(a,b) +#endif + +#define WMIREG_FLAG_CALLBACK 0x80000000 // not exposed in DDK + + +#ifndef WPPINIT_EXPORT +# define WPPINIT_EXPORT +#endif + + +WPPINIT_EXPORT +NTSTATUS +WppTraceCallback( + IN UCHAR minorFunction, + IN PVOID DataPath, + IN ULONG BufferLength, + IN PVOID Buffer, + IN PVOID Context, + OUT PULONG Size + ) +/*++ + +Routine Description: + + Callback routine for IoWMIRegistrationControl. + +Arguments: + +Return Value: + + status + +Comments: + + if return value is STATUS_BUFFER_TOO_SMALL and BufferLength >= 4, + then first ulong of buffer contains required size + + +--*/ + +{ + WPP_PROJECT_CONTROL_BLOCK *cb = (WPP_PROJECT_CONTROL_BLOCK*)Context; + NTSTATUS status = STATUS_SUCCESS; +#if defined(WPP_TRACE_W2K_COMPATABILITY) + static LPCGUID regGuid = NULL; +#endif + + UNREFERENCED_PARAMETER(DataPath); + + WppDebug(0,("WppTraceCallBack 0x%08X %p\n", minorFunction, Context)); + + *Size = 0; + + switch(minorFunction) + { + case IRP_MN_REGINFO: + { + PWMIREGINFOW wmiRegInfo; + PCUNICODE_STRING regPath; + PWCHAR stringPtr; + ULONG registryPathOffset; + ULONG bufferNeeded; + +#if defined(WPP_TRACE_W2K_COMPATABILITY) + + wmiRegInfo = (PWMIREGINFO)Buffer; + + // Replace the null with the driver's trace control GUID + // regGuid is initialized the first time, so the GUID is saved for the next + // IRP_MN_REGINFO call + if (regGuid == NULL) { + regGuid = cb->Registration.ControlGuid; + } + + if (wmiRegInfo->GuidCount >= 1) { + // Replace the null trace GUID with the driver's trace control GUID + wmiRegInfo->WmiRegGuid[wmiRegInfo->GuidCount-1].Guid = *regGuid; + wmiRegInfo->WmiRegGuid[wmiRegInfo->GuidCount-1].Flags = + WMIREG_FLAG_TRACE_CONTROL_GUID | WMIREG_FLAG_TRACED_GUID; + *Size= wmiRegInfo->BufferSize; + status = STATUS_SUCCESS; +#ifdef WPP_GLOBALLOGGER + // Check if Global logger is active + StorWppInitGlobalLogger( + cb->Registration.ControlGuid, + (PTRACEHANDLE)&cb->Control.Logger, + &cb->Control.Flags[0], + &cb->Control.Level); +#endif //#ifdef WPP_GLOBALLOGGER + break; + } +#endif + + regPath = cb->Registration.RegistryPath; + + if (regPath == NULL) + { + // No registry path specified. This is a bad thing for + // the device to do, but is not fatal + + registryPathOffset = 0; + bufferNeeded = FIELD_OFFSET(WMIREGINFOW, WmiRegGuid) + + 1 * sizeof(WMIREGGUIDW); + } + else { + registryPathOffset = FIELD_OFFSET(WMIREGINFOW, WmiRegGuid) + + 1 * sizeof(WMIREGGUIDW); + + bufferNeeded = registryPathOffset + + regPath->Length + sizeof(USHORT); + } + + if (bufferNeeded <= BufferLength) + { + RtlZeroMemory(Buffer, BufferLength); + + wmiRegInfo = (PWMIREGINFO)Buffer; + wmiRegInfo->BufferSize = bufferNeeded; + wmiRegInfo->RegistryPath = registryPathOffset; + wmiRegInfo->GuidCount = 1; + +#if defined(WPP_TRACE_W2K_COMPATABILITY) + wmiRegInfo->WmiRegGuid[0].Guid = *regGuid; +#else + wmiRegInfo->WmiRegGuid[0].Guid = *cb->Registration.ControlGuid; + +#endif // #ifdef WPP_TRACE_W2K_COMPATABILITY + + wmiRegInfo->WmiRegGuid[0].Flags = + WMIREG_FLAG_TRACE_CONTROL_GUID | WMIREG_FLAG_TRACED_GUID; + + if (regPath != NULL) { + stringPtr = (PWCHAR)((PUCHAR)Buffer + registryPathOffset); + *stringPtr++ = regPath->Length; + StorMoveMemory(stringPtr, regPath->Buffer, regPath->Length); + + } + status = STATUS_SUCCESS; + *Size = bufferNeeded; + } else { + status = STATUS_BUFFER_TOO_SMALL; + if (BufferLength >= sizeof(ULONG)) { + *((PULONG)Buffer) = bufferNeeded; + *Size = sizeof(ULONG); + } + } + +#ifdef WPP_GLOBALLOGGER + // Check if Global logger is active + StorWppInitGlobalLogger( + cb->Registration.ControlGuid, + (PTRACEHANDLE)&cb->Control.Logger, + &cb->Control.Flags[0], + &cb->Control.Level); +#endif //#ifdef WPP_GLOBALLOGGER + + break; + } + + case IRP_MN_ENABLE_EVENTS: + case IRP_MN_DISABLE_EVENTS: + { + PWNODE_HEADER Wnode = (PWNODE_HEADER)Buffer; + ULONG Level; + ULONG ReturnLength ; + + if (cb == NULL ) + { + status = STATUS_WMI_GUID_NOT_FOUND; + break; + } + + if (BufferLength >= sizeof(WNODE_HEADER)) { + status = STATUS_SUCCESS; + + if (minorFunction == IRP_MN_DISABLE_EVENTS) { + cb->Control.Level = 0; + cb->Control.Flags[0] = 0; + cb->Control.Logger = 0; + } else { + TRACEHANDLE lh; + lh = (TRACEHANDLE)( Wnode->HistoricalContext ); + cb->Control.Logger = lh; +#if !defined(WPP_TRACE_W2K_COMPATABILITY) + if ((status = StorWmiQueryTraceInformation( + TraceEnableLevelClass, + &Level, + sizeof(Level), + &ReturnLength, + (PVOID)Wnode)) == STATUS_SUCCESS) + { + cb->Control.Level = (UCHAR)Level; + } + + status = StorWmiQueryTraceInformation( + TraceEnableFlagsClass, + &cb->Control.Flags[0], + sizeof(cb->Control.Flags[0]), + &ReturnLength, + (PVOID)Wnode); +#else // #ifndef WPP_TRACE_W2K_COMPATABILITY + cb->Control.Flags[0] = WmiGetLoggerEnableFlags(lh) ; + cb->Control.Level = (UCHAR)WmiGetLoggerEnableLevel(lh) ; + WppDebug(0,("Enable/Disable Logger = %p, Flags = 0x%8x, Level = %x08X\n", + cb->Control.Logger,cb->Control.Flags[0],cb->Control.Level)); +#endif // #ifndef WPP_TRACE_W2K_COMPATABILITY + } + } else { + status = STATUS_INVALID_PARAMETER; + } + + break; + } + + case IRP_MN_ENABLE_COLLECTION: + case IRP_MN_DISABLE_COLLECTION: + { + status = STATUS_SUCCESS; + break; + } + + case IRP_MN_QUERY_ALL_DATA: + case IRP_MN_QUERY_SINGLE_INSTANCE: + case IRP_MN_CHANGE_SINGLE_INSTANCE: + case IRP_MN_CHANGE_SINGLE_ITEM: + case IRP_MN_EXECUTE_METHOD: + { + status = STATUS_INVALID_DEVICE_REQUEST; + break; + } + + default: + { + status = STATUS_INVALID_DEVICE_REQUEST; + break; + } + + } +// DbgPrintEx(XX_FLTR, DPFLTR_TRACE_LEVEL, +// "%!FUNC!(%!SYSCTRL!) => %!status! (size = %d)", minorFunction, status, *Size); + return(status); +} + +WPPINIT_EXPORT +void WppInitKm( + IN PVOID DriverObject, + IN PVOID InitInfo, + IN OUT WPP_REGISTRATION_BLOCK* WppReg + ) +{ + if (StorInitTracing(InitInfo) == STATUS_SUCCESS) { + + pfnWppTraceMessage = (PFN_WPPTRACEMESSAGE) StorWmiTraceMessage; + + while(WppReg) { + + WPP_TRACE_CONTROL_BLOCK *cb = (WPP_TRACE_CONTROL_BLOCK*)WppReg; + NTSTATUS status ; + + WppReg -> Callback = WppTraceCallback; + WppReg -> RegistryPath = NULL; + cb -> FlagsLen = WppReg -> FlagsLen; + cb -> Level = 0; + cb -> Flags[0] = 0; + status = StorIoWMIRegistrationControl( + (PDEVICE_OBJECT)WppReg, + WMIREG_ACTION_REGISTER | WMIREG_FLAG_CALLBACK + ); + WppDebug(0,("IoWMIRegistrationControl status = %08X\n")); + WppReg = WppReg->Next; + } + } +} + +#if !defined(WPP_TRACE_W2K_COMPATABILITY) +WPPINIT_EXPORT +void WppCleanupKm( + PVOID TraceContext, + WPP_REGISTRATION_BLOCK* WppReg + ) +{ + StorCleanupTracing(TraceContext); + while (WppReg) { + StorIoWMIRegistrationControl( + (PDEVICE_OBJECT)WppReg, + WMIREG_ACTION_DEREGISTER | WMIREG_FLAG_CALLBACK + ); + WppReg = WppReg -> Next; + } +} +#else // #if !defined(WPP_TRACE_W2K_COMPATABILITY) +WPPINIT_EXPORT +void WppCleanupKm( + PDEVICE_OBJECT pDO + ) +{ + IoWMIRegistrationControl(pDO, WMIREG_ACTION_DEREGISTER ); +} +#endif // #if !defined(WPP_TRACE_W2K_COMPATABILITY) + +#if !defined(WPP_TRACE_W2K_COMPATABILITY) +#define WPP_SYSTEMCONTROL(PDO) +#define WPP_SYSTEMCONTROL2(PDO, offset) +#else // #if !defined(WPP_TRACE_W2K_COMPATABILITY) + +ULONG_PTR WPP_Global_NextDeviceOffsetInDeviceExtension = -1; + +#define WPP_SYSTEMCONTROL(PDO) \ + PDO->MajorFunction[ IRP_MJ_SYSTEM_CONTROL ] = WPPSystemControlDispatch; +#define WPP_SYSTEMCONTROL2(PDO, offset) \ + WPP_SYSTEMCONTROL(PDO); WPP_Global_NextDeviceOffsetInDeviceExtension = (ULONG_PTR)offset; + +#ifdef __cplusplus +extern "C" +{ +#endif __cplusplus + +// Routine to handle the System Control in W2K +NTSTATUS +WPPSystemControlDispatch( + __in PDEVICE_OBJECT pDO, + __in PIRP Irp + ); + +#ifdef __cplusplus +} +#endif __cplusplus + + +#ifdef ALLOC_PRAGMA + #pragma alloc_text( PAGE, WPPSystemControlDispatch) +#endif // ALLOC_PRAGMA + +// Routine to handle the System Control in W2K +NTSTATUS +WPPSystemControlDispatch( + __in PDEVICE_OBJECT pDO, + __in PIRP Irp + ) +{ + + PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation(Irp); + ULONG BufferSize = irpSp->Parameters.WMI.BufferSize; + PVOID Buffer = irpSp->Parameters.WMI.Buffer; + ULONG ReturnSize = 0; + NTSTATUS Status = STATUS_SUCCESS; + PWNODE_HEADER Wnode=NULL; + HANDLE ThreadHandle; + + WppDebug(0,("WPPSYSTEMCONTROL\n")); + + if (pDO == (PDEVICE_OBJECT)irpSp->Parameters.WMI.ProviderId) { +#if defined(WPP_TRACE_W2K_COMPATABILITY) + //To differentiate between the case where wmilib has already filled in parts of the buffer + if (irpSp->MinorFunction == IRP_MN_REGINFO) RtlZeroMemory(Buffer, BufferSize); +#endif + Status = WppTraceCallback((UCHAR)(irpSp->MinorFunction), + NULL, + BufferSize, + Buffer, + &WPP_CB[0], + &ReturnSize); + + WppDebug(0,("WPPSYSTEMCONTROL Status 0x%08X\n",Status)); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = ReturnSize; + IoCompleteRequest( Irp, IO_NO_INCREMENT ); + return Status; + + } else if (WPP_Global_NextDeviceOffsetInDeviceExtension != -1) { + + ULONG_PTR t; + + WppDebug(0,("WPPSYSTEMCONTROL - not for us\n")); + + // + // Set current stack back one. + // + IoSkipCurrentIrpStackLocation( Irp ); + // + // Pass the call to the next driver. + // + t = (ULONG_PTR)pDO->DeviceExtension; + t += WPP_Global_NextDeviceOffsetInDeviceExtension; + return IoCallDriver(*(PDEVICE_OBJECT*)t,Irp); + + } else { + + //unable to pass down -- what to do? + //don't change irp status - IO defaults to failure + return Irp->IoStatus.Status; + } +} + +#endif // #if !defined(WPP_TRACE_W2K_COMPATABILITY) diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-WdfDefault.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-WdfDefault.tpl new file mode 100644 index 00000000000..76c7205e671 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-WdfDefault.tpl @@ -0,0 +1 @@ +`INCLUDE km-default.tpl` \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-default.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-default.tpl new file mode 100644 index 00000000000..8d1c61c6782 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-default.tpl @@ -0,0 +1,119 @@ +`**********************************************************************` +`* This is a template file for tracewpp preprocessor *` +`* If you need to use a custom version of this file in your project *` +`* Please clone it from this one and point WPP to it by specifying *` +`* -gen:{yourfile} option on RUN_WPP line in your sources file *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` +//`Compiler.Checksum` Generated File. Do not edit. +// File created by `Compiler.Name` compiler version `Compiler.Version`-`Compiler.Timestamp` +// on `System.Date` at `System.Time` UTC from a template `TemplateFile` + +// +// Define anything which is needs but missing from +// older versions of the DDK. +// +#include +#include +#include +#include + +#if !defined(TRACE_LEVEL_NONE) + #define TRACE_LEVEL_NONE 0 + #define TRACE_LEVEL_CRITICAL 1 + #define TRACE_LEVEL_FATAL 1 + #define TRACE_LEVEL_ERROR 2 + #define TRACE_LEVEL_WARNING 3 + #define TRACE_LEVEL_INFORMATION 4 + #define TRACE_LEVEL_VERBOSE 5 + #define TRACE_LEVEL_RESERVED6 6 + #define TRACE_LEVEL_RESERVED7 7 + #define TRACE_LEVEL_RESERVED8 8 + #define TRACE_LEVEL_RESERVED9 9 +#endif + +#if !defined(TRACE_INFORMATION_CLASS_DEFINE) +typedef enum _TRACE_INFORMATION_CLASS { + TraceIdClass, + TraceHandleClass, + TraceEnableFlagsClass, + TraceEnableLevelClass, + GlobalLoggerHandleClass, + EventLoggerHandleClass, + AllLoggerHandlesClass, + TraceHandleByNameClass +} TRACE_INFORMATION_CLASS; + +#define TRACE_MESSAGE_SEQUENCE 1 +#define TRACE_MESSAGE_GUID 2 +#define TRACE_MESSAGE_COMPONENTID 4 +#define TRACE_MESSAGE_TIMESTAMP 8 +#define TRACE_MESSAGE_PERFORMANCE_TIMESTAMP 16 +#define TRACE_MESSAGE_SYSTEMINFO 32 + +#endif // !defined(TRACE_INFORMATION_CLASS_DEFINE) + + +// +// Advanced tracing APIs (XP and later) will be indirectly called. +// +typedef +LONG +(*PFN_WPPQUERYTRACEINFORMATION) ( + IN TRACE_INFORMATION_CLASS TraceInformationClass, + OUT PVOID TraceInformation, + IN ULONG TraceInformationLength, + OUT PULONG RequiredLength OPTIONAL, + IN PVOID Buffer OPTIONAL + ); + +typedef +LONG +(*PFN_WPPTRACEMESSAGE)( + IN ULONG64 LoggerHandle, + IN ULONG MessageFlags, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + IN ... + ); + +`INCLUDE km-header.tpl` +`INCLUDE control.tpl` +`INCLUDE tracemacro.tpl` + +`IF FOUND WPP_INIT_TRACING` +#define WPPINIT_EXPORT + `INCLUDE km-init.tpl` +`ENDIF` + +// +// Tracing Macro name redefinition +// + +// NoMsgArgs + +`FORALL f IN Funcs WHERE !DoubleP && !MsgArgs` +#undef `f.Name` +#define `f.Name` WPP_(CALL) +`ENDFOR` + +`FORALL f IN Funcs WHERE DoubleP && !MsgArgs` +#undef `f.Name` +#define `f.Name`(ARGS) WPP_(CALL) ARGS +`ENDFOR` + + +// MsgArgs + +`FORALL f IN Funcs WHERE MsgArgs` +#undef `f.Name` +#define `f.Name`(`f.FixedArgs` MSGARGS) WPP_(CALL)(`f.FixedArgs` MSGARGS) +`ENDFOR` + +`FORALL r IN Reorder` +#undef WPP_R`r.Name` +#define WPP_R`r.Name`(`r.Arguments`) `r.Permutation` +`ENDFOR` + + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-header.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-header.tpl new file mode 100644 index 00000000000..8a7ff6e38dc --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-header.tpl @@ -0,0 +1,154 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +// template `TemplateFile` +#ifdef WPP_THIS_FILE +// included twice +# define WPP_ALREADY_INCLUDED +# undef WPP_THIS_FILE +#endif // #ifdef WPP_THIS_FILE + +#define WPP_THIS_FILE `SourceFile.CanonicalName` + +#ifndef WPP_ALREADY_INCLUDED + +`* Dump the definitions specified via -D on the command line to WPP *` + +`FORALL def IN MacroDefinitions` +#define `def.Name` `def.Alias` +`ENDFOR` + +#define WPP_THIS_FILE `SourceFile.CanonicalName` + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef enum _WPP_TRACE_API_SUITE { + WppTraceDisabledSuite, + WppTraceWin2K, + WppTraceWinXP, + WppTraceTraceLH, + WppTraceMaxSuite +} WPP_TRACE_API_SUITE; + + +__declspec(selectany) PFN_WPPQUERYTRACEINFORMATION pfnWppQueryTraceInformation = NULL; +__declspec(selectany) PFN_WPPTRACEMESSAGE pfnWppTraceMessage = NULL; +__declspec(selectany) WPP_TRACE_API_SUITE WPPTraceSuite = WppTraceDisabledSuite; + + +#if !defined(_NTRTL_) +#if !defined(_NTHAL_) + // fake RTL_TIME_ZONE_INFORMATION // + typedef int RTL_TIME_ZONE_INFORMATION; +#endif +# define _WMIKM_ +#endif +#ifndef WPP_TRACE +#define WPP_TRACE pfnWppTraceMessage +#endif + + +VOID +WppLoadTracingSupport( + VOID + ); + +LONG +WppTraceCallback( + __in UCHAR MinorFunction, + __in_opt PVOID DataPath, + __in ULONG BufferLength, + __inout_bcount(BufferLength) PVOID Buffer, + __in PVOID Context, + __out PULONG Size + ); +#if !defined(WPP_TRACE_CONTROL_NULL_GUID) +DEFINE_GUID(WPP_TRACE_CONTROL_NULL_GUID, 0x00000000L, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00); +#endif +#define WPP_TRACE_CONTROL(Function,Buffer,BufferSize,ReturnSize) WppTraceCallback(Function,NULL,BufferSize,Buffer,&WPP_CB[0],&ReturnSize); + + +__inline ULONG64 WppQueryLogger(__in_opt PCWSTR LoggerName) +{ + + if (WppTraceWinXP == WPPTraceSuite) { + + ULONG ReturnLength ; + LONG Status ; + ULONG64 TraceHandle ; + UNICODE_STRING Buffer ; + + RtlInitUnicodeString(&Buffer, LoggerName ? LoggerName : L"stdout"); + + Status = pfnWppQueryTraceInformation( + TraceHandleByNameClass, + (PVOID)&TraceHandle, + sizeof(TraceHandle), + &ReturnLength, + (PVOID)&Buffer + ); + if (Status != STATUS_SUCCESS) { + return (ULONG64)0 ; + } + + return TraceHandle ; + } else { + return (ULONG64) 0 ; + } +} + +typedef LONG (*WMIENTRY_NEW)( + __in UCHAR MinorFunction, + __in_opt PVOID DataPath, + __in ULONG BufferLength, + __inout_bcount(BufferLength) PVOID Buffer, + __in PVOID Context, + __out PULONG Size + ); + +typedef struct _WPP_TRACE_CONTROL_BLOCK +{ + WMIENTRY_NEW Callback; + LPCGUID ControlGuid; + struct _WPP_TRACE_CONTROL_BLOCK *Next; + __int64 Logger; + PUNICODE_STRING RegistryPath; + UCHAR FlagsLen; + UCHAR Level; + USHORT Reserved; + ULONG Flags[1]; +} WPP_TRACE_CONTROL_BLOCK, *PWPP_TRACE_CONTROL_BLOCK; + +VOID WppCleanupKm(__in_opt PDEVICE_OBJECT pDeviceObject); +#define WPP_CLEANUP(DrvObj) WppCleanupKm((PDEVICE_OBJECT) DrvObj) + +#define WPP_IsValidSid RtlValidSid +#define WPP_GetLengthSid RtlLengthSid + +// +// Callback routine to be defined by the driver, which will be called from WPP callback +// WPP will pass current valued of : GUID, Logger, Enable, Flags, and Level +// +// To activate driver must define WPP_PRIVATE_ENABLE_CALLBACK in their code, sample below +// #define WPP_PRIVATE_ENABLE_CALLBACK MyPrivateCallback; +// +typedef +VOID +(*PFN_WPP_PRIVATE_ENABLE_CALLBACK)( + __in LPCGUID Guid, + __in __int64 Logger, + __in BOOLEAN Enable, + __in ULONG Flags, + __in UCHAR Level); + +#if defined(__cplusplus) +}; +#endif + +#endif // #ifndef WPP_ALREADY_INCLUDED + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-init.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-init.tpl new file mode 100644 index 00000000000..4c9d9b4446a --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-init.tpl @@ -0,0 +1,1052 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +// template `TemplateFile` +// +// Defines a set of functions that simplifies +// kernel mode registration for tracing +// + +#pragma warning(disable: 4201) +#include + +#if defined(__cplusplus) +extern "C" { +#endif + +#if !defined(WppDebug) +#define WppDebug(a,b) +#endif + + +// Routine to handle the System Control in W2K +DRIVER_DISPATCH WPPSystemControlDispatch; +NTSTATUS +WPPSystemControlDispatch( + __in PDEVICE_OBJECT DeviceObject, + __in PIRP Irp + ); + +WPPINIT_EXPORT +void WppInitGlobalLogger( + __in LPCGUID ControlGuid, + __out PTRACEHANDLE LoggerHandle, + __out PULONG Flags, + __out PUCHAR Level + ); + + +WPPINIT_EXPORT +VOID WppInitKm( + __in_opt PDEVICE_OBJECT pDevObject + ); + +#ifdef ALLOC_PRAGMA + #pragma alloc_text( PAGE, WPPSystemControlDispatch) + #pragma alloc_text( PAGE, WppLoadTracingSupport) + #pragma alloc_text( PAGE, WppInitGlobalLogger) + #pragma alloc_text( PAGE, WppTraceCallback) + #pragma alloc_text( PAGE, WppInitKm) + #pragma alloc_text( PAGE, WppCleanupKm) +#endif // ALLOC_PRAGMA + +// define annotation record that will carry control information to pdb (in case somebody needs it) +WPP_FORCEINLINE void WPP_CONTROL_ANNOTATION() { +#if !defined(WPP_NO_ANNOTATIONS) +#if !defined(WPP_ANSI_ANNOTATION) +# define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) __annotation(L"TMC:", WPP_GUID_WTEXT Guid, _WPPW(WPP_STRINGIZE(Name)) Bits); +# define WPP_DEFINE_BIT(Name) , _WPPW(#Name) +#else +# define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) __annotation("TMC:", WPP_GUID_TEXT Guid, WPP_STRINGIZE(Name) Bits); +# define WPP_DEFINE_BIT(Name) , #Name +#endif + WPP_CONTROL_GUIDS +# undef WPP_DEFINE_BIT +# undef WPP_DEFINE_CONTROL_GUID +#endif +} + + +#define WPP_NEXT(Name) ((WPP_TRACE_CONTROL_BLOCK*) \ + (WPP_XGLUE(WPP_CTL_, WPP_EVAL(Name)) + 1 == WPP_LAST_CTL ? 0:WPP_MAIN_CB + WPP_XGLUE(WPP_CTL_, WPP_EVAL(Name)) + 1)) + + +WPP_CB_TYPE WPP_MAIN_CB[WPP_LAST_CTL]; + +__inline void WPP_INIT_CONTROL_ARRAY(WPP_CB_TYPE* Arr) { +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) \ + Arr->Control.Callback = NULL; \ + Arr->Control.ControlGuid = WPP_XGLUE4(&WPP_, ThisDir, _CTLGUID_, WPP_EVAL(Name)); \ + Arr->Control.Next = WPP_NEXT(WPP_EVAL(Name)); \ + Arr->Control.RegistryPath= NULL; \ + Arr->Control.FlagsLen = WPP_FLAG_LEN; \ + Arr->Control.Level = WPP_LAST_CTL; \ + Arr->Control.Reserved = 0; \ + Arr->Control.Flags[0] = 0; \ + ++Arr; +#define WPP_DEFINE_BIT(BitName) L" " L ## #BitName +WPP_CONTROL_GUIDS +#undef WPP_DEFINE_BIT +#undef WPP_DEFINE_CONTROL_GUID +} + + +#undef WPP_INIT_STATIC_DATA +#define WPP_INIT_STATIC_DATA WPP_INIT_CONTROL_ARRAY(WPP_MAIN_CB) + + +ULONG_PTR WPP_Global_NextDeviceOffsetInDeviceExtension = (ULONG_PTR)-1; + +#define WPP_INIT_TRACING(DrvObj, RegPath) \ + { \ + UNREFERENCED_PARAMETER(RegPath); \ + WppDebug(0,("WPP_INIT_TRACING: &WPP_CB[0] %p\n", &WPP_MAIN_CB[0])); \ + WPP_INIT_STATIC_DATA; \ + WppLoadTracingSupport(); \ + WPP_CB = WPP_MAIN_CB; \ + ( WPP_CONTROL_ANNOTATION(), \ + WPP_MAIN_CB[0].Control.RegistryPath = NULL, \ + WppInitKm( (PDEVICE_OBJECT)DrvObj ) \ + ); \ + } + +#define WMIREG_FLAG_CALLBACK 0x80000000 // not exposed in DDK + +#ifndef WMIREG_FLAG_TRACE_PROVIDER +#define WMIREG_FLAG_TRACE_PROVIDER 0x00010000 +#endif + +#ifndef WPP_POOLTAG +#define WPP_POOLTAG 'ECTS' +#endif + +#ifndef WPP_POOLTYPE +#define WPP_POOLTYPE PagedPool +#endif + +#ifndef WPP_MAX_MOF_FIELDS +#define WPP_MAX_MOF_FIELDS 7 +#endif + +#ifndef TRACE_MESSAGE_MAXIMUM_SIZE +#define TRACE_MESSAGE_MAXIMUM_SIZE 8*1024 +#endif + +typedef struct _WPP_TRACE_BUFFER { + EVENT_TRACE_HEADER Header; + MOF_FIELD MofField[WPP_MAX_MOF_FIELDS+1]; +} WPP_TRACE_BUFFER; + + +NTSTATUS +W2kTraceMessage(__in TRACEHANDLE LoggerHandle, + __in ULONG TraceOptions, + __in LPGUID MessageGuid, + __in USHORT MessageNumber, + ... + ) +/*++ + +Routine Description: + + This is a function that simulates tracemessage in W2K + +Arguments: + + LoggerHandle - handle providers logger handle + + TraceOptions - unreferenced + + MessageGuid - pointer to message GUID + + MessageNumber - Type of message been logged + + ... - list or arguments + +Return Value: + + NTSTATUS code indicating success or failure + +--*/ + +{ + size_t ByteCount; + size_t ArgumentCount; + va_list VarArgs; + PVOID DataPtr; + size_t DataSize = 0; + size_t ArgOffset; + NTSTATUS Status = STATUS_SUCCESS; + WPP_TRACE_BUFFER TraceBuf; + PVOID Data=NULL; + + UNREFERENCED_PARAMETER(TraceOptions); // unused + + RtlZeroMemory(&(TraceBuf.Header), sizeof(EVENT_TRACE_HEADER)); + + //Fill in header fields + ((PWNODE_HEADER)&(TraceBuf.Header))->HistoricalContext = LoggerHandle; + TraceBuf.Header.GuidPtr = (ULONG_PTR)MessageGuid; + TraceBuf.Header.Flags = WNODE_FLAG_TRACED_GUID |WNODE_FLAG_USE_GUID_PTR|WNODE_FLAG_USE_MOF_PTR; + //Type is 0xFF to indicate that the first data is the MessageNumber + TraceBuf.Header.Class.Type = 0xFF; + + //The first Mof data is the Message Number + TraceBuf.MofField[0].DataPtr = (ULONG_PTR)&MessageNumber; + TraceBuf.MofField[0].Length = sizeof(USHORT); + + + // Determine the number bytes to follow header + ByteCount = 0; // For Count of Bytes + ArgumentCount = 0; // For Count of Arguments + va_start(VarArgs, MessageNumber); + + while ((DataPtr = va_arg (VarArgs, PVOID)) != NULL) + { + DataSize = va_arg (VarArgs, size_t); + + // Check for integer overflow. + if (ByteCount + DataSize > ByteCount) + { + ByteCount += DataSize; + ArgumentCount++; + if (ArgumentCount <= WPP_MAX_MOF_FIELDS) + { + TraceBuf.MofField[ArgumentCount].DataPtr = (ULONG_PTR)DataPtr; + TraceBuf.MofField[ArgumentCount].Length = (ULONG)DataSize; + } + } + } + + va_end(VarArgs); + + if (ByteCount > TRACE_MESSAGE_MAXIMUM_SIZE) + { + return STATUS_UNSUCCESSFUL; + } + + //This occurs infrequently + if (ArgumentCount > WPP_MAX_MOF_FIELDS) + { + //Allocate the blob to hold the data + Data = ExAllocatePoolWithTag(WPP_POOLTYPE,ByteCount,WPP_POOLTAG); + if (Data == NULL) + { + return STATUS_NO_MEMORY; + } + + TraceBuf.MofField[1].DataPtr = (ULONG_PTR)Data; + TraceBuf.MofField[1].Length = (ULONG)ByteCount; + + ArgOffset = 0; + DataSize = 0; + va_start(VarArgs, MessageNumber); + + while ((DataPtr = va_arg (VarArgs, PVOID)) != NULL) { + DataSize = va_arg (VarArgs, size_t); + RtlCopyMemory((char*)Data + ArgOffset, DataPtr, DataSize); + ArgOffset += DataSize; + } + + va_end(VarArgs); + + //Fill in the total size (header + 2 mof fields) + TraceBuf.Header.Size = (USHORT)(sizeof(EVENT_TRACE_HEADER) + 2*sizeof(MOF_FIELD)); + + } + else + { + //Fill in the total size (header + mof fields) + TraceBuf.Header.Size = (USHORT)(sizeof(EVENT_TRACE_HEADER) + (ArgumentCount+1)*sizeof(MOF_FIELD)); + } + + + Status = IoWMIWriteEvent(&TraceBuf.Header); + + if (Data) ExFreePool(Data); + + return Status; +} + +// +// Public routines to break down the Loggerhandle +// + +#if !defined(KERNEL_LOGGER_ID) +#define KERNEL_LOGGER_ID 0xFFFF // USHORT only +#endif + +typedef struct _WPP_TRACE_ENABLE_CONTEXT { + USHORT LoggerId; // Actual Id of the logger + UCHAR Level; // Enable level passed by control caller + UCHAR InternalFlag; // Reserved + ULONG EnableFlags; // Enable flags passed by control caller +} WPP_TRACE_ENABLE_CONTEXT, *PWPP_TRACE_ENABLE_CONTEXT; + +#if !defined(WmiGetLoggerId) +#define WmiGetLoggerId(LoggerContext) \ + (((PWPP_TRACE_ENABLE_CONTEXT) (&LoggerContext))->LoggerId == \ + (USHORT)KERNEL_LOGGER_ID) ? \ + KERNEL_LOGGER_ID : \ + ((PWPP_TRACE_ENABLE_CONTEXT) (&LoggerContext))->LoggerId + +#define WmiGetLoggerEnableFlags(LoggerContext) \ + ((PWPP_TRACE_ENABLE_CONTEXT) (&LoggerContext))->EnableFlags +#define WmiGetLoggerEnableLevel(LoggerContext) \ + ((PWPP_TRACE_ENABLE_CONTEXT) (&LoggerContext))->Level +#endif + +#ifndef WPPINIT_EXPORT +#define WPPINIT_EXPORT +#endif + +#define WppIsEqualGuid(G1, G2)(RtlCompareMemory(G1, G2, sizeof(GUID)) == sizeof(GUID)) + + +VOID +WppLoadTracingSupport( + VOID + ) +/*++ + +Routine Description: + + This function assigns at runtime the ETW API set to be use for tracing. + +Arguments: + +Remarks: + + At runtime determine assing the funtions pointers for the trace APIs to be use. + XP and above will use TraceMessage, and Win2K will use our private W2kTraceMessage + which uses TraceEvent + +--*/ +{ + UNICODE_STRING name; + + + PAGED_CODE(); + + RtlInitUnicodeString(&name, L"WmiTraceMessage"); + pfnWppTraceMessage = (PFN_WPPTRACEMESSAGE) (INT_PTR) + MmGetSystemRoutineAddress(&name); + + if (pfnWppTraceMessage == NULL) { + // + // Subsitute the W2K verion of WmiTraceMessage + // + pfnWppTraceMessage = W2kTraceMessage; + WPPTraceSuite = WppTraceWin2K; + + WppDebug(0,("WppLoadTracingSupport:subsitute pWmiTraceMessage %p\n", + pfnWppTraceMessage)); + + return; // no point in continuing. + } + + RtlInitUnicodeString(&name, L"WmiQueryTraceInformation"); + pfnWppQueryTraceInformation = (PFN_WPPQUERYTRACEINFORMATION) (INT_PTR) + MmGetSystemRoutineAddress(&name); + WPPTraceSuite = WppTraceWinXP; +} + + +#ifdef WPP_GLOBALLOGGER +#define DEFAULT_GLOBAL_LOGGER_KEY L"WMI\\GlobalLogger\\" +#define WPP_TEXTGUID_LEN 38 +#define GREGVALUENAMELENGTH (18 + WPP_TEXTGUID_LEN) // wslen(L"WMI\\GlobalLogger\\") + GUIDLENGTH + +WPPINIT_EXPORT +void WppInitGlobalLogger( + __in LPCGUID ControlGuid, + __out PTRACEHANDLE LoggerHandle, + __out PULONG Flags, + __out PUCHAR Level + ) +{ +WCHAR GRegValueName[GREGVALUENAMELENGTH]; +RTL_QUERY_REGISTRY_TABLE Parms[3]; +ULONG CurrentFlags = 0; +ULONG CurrentLevel = 0; +ULONG Start = 0; +NTSTATUS Status; +ULONG Zero = 0; +UNICODE_STRING GuidString; + + + PAGED_CODE(); + + WppDebug(0,("WPP checking Global Logger\n")); + + + // + // Fill in the query table to find out if the Global Logger is Started + // + // Trace Flags + Parms[0].QueryRoutine = NULL; + Parms[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parms[0].Name = L"Start"; + Parms[0].EntryContext = &Start; + Parms[0].DefaultType = REG_DWORD; + Parms[0].DefaultData = &Zero; + Parms[0].DefaultLength = sizeof(ULONG); + // Termination + Parms[1].QueryRoutine = NULL; + Parms[1].Flags = 0; + // + // Perform the query + // + + Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL | RTL_REGISTRY_OPTIONAL, + DEFAULT_GLOBAL_LOGGER_KEY, + Parms, + NULL, + NULL); + if (!NT_SUCCESS(Status) || Start == 0 ) { + return; + } + + // Fill in the query table to find out if we should use the Global logger + // + // Trace Flags + Parms[0].QueryRoutine = NULL; + Parms[0].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parms[0].Name = L"Flags"; + Parms[0].EntryContext = &CurrentFlags; + Parms[0].DefaultType = REG_DWORD; + Parms[0].DefaultData = &Zero; + Parms[0].DefaultLength = sizeof(ULONG); + // Trace level + Parms[1].QueryRoutine = NULL; + Parms[1].Flags = RTL_QUERY_REGISTRY_DIRECT; + Parms[1].Name = L"Level"; + Parms[1].EntryContext = &CurrentLevel; + Parms[1].DefaultType = REG_DWORD; + Parms[1].DefaultData = &Zero; + Parms[1].DefaultLength = sizeof(UCHAR); + // Termination + Parms[2].QueryRoutine = NULL; + Parms[2].Flags = 0; + + + RtlCopyMemory(GRegValueName, DEFAULT_GLOBAL_LOGGER_KEY, (wcslen(DEFAULT_GLOBAL_LOGGER_KEY)+1) *sizeof(WCHAR)); + + Status = RtlStringFromGUID(ControlGuid, &GuidString); + if( Status != STATUS_SUCCESS ) { + WppDebug(0,("WPP GlobalLogger failed RtlStringFromGUID \n")); + return; + } + + if (GuidString.Length > (WPP_TEXTGUID_LEN * sizeof(WCHAR))){ + WppDebug(0,("WPP GlobalLogger RtlStringFromGUID too large\n")); + RtlFreeUnicodeString(&GuidString); + return; + } + + // got the GUID in form "{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}" + // need GUID in form "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" + // copy the translated GUID string + + RtlCopyMemory(&GRegValueName[(ULONG)wcslen(GRegValueName)], &GuidString.Buffer[1], GuidString.Length); + GRegValueName[(ULONG)wcslen(GRegValueName) - 1] = L'\0'; + RtlFreeUnicodeString(&GuidString); + + // + // Perform the query + // + + Status = RtlQueryRegistryValues(RTL_REGISTRY_CONTROL | RTL_REGISTRY_OPTIONAL, + GRegValueName, + Parms, + NULL, + NULL); + if (NT_SUCCESS(Status)) { + if (Start==1) { + *LoggerHandle= WMI_GLOBAL_LOGGER_ID; + *Flags = CurrentFlags & 0x7FFFFFFF; + *Level = (UCHAR)(CurrentLevel & 0xFF); + WppDebug(0,("WPP Enabled via Global Logger Flags=0x%08X Level=0x%02X\n",CurrentFlags,CurrentLevel)); + + } + } else { + WppDebug(0,("WPP GlobalLogger has No Flags/Levels Status=%08X\n",Status)); + } +} +#endif //#ifdef WPP_GLOBALLOGGER + +#define WPP_MAX_COUNT_REGISTRATION_GUID 63 + +WPPINIT_EXPORT +NTSTATUS +WppTraceCallback( + __in UCHAR MinorFunction, + __in_opt PVOID DataPath, + __in ULONG BufferLength, + __inout_bcount(BufferLength) PVOID Buffer, + __in PVOID Context, + __out PULONG Size + ) +/*++ + +Routine Description: + + This function is the callback WMI calls when we register and when our + events are enabled or disabled. + +Arguments: + + MinorFunction - specifies the type of callback (register, event enable/disable) + + DataPath - varies depending on the ActionCode + + BufferLength - size of the Buffer parameter + + Buffer - in/out buffer where we read from or write to depending on the type + of callback + + Context - the pointer private struct WPP_TRACE_CONTROL_BLOCK + + Size - output parameter to receive the amount of data written into Buffer + +Return Value: + + NTSTATUS code indicating success/failure + +Comments: + + if return value is STATUS_BUFFER_TOO_SMALL and BufferLength >= 4, + then first ulong of buffer contains required size + + +--*/ + +{ + PWPP_TRACE_CONTROL_BLOCK cntl; + NTSTATUS Status = STATUS_SUCCESS; + + UNREFERENCED_PARAMETER(DataPath); + + + PAGED_CODE(); + + WppDebug(0,("WppTraceCallBack 0x%08X %p\n", MinorFunction, Context)); + + *Size = 0; + + switch(MinorFunction) + { + case IRP_MN_REGINFO: + { + PWMIREGINFOW WmiRegInfo; + PCUNICODE_STRING RegPath; + PWCHAR StringPtr; + ULONG RegistryPathOffset; + ULONG BufferNeeded; + ULONG GuidCount = 0; + + // + // Initialize locals + // + + cntl = (PWPP_TRACE_CONTROL_BLOCK)Context; + WmiRegInfo = (PWMIREGINFO)Buffer; + + if (WppTraceWin2K == WPPTraceSuite && WmiRegInfo->GuidCount > 1) { + + // + // Calculate buffer size need to hold all info. + // + BufferNeeded = FIELD_OFFSET(WMIREGINFOW, WmiRegGuid) + + WmiRegInfo->GuidCount * sizeof(WMIREGGUIDW); + + if ( BufferNeeded > BufferLength) { + Status = STATUS_BUFFER_TOO_SMALL; + if (BufferLength >= sizeof(ULONG)) { + *((PULONG)Buffer) = BufferNeeded; + *Size = sizeof(ULONG); + } + break; + } + + // + // Deal with the WMI + WPP registration case can only handle + // One Tracing CONTROL GUID, at the last poscition + // + + WmiRegInfo->WmiRegGuid[WmiRegInfo->GuidCount - 1].Guid = *cntl->ControlGuid; + WmiRegInfo->WmiRegGuid[WmiRegInfo->GuidCount - 1].Flags = + WMIREG_FLAG_TRACE_CONTROL_GUID | WMIREG_FLAG_TRACED_GUID; + cntl->Level = 0; + cntl->Flags[0] = 0; +#ifdef WPP_GLOBALLOGGER + WppInitGlobalLogger( cntl->ControlGuid, + (PTRACEHANDLE)&cntl->Logger, + &cntl->Flags[0], + &cntl->Level + ); +#endif + break; + } + + RegPath = cntl->RegistryPath; + + // + // Count the number of guid to be identified. + // + while(cntl) { GuidCount++; cntl = cntl->Next; } + + if (GuidCount > WPP_MAX_COUNT_REGISTRATION_GUID){ + Status = STATUS_INVALID_PARAMETER; + break; + } + + WppDebug(0,("WppTraceCallBack: GUID count %d\n", GuidCount)); + + // + // Calculate buffer size need to hold all info. + // Calculate offset to where RegistryPath parm will be copied. + // + + if (RegPath == NULL) + { + + RegistryPathOffset = 0; + + BufferNeeded = FIELD_OFFSET(WMIREGINFOW, WmiRegGuid) + + GuidCount * sizeof(WMIREGGUIDW); + + } else { + + RegistryPathOffset = FIELD_OFFSET(WMIREGINFOW, WmiRegGuid) + + GuidCount * sizeof(WMIREGGUIDW); + + BufferNeeded = RegistryPathOffset + + RegPath->Length + sizeof(USHORT); + } + + // + // If the provided buffer is large enough, then fill with info. + // + + if (BufferNeeded <= BufferLength) + { + ULONG i; + + RtlZeroMemory(Buffer, BufferLength); + + // + // Fill in the WMIREGINFO + // + + WmiRegInfo->BufferSize = BufferNeeded; + WmiRegInfo->RegistryPath = RegistryPathOffset; + WmiRegInfo->GuidCount = GuidCount; + + if (RegPath != NULL) { + StringPtr = (PWCHAR)((PUCHAR)Buffer + RegistryPathOffset); + *StringPtr++ = RegPath->Length; + + RtlCopyMemory(StringPtr, RegPath->Buffer, RegPath->Length); + } + + // + // Fill in the WMIREGGUID + // + + cntl = (PWPP_TRACE_CONTROL_BLOCK) Context; + + for (i=0; iWmiRegGuid[i].Guid = *cntl->ControlGuid; + WmiRegInfo->WmiRegGuid[i].Flags = WMIREG_FLAG_TRACE_CONTROL_GUID | + WMIREG_FLAG_TRACED_GUID; + cntl->Level = 0; + cntl->Flags[0] = 0; + WppDebug(0,("Control GUID::%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", + cntl->ControlGuid->Data1, + cntl->ControlGuid->Data2, + cntl->ControlGuid->Data3, + cntl->ControlGuid->Data4[0], + cntl->ControlGuid->Data4[1], + cntl->ControlGuid->Data4[2], + cntl->ControlGuid->Data4[3], + cntl->ControlGuid->Data4[4], + cntl->ControlGuid->Data4[5], + cntl->ControlGuid->Data4[6], + cntl->ControlGuid->Data4[7] + )); + + cntl = cntl->Next; + } + + Status = STATUS_SUCCESS; + *Size = BufferNeeded; + + } else { + Status = STATUS_BUFFER_TOO_SMALL; + + if (BufferLength >= sizeof(ULONG)) { + *((PULONG)Buffer) = BufferNeeded; + *Size = sizeof(ULONG); + } + } + +#ifdef WPP_GLOBALLOGGER + // Check if Global logger is active + + cntl = (PWPP_TRACE_CONTROL_BLOCK) Context; + while(cntl) { + WppInitGlobalLogger( + cntl->ControlGuid, + (PTRACEHANDLE)&cntl->Logger, + &cntl->Flags[0], + &cntl->Level); + cntl = cntl->Next; + } +#endif //#ifdef WPP_GLOBALLOGGER + + break; + } + + case IRP_MN_ENABLE_EVENTS: + case IRP_MN_DISABLE_EVENTS: + { + PWNODE_HEADER Wnode; + ULONG Level; + ULONG ReturnLength; + ULONG index; + + if (Context == NULL ) { + Status = STATUS_WMI_GUID_NOT_FOUND; + break; + } + + if (BufferLength < sizeof(WNODE_HEADER)) { + Status = STATUS_INVALID_PARAMETER; + } + + // + // Initialize locals + // + Wnode = (PWNODE_HEADER)Buffer; + + // + // Traverse this ProjectControlBlock's ControlBlock list and + // find the "cntl" ControlBlock which matches the Wnode GUID. + // + cntl = (PWPP_TRACE_CONTROL_BLOCK) Context; + index = 0; + while(cntl) { + if (WppIsEqualGuid(cntl->ControlGuid, &Wnode->Guid )) { + break; + } + index++; + cntl = cntl->Next; + } + + if (cntl == NULL) { + Status = STATUS_WMI_GUID_NOT_FOUND; + break; + } + + // + // Do the requested event action + // + Status = STATUS_SUCCESS; + + if (MinorFunction == IRP_MN_DISABLE_EVENTS) { + + WppDebug(0,("WppTraceCallBack: DISABLE_EVENTS\n")); + + cntl->Level = 0; + cntl->Flags[0] = 0; + cntl->Logger = 0; + + } else { + + TRACEHANDLE lh; + + lh = (TRACEHANDLE)( Wnode->HistoricalContext ); + cntl->Logger = lh; + + if (WppTraceWinXP == WPPTraceSuite) { + + Status = pfnWppQueryTraceInformation( TraceEnableLevelClass, + &Level, + sizeof(Level), + &ReturnLength, + (PVOID) Wnode ); + + if (Status == STATUS_SUCCESS) { + cntl->Level = (UCHAR)Level; + } + + Status = pfnWppQueryTraceInformation( TraceEnableFlagsClass, + &cntl->Flags[0], + sizeof(cntl->Flags[0]), + &ReturnLength, + (PVOID) Wnode ); + + } else { + cntl->Flags[0] = ((PWPP_TRACE_ENABLE_CONTEXT) &lh)->EnableFlags; + cntl->Level = (UCHAR) ((PWPP_TRACE_ENABLE_CONTEXT) &lh)->Level; + } + + WppDebug(0,("WppTraceCallBack: ENABLE_EVENTS " + "LoggerId %d, Flags 0x%08X, Level 0x%02X\n", + (USHORT) cntl->Logger, + cntl->Flags[0], + cntl->Level)); + + } + +#ifdef WPP_PRIVATE_ENABLE_CALLBACK + // + // Notify changes to flags, level for GUID + // + WPP_PRIVATE_ENABLE_CALLBACK( cntl->ControlGuid, + cntl->Logger, + (MinorFunction != IRP_MN_DISABLE_EVENTS) ? TRUE:FALSE, + cntl->Flags[0], + cntl->Level ); +#endif + + break; + } + + case IRP_MN_ENABLE_COLLECTION: + case IRP_MN_DISABLE_COLLECTION: + { + Status = STATUS_SUCCESS; + break; + } + + case IRP_MN_QUERY_ALL_DATA: + case IRP_MN_QUERY_SINGLE_INSTANCE: + case IRP_MN_CHANGE_SINGLE_INSTANCE: + case IRP_MN_CHANGE_SINGLE_ITEM: + case IRP_MN_EXECUTE_METHOD: + { + Status = STATUS_INVALID_DEVICE_REQUEST; + break; + } + + default: + { + Status = STATUS_INVALID_DEVICE_REQUEST; + break; + } + + } + return(Status); +} + +WPPINIT_EXPORT +VOID WppInitKm( + __in_opt PDEVICE_OBJECT pDevObject + ) +/*++ + +Routine Description: + + This function registers a driver with ETW as a provider of trace + events from the defined GUIDs + +Arguments: + + pDevObject - Optional pointer to a device object object, neede only for W2K + +Remarks: + + This function is called by the WPP_INIT_TRACING(DrvObj, RegPath) macro, for XP and + above the DrvObj can be NULL. + +--*/ + +{ + PWPP_TRACE_CONTROL_BLOCK WppReg = &WPP_CB[0].Control; + NTSTATUS Status; + + + PAGED_CODE(); + + WppDebug(0,("WPP Init.\n")); + + if (WppTraceWinXP == WPPTraceSuite){ + + + WppReg -> Callback = WppTraceCallback; + Status = IoWMIRegistrationControl( + (PDEVICE_OBJECT)WppReg, + WMIREG_ACTION_REGISTER | + WMIREG_FLAG_CALLBACK | + WMIREG_FLAG_TRACE_PROVIDER + ); + WppDebug(0,("IoWMIRegistrationControl Status = %08X\n",Status)); + + } else { + +#ifdef WDF_WPP_KMDF_DRIVER + Status = WdfDriverRegisterTraceInfo((PDRIVER_OBJECT)pDevObject, + WppTraceCallback, + WppReg); + if (!NT_SUCCESS(Status)) { + WppDebug(0,("WdfDriverRegisterTraceInfo failed Status = %08X\n",Status)); + } +#else + WppReg -> Callback = NULL; + Status = IoWMIRegistrationControl(pDevObject, + WMIREG_ACTION_REGISTER + ); + WppDebug(0,("IoWMIRegistrationControl Status = %08X\n",Status)); +#endif + } + +} + +WPPINIT_EXPORT +VOID +WppCleanupKm( + __in_opt PDEVICE_OBJECT DeviceObject + ) +/*++ + +Routine Description: + + This function deregisters a driver from ETW as provider of trace + events. + +Arguments: + + pDevObject - Optional pointer to a device object object, neede only for W2K. + +Remarks: + + This is the defined WPP_CLEANUP(DrvObj) macro, and the macro can + take NULL as an argument for XP and above. + +--*/ + +{ + + + PAGED_CODE(); + + if (WPP_CB == (WPP_CB_TYPE*)&WPP_CB){ + // + // WPP_INIT_TRACING macro has not been called + // + return; + } + + if (WppTraceWinXP == WPPTraceSuite) { + PWPP_TRACE_CONTROL_BLOCK WppReg = &WPP_CB[0].Control; + + IoWMIRegistrationControl( (PDEVICE_OBJECT)WppReg, + WMIREG_ACTION_DEREGISTER | + WMIREG_FLAG_CALLBACK ); + + } else { +#ifndef WDF_WPP_KMDF_DRIVER + IoWMIRegistrationControl(DeviceObject, WMIREG_ACTION_DEREGISTER ); +#else + UNREFERENCED_PARAMETER(DeviceObject); + // + // WDF does the job of unregistering the device and deleting it + // when the driver is unloaded. So we don't do anything in the + // WPP_CLEANUP call. + // +#endif + } + + WPP_CB = (WPP_CB_TYPE*)&WPP_CB; + +} + + +#define WPP_SYSTEMCONTROL(PDO) \ + if(WPPTraceSuite == WppTraceDisabledSuite){ \ + WppLoadTracingSupport(); \ + } \ + if(WPPTraceSuite == WppTraceWin2K){ \ + PDO->MajorFunction[ IRP_MJ_SYSTEM_CONTROL ] = WPPSystemControlDispatch; \ + } + +#define WPP_SYSTEMCONTROL2(PDO, offset) \ + if(WPPTraceSuite == WppTraceDisabledSuite){ \ + WppLoadTracingSupport(); \ + } \ + if(WPPTraceSuite == WppTraceWin2K){ \ + WPP_SYSTEMCONTROL(PDO); WPP_Global_NextDeviceOffsetInDeviceExtension = (ULONG_PTR)offset; \ + } + + + +// Routine to handle the System Control in W2K +NTSTATUS +WPPSystemControlDispatch( + __in PDEVICE_OBJECT DeviceObject, + __in PIRP Irp + ) +{ + + PIO_STACK_LOCATION irpSp = IoGetCurrentIrpStackLocation(Irp); + ULONG BufferSize = irpSp->Parameters.WMI.BufferSize; + PVOID Buffer = irpSp->Parameters.WMI.Buffer; + ULONG ReturnSize = 0; + NTSTATUS Status = STATUS_SUCCESS; + + PAGED_CODE(); + + WppDebug(0,("WPPSYSTEMCONTROL\n")); + + if (DeviceObject == (PDEVICE_OBJECT)irpSp->Parameters.WMI.ProviderId) { + if (irpSp->MinorFunction == IRP_MN_REGINFO) { + RtlZeroMemory(Buffer, BufferSize); + } + Status = WppTraceCallback((UCHAR)(irpSp->MinorFunction), + NULL, + BufferSize, + Buffer, + &WPP_CB[0], + &ReturnSize + ); + + WppDebug(0,("WPPSYSTEMCONTROL Status 0x%08X\n",Status)); + + Irp->IoStatus.Status = Status; + Irp->IoStatus.Information = ReturnSize; + IoCompleteRequest( Irp, IO_NO_INCREMENT ); + return Status; + } else if (WPP_Global_NextDeviceOffsetInDeviceExtension != -1) { + + ULONG_PTR t; + + WppDebug(0,("WPPSYSTEMCONTROL - not for us\n")); + + // + // Set current stack back one. + // + IoSkipCurrentIrpStackLocation( Irp ); + // + // Pass the call to the next driver. + // + t = (ULONG_PTR)DeviceObject->DeviceExtension; + t += WPP_Global_NextDeviceOffsetInDeviceExtension; + return IoCallDriver(*(PDEVICE_OBJECT*)t,Irp); + + } else { + // + // Unable to pass down + // + return Irp->IoStatus.Status; + } +} + +#if defined(__cplusplus) +}; +#endif diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-w2k.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-w2k.tpl new file mode 100644 index 00000000000..92db45b36e9 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/km-w2k.tpl @@ -0,0 +1,13 @@ +`**********************************************************************` +`* This is a template file for tracewpp preprocessor *` +`* If you need to use a custom version of this file in your project *` +`* Please clone it from this one and point WPP to it by specifying *` +`* -gen:{yourfile} option on RUN_WPP line in your sources file *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` +//`Compiler.Checksum` Generated File. Do not edit. +// File created by `Compiler.Name` compiler version `Compiler.Version`-`Compiler.Timestamp` +// on `System.Date` at `System.Time` UTC from a template `TemplateFile` + +`INCLUDE km-default.tpl` diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/mof.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/mof.tpl new file mode 100644 index 00000000000..a9c7d9220ee --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/mof.tpl @@ -0,0 +1,15 @@ +// Generated File. Do not edit. +// File created by `Compiler.Name` compiler version `Compiler.Version`-`Compiler.Timestamp` +// on `System.Date` at `System.Time` UTC + +`FORALL Guid IN TraceGuids` +`Guid.Text` `Guid.Comment` +`FORALL Msg in Guid.Messages` +#typev `Msg.Name` `Msg.MsgNo` "`Msg.Text`" +{ +`FORALL Arg IN Msg.Arguments` + `Arg.Name`, `Arg.MofType` // `Arg.No` +`ENDFOR Arg` +} +`ENDFOR Msg` +`ENDFOR Guid` diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/r1defwpp.ini b/eng/WpfArcadeSdk/tools/WppConfig/rev1/r1defwpp.ini new file mode 100644 index 00000000000..da747d9c2ca --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/r1defwpp.ini @@ -0,0 +1,89 @@ +# +# Default types for WPP +# + +# our basic arithmetic types + +DEFINE_SIMPLE_TYPE( SBYTE, signed char, ItemChar, "d"); +DEFINE_SIMPLE_TYPE( SSHORT, signed short, ItemShort, "hd"); +DEFINE_SIMPLE_TYPE( SINT, signed int, ItemInt, "d"); +DEFINE_SIMPLE_TYPE( SLONG, signed long, ItemLong, "ld"); +DEFINE_SIMPLE_TYPE( SINT64, signed _int64, ItemLongLong, "I64d"); + +DEFINE_FLAVOR( UCHAR, SBYTE, ItemUChar, "c" ); +DEFINE_FLAVOR( SCHAR, SBYTE, ItemChar, "c" ); +DEFINE_FLAVOR( BOOLEAN, SBYTE, ItemListByte(FALSE,TRUE), "s"); + +# arch dependent types + +DEFINE_SIMPLE_TYPE( SLONGPTR, void*, ItemPtr, "p"); +DEFINE_SIMPLE_TYPE( PTR, void*, ItemPtr, "p"); +DEFINE_SIMPLE_TYPE( HANDLE, void*, ItemPtr, "p"); + +# all strings require custom processing + +DEFINE_CPLX_TYPE(ASTR, WPP_LOGASTR, ItemString, "s"); +DEFINE_CPLX_TYPE(ARSTR, WPP_LOGASTR, ItemRString, "s"); +DEFINE_CPLX_TYPE(WSTR, WPP_LOGWSTR, ItemWString, "s"); +DEFINE_CPLX_TYPE(CSTR, WPP_LOGCSTR, ItemPString, "s"); +DEFINE_CPLX_TYPE(USTR, WPP_LOGUSTR, ItemPWString, "s"); + +# default formats for those who don't care to provide their own strings + +DEFINE_FLAVOR(UBYTE, SBYTE,, "u"); +DEFINE_FLAVOR(XBYTE, SBYTE,, "02x"); +DEFINE_FLAVOR(OBYTE, SBYTE,, "o"); + +DEFINE_FLAVOR(USHORT, SSHORT, ItemUShort, "hu"); +DEFINE_FLAVOR(XSHORT, SSHORT,, "04hX"); +DEFINE_FLAVOR(OSHORT, SSHORT,, "ho"); + +DEFINE_FLAVOR(UINT, SINT, ItemUInt, "u"); +DEFINE_FLAVOR(XINT, SINT,, "08x"); +DEFINE_FLAVOR(OINT, SINT,, "o"); + +DEFINE_FLAVOR(ULONG, SLONG, ItemULong, "lu"); +DEFINE_FLAVOR(XLONG, SLONG,, "08lX"); +DEFINE_FLAVOR(OLONG, SLONG,, "lo"); + +DEFINE_FLAVOR(UINT64, SINT64,, "i64u"); +DEFINE_FLAVOR(XINT64, SINT64,, "08i64X"); +DEFINE_FLAVOR(OINT64, SINT64,, "i64o"); + +DEFINE_FLAVOR(ULONGPTR, SLONGPTR,,); +DEFINE_FLAVOR(XLONGPTR, SLONGPTR,,); +DEFINE_FLAVOR(OLONGPTR, SLONGPTR,,); + +# special formats + +DEFINE_FLAVOR(IPADDR, UINT, ItemIPAddr, "s"); +DEFINE_FLAVOR(PORT, USHORT, ItemPort, "s"); +DEFINE_FLAVOR(STATUS, UINT, ItemNTSTATUS, "s"); +DEFINE_FLAVOR(WINERROR, UINT, ItemWINERROR, "s"); +DEFINE_FLAVOR(PORT, USHORT, ItemPort, "s"); +DEFINE_SIMPLE_TYPE(GUID, GUID, ItemGuid, "s"); + +# time related stuff + +DEFINE_FLAVOR(TIMESTAMP, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(TIME, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(DATE, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(WAITTIME, SINT64, ItemTimestamp, "s"); +DEFINE_FLAVOR(TIMEDELTA, SINT64, ItemTimestamp, "s"); + +# enumeration types + +DEFINE_FLAVOR(ItemListByte, SBYTE, ItemListByte, "s"); +DEFINE_FLAVOR(ItemListShort, SSHORT, ItemListShort,"s"); +DEFINE_FLAVOR(ItemListLong, SLONG, ItemListLong, "s"); + +CUSTOM_TYPE(IRQL, ItemListByte(Low,APC,DPC) ); + +CUSTOM_TYPE(PNPMN, ItemListByte(IRP_MN_START_DEVICE,IRP_MN_QUERY_REMOVE_DEVICE,IRP_MN_REMOVE_DEVICE,IRP_MN_CANCEL_REMOVE_DEVICE,IRP_MN_STOP_DEVICE,IRP_MN_QUERY_STOP_DEVICE,IRP_MN_CANCEL_STOP_DEVICE,IRP_MN_QUERY_DEVICE_RELATIONS,IRP_MN_QUERY_INTERFACE,IRP_MN_QUERY_CAPABILITIES,IRP_MN_QUERY_RESOURCES,IRP_MN_QUERY_RESOURCE_REQUIREMENTS,IRP_MN_QUERY_DEVICE_TEXT,IRP_MN_FILTER_RESOURCE_REQUIREMENTS,IRP_MN_PNP_14,IRP_MN_READ_CONFIG,IRP_MN_WRITE_CONFIG,IRP_MN_EJECT,IRP_MN_SET_LOCK,IRP_MN_QUERY_ID,IRP_MN_QUERY_PNP_DEVICE_STATE,IRP_MN_QUERY_BUS_INFORMATION,IRP_MN_DEVICE_USAGE_NOTIFICATION,IRP_MN_SURPRISE_REMOVAL) ); + +# default tracing macro + +SimpleTrace(MSG,ARG); +SimpleTraceEx(GRP,MSG,ARG); + +USEPREFIX(*, "[%9!x!].%3!03x!::%4 [%1] "); \ No newline at end of file diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/simple.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/simple.tpl new file mode 100644 index 00000000000..dd00ffd3d1a --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/simple.tpl @@ -0,0 +1,23 @@ +`**********************************************************************` +`* This is a template file for tracewpp preprocessor *` +`* If you need to use a custom version of this file in your project *` +`* Please clone it from this one and point WPP to it by specifying *` +`* -gen:{yourfile}outfile option on RUN_WPP line in your sources file *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` +//`Compiler.Checksum` Generated File. Do not edit. +// File created by `Compiler.Name` compiler version `Compiler.Version`-`Compiler.Timestamp` +// on `System.Date` at `System.Time` UTC from a template `TemplateFile` + +// PLEASE NOTE: +// Using simple.tpl for production environment without overriding +// WPP_ENABLED and WPP_LOGGER macro is NOT RECOMMENDED. +// +// If WPP_ENABLED is not provided, the logging is always on +// If WPP_LOGGER is not provided, traces always go to the logger named stdout (if it is running) +// + +`INCLUDE header.tpl` +`INCLUDE stdout.tpl` +`INCLUDE trmacro.tpl` diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/stdout.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/stdout.tpl new file mode 100644 index 00000000000..7935f44434c --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/stdout.tpl @@ -0,0 +1,29 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +// template `TemplateFile` + +`FORALL f IN Funcs` +#define WPP`f.GooId`_LOGGER(`f.GooArgs`) // `f.Name` +`ENDFOR` + +#ifndef WPP_LOGGER_ARG +# define WPP_LOGGER_ARG +#endif + +#ifndef WPP_GET_LOGGER + #define WPP_GET_LOGGER WppGetLogger() + __inline TRACEHANDLE WppGetLogger() + { + static TRACEHANDLE Logger; + if (Logger) {return Logger;} + return Logger = WppQueryLogger(0); + } +#endif + +#ifndef WPP_ENABLED +# define WPP_ENABLED() 1 +#endif diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/tracemacro.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/tracemacro.tpl new file mode 100644 index 00000000000..bf5fe128b5f --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/tracemacro.tpl @@ -0,0 +1,255 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +#if defined(__cplusplus) +extern "C" { +#endif + +#ifndef WPP_ALREADY_INCLUDED + +// template `TemplateFile` +// expects: +// WPP_THIS_FILE defined (see header.tpl) +// WPP_LOGGER_ARG defined +// WPP_GET_LOGGER defined +// WPP_ENABLED() defined + +#ifndef NO_CHECK_FOR_NULL_STRING +#ifndef WPP_CHECK_FOR_NULL_STRING +#define WPP_CHECK_FOR_NULL_STRING 1 +#endif +#endif + +#define WPP_EVAL(_value_) _value_ +#define WPP_(Id) WPP_EVAL(WPP_) ## WPP_EVAL(Id) ## WPP_EVAL(_) ## WPP_EVAL(WPP_THIS_FILE) ## WPP_EVAL(__LINE__) + +#if !defined(WPP_INLINE) +#define WPP_INLINE DECLSPEC_NOINLINE __inline +#endif + +#else // #ifndef WPP_ALREADY_INCLUDED + +#undef WPP_LOCAL_TraceGuids + +#endif // #ifndef WPP_ALREADY_INCLUDED + +#if !defined(WPP_NO_ANNOTATIONS) +#if !defined(WPP_ANSI_ANNOTATION) +`FORALL Msg IN Messages` +# define WPP_ANNOTATE_`Msg.Name` __annotation(L"TMF:", L"`Msg.Guid` `CurrentDir` // SRC=`SourceFile.Name` MJ=`ENV MAJORCOMP` MN=`ENV MINORCOMP`", L"#typev `Msg.Name` `Msg.MsgNo` \"`Msg.Text`\" // `Msg.Indent` `Msg.GooPairs`", L"{"`FORALL Arg IN Msg.Arguments`, L"`Arg.Name`, `Arg.MofType` -- `Arg.No`" `ENDFOR Arg`, L"}") +`ENDFOR` +#else +`FORALL Msg IN Messages` +# define WPP_ANNOTATE_`Msg.Name` __annotation("TMF:", "`Msg.Guid` `CurrentDir` // SRC=`SourceFile.Name` MJ=`ENV MAJORCOMP` MN=`ENV MINORCOMP`", "#typev `Msg.Name` `Msg.MsgNo` \"`Msg.Text`\" // `Msg.Indent` `Msg.GooPairs`", "{"`FORALL Arg IN Msg.Arguments`, "`Arg.Name`, `Arg.MofType` -- `Arg.No`" `ENDFOR Arg`, "}") +`ENDFOR` +#endif +# define WPP_ANNOTATE(x) WPP_ANNOTATE_ ## x, +#else +# define WPP_ANNOTATE(x) +#endif + +#define WPP_LOCAL_TraceGuids WPP_`SourceFile.CanonicalName`_Traceguids + +#if `TraceGuids.Count` +static const GUID WPP_LOCAL_TraceGuids[] = {`FORALL Guid IN TraceGuids` `Guid.Struct`, `ENDFOR`}; +#endif + +#ifndef WPP_ALREADY_INCLUDED + +#if !defined(WPP_TRACE_OPTIONS) +enum {WPP_TRACE_OPTIONS = TRACE_MESSAGE_SEQUENCE | TRACE_MESSAGE_GUID + | TRACE_MESSAGE_SYSTEMINFO | TRACE_MESSAGE_TIMESTAMP }; +#endif + +#if !defined(WPP_LOGPAIR) +# define WPP_LOGPAIR(_Size, _Addr) (_Addr),((SIZE_T)_Size), +#endif + +#define WPP_LOGTYPEVAL(_Type, _Value) WPP_LOGPAIR(sizeof(_Type), &(_Value)) +#define WPP_LOGTYPEPTR(_Value) WPP_LOGPAIR(sizeof(*(_Value)), (_Value)) + +// Marshalling macros. + +#if !defined(WPP_LOGASTR) +# if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGASTR(_value) WPP_LOGPAIR(strlen(_value) + 1, _value ) +# else +# define WPP_LOGASTR(_value) WPP_LOGPAIR( (_value)?strlen(_value) + 1:5, (_value)?(_value):"NULL" ) +# endif +#endif + +#if !defined(WPP_LOGWSTR) +# if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGWSTR(_value) WPP_LOGPAIR( (wcslen(_value)+1) * sizeof(WCHAR), _value) +# else +# define WPP_LOGWSTR(_value) WPP_LOGPAIR( (_value)?(((_value)[0] == 0)?7 * sizeof(WCHAR):(wcslen(_value) + 1)* sizeof(WCHAR)):5 * sizeof(WCHAR), (_value)?(((_value)[0] == 0) ? L"" : (_value)):L"NULL") +# endif +#endif + +#if !defined(WPP_LOGPGUID) +# define WPP_LOGPGUID(_value) WPP_LOGPAIR( sizeof(GUID), (_value) ) +#endif + + +#if !defined(WPP_LOGPSID) +# if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGPSID(_value) WPP_LOGPAIR( WPP_GetLengthSid(_value), (_value) ) +# else +# define WPP_LOGPSID(_value) WPP_LOGPAIR( (_value)? (WPP_IsValidSid(_value)? \ + WPP_GetLengthSid(_value):5):5, \ + (_value)? (WPP_IsValidSid(_value)?\ + (_value):"NULL"):"NULL") +#endif +#endif + +#if !defined(WPP_LOGCSTR) +# define WPP_LOGCSTR(_x) \ + WPP_LOGPAIR( sizeof((_x).Length), &(_x).Length ) WPP_LOGPAIR( (_x).Length, (_x).Buffer ) +#endif + +#if !defined(WPP_LOGUSTR) +# define WPP_LOGUSTR(_x) \ + WPP_LOGPAIR( sizeof((_x).Length), &(_x).Length ) WPP_LOGPAIR( (_x).Length, (_x).Buffer ) +#endif + +#if !defined(WPP_LOGPUSTR) +#if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGPUSTR(_x) WPP_LOGUSTR(*(_x)) +#else +# define WPP_LOGPUSTR(_x) WPP_LOGPAIR( sizeof(USHORT), (_x && (*(_x)).Length)? &(*(_x)).Length : L"\5")\ + WPP_LOGPAIR( (_x && (*(_x)).Buffer)?(*(_x)).Length:5*sizeof(WCHAR), (_x && (*(_x)).Buffer)?(*(_x)).Buffer:L"NULL") +#endif +#endif + +#if !defined(WPP_LOGPCSTR) +#if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGPCSTR(_x) WPP_LOGCSTR(*(_x)) +#else +# define WPP_LOGPCSTR(_x) WPP_LOGPAIR( sizeof(USHORT), (_x && (*(_x)).Length)? &(*(_x)).Length : L"\5")\ + WPP_LOGPAIR( (_x && (*(_x)).Buffer)?(*(_x)).Length:5*sizeof(char), (_x && (*(_x)).Buffer)?((const char *)(*(_x)).Buffer):"NULL") +#endif +#endif + +#if !defined(WPP_LOGSTDSTR) +#define WPP_LOGSTDSTR(_value) WPP_LOGPAIR( (_value).size()+1, (_value).c_str() ) +#endif + +#endif // #ifndef WPP_ALREADY_INCLUDED + + +`FORALL i IN TypeSigSet WHERE !UnsafeArgs` +#ifndef WPP_SF_`i.Name`_def +# define WPP_SF_`i.Name`_def +WPP_INLINE void WPP_SF_`i.Name`(WPP_LOGGER_ARG unsigned short id, LPCGUID TraceGuid`i.Arguments`) + { WPP_TRACE(WPP_GET_LOGGER, WPP_TRACE_OPTIONS, (LPGUID)TraceGuid, id, `i.LogArgs` 0); } +#endif // #ifndef WPP_SF_`i.Name`_def +`ENDFOR` + +`FORALL i IN TypeSigSet WHERE UnsafeArgs` +#ifndef WPP_SF_`i.Name`_def +# define WPP_SF_`i.Name`_def +WPP_INLINE void WPP_SF_`i.Name`(WPP_LOGGER_ARG unsigned short id, LPCGUID TraceGuid, ...) { + va_list ap; va_start(ap, TraceGuid); UNREFERENCED_PARAMETER(ap); + { + `i.DeclVars` + WPP_TRACE(WPP_GET_LOGGER, WPP_TRACE_OPTIONS, (LPGUID)TraceGuid, id, `i.LogArgs` 0); + + } +} +#endif // #ifndef WPP_SF_`i.Name`_def +`ENDFOR` +#ifndef WPP_POST +# define WPP_POST() +#endif + +#ifndef WPP_PRE +# define WPP_PRE() +#endif + + +#ifdef WPP_DEBUG +`FORALL i IN Messages WHERE !MsgArgs` +#ifndef WPP`i.GooId`_POST +# define WPP`i.GooId`_POST(`i.GooArgs`) +#endif +#ifndef WPP`i.GooId`_PRE +# define WPP`i.GooId`_PRE(`i.GooArgs`) +#endif +#define WPP_CALL_`i.Name`(`i.FixedArgs``i.MacroArgs`) \ + WPP`i.GooId`_PRE(`i.GooVals`) \ + WPP_ANNOTATE(`i.Name`) \ + ( ( \ + (WPP_CB != (WPP_CB_TYPE*)&WPP_CB) && `i.MsgVal`WPP`i.GooId`_ENABLED(`i.GooVals`) ? \ + WPP_DEBUG((`i.DbgMacroArgs`)), \ + WPP_SF_`i.TypeSig`(WPP`i.GooId`_LOGGER(`i.GooVals`) `i.MsgNo`, \ + WPP_LOCAL_TraceGuids+0`i.MacroExprs`), 1:0 \ + ) ) \ + WPP`i.GooId`_POST(`i.GooVals`) +`ENDFOR` +#else +`FORALL i IN Messages WHERE !MsgArgs` +#ifndef WPP`i.GooId`_POST +# define WPP`i.GooId`_POST(`i.GooArgs`) +#endif +#ifndef WPP`i.GooId`_PRE +# define WPP`i.GooId`_PRE(`i.GooArgs`) +#endif +#define WPP_CALL_`i.Name`(`i.FixedArgs``i.MacroArgs`) \ + WPP`i.GooId`_PRE(`i.GooVals`) \ + WPP_ANNOTATE(`i.Name`) \ + ( ( \ + (WPP_CB != (WPP_CB_TYPE*)&WPP_CB) && `i.MsgVal`WPP`i.GooId`_ENABLED(`i.GooVals`) ? \ + WPP_SF_`i.TypeSig`(WPP`i.GooId`_LOGGER(`i.GooVals`) `i.MsgNo`, \ + WPP_LOCAL_TraceGuids+0`i.MacroExprs`), 1:0 \ + ) ) \ + WPP`i.GooId`_POST(`i.GooVals`) +`ENDFOR` +#endif + + +#ifdef WPP_DEBUG +`FORALL i IN Messages WHERE MsgArgs` +#ifndef WPP`i.GooId`_POST +# define WPP`i.GooId`_POST(`i.GooArgs`) +#endif +#ifndef WPP`i.GooId`_PRE +# define WPP`i.GooId`_PRE(`i.GooArgs`) +#endif +#define WPP_CALL_`i.Name`(`i.FixedArgs` MSGARGS) \ + WPP`i.GooId`_PRE(`i.GooVals`) \ + WPP_ANNOTATE(`i.Name`) \ + (( \ + (WPP_CB != (WPP_CB_TYPE*)&WPP_CB) && WPP`i.GooId`_ENABLED(`i.GooVals`)? \ + WPP_SF_`i.TypeSig`(WPP`i.GooId`_LOGGER(`i.GooVals`) `i.MsgNo`,WPP_LOCAL_TraceGuids+0 WPP_R`i.ReorderSig` MSGARGS), \ + WPP_DEBUG(MSGARGS),1:0 \ + )) \ + WPP`i.GooId`_POST(`i.GooVals`) +`ENDFOR` +#else +`FORALL i IN Messages WHERE MsgArgs` +#ifndef WPP`i.GooId`_POST +# define WPP`i.GooId`_POST(`i.GooArgs`) +#endif +#ifndef WPP`i.GooId`_PRE +# define WPP`i.GooId`_PRE(`i.GooArgs`) +#endif +#define WPP_CALL_`i.Name`(`i.FixedArgs` MSGARGS) \ + WPP`i.GooId`_PRE(`i.GooVals`) \ + WPP_ANNOTATE(`i.Name`) \ + ( \ + (WPP_CB != (WPP_CB_TYPE*)&WPP_CB) && WPP`i.GooId`_ENABLED(`i.GooVals`)?\ + WPP_SF_`i.TypeSig`(WPP`i.GooId`_LOGGER(`i.GooVals`) `i.MsgNo`,WPP_LOCAL_TraceGuids+0 WPP_R`i.ReorderSig` MSGARGS),\ + 1:0 \ + ) \ + WPP`i.GooId`_POST(`i.GooVals`) +`ENDFOR` +#endif + + + +#if defined(__cplusplus) +}; +#endif diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/trmacro.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/trmacro.tpl new file mode 100644 index 00000000000..ac811a341e6 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/trmacro.tpl @@ -0,0 +1,261 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright 1999-2005 Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +#ifndef WPP_ALREADY_INCLUDED + +// template `TemplateFile` +// expects: +// WPP_THIS_FILE defined (see header.tpl) +// WPP_LOGGER_ARG defined +// WPP_GET_LOGGER defined +// WPP_ENABLED() defined + +#ifndef NO_CHECK_FOR_NULL_STRING +#ifndef WPP_CHECK_FOR_NULL_STRING +#define WPP_CHECK_FOR_NULL_STRING 1 +#endif +#endif + + +#define WPP_EVAL(_value_) _value_ +#define WPP_(Id) WPP_EVAL(WPP_) ## WPP_EVAL(Id) ## WPP_EVAL(_) ## WPP_EVAL(WPP_THIS_FILE) ## WPP_EVAL(__LINE__) + +#if !defined(WPP_INLINE) +# define WPP_INLINE __inline +#endif + +#else // #ifndef WPP_ALREADY_INCLUDED + +#undef WPP_LOCAL_TraceGuids + +#endif // #ifndef WPP_ALREADY_INCLUDED + + +#if !defined(WPP_NO_ANNOTATIONS) +#if !defined(WPP_ANSI_ANNOTATION) +`FORALL Msg IN Messages` +# define WPP_ANNOTATE_`Msg.Name` __annotation(L"TMF:", L"`Msg.Guid` `CurrentDir` // SRC=`SourceFile.Name` MJ=`ENV MAJORCOMP` MN=`ENV MINORCOMP`", L"#typev `Msg.Name` `Msg.MsgNo` \"`Msg.Text`\" // `Msg.Indent` `Msg.GooPairs`", L"{"`FORALL Arg IN Msg.Arguments`, L"`Arg.Name`, `Arg.MofType` -- `Arg.No`" `ENDFOR Arg`, L"}") +`ENDFOR` +#else +`FORALL Msg IN Messages` +# define WPP_ANNOTATE_`Msg.Name` __annotation("TMF:", "`Msg.Guid` `CurrentDir` // SRC=`SourceFile.Name` MJ=`ENV MAJORCOMP` MN=`ENV MINORCOMP`", "#typev `Msg.Name` `Msg.MsgNo` \"`Msg.Text`\" // `Msg.Indent` `Msg.GooPairs`", "{"`FORALL Arg IN Msg.Arguments`, "`Arg.Name`, `Arg.MofType` -- `Arg.No`" `ENDFOR Arg`, "}") +`ENDFOR` +#endif +# define WPP_ANNOTATE(x) WPP_ANNOTATE_ ## x, +#else +# define WPP_ANNOTATE(x) +#endif + +#define WPP_LOCAL_TraceGuids WPP_`SourceFile.CanonicalName`_Traceguids + +#if `TraceGuids.Count` +static const GUID WPP_LOCAL_TraceGuids[] = {`FORALL Guid IN TraceGuids` `Guid.Struct`, `ENDFOR`}; +#endif + +#ifndef WPP_ALREADY_INCLUDED + +#if !defined(WPP_TRACE_OPTIONS) +enum {WPP_TRACE_OPTIONS = TRACE_MESSAGE_SEQUENCE | TRACE_MESSAGE_GUID + | TRACE_MESSAGE_SYSTEMINFO | TRACE_MESSAGE_TIMESTAMP }; +#endif + +#if !defined(WPP_LOGPAIR) +# define WPP_LOGPAIR(_Size, _Addr) (_Addr),((SIZE_T)_Size), +#endif + +#define WPP_LOGTYPEVAL(_Type, _Value) WPP_LOGPAIR(sizeof(_Type), &(_Value)) +#define WPP_LOGTYPEPTR(_Value) WPP_LOGPAIR(sizeof(*(_Value)), (_Value)) + +// Marshalling macros. + +#if !defined(WPP_LOGASTR) +# if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGASTR(_value) WPP_LOGPAIR(strlen(_value) + 1, _value ) +# else +# define WPP_LOGASTR(_value) WPP_LOGPAIR( (_value)?strlen(_value) + 1:5, (_value)?(_value):"NULL" ) +# endif +#endif + +#if !defined(WPP_LOGWSTR) +# if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGWSTR(_value) WPP_LOGPAIR( (wcslen(_value)+1) * sizeof(WCHAR), _value) +# else +# define WPP_LOGWSTR(_value) WPP_LOGPAIR( (_value)?(((_value)[0] == 0)?7 * sizeof(WCHAR):(wcslen(_value) + 1)* sizeof(WCHAR)):5 * sizeof(WCHAR), (_value)?(((_value)[0] == 0) ? L"" : (_value)):L"NULL") +# endif +#endif + +#if !defined(WPP_LOGPGUID) +# define WPP_LOGPGUID(_value) WPP_LOGPAIR( sizeof(GUID), (_value) ) +#endif + + +#if !defined(WPP_LOGPSID) +# if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGPSID(_value) WPP_LOGPAIR( GetLengthSid(_value), (_value) ) +# else +# define WPP_LOGPSID(_value) WPP_LOGPAIR( (_value)? (IsValidSid(_value)? \ + GetLengthSid(_value):5):5, \ + (_value)? (IsValidSid(_value)?\ + (_value):"NULL"):"NULL") +#endif +#endif + +#if !defined(WPP_LOGCSTR) +# define WPP_LOGCSTR(_x) \ + WPP_LOGPAIR( sizeof((_x).Length), &(_x).Length ) WPP_LOGPAIR( (_x).Length, (_x).Buffer ) +#endif + +#if !defined(WPP_LOGUSTR) +# define WPP_LOGUSTR(_x) \ + WPP_LOGPAIR( sizeof((_x).Length), &(_x).Length ) WPP_LOGPAIR( (_x).Length, (_x).Buffer ) +#endif + +#if !defined(WPP_LOGPUSTR) +#if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGPUSTR(_x) WPP_LOGUSTR(*(_x)) +#else +# define WPP_LOGPUSTR(_x) WPP_LOGPAIR( sizeof(USHORT), (_x && (*(_x)).Length)? &(*(_x)).Length : L"\5")\ + WPP_LOGPAIR( (_x && (*(_x)).Buffer)?(*(_x)).Length:5*sizeof(WCHAR), (_x && (*(_x)).Buffer)?(*(_x)).Buffer:L"NULL") +#endif +#endif + +#if !defined(WPP_LOGPCSTR) +#if !defined(WPP_CHECK_FOR_NULL_STRING) +# define WPP_LOGPCSTR(_x) WPP_LOGCSTR(*(_x)) +#else +# define WPP_LOGPCSTR(_x) WPP_LOGPAIR( sizeof(USHORT), (_x && (*(_x)).Length)? &(*(_x)).Length : L"\5")\ + WPP_LOGPAIR( (_x && (*(_x)).Buffer)?(*(_x)).Length:5*sizeof(char), (_x && (*(_x)).Buffer)?((const char *)(*(_x)).Buffer):"NULL") +#endif +#endif + +#if !defined(WPP_LOGSTDSTR) +#define WPP_LOGSTDSTR(_value) WPP_LOGPAIR( (_value).size()+1, (_value).c_str() ) +#endif + +#endif // #ifndef WPP_ALREADY_INCLUDED + + +`FORALL i IN TypeSigSet WHERE !UnsafeArgs` +#ifndef WPP_SF_`i.Name`_def +# define WPP_SF_`i.Name`_def +WPP_INLINE void WPP_SF_`i.Name`(WPP_LOGGER_ARG unsigned short id, LPCGUID TraceGuid`i.Arguments`) + { WPP_TRACE(WPP_GET_LOGGER, WPP_TRACE_OPTIONS, (LPGUID)TraceGuid, id, `i.LogArgs` 0); } +#endif // #ifndef WPP_SF_`i.Name`_def +`ENDFOR` + +`FORALL i IN TypeSigSet WHERE UnsafeArgs` +#ifndef WPP_SF_`i.Name`_def +# define WPP_SF_`i.Name`_def +WPP_INLINE void WPP_SF_`i.Name`(WPP_LOGGER_ARG unsigned short id, LPCGUID TraceGuid, ...) { + va_list ap; va_start(ap, TraceGuid); UNREFERENCED_PARAMETER(ap); + { + `i.DeclVars` + WPP_TRACE(WPP_GET_LOGGER, WPP_TRACE_OPTIONS, (LPGUID)TraceGuid, id, `i.LogArgs` 0); + + } +} +#endif // #ifndef WPP_SF_`i.Name`_def +`ENDFOR` +#ifndef WPP_POST +# define WPP_POST() +#endif + +#ifndef WPP_PRE +# define WPP_PRE() +#endif + + +#ifdef WPP_DEBUG +`FORALL i IN Messages WHERE !MsgArgs` +#ifndef WPP`i.GooId`_POST +# define WPP`i.GooId`_POST(`i.GooArgs`) +#endif +#ifndef WPP`i.GooId`_PRE +# define WPP`i.GooId`_PRE(`i.GooArgs`) +#endif +#define WPP_CALL_`i.Name`(`i.FixedArgs``i.MacroArgs`) \ + WPP`i.GooId`_PRE(`i.GooVals`) \ + WPP_ANNOTATE(`i.Name`) \ + ( ( \ + `i.MsgVal`WPP`i.GooId`_ENABLED(`i.GooVals`) ? \ + WPP_DEBUG((`i.MacroArgs`)), \ + WPP_SF_`i.TypeSig`(WPP`i.GooId`_LOGGER(`i.GooVals`) `i.MsgNo`, \ + WPP_LOCAL_TraceGuids+0`i.MacroExprs`), 1:0 \ + ) ) \ + WPP`i.GooId`_POST(`i.GooVals`) +`ENDFOR` +#else +`FORALL i IN Messages WHERE !MsgArgs` +#ifndef WPP`i.GooId`_POST +# define WPP`i.GooId`_POST(`i.GooArgs`) +#endif +#ifndef WPP`i.GooId`_PRE +# define WPP`i.GooId`_PRE(`i.GooArgs`) +#endif +#define WPP_CALL_`i.Name`(`i.FixedArgs``i.MacroArgs`) \ + WPP`i.GooId`_PRE(`i.GooVals`) \ + WPP_ANNOTATE(`i.Name`) \ + ( ( \ + `i.MsgVal`WPP`i.GooId`_ENABLED(`i.GooVals`) ? \ + WPP_SF_`i.TypeSig`(WPP`i.GooId`_LOGGER(`i.GooVals`) `i.MsgNo`, \ + WPP_LOCAL_TraceGuids+0`i.MacroExprs`), 1:0 \ + ) ) \ + WPP`i.GooId`_POST(`i.GooVals`) +`ENDFOR` +#endif + +// NoMsgArgs + +`FORALL f IN Funcs WHERE !DoubleP && !MsgArgs` +#undef `f.Name` +#define `f.Name` WPP_(CALL) +`ENDFOR` + +`FORALL f IN Funcs WHERE DoubleP && !MsgArgs` +#undef `f.Name` +#define `f.Name`(ARGS) WPP_(CALL) ARGS +`ENDFOR` + + +// MsgArgs + +`FORALL f IN Funcs WHERE MsgArgs` +#undef `f.Name` +#define `f.Name`(`f.FixedArgs` MSGARGS) WPP_(CALL)(`f.FixedArgs` MSGARGS) +`ENDFOR` + + +#ifdef WPP_DEBUG +`FORALL i IN Messages WHERE MsgArgs` +#ifndef WPP`i.GooId`_POST +# define WPP`i.GooId`_POST(`i.GooArgs`) +#endif +#ifndef WPP`i.GooId`_PRE +# define WPP`i.GooId`_PRE(`i.GooArgs`) +#endif +#define WPP_CALL_`i.Name`(`i.FixedArgs` MSGARGS) WPP`i.GooId`_PRE(`i.GooVals`) WPP_ANNOTATE(`i.Name`) ((WPP`i.GooId`_ENABLED(`i.GooVals`)?WPP_SF_`i.TypeSig`(WPP`i.GooId`_LOGGER(`i.GooVals`) `i.MsgNo`,WPP_LOCAL_TraceGuids+0 WPP_R`i.ReorderSig` MSGARGS), WPP_DEBUG((MSGARGS),1:0)) \ + WPP`i.GooId`_POST(`i.GooVals`) +`ENDFOR` +#else +`FORALL i IN Messages WHERE MsgArgs` +#ifndef WPP`i.GooId`_POST +# define WPP`i.GooId`_POST(`i.GooArgs`) +#endif +#ifndef WPP`i.GooId`_PRE +# define WPP`i.GooId`_PRE(`i.GooArgs`) +#endif +#define WPP_CALL_`i.Name`(`i.FixedArgs` MSGARGS) WPP`i.GooId`_PRE(`i.GooVals`) WPP_ANNOTATE(`i.Name`) (WPP`i.GooId`_ENABLED(`i.GooVals`)?WPP_SF_`i.TypeSig`(WPP`i.GooId`_LOGGER(`i.GooVals`) `i.MsgNo`,WPP_LOCAL_TraceGuids+0 WPP_R`i.ReorderSig` MSGARGS),1:0) WPP`i.GooId`_POST(`i.GooVals`) +`ENDFOR` +#endif + + +`FORALL r IN Reorder` +#undef WPP_R`r.Name` +#define WPP_R`r.Name`(`r.Arguments`) `r.Permutation` +`ENDFOR` + +/// more stuff + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-default.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-default.tpl new file mode 100644 index 00000000000..a849e9db351 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-default.tpl @@ -0,0 +1,50 @@ +`**********************************************************************` +`* This is a template file for tracewpp preprocessor *` +`* If you need to use a custom version of this file in your project *` +`* Please clone it from this one and point WPP to it by specifying *` +`* -gen:{yourfile} option on RUN_WPP line in your sources file *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` +//`Compiler.Checksum` Generated File. Do not edit. +// File created by `Compiler.Name` compiler version `Compiler.Version`-`Compiler.Timestamp` +// on `System.Date` at `System.Time` UTC from a template `TemplateFile` + +`INCLUDE um-header.tpl` +`INCLUDE control.tpl` +`INCLUDE tracemacro.tpl` + +`IF FOUND WPP_INIT_TRACING` +#define WPPINIT_EXPORT + `INCLUDE um-init.tpl` +`ENDIF` + +// +// Tracing Macro name redefinition +// + +// NoMsgArgs + +`FORALL f IN Funcs WHERE !DoubleP && !MsgArgs` +#undef `f.Name` +#define `f.Name` WPP_(CALL) +`ENDFOR` + +`FORALL f IN Funcs WHERE DoubleP && !MsgArgs` +#undef `f.Name` +#define `f.Name`(ARGS) WPP_(CALL) ARGS +`ENDFOR` + + +// MsgArgs + +`FORALL f IN Funcs WHERE MsgArgs` +#undef `f.Name` +#define `f.Name`(`f.FixedArgs` MSGARGS) WPP_(CALL)(`f.FixedArgs` MSGARGS) +`ENDFOR` + +`FORALL r IN Reorder` +#undef WPP_R`r.Name` +#define WPP_R`r.Name`(`r.Arguments`) `r.Permutation` +`ENDFOR` + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-header.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-header.tpl new file mode 100644 index 00000000000..a548bf97f00 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-header.tpl @@ -0,0 +1,89 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +// template `TemplateFile` +#ifdef WPP_THIS_FILE +// included twice +# define WPP_ALREADY_INCLUDED +# undef WPP_THIS_FILE +#endif // #ifdef WPP_THIS_FILE + +#define WPP_THIS_FILE `SourceFile.CanonicalName` + +#ifndef WPP_ALREADY_INCLUDED + +`* Dump defintions specified via -D on the command line to WPP *` + +`FORALL def IN MacroDefinitions` +#define `def.Name` `def.Alias` +`ENDFOR` + +#include +#include +#include +#ifndef WPP_TRACE_W2K_COMPATABILITY +#include +#endif + +#if defined(__cplusplus) +extern "C" { +#endif + +// LEGACY: This structure was used by Win2k RpcRt4 and cluster tracing + +typedef struct _WPP_WIN2K_CONTROL_BLOCK { + TRACEHANDLE Logger; + ULONG Flags; + ULONG Level; +} WPP_WIN2K_CONTROL_BLOCK, *PWPP_WIN2K_CONTROL_BLOCK; + +#pragma warning(push) +#pragma warning(disable:4201) // nonstandard extension used nameless struct/union + +typedef struct _WPP_TRACE_CONTROL_BLOCK +{ + struct _WPP_TRACE_CONTROL_BLOCK *Next; + TRACEHANDLE UmRegistrationHandle; + union { + TRACEHANDLE Logger; + PWPP_WIN2K_CONTROL_BLOCK Win2kCb; + PVOID Ptr; + struct _WPP_TRACE_CONTROL_BLOCK *Cb; + }; + + UCHAR FlagsLen; + UCHAR Level; + USHORT Options; + ULONG Flags[1]; +} WPP_TRACE_CONTROL_BLOCK, *PWPP_TRACE_CONTROL_BLOCK; +#pragma warning(pop) + + +#define WPP_IsValidSid IsValidSid +#define WPP_GetLengthSid GetLengthSid + +#ifndef WPP_TRACE +#define WPP_TRACE TraceMessage +#endif + +enum { + WPP_VER_WIN2K_CB_FORWARD_PTR = 0x01, + WPP_VER_WHISTLER_CB_FORWARD_PTR = 0x02, + WPP_VER_LH_CB_FORWARD_PTR = 0x03 +}; + +VOID WppCleanupUm( VOID ); +#define WPP_CLEANUP() WppCleanupUm() + +#define WppLoadTracingSupport + +#if defined(__cplusplus) +}; +#endif + +#endif // #ifndef WPP_ALREADY_INCLUDED + + diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-init.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-init.tpl new file mode 100644 index 00000000000..8005cd18b22 --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-init.tpl @@ -0,0 +1,482 @@ +`**********************************************************************` +`* This is an include template file for tracewpp preprocessor. *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` + +// template `TemplateFile` +// +// Defines a set of functions that simplifies +// User mode registration for tracing +// + +#if defined(__cplusplus) +extern "C" { +#endif + +// define annotation record that will carry control information to pdb (in case somebody needs it) +WPP_FORCEINLINE void WPP_CONTROL_ANNOTATION() { +#if !defined(WPP_NO_ANNOTATIONS) +#if !defined(WPP_ANSI_ANNOTATION) +# define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) __annotation(L"TMC:", WPP_GUID_WTEXT Guid, _WPPW(WPP_STRINGIZE(Name)) Bits); +# define WPP_DEFINE_BIT(Name) , _WPPW(#Name) +#else +# define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) __annotation("TMC:", WPP_GUID_TEXT Guid, WPP_STRINGIZE(Name) Bits); +# define WPP_DEFINE_BIT(Name) , #Name +#endif + WPP_CONTROL_GUIDS +# undef WPP_DEFINE_BIT +# undef WPP_DEFINE_CONTROL_GUID +#endif +} + +LPCGUID WPP_REGISTRATION_GUIDS[WPP_LAST_CTL]; + +WPP_CB_TYPE WPP_MAIN_CB[WPP_LAST_CTL]; + +#define WPP_NEXT(Name) ((WPP_TRACE_CONTROL_BLOCK*) \ + (WPP_XGLUE(WPP_CTL_, WPP_EVAL(Name)) + 1 == WPP_LAST_CTL ? 0:WPP_MAIN_CB + WPP_XGLUE(WPP_CTL_, WPP_EVAL(Name)) + 1)) + +__inline void WPP_INIT_CONTROL_ARRAY(WPP_CB_TYPE* Arr) { +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) \ + Arr->Control.Ptr = NULL; \ + Arr->Control.Next = WPP_NEXT(WPP_EVAL(Name)); \ + Arr->Control.FlagsLen = WPP_FLAG_LEN; \ + Arr->Control.Level = WPP_LAST_CTL; \ + Arr->Control.Options = 0; \ + Arr->Control.Flags[0] = 0; \ + ++Arr; +#define WPP_DEFINE_BIT(BitName) L" " L ## #BitName +WPP_CONTROL_GUIDS +#undef WPP_DEFINE_BIT +#undef WPP_DEFINE_CONTROL_GUID +} + +#undef WPP_INIT_STATIC_DATA +#define WPP_INIT_STATIC_DATA WPP_INIT_CONTROL_ARRAY(WPP_MAIN_CB) + +__inline void WPP_INIT_GUID_ARRAY(LPCGUID* Arr) { +#define WPP_DEFINE_CONTROL_GUID(Name,Guid,Bits) \ + WPP_XGLUE4(*Arr = &WPP_, ThisDir, _CTLGUID_, WPP_EVAL(Name)); \ + ++Arr; +WPP_CONTROL_GUIDS +#undef WPP_DEFINE_CONTROL_GUID +} + + + +VOID WppInitUm(__in_opt LPCWSTR AppName); + +#define WPP_INIT_TRACING(AppName) \ + WppLoadTracingSupport; \ + (WPP_CONTROL_ANNOTATION(),WPP_INIT_STATIC_DATA, \ + WPP_INIT_GUID_ARRAY((LPCGUID*)&WPP_REGISTRATION_GUIDS), \ + WPP_CB= WPP_MAIN_CB, \ + WppInitUm(AppName)) + + +void WPP_Set_Dll_CB( + PWPP_TRACE_CONTROL_BLOCK Control, + VOID * DllControlBlock, + USHORT Flags) +{ + + if (*(PVOID*)DllControlBlock != DllControlBlock){ + Control->Ptr = DllControlBlock; + } else { + if (Flags == WPP_VER_WHISTLER_CB_FORWARD_PTR ){ + memset(Control, 0, sizeof(WPP_TRACE_CONTROL_BLOCK)); + *(PWPP_TRACE_CONTROL_BLOCK*)DllControlBlock = Control; + Control->Options = WPP_VER_LH_CB_FORWARD_PTR; + + } else if (Flags == WPP_VER_WIN2K_CB_FORWARD_PTR ) { + Control->Ptr = DllControlBlock; + } + } + +} + + +#define WPP_SET_FORWARD_PTR(CTL, FLAGS, PTR) (\ + (WPP_MAIN_CB[WPP_CTRL_NO(WPP_BIT_ ## CTL )].Control.Options = (FLAGS)));\ + WPP_Set_Dll_CB(&WPP_MAIN_CB[WPP_CTRL_NO(WPP_BIT_ ## CTL )].Control,(PTR),(USHORT)FLAGS) + + +#define DEFAULT_LOGGER_NAME L"stdout" + +#if !defined(WppDebug) +# define WppDebug(a,b) +#endif + +#if !defined(WPPINIT_STATIC) +# define WPPINIT_STATIC +#endif + +#if !defined(WPPINIT_EXPORT) +# define WPPINIT_EXPORT +#endif + +#define WPP_GUID_FORMAT "%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x" +#define WPP_GUID_ELEMENTS(p) \ + p->Data1, p->Data2, p->Data3,\ + p->Data4[0], p->Data4[1], p->Data4[2], p->Data4[3],\ + p->Data4[4], p->Data4[5], p->Data4[6], p->Data4[7] + +#define WPP_MAX_LEVEL 255 +#define WPP_MAX_FLAGS 0xFFFFFFFF + + + + + +__inline TRACEHANDLE WppQueryLogger(__in_opt PCWSTR LoggerName) +{ + ULONG Status; + EVENT_TRACE_PROPERTIES LoggerInfo; + + ZeroMemory(&LoggerInfo, sizeof(LoggerInfo)); + LoggerInfo.Wnode.BufferSize = sizeof(LoggerInfo); + LoggerInfo.Wnode.Flags = WNODE_FLAG_TRACED_GUID; + + Status = ControlTraceW(0, LoggerName ? LoggerName : L"stdout", &LoggerInfo, EVENT_TRACE_CONTROL_QUERY); + if (Status == ERROR_SUCCESS || Status == ERROR_MORE_DATA) { + return (TRACEHANDLE) LoggerInfo.Wnode.HistoricalContext; + } + return 0; +} + + +#if defined (WPP_GLOBALLOGGER) + +#define WPP_REG_GLOBALLOGGER_FLAGS L"Flags" +#define WPP_REG_GLOBALLOGGER_LEVEL L"Level" +#define WPP_REG_GLOBALLOGGER_START L"Start" + +#define WPP_TEXTGUID_LEN 38 +#define WPP_REG_GLOBALLOGGER_KEY L"SYSTEM\\CurrentControlSet\\Control\\Wmi\\GlobalLogger" + +WPPINIT_STATIC +void WppIntToHex( + __out_ecount(digits) LPWSTR Buf, + unsigned int value, + int digits + ) +{ + static LPCWSTR hexDigit = L"0123456789abcdef"; + while (--digits >= 0) { + Buf[digits] = hexDigit[ value & 15 ]; + value /= 16; + } +} + +WPPINIT_EXPORT +void WppInitGlobalLogger( + IN LPCGUID ControlGuid, + IN PTRACEHANDLE LoggerHandle, + OUT PULONG Flags, + __out_ecount(sizeof(UCHAR)) PUCHAR Level ) +{ +WCHAR GuidBuf[WPP_TEXTGUID_LEN]; +ULONG CurrentFlags = 0; +ULONG CurrentLevel = 0; +DWORD Start = 0; +DWORD DataSize ; +ULONG Status ; +HKEY GloblaLoggerHandleKey; +HKEY ValueHandleKey ; + + + + WppDebug(0,("WPP checking Global Logger %S",WPP_REG_GLOBALLOGGER_KEY)); + + if ((Status = RegOpenKeyExW(HKEY_LOCAL_MACHINE, + (LPWSTR)WPP_REG_GLOBALLOGGER_KEY, + 0, + KEY_READ, + &GloblaLoggerHandleKey + )) != ERROR_SUCCESS) { + WppDebug(0,("GlobalLogger key does not exist (0x%08X)",Status)); + return ; + } + + DataSize = sizeof(DWORD); + Status = RegQueryValueExW(GloblaLoggerHandleKey, + (LPWSTR)WPP_REG_GLOBALLOGGER_START, + 0, + NULL, + (LPBYTE)&Start, + &DataSize); + if (Status != ERROR_SUCCESS || Start == 0 ) { + WppDebug(0,("Global Logger not started (0x%08X)",Status)); + goto Cleanup; + } + + + WppDebug(0,("Global Logger exists and is set to be started")); + + { + static LPCWSTR hexDigit = L"0123456789abcdef"; + int i; + + WppIntToHex(GuidBuf, ControlGuid->Data1, 8); + GuidBuf[8] = '-'; + + WppIntToHex(&GuidBuf[9], ControlGuid->Data2, 4); + GuidBuf[13] = '-'; + + WppIntToHex(&GuidBuf[14], ControlGuid->Data3, 4); + GuidBuf[18] = '-'; + + GuidBuf[19] = hexDigit[(ControlGuid->Data4[0] & 0xF0) >> 4]; + GuidBuf[20] = hexDigit[ControlGuid->Data4[0] & 0x0F ]; + GuidBuf[21] = hexDigit[(ControlGuid->Data4[1] & 0xF0) >> 4]; + GuidBuf[22] = hexDigit[ControlGuid->Data4[1] & 0x0F ]; + GuidBuf[23] = '-'; + + for( i=2; i < 8 ; i++ ){ + GuidBuf[i*2+20] = hexDigit[(ControlGuid->Data4[i] & 0xF0) >> 4]; + GuidBuf[i*2+21] = hexDigit[ControlGuid->Data4[i] & 0x0F ]; + } + GuidBuf[36] = 0; + + } + + // + // Perform the query + // + + if ((Status = RegOpenKeyExW(GloblaLoggerHandleKey, + (LPWSTR)GuidBuf, + 0, + KEY_READ, + &ValueHandleKey + )) != ERROR_SUCCESS) { + WppDebug(0,("Global Logger Key not set for this Control Guid %S (0x%08X)",GuidBuf,Status)); + goto Cleanup; + } + // Get the Flags Parameter + DataSize = sizeof(DWORD); + Status = RegQueryValueExW(ValueHandleKey, + (LPWSTR)WPP_REG_GLOBALLOGGER_FLAGS, + 0, + NULL, + (LPBYTE)&CurrentFlags, + &DataSize); + if (Status != ERROR_SUCCESS || CurrentFlags == 0 ) { + WppDebug(0,("GlobalLogger for %S Flags not set (0x%08X)",GuidBuf,Status)); + } + // Get the levels Parameter + DataSize = sizeof(DWORD); + Status = RegQueryValueExW(ValueHandleKey, + (LPWSTR)WPP_REG_GLOBALLOGGER_LEVEL, + 0, + NULL, + (LPBYTE)&CurrentLevel, + &DataSize); + if (Status != ERROR_SUCCESS || CurrentLevel == 0 ) { + WppDebug(0,("GlobalLogger for %S Level not set (0x%08X)",GuidBuf,Status)); + } + + if (Start==1) { + + if ((*LoggerHandle= WppQueryLogger( L"GlobalLogger")) != (TRACEHANDLE)NULL) { + *Flags = CurrentFlags & 0x7FFFFFFF ; + *Level = (UCHAR)(CurrentLevel & 0xFF) ; + WppDebug(0,("WPP Enabled via Global Logger Flags=0x%08X Level=0x%02X",CurrentFlags,CurrentLevel)); + } else { + WppDebug(0,("GlobalLogger set for start but not running (Flags=0x%08X Level=0x%02X)",CurrentFlags,CurrentLevel)); + } + + } + + RegCloseKey(ValueHandleKey); +Cleanup: + RegCloseKey(GloblaLoggerHandleKey); +} +#endif //#ifdef WPP_GLOBALLOGGER + +#ifdef WPP_MANAGED_CPP +#pragma managed(push, off) +#endif + +ULONG +WINAPI +WppControlCallback( + IN WMIDPREQUESTCODE RequestCode, + IN PVOID Context, + __inout ULONG *InOutBufferSize, + __inout PVOID Buffer + ) +{ + PWPP_TRACE_CONTROL_BLOCK Ctx = (PWPP_TRACE_CONTROL_BLOCK)Context; + TRACEHANDLE Logger; + UCHAR Level; + DWORD Flags; + + *InOutBufferSize = 0; + + switch (RequestCode) + { + case WMI_ENABLE_EVENTS: + { + Logger = GetTraceLoggerHandle( Buffer ); + Level = GetTraceEnableLevel(Logger); + Flags = GetTraceEnableFlags(Logger); + + WppDebug(1, ("[WppInit] WMI_ENABLE_EVENTS Ctx %p Flags %x" + " Lev %d Logger %I64x\n", + Ctx, Flags, Level, Logger) ); + break; + } + case WMI_DISABLE_EVENTS: + { + Logger = 0; + Flags = 0; + Level = 0; + WppDebug(1, ("[WppInit] WMI_DISABLE_EVENTS Ctx 0x%08p\n", Ctx)); + break; + } + default: + { + return(ERROR_INVALID_PARAMETER); + } + } + if (Ctx->Options & WPP_VER_WIN2K_CB_FORWARD_PTR && Ctx->Win2kCb) { + Ctx->Win2kCb->Logger = Logger; + Ctx->Win2kCb->Level = Level; + Ctx->Win2kCb->Flags = Flags; + } else { + if (Ctx->Options & WPP_VER_WHISTLER_CB_FORWARD_PTR && Ctx->Cb) { + Ctx = Ctx->Cb; // use forwarding address + } + Ctx->Logger = Logger; + Ctx->Level = Level; + Ctx->Flags[0] = Flags; + + } + return(ERROR_SUCCESS); +} + +#ifdef WPP_MANAGED_CPP +#pragma managed(pop) +#endif + + +WPPINIT_EXPORT +VOID WppInitUm(__in_opt LPCWSTR AppName) +{ + PWPP_TRACE_CONTROL_BLOCK Control = &WPP_CB[0].Control; + TRACE_GUID_REGISTRATION TraceRegistration; + LPCGUID * RegistrationGuids = (LPCGUID *)&WPP_REGISTRATION_GUIDS; + LPCGUID ControlGuid; + + ULONG Status; + +#ifdef WPP_MOF_RESOURCENAME +#ifdef WPP_DLL + HMODULE hModule = NULL; +#endif + WCHAR ImagePath[MAX_PATH] = {UNICODE_NULL} ; + WCHAR WppMofResourceName[] = WPP_MOF_RESOURCENAME ; +#else + UNREFERENCED_PARAMETER(AppName); +#endif //#ifdef WPP_MOF_RESOURCENAME + + WppDebug(1, ("Registering %ws\n", AppName) ); + + for(; Control; Control = Control->Next) { + + ControlGuid = *RegistrationGuids++; + TraceRegistration.Guid = ControlGuid; + TraceRegistration.RegHandle = 0; + + WppDebug(1,(WPP_GUID_FORMAT " %ws : %d\n", + WPP_GUID_ELEMENTS(ControlGuid), + AppName, + Control->FlagsLen)); + + +#ifdef WPP_MOF_RESOURCENAME + if (AppName != NULL) { + DWORD Status ; +#ifdef WPP_DLL + if ((hModule = GetModuleHandleW(AppName)) != NULL) { + Status = GetModuleFileNameW(hModule, ImagePath, MAX_PATH) ; + ImagePath[MAX_PATH-1] = '\0'; + if (Status == 0) { + WppDebug(1,("RegisterTraceGuids => GetModuleFileName(DLL) Failed 0x%08X\n",GetLastError())); + } + } else { + WppDebug(1,("RegisterTraceGuids => GetModuleHandleW failed for %ws (0x%08X)\n",AppName,GetLastError())); + } +#else // #ifdef WPP_DLL + Status = GetModuleFileNameW(NULL,ImagePath,MAX_PATH); + if (Status == 0) { + WppDebug(1,("GetModuleFileName(EXE) Failed 0x%08X\n",GetLastError())); + } +#endif // #ifdef WPP_DLL + } + WppDebug(1,("registerTraceGuids => registering with WMI, App=%ws, Mof=%ws, ImagePath=%ws\n",AppName,WppMofResourceName,ImagePath)); + + Status = RegisterTraceGuidsW( // Always use Unicode +#else // ifndef WPP_MOF_RESOURCENAME + + Status = RegisterTraceGuids( +#endif // ifndef WPP_MOF_RESOURCENAME + + WppControlCallback, + Control, // Context for the callback + ControlGuid, + 1, + &TraceRegistration, +#ifndef WPP_MOF_RESOURCENAME + 0, //ImagePath, + 0, //ResourceName, +#else // #ifndef WPP_MOF_RESOURCENAME + ImagePath, + WppMofResourceName, +#endif // #ifndef WPP_MOF_RESOURCENAME + &Control->UmRegistrationHandle + ); + + WppDebug(1, ("RegisterTraceGuid => %d\n", Status) ); +#if defined (WPP_GLOBALLOGGER) + // Check if Global logger is active if we have not been immediately activated + + if (Control->Logger == (TRACEHANDLE)NULL) { + WppInitGlobalLogger( ControlGuid, (PTRACEHANDLE)&Control->Logger, &Control->Flags[0], &Control->Level); + } +#endif //#if defined (WPP_GLOBALLOGGER) + + } + + +} + +WPPINIT_EXPORT +VOID WppCleanupUm( VOID ) +{ + PWPP_TRACE_CONTROL_BLOCK Control; + + if (WPP_CB == (WPP_CB_TYPE*)&WPP_CB){ + // + // WPP_INIT_TRACING macro has not been called + // + return; + } + WppDebug(1, ("Cleanup\n") ); + Control = &WPP_CB[0].Control; + for(; Control; Control = Control->Next) { + WppDebug(1,("UnRegistering %I64x\n", Control->UmRegistrationHandle) ); + if (Control->UmRegistrationHandle) { + UnregisterTraceGuids(Control->UmRegistrationHandle); + Control->UmRegistrationHandle = (TRACEHANDLE)NULL ; + } + } + + WPP_CB = (WPP_CB_TYPE*)&WPP_CB; +} + +#if defined(__cplusplus) +}; +#endif diff --git a/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-w2k.tpl b/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-w2k.tpl new file mode 100644 index 00000000000..88fb0982bce --- /dev/null +++ b/eng/WpfArcadeSdk/tools/WppConfig/rev1/um-w2k.tpl @@ -0,0 +1,398 @@ +`**********************************************************************` +`* This is a template file for tracewpp preprocessor *` +`* If you need to use a custom version of this file in your project *` +`* Please clone it from this one and point WPP to it by specifying *` +`* -gen:{yourfile} option on RUN_WPP line in your sources file *` +`* *` +`* Copyright (c) Microsoft Corporation. All Rights Reserved. *` +`**********************************************************************` +//`Compiler.Checksum` Generated File. Do not edit. +// File created by `Compiler.Name` compiler version `Compiler.Version`-`Compiler.Timestamp` +// on `System.Date` at `System.Time` UTC from a template `TemplateFile` + +`INCLUDE um-header.tpl` + +#ifndef WPP_ALREADY_INCLUDED + +#if defined(__cplusplus) +extern "C" { +#endif + +typedef +ULONG +(*PFN_WPPTRACEMESSAGE)( + IN TRACEHANDLE LoggerHandle, + IN ULONG MessageFlags, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + IN ... + ); + + +typedef +ULONG +(*PFN_WPPTRACEMESSAGEVA)( + IN TRACEHANDLE LoggerHandle, + IN ULONG MessageFlags, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + IN va_list MessageArgList + ); + +typedef enum _WPP_TRACE_API_SUITE { + WppTraceWin2K, + WppTraceWinXP, + WppTraceTraceLH, + WppTraceMaxSuite +} WPP_TRACE_API_SUITE; + +ULONG +WppInitTraceFunction(IN TRACEHANDLE LoggerHandle, + IN DWORD TraceOptions, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + ... + ); +ULONG +TraceMessageW2k(IN TRACEHANDLE LoggerHandle, + IN DWORD TraceOptions, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + ... + ) ; + +ULONG +TraceMessageW2kVa(IN TRACEHANDLE LoggerHandle, + IN DWORD TraceOptions, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + IN va_list MessageArgList + ); + +__declspec(selectany) PFN_WPPTRACEMESSAGE pfnWppTraceMessage = WppInitTraceFunction; +__declspec(selectany) PFN_WPPTRACEMESSAGEVA pfnWppTraceMessageVa = TraceMessageW2kVa; +__declspec(selectany) WPP_TRACE_API_SUITE WPPTraceSuite = WppTraceWin2K; + + +#undef WPP_TRACE +#define WPP_TRACE pfnWppTraceMessage + +#ifndef WPP_MAX_MOF_FIELDS +#define WPP_MAX_MOF_FIELDS 7 +#endif + + +#ifndef TRACE_MESSAGE_MAXIMUM_SIZE +#define TRACE_MESSAGE_MAXIMUM_SIZE 8*1024 +#endif + + +__inline ULONG +TraceMessageW2kVa(IN TRACEHANDLE LoggerHandle, + IN DWORD TraceOptions, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + IN va_list MessageArgList + ) +/*++ + +Routine Description: + + This is a function that simulates tracemessage in W2K + +Arguments: + + LoggerHandle - handle providers logger handle + + TraceOptions - unreferenced + + MessageGuid - pointer to message GUID + + MessageNumber - Type of message been logged + + MessageArgList - list or arguments + +Return Value: + + code indicating success or failure +--*/ +{ + +typedef struct _WPP_TRACE_BUFFER { + EVENT_TRACE_HEADER Header; + MOF_FIELD MofField[WPP_MAX_MOF_FIELDS+1]; +} WPP_TRACE_BUFFER; + + + size_t ByteCount; + size_t ArgumentCount; + va_list VarArgs = MessageArgList; + PVOID DataPtr ; + size_t DataSize = 0; + size_t ArgOffset; + ULONG Status; + WPP_TRACE_BUFFER TraceBuf; + PVOID Data=NULL; + + UNREFERENCED_PARAMETER(TraceOptions); + + // + // Fill in header fields + // Type is 0xFF to indicate that the first data is the MessageNumber + // The first Mof data is the Message Number + // + + TraceBuf.Header.GuidPtr = (ULONGLONG)MessageGuid ; + TraceBuf.Header.Flags = WNODE_FLAG_TRACED_GUID |WNODE_FLAG_USE_GUID_PTR|WNODE_FLAG_USE_MOF_PTR; + TraceBuf.Header.Class.Type = 0xFF ; + TraceBuf.MofField[0].DataPtr = (ULONGLONG)&MessageNumber; + TraceBuf.MofField[0].Length = sizeof(USHORT); + + // Determine the number bytes to follow header + ByteCount = 0 ; + ArgumentCount = 0 ; + + while ((DataPtr = va_arg (VarArgs, PVOID)) != NULL) { + DataSize = va_arg (VarArgs, size_t); + + // Check for integer overflow. + if (ByteCount + DataSize > ByteCount) + { + ByteCount += DataSize ; + ArgumentCount++ ; + + if (ArgumentCount <= WPP_MAX_MOF_FIELDS) { + TraceBuf.MofField[ArgumentCount].DataPtr = (ULONGLONG)DataPtr; + TraceBuf.MofField[ArgumentCount].Length = (ULONG)DataSize; + } + } + } + + va_end(VarArgs); + if (ByteCount > TRACE_MESSAGE_MAXIMUM_SIZE) { + return 0; + } + + if (ArgumentCount > WPP_MAX_MOF_FIELDS) { + // + // This occurs infrequently + // Allocate the blob to hold the data + // + Data = LocalAlloc(0,ByteCount); + if (Data == NULL) { + return 0; + } + + TraceBuf.MofField[1].DataPtr = (ULONGLONG)Data; + TraceBuf.MofField[1].Length = (ULONG)ByteCount; + + ArgOffset = 0 ; + DataSize = 0 ; + VarArgs = MessageArgList; + while ((DataPtr = va_arg (VarArgs, PVOID)) != NULL) { + DataSize = va_arg (VarArgs, size_t) ; + memcpy((char*)Data + ArgOffset, DataPtr, DataSize) ; + ArgOffset += DataSize ; + } + va_end(VarArgs) ; + + //Fill in the total size (header + 2 mof fields) + TraceBuf.Header.Size = (USHORT)(sizeof(EVENT_TRACE_HEADER) + 2*sizeof(MOF_FIELD)); + + } else { + //Fill in the total size (header + mof fields) + TraceBuf.Header.Size = (USHORT)(sizeof(EVENT_TRACE_HEADER) + (ArgumentCount+1)*sizeof(MOF_FIELD)); + } + + Status = TraceEvent(LoggerHandle, &TraceBuf.Header) ; + + if (Data) { + LocalFree(Data); + } + + if(ERROR_SUCCESS != Status) { + // Silently ignored error + } + + return 0; +} + + +__inline ULONG +TraceMessageW2k(IN TRACEHANDLE LoggerHandle, + IN DWORD TraceOptions, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + ... + ) +/*++ + +Routine Description: + + This is a function that simulates tracemessage in W2K + +Arguments: + + LoggerHandle - handle providers logger handle + + TraceOptions - unreferenced + + MessageGuid - pointer to message GUID + + MessageNumber - Type of message been logged + + ... - list or arguments + +Return Value: + + code indicating success or failure +--*/ +{ + va_list VarArgs ; + + va_start(VarArgs, MessageNumber); + + return( TraceMessageW2kVa( LoggerHandle, + TraceOptions, + MessageGuid, + MessageNumber, + VarArgs + ) + ); + +} + +// +// Advanced tracing APIs (XP and later) will be indirectly called. +// + +__inline VOID WppDynamicTracingSupport( + VOID + ) +/*++ + +Routine Description: + + This function assigns at runtime the ETW API set to be use for tracing. + +Arguments: + +Remarks: + + At runtime determine assing the funtions pointers for the trace APIs to be use. + XP and above will use TraceMessage, and Win2K will use our private W2kTraceMessage + which uses TraceEvent + +--*/ +{ + HINSTANCE hinstLib; + + hinstLib = LoadLibraryW(L"advapi32"); + if (hinstLib != NULL) + { + pfnWppTraceMessage = (PFN_WPPTRACEMESSAGE) (INT_PTR) + GetProcAddress(hinstLib, "TraceMessage"); + + if (NULL == pfnWppTraceMessage) { + pfnWppTraceMessage = TraceMessageW2k; + pfnWppTraceMessageVa = TraceMessageW2kVa; + WPPTraceSuite = WppTraceWin2K; + } else { + + WPPTraceSuite = WppTraceWinXP; + pfnWppTraceMessageVa = (PFN_WPPTRACEMESSAGEVA) (INT_PTR) + GetProcAddress(hinstLib, "TraceMessageVa"); + if (NULL == pfnWppTraceMessageVa) { + pfnWppTraceMessageVa = TraceMessageW2kVa; + } + } + + FreeLibrary(hinstLib); + } else { + pfnWppTraceMessage = TraceMessageW2k; + pfnWppTraceMessageVa = TraceMessageW2kVa; + WPPTraceSuite = WppTraceWin2K; + } +} + + +__inline ULONG +WppInitTraceFunction(IN TRACEHANDLE LoggerHandle, + IN DWORD TraceOptions, + IN LPGUID MessageGuid, + IN USHORT MessageNumber, + ... + ) +/*++ + +Routine Description: + + This is a function initializes the tracing function if not + calling WPP_INIT_TRACING. It uses TraceMessageVa to log events + + +--*/ +{ + + va_list VarArgs ; + + WppDynamicTracingSupport(); + + va_start(VarArgs, MessageNumber); + + pfnWppTraceMessageVa( LoggerHandle, + TraceOptions, + MessageGuid, + MessageNumber, + VarArgs + ); + + return 0; +} + +#undef WppLoadTracingSupport +#define WppLoadTracingSupport WppDynamicTracingSupport() + +#if defined(__cplusplus) +}; +#endif + +#endif // WPP_ALREADY_INCLUDED + +`INCLUDE control.tpl` +`INCLUDE tracemacro.tpl` + +`IF FOUND WPP_INIT_TRACING` +#define WPPINIT_EXPORT + `INCLUDE um-init.tpl` +`ENDIF` + +// +// Tracing Macro name redefinition +// + +// NoMsgArgs + +`FORALL f IN Funcs WHERE !DoubleP && !MsgArgs` +#undef `f.Name` +#define `f.Name` WPP_(CALL) +`ENDFOR` + +`FORALL f IN Funcs WHERE DoubleP && !MsgArgs` +#undef `f.Name` +#define `f.Name`(ARGS) WPP_(CALL) ARGS +`ENDFOR` + + +// MsgArgs + +`FORALL f IN Funcs WHERE MsgArgs` +#undef `f.Name` +#define `f.Name`(`f.FixedArgs` MSGARGS) WPP_(CALL)(`f.FixedArgs` MSGARGS) +`ENDFOR` + +`FORALL r IN Reorder` +#undef WPP_R`r.Name` +#define WPP_R`r.Name`(`r.Arguments`) `r.Permutation` +`ENDFOR` + diff --git a/eng/build.yml b/eng/build.yml new file mode 100644 index 00000000000..464b0c1b038 --- /dev/null +++ b/eng/build.yml @@ -0,0 +1,94 @@ +# +# This file should be kept in sync across https://www.github.com/dotnet/wpf and dotnet-wpf-int repos. +# + +parameters: + name: '' + # send telemetry + enableTelemetry: true + # install Microbuild plugin if not a public build + enableMicrobuild: true + # queue YAML object - https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-schema.md#queue + queue: {} + # variables YAML object - https://github.com/Microsoft/vsts-agent/blob/master/docs/preview/yamlgettingstarted-schema.md#phase + variables: {} + # run this build as a public build, even in the internal project + runAsPublic: false + +# Common conditionals: There are a number of common conditionals that are useful. Generally these are used to decide what resources can be accessed, +# or what logic should be applied based on the context the build is being run in. +# - eq/ne(variables['Agent.Os'], 'Windows_NT') - Running/not running on a windows machine +# - eq/ne(variables['System.TeamProject'], 'public') - Running/not running on the dotnet public VSTS project +# - and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest') - Not running in public and not a pull request. +# - or(eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest') - Running in public or a pull request. + +phases: +- template: /eng/common/templates/phases/base.yml + parameters: + enableTelemetry: ${{ parameters.enableTelemetry }} + + enableMicrobuild: ${{ parameters.enableMicrobuild }} + + name: ${{ parameters.name }} + + queue: ${{ parameters.queue }} + + runAsPublic: ${{ parameters.runAsPublic }} + + variables: + ${{ insert }}: ${{ parameters.variables }} + _HelixBuildConfig: $(_BuildConfig) + # Only enable publishing in non-public, non PR scenarios. + ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + # This should be changed to an isolated blob feed per-build. + # Right now a manual build of a random branch would get published alongside the normal branch artifacts. + _PublishBlobFeedUrl: https://dotnetfeed.blob.core.windows.net/dotnet-windowsdesktop/index.json + _SignArgs: /p:DotNetSignType=$(_SignType) /p:TeamName=$(_TeamName) + _PublishArgs: /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) + /p:DotNetPublishBlobFeedUrl=$(_PublishBlobFeedUrl) + /p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed) + /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) + /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) + _OfficialBuildIdArgs: /p:OfficialBuildId=$(BUILD.BUILDNUMBER) + # else + ${{ if or(eq(parameters.runAsPublic, 'true'), eq(variables['System.TeamProject'], 'public'), in(variables['Build.Reason'], 'PullRequest')) }}: + _PublishArgs: '' + _OfficialBuildIdArgs: '' + _SignArgs: '' + + steps: + - ${{ if and(eq(parameters.runAsPublic, 'false'), ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}: + - task: AzureKeyVault@1 + inputs: + azureSubscription: 'DotNet-Engineering-Services_KeyVault' + KeyVaultName: EngKeyVault + SecretsFilter: 'dotnetfeed-storage-access-key-1,microsoft-symbol-server-pat,symweb-symbol-server-pat' + + # Use utility script to run script command dependent on agent OS. + - script: eng\common\cibuild.cmd + -configuration $(_BuildConfig) + -prepareMachine + $(_PublishArgs) + $(_SignArgs) + $(_OfficialBuildIdArgs) + /p:Platform=$(_Platform) /p:IsShipping=$(_IsShipping) + displayName: Windows Build / Publish + condition: and(succeeded(), eq(variables['Agent.Os'], 'Windows_NT')) + + - task: PublishBuildArtifacts@1 + displayName: Publish Logs to VSTS + inputs: + PathtoPublish: '$(Build.SourcesDirectory)/artifacts/log/$(_BuildConfig)' + PublishLocation: Container + ArtifactName: $(Agent.Os)_$(Agent.JobName) + continueOnError: true + condition: always() + + - task: PublishTestResults@2 + displayName: Publish Test Results + inputs: + testResultsFormat: 'xUnit' + testResultsFiles: '*.xml' + searchFolder: '$(Build.SourcesDirectory)/artifacts/TestResults/$(_BuildConfig)' + continueOnError: true + condition: always() \ No newline at end of file diff --git a/eng/common/darc-init.sh b/eng/common/darc-init.sh old mode 100755 new mode 100644 diff --git a/eng/configure-toolset.ps1 b/eng/configure-toolset.ps1 new file mode 100644 index 00000000000..73568183573 --- /dev/null +++ b/eng/configure-toolset.ps1 @@ -0,0 +1,20 @@ +# +# This file should be kept in sync across https://www.github.com/dotnet/wpf and dotnet-wpf-int repos. +# + +# This repo uses C++/CLI /clr:pure (or /clr:netcore) switches during compilation, which are +# deprecated. Ensure that this warning is always suppressed during build. +if (($properties -eq $null) -or (-not ($properties -icontains '/nowarn:D9035'))) { + $properties = @('/nowarn:D9035') + $properties +} + +# Make sure that Nuget restore doesn't hit the cache when running CI builds +# See https://github.com/NuGet/Home/issues/3116 +if ($ci) { + if (($properties -eq $null) -or (-not ($properties -icontains '/p:RestoreNoCache=true'))) { + $properties = @('/p:RestoreNoCache=true') + $properties + } +} +# Always generate binary logs +$binaryLog = $true +$DoNotAbortNativeToolsInstallationOnFailure = $true diff --git a/eng/pipeline.yml b/eng/pipeline.yml index 1d75c6cf808..e726b9e3812 100644 --- a/eng/pipeline.yml +++ b/eng/pipeline.yml @@ -1,8 +1,12 @@ +# +# This file should be kept in sync across https://www.github.com/dotnet/wpf and dotnet-wpf-int repos. +# +# parameters: # Needed because agent pool can't be read from a user-defined variable (Azure DevOps limitation) - # Defaults to dotnet-external-temp-vs2019 - agentPool: dotnet-external-temp-vs2019 + # Defaults to dotnet-internal-vs2019-preview + agentPool: dotnet-internal-vs2019-preview # Needed because runAsPublic is used in template expressions, which can't read from user-defined variables # Defaults to true @@ -16,7 +20,7 @@ jobs: enablePublishTestResults: true enablePublishBuildAssets: true enableTelemetry: true - helixRepo: dotnet/wpf + helixRepo: dnceng/wpf jobs: - job: Windows_NT @@ -26,7 +30,7 @@ jobs: - name: _TeamName value: DotNetCore - name: _SignType - value: test + value: real - name: _SignArgs value: '' @@ -67,6 +71,8 @@ jobs: value: /p:DotNetPublishBlobFeedKey=$(dotnetfeed-storage-access-key-1) /p:DotNetPublishBlobFeedUrl=$(_PublishBlobFeedUrl) /p:DotNetPublishToBlobFeed=$(_DotNetPublishToBlobFeed) + /p:DotNetPublishUsingPipelines=$(_PublishUsingPipelines) + /p:DotNetArtifactsCategory=$(_DotNetArtifactsCategory) /p:DotNetSymbolServerTokenMsdl=$(microsoft-symbol-server-pat) /p:DotNetSymbolServerTokenSymWeb=$(symweb-symbol-server-pat) - name: _OfficialBuildIdArgs @@ -102,4 +108,4 @@ jobs: $(_SignArgs) $(_OfficialBuildIdArgs) $(_PlatformArgs) - displayName: Windows Build / Publish \ No newline at end of file + displayName: Windows Build / Publish diff --git a/eng/restore-toolset.ps1 b/eng/restore-toolset.ps1 new file mode 100644 index 00000000000..a7f5a8162c1 --- /dev/null +++ b/eng/restore-toolset.ps1 @@ -0,0 +1,5 @@ +# +# This file should be kept in sync across https://www.github.com/dotnet/wpf and dotnet-wpf-int repos. +# + +. $PsScriptRoot\common\init-tools-native.ps1 -InstallDirectory $PSScriptRoot\..\.tools\native -GlobalJsonFile $PSScriptRoot\..\global.json \ No newline at end of file diff --git a/global.json b/global.json index 27bac917b80..b02c631f153 100644 --- a/global.json +++ b/global.json @@ -9,6 +9,11 @@ "version": "3.0.100-preview-010024" }, "msbuild-sdks": { - "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19177.11" + "Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.19177.2", + "Microsoft.DotNet.Arcade.Wpf.Sdk": "4.8.0-prerelease.19168.11" + }, + "native-tools": { + "strawberry-perl": "5.28.1.1-1", + "msvcurt-c1xx": "0.0.0.3" } } diff --git a/packaging/Directory.Build.props b/packaging/Directory.Build.props new file mode 100644 index 00000000000..1152d4c9c6c --- /dev/null +++ b/packaging/Directory.Build.props @@ -0,0 +1,47 @@ + + + true + + + true + true + + + + Dummy-$(PackageName) + true + false + true + + + true + false + + + + + LICENSE.TXT + + + + + + + + diff --git a/packaging/Directory.Build.targets b/packaging/Directory.Build.targets new file mode 100644 index 00000000000..14437118703 --- /dev/null +++ b/packaging/Directory.Build.targets @@ -0,0 +1,3 @@ + + + diff --git a/packaging/Microsoft.DotNet.Arcade.Wpf.Sdk/Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral.csproj b/packaging/Microsoft.DotNet.Arcade.Wpf.Sdk/Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral.csproj new file mode 100644 index 00000000000..ac9fb2d1129 --- /dev/null +++ b/packaging/Microsoft.DotNet.Arcade.Wpf.Sdk/Microsoft.DotNet.Arcade.Wpf.Sdk.ArchNeutral.csproj @@ -0,0 +1,31 @@ + + + {B73BB4AB-68DE-4B91-BBB0-AB4F2D504AC3} + netcoreapp3.0 + AnyCPU;x64 + + + + + true + + + + $(MSBuildProjectName.Replace('.ArchNeutral','')) + $(PackageName) + WPF Build props/targets transport package shared between dotnet/wpf and dotnet-wpf-int + + + + + + + + + + + diff --git a/packaging/Microsoft.DotNet.Wpf.GitHub/Microsoft.DotNet.Wpf.GitHub.ArchNeutral.csproj b/packaging/Microsoft.DotNet.Wpf.GitHub/Microsoft.DotNet.Wpf.GitHub.ArchNeutral.csproj new file mode 100644 index 00000000000..d908eccc66c --- /dev/null +++ b/packaging/Microsoft.DotNet.Wpf.GitHub/Microsoft.DotNet.Wpf.GitHub.ArchNeutral.csproj @@ -0,0 +1,13 @@ + + + 9a7e395b-e859-40e2-809d-efb72cf3a2ee + netcoreapp3.0 + AnyCPU;x64 + + + + $(MSBuildProjectName.Replace('.ArchNeutral','')) + $(PackageName) + WPF Transport Package from dotnet/wpf repository + + diff --git a/packaging/Microsoft.DotNet.Wpf.GitHub/Microsoft.DotNet.Wpf.GitHub.csproj b/packaging/Microsoft.DotNet.Wpf.GitHub/Microsoft.DotNet.Wpf.GitHub.csproj new file mode 100644 index 00000000000..46d1b123c68 --- /dev/null +++ b/packaging/Microsoft.DotNet.Wpf.GitHub/Microsoft.DotNet.Wpf.GitHub.csproj @@ -0,0 +1,13 @@ + + + c847934a-828c-4ebb-a004-b0e97c8313f4 + netcoreapp3.0 + AnyCPU;x64 + + + + $(MSBuildProjectName.Replace('.ArchNeutral','')) + $(PackageName) + WPF Transport Package from dotnet/wpf repository + + diff --git a/src/Directory.Build.Props b/src/Directory.Build.Props index c7d7f5865a6..12d9ad073ec 100644 --- a/src/Directory.Build.Props +++ b/src/Directory.Build.Props @@ -1,4 +1,3 @@ - - + diff --git a/src/Microsoft.DotNet.Wpf/Directory.Build.Props b/src/Microsoft.DotNet.Wpf/Directory.Build.Props index c7d7f5865a6..12d9ad073ec 100644 --- a/src/Microsoft.DotNet.Wpf/Directory.Build.Props +++ b/src/Microsoft.DotNet.Wpf/Directory.Build.Props @@ -1,4 +1,3 @@ - - + diff --git a/src/Microsoft.DotNet.Wpf/src/Common/src/System/SR.cs b/src/Microsoft.DotNet.Wpf/src/Common/src/System/SR.cs index 10e7fb03205..3c86205337a 100644 --- a/src/Microsoft.DotNet.Wpf/src/Common/src/System/SR.cs +++ b/src/Microsoft.DotNet.Wpf/src/Common/src/System/SR.cs @@ -2,21 +2,24 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +using System; using System.Resources; using System.Runtime.CompilerServices; -#if CUSTOM_SR_NAMESPACE -namespace #CUSTOM_SR_NAMESPACE# +#if WINDOWS_BASE +namespace MS.Internal.WindowsBase +#elif PRESENTATION_CORE +namespace MS.Internal.PresentationCore +#elif PBTCOMPILER +namespace MS.Utility +#elif AUTOMATION +namespace MS.Internal.Automation #else namespace System #endif { -#if CUSTOM_SR_CLASSNAME - internal partial class #CUSTOM_SR_CLASSNAME# -#else internal partial class SR -#endif { private static ResourceManager ResourceManager => SRID.ResourceManager; diff --git a/src/Microsoft.DotNet.Wpf/src/Directory.Build.Props b/src/Microsoft.DotNet.Wpf/src/Directory.Build.Props index 0d695cffd55..01dd165300a 100644 --- a/src/Microsoft.DotNet.Wpf/src/Directory.Build.Props +++ b/src/Microsoft.DotNet.Wpf/src/Directory.Build.Props @@ -1,12 +1,15 @@ - - + + + ECMA + $(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb true $(MSBuildThisFileDirectory)Shared\ $(MSBuildThisFileDirectory)Common\ - true - true + $(MSBuildThisFileDirectory)WpfGfx\ + $(WpfGraphicsPath) + $(MSBuildThisFileDirectory)PresentationNative\ diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/RefAssemblyAttrs.cs b/src/Microsoft.DotNet.Wpf/src/Shared/RefAssemblyAttrs.cs index ef53e902c2e..aa83750cfa5 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/RefAssemblyAttrs.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/RefAssemblyAttrs.cs @@ -17,6 +17,8 @@ namespace MS.Internal.PresentationFramework namespace MS.Internal.ReachFramework #elif UIAUTOMATIONTYPES namespace MS.Internal.UIAutomationTypes +#elif DIRECTWRITE_FORWARDER +namespace MS.Internal.DirectWriteForwarder #else namespace Microsoft.Internal #endif @@ -32,6 +34,7 @@ internal static class BuildInfo internal const string DEVDIV_PUBLIC_KEY_TOKEN = "b77a5c561934e089"; // Constants to prevent hardcoding in InternalsVisibleTo attribute + internal const string DirectWriteForwarder = "DirectWriteForwarder, PublicKey=" + WCP_PUBLIC_KEY_STRING; internal const string PresentationCore = "PresentationCore, PublicKey="+ WCP_PUBLIC_KEY_STRING; internal const string PresentationCFFRasterizer = "PresentationCFFRasterizer, PublicKey="+ WCP_PUBLIC_KEY_STRING; internal const string PresentationFramework = "PresentationFramework, PublicKey="+ WCP_PUBLIC_KEY_STRING; diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/Configurations.props b/src/Microsoft.DotNet.Wpf/src/System.Xaml/Configurations.props deleted file mode 100644 index 6cc4dcd0ebe..00000000000 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/Configurations.props +++ /dev/null @@ -1,8 +0,0 @@ - - - - - netcoreapp-Windows_NT; - - - \ No newline at end of file diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System.Xaml.csproj b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System.Xaml.csproj index d8de8227f7a..ff7be72b809 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System.Xaml.csproj +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System.Xaml.csproj @@ -2,22 +2,15 @@ {9AC36357-34B7-40A1-95CA-FE9F46D089A7} System.Xaml - netcoreapp3.0 + netcoreapp3.0 AnyCPU;x64 - $(NoWarn);0618;NU5125 + $(NoWarn);0618;NU5125;0618 $(DefineConstants);OLDRESOURCES;SYSTEM_XAML - - true - runtime.win-$(Platform) - runtime.win-x86 - $(PackageRuntimeIdentifierPrefix).Microsoft.DotNet.Wpf.Private - Microsoft.DotNet.Wpf - @@ -96,11 +89,37 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - All - + diff --git a/src/Microsoft.DotNet.Wpf/test/Common/TestServices/TestServices.csproj b/src/Microsoft.DotNet.Wpf/test/Common/TestServices/TestServices.csproj index 9b4f791949b..54ec593354e 100644 --- a/src/Microsoft.DotNet.Wpf/test/Common/TestServices/TestServices.csproj +++ b/src/Microsoft.DotNet.Wpf/test/Common/TestServices/TestServices.csproj @@ -4,7 +4,7 @@ TestServices $(DefineConstants);FRAMEWORK_NATIVEMETHODS;CORE_NATIVEMETHODS;DRT true - $(NoWarn);CS0618 + $(NoWarn);CS0618;0618 AnyCPU;x64 true diff --git a/src/Microsoft.DotNet.Wpf/test/Common/dir.props b/src/Microsoft.DotNet.Wpf/test/Common/dir.props deleted file mode 100644 index a6853553d1b..00000000000 --- a/src/Microsoft.DotNet.Wpf/test/Common/dir.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Microsoft.DotNet.Wpf/test/Directory.Build.props b/src/Microsoft.DotNet.Wpf/test/Directory.Build.props index d927641fe56..4ca582bca1e 100644 --- a/src/Microsoft.DotNet.Wpf/test/Directory.Build.props +++ b/src/Microsoft.DotNet.Wpf/test/Directory.Build.props @@ -1,4 +1,7 @@ + + true + $(MsBuildThisFileDirectory) @@ -6,6 +9,7 @@ true false false + false diff --git a/src/Microsoft.DotNet.Wpf/test/dir.props b/src/Microsoft.DotNet.Wpf/test/dir.props deleted file mode 100644 index a6853553d1b..00000000000 --- a/src/Microsoft.DotNet.Wpf/test/dir.props +++ /dev/null @@ -1,6 +0,0 @@ - - - - \ No newline at end of file