Fix cross-compilation of DXC from non-Windows hosts to Windows targets

Use the same method as Chrome for mc.exe (Message Compiler): commit
the generated files, and on Windows, compile with mc.exe and compare the
results with what we commit, erroring on mismatch.

Also make sure to compile the tablegen executables using the host
toolchain.

Bug: dawn:2070
Change-Id: I46b7d39d73305b9ecebc56a90b3ce85bda2c3d9e
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/152222
Commit-Queue: Antonio Maiorano <amaiorano@google.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Kokoro: Kokoro <noreply+kokoro@google.com>
diff --git a/DEPS b/DEPS
index 75a0c13..276377a 100644
--- a/DEPS
+++ b/DEPS
@@ -342,7 +342,18 @@
                 '--no_auth',
                 '--bucket', 'chromium-browser-clang/rc',
                 '-s', 'build/toolchain/win/rc/linux64/rc.sha1',
-    ]
+    ],
+  },
+  {
+    'name': 'rc_mac',
+    'pattern': '.',
+    'condition': 'dawn_standalone and checkout_win and host_os == "mac"',
+    'action': [ 'download_from_google_storage',
+                '--no_resume',
+                '--no_auth',
+                '--bucket', 'chromium-browser-clang/rc',
+                '-s', 'build/toolchain/win/rc/mac/rc.sha1',
+    ],
   },
   # Pull clang-format binaries using checked-in hashes.
   {
diff --git a/third_party/gn/dxc/BUILD.gn b/third_party/gn/dxc/BUILD.gn
index 4b4740d..79e840f 100644
--- a/third_party/gn/dxc/BUILD.gn
+++ b/third_party/gn/dxc/BUILD.gn
@@ -21,7 +21,7 @@
 import("build/built_target_action.gni")
 import("build/cmake_configure_file.gni")
 import("build/generate_version_include.gni")
-import("build/system_binary_action.gni")
+import("build/message_compiler.gni")
 
 dawn_dxc_gn_dir = "$dawn_dxc_dir/../gn"
 llvm_target_triple = "dxil-ms-dx"  # Force target triple
@@ -42,27 +42,27 @@
 }
 
 if (target_cpu == "x64") {
-  if (current_os == "linux") {
+  if (target_os == "linux") {
     llvm_current_triple = "x86_64-unknown-linux-gnu"
-  } else if (current_os == "win") {
+  } else if (target_os == "win") {
     llvm_current_triple = "x86_64-pc-win32"
   } else {
     assert(
         false,
-        "define 'llvm_current_triple' for target_cpu: $target_cpu, target_os: $current_os")
+        "define 'llvm_current_triple' for target_cpu: $target_cpu, target_os: $target_os")
   }
 } else if (target_cpu == "x86") {
-  if (current_os == "win") {
+  if (target_os == "win") {
     llvm_current_triple = "x86_32-pc-win32"
   } else {
     assert(
         false,
-        "define 'llvm_current_triple' for target_cpu: $target_cpu, target_os: $current_os")
+        "define 'llvm_current_triple' for target_cpu: $target_cpu, target_os: $target_os")
   }
 } else {
   assert(
       false,
-      "define 'llvm_current_triple' for target_cpu: $target_cpu, target_os: $current_os")
+      "define 'llvm_current_triple' for target_cpu: $target_cpu, target_os: $target_os")
 }
 
 #######################################################################
@@ -171,11 +171,8 @@
     "HAVE_LIMITS_H=1",
     "HAVE_LINK_H=",
     "HAVE_LONGJMP=",
-    "HAVE_MACH_MACH_H=",
-    "HAVE_MACH_O_DYLD_H=",
     "HAVE_MALLCTL=",
     "HAVE_MALLINFO2=",
-    "HAVE_MALLOC_H=1",
     "HAVE_MALLOC_MALLOC_H=",
     "HAVE_MALLOC_ZONE_STATISTICS=",
     "HAVE_MKDTEMP=",
@@ -238,15 +235,17 @@
       "HAVE_PTHREAD_GETSPECIFIC=",
       "HAVE_PTHREAD_H=",
       "HAVE_PTHREAD_MUTEX_LOCK=",
+      "HAVE_MACH_MACH_H=",
+      "HAVE_MACH_O_DYLD_H=",
+      "HAVE_MALLOC_H=1",
     ]
-  } else if (is_linux) {
+  } else if (is_linux || is_mac) {
     values += [
       "HAVE_DECL_STRERROR_S=",
       "HAVE_DIRENT_H=1",
       "HAVE_FUTIMES=1",
       "HAVE_GETPAGESIZE=1",
       "HAVE_GETRUSAGE=1",
-      "HAVE_MALLINFO=1",
       "HAVE_SYS_MMAN_H=1",
       "HAVE_SYS_PARAM_H=1",
       "HAVE_SYS_RESOURCE_H=1",
@@ -256,6 +255,21 @@
       "HAVE_PTHREAD_H=1",
       "HAVE_PTHREAD_MUTEX_LOCK=1",
     ]
+    if (is_linux) {
+      values += [
+        "HAVE_MALLOC_H=1",
+        "HAVE_MALLINFO=1",
+        "HAVE_MACH_MACH_H=",
+        "HAVE_MACH_O_DYLD_H=",
+      ]
+    } else {
+      values += [
+        "HAVE_MALLOC_H=",
+        "HAVE_MALLINFO=",
+        "HAVE_MACH_MACH_H=1",
+        "HAVE_MACH_O_DYLD_H=1",
+      ]
+    }
   }
   if (is_win) {
     values += [
@@ -466,8 +480,11 @@
     ]
   }
 
+  cflags_c = []
+  cflags_cc = []
+
   if (is_win) {
-    cflags_cc = [
+    cflags_cc += [
       "/EHsc",  # DXC uses exceptions
       "/Zc:__cplusplus",
       "/Zc:twoPhase-",  # DXC source relies on MSVC's non-conforming
@@ -475,13 +492,11 @@
       "/Zc:sizedDealloc-",  # Disable sized allocation
     ]
 
-    cflags_c = [
+    cflags_c += [
       "/EHsc",  # DXC uses exceptions
     ]
-  } else if (is_linux) {
-    cflags_c = []
-
-    cflags_cc = [
+  } else if (is_linux || is_mac) {
+    cflags_cc += [
       "-fcxx-exceptions",  # DXC uses exceptions
       "-fms-extensions",
       "-frtti",  # DXC uses RTTI
@@ -735,16 +750,29 @@
   }
 }
 
-template("clang_tablegen") {
+template("llvm_tablegen") {
   tblgen(target_name) {
     forward_variables_from(invoker,
                            [
+                             "args",
                              "output_name",
                              "td_file",
                              "visibility",
                            ])
-    args = invoker.args
-    tblgen_target = ":clang-tblgen"
+    tblgen_target = ":llvm-tblgen($host_toolchain)"
+  }
+}
+
+template("clang_tablegen") {
+  tblgen(target_name) {
+    forward_variables_from(invoker,
+                           [
+                             "args",
+                             "output_name",
+                             "td_file",
+                             "visibility",
+                           ])
+    tblgen_target = ":clang-tblgen($host_toolchain)"
   }
 }
 
@@ -765,25 +793,22 @@
 ## llvm-tblgen and clang-tblgen targets
 #######################################################################
 
-tblgen("HLSLOptions-inc") {
+llvm_tablegen("HLSLOptions-inc") {
   args = [ "-gen-opt-parser-defs" ]
   td_file = "$dawn_dxc_dir/include/dxc/Support/HLSLOptions.td"
   output_name = "include/dxc/Support/HLSLOptions.inc"
-  tblgen_target = ":llvm-tblgen"
 }
 
-tblgen("Intrinsics-td") {
+llvm_tablegen("Intrinsics-td") {
   args = [ "-gen-intrinsic" ]
   td_file = "$dawn_dxc_dir/include/llvm/IR/Intrinsics.td"
   output_name = "include/llvm/IR/Intrinsics.gen"
-  tblgen_target = ":llvm-tblgen"
 }
 
-tblgen("clang-Driver-Options-inc") {
+llvm_tablegen("clang-Driver-Options-inc") {
   args = [ "-gen-opt-parser-defs" ]
   td_file = "$dawn_dxc_dir/tools/clang/include/clang/Driver/Options.td"
   output_name = "tools/clang/include/clang/Driver/Options.inc"
-  tblgen_target = ":llvm-tblgen"
 }
 
 clang_diag_gen("Analysis") {
@@ -1021,32 +1046,16 @@
 #######################################################################
 
 # Generates dxcetw.h used by dxcompiler
-system_binary_action("dxcetw-h") {
-  manifest = "$dawn_dxc_dir/include/dxc/Tracing/dxcetw.man"
-  inputs = [ manifest ]
-  gen_output_dir = "$target_gen_dir/include/dxc/Tracing/dxcetw"
-  outputs = [
-    "$gen_output_dir/dxcetw.h",
-    "$gen_output_dir/dxcetw.rc",
-    "$gen_output_dir/dxcetwTEMP.bin",
-
-    # Note: CMake copies from tmpdxcetw_MSG00001.bin to MSG00001.bin,
-    # but we don't copy, so we get the default output name. Is this okay?
-    "$gen_output_dir/dxcetw_MSG00001.bin",
-  ]
-  args = [
-    "mc",
-    "-r",
-    rebase_path(gen_output_dir, root_build_dir),
-    "-h",
-    rebase_path(gen_output_dir, root_build_dir),
+message_compiler("dxcetw-h") {
+  sources = [ "$dawn_dxc_dir/include/dxc/Tracing/dxcetw.man" ]
+  extra_args = [
     "-p",
     "DxcEtw_",
     "-um",
     "-z",
     "dxcetw",
-    rebase_path(manifest, root_build_dir),
   ]
+  output_dir = "$target_gen_dir/include/dxc/Tracing/dxcetw"
 }
 
 generate_version_include("hlsl_dxcversion_autogen") {
@@ -1194,7 +1203,7 @@
       "${target_gen_dir}/lib/DxilPIXPasses",
     ]
 
-    if (is_linux) {
+    if (is_linux || is_mac) {
       include_dirs += [
         "$dawn_dxheaders_dir/include/directx",
         "$dawn_dxheaders_dir/include/wsl/stubs/",
diff --git a/third_party/gn/dxc/build/message_compiler.gni b/third_party/gn/dxc/build/message_compiler.gni
new file mode 100644
index 0000000..0e74dff
--- /dev/null
+++ b/third_party/gn/dxc/build/message_compiler.gni
@@ -0,0 +1,78 @@
+# Copyright 2023 The Dawn Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Adapted from https://source.chromium.org/chromium/chromium/src/+/main:build/win/message_compiler.gni;l=1?q=message_compiler.gni&sq=&ss=chromium
+
+# To support cross-compilation from a non-Windows host to a Windows target,
+# the files generated by mc.exe are expected to be copied and committed
+# to "../win_build_output/". When running this script, the files in this
+# directory are copied to $output_dir. On Windows hosts, the script will
+# run mc.exe against the input source files, and validate that the generated
+# files match what's in "../win_build_output/", failing if they do not.
+# If mismatched, presumably the source files have changed, and the newly
+# generated files should be copied and committed to "../win_build_output/".
+#
+# sources
+#   List of message files to process.
+#
+# deps, public_deps, visibility
+#   Normal meaning.
+template("message_compiler") {
+  extra_args = []
+  if (defined(invoker.extra_args)) {
+    extra_args = invoker.extra_args
+  }
+
+  output_dir = "$target_gen_dir"
+  if (defined(invoker.output_dir)) {
+    output_dir = invoker.output_dir
+  }
+
+  action_foreach(target_name) {
+    forward_variables_from(invoker, [ "visibility" ])
+    script = "build/message_compiler.py"
+    outputs = [
+      "$output_dir/{{source_name_part}}.h",
+      "$output_dir/{{source_name_part}}.rc",
+    ]
+
+    args = [
+      # The first argument is the environment file saved to the build
+      # directory. This is required because the Windows toolchain setup saves
+      # the VC paths and such so that running "mc.exe" will work with the
+      # configured toolchain. This file is in the root build dir.
+      "environment.$current_cpu",
+
+      # Where to put the header.
+      "-h",
+      rebase_path(output_dir, root_build_dir),
+
+      # Where to put the .rc file.
+      "-r",
+      rebase_path(output_dir, root_build_dir),
+
+      # Input is Unicode.
+      "-u",
+    ]
+    args += extra_args
+    args += [ "{{source}}" ]
+
+    forward_variables_from(invoker,
+                           [
+                             "deps",
+                             "public_deps",
+                             "sources",
+                           ])
+  }
+}
diff --git a/third_party/gn/dxc/build/message_compiler.py b/third_party/gn/dxc/build/message_compiler.py
new file mode 100644
index 0000000..abd0d85
--- /dev/null
+++ b/third_party/gn/dxc/build/message_compiler.py
@@ -0,0 +1,154 @@
+# Copyright 2023 The Dawn Authors
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# Adapted from https://source.chromium.org/chromium/chromium/src/+/main:build/win/message_compiler.py;l=7?q=message_compiler.py&ss=chromium
+
+# Runs the Microsoft Message Compiler (mc.exe).
+#
+# Usage: message_compiler.py <environment_file> [<args to mc.exe>*]
+
+import difflib
+import distutils.dir_util
+import filecmp
+import os
+import re
+import shutil
+import subprocess
+import sys
+import tempfile
+
+
+def main():
+    env_file, rest = sys.argv[1], sys.argv[2:]
+
+    # Parse some argument flags.
+    header_dir = None
+    resource_dir = None
+    input_file = None
+    for i, arg in enumerate(rest):
+        if arg == '-h' and len(rest) > i + 1:
+            assert header_dir == None
+            header_dir = rest[i + 1]
+        elif arg == '-r' and len(rest) > i + 1:
+            assert resource_dir == None
+            resource_dir = rest[i + 1]
+        elif arg.endswith('.mc') or arg.endswith('.man'):
+            assert input_file == None
+            input_file = arg
+
+    # Copy checked-in outputs to final location.
+    THIS_DIR = os.path.abspath(os.path.dirname(__file__))
+    assert header_dir == resource_dir
+    # Final destination is in ../win_build_output/mc/<header_dir>.
+    source = os.path.join(THIS_DIR, "..", "win_build_output",
+                          re.sub(r'.*gn/dxc/', 'mc/', header_dir))
+    # If these are new files, create the source directory. The diff will fail later to let
+    # the user know what files to copy.
+    os.makedirs(source, exist_ok=True)
+    distutils.dir_util.copy_tree(source, header_dir, preserve_times=False)
+
+    # On non-Windows, that's all we can do.
+    if sys.platform != 'win32':
+        return
+
+    # On Windows, run mc.exe on the input and check that its outputs are
+    # identical to the checked-in outputs.
+
+    # Read the environment block from the file. This is stored in the format used
+    # by CreateProcess. Drop last 2 NULs, one for list terminator, one for
+    # trailing vs. separator.
+    env_pairs = open(env_file).read()[:-2].split('\0')
+    env_dict = dict([item.split('=', 1) for item in env_pairs])
+
+    extension = os.path.splitext(input_file)[1]
+
+    # mc writes to stderr, so this explicitly redirects to stdout and eats it.
+    try:
+        tmp_dir = tempfile.mkdtemp()
+        delete_tmp_dir = True
+        if header_dir:
+            rest[rest.index('-h') + 1] = tmp_dir
+            header_dir = tmp_dir
+        if resource_dir:
+            rest[rest.index('-r') + 1] = tmp_dir
+            resource_dir = tmp_dir
+
+        # This needs shell=True to search the path in env_dict for the mc
+        # executable.
+        subprocess.check_output(['mc.exe'] + rest,
+                                env=env_dict,
+                                stderr=subprocess.STDOUT,
+                                shell=True)
+        # We require all source code (in particular, the header generated here) to
+        # be UTF-8. jinja can output the intermediate .mc file in UTF-8 or UTF-16LE.
+        # However, mc.exe only supports Unicode via the -u flag, and it assumes when
+        # that is specified that the input is UTF-16LE (and errors out on UTF-8
+        # files, assuming they're ANSI). Even with -u specified and UTF16-LE input,
+        # it generates an ANSI header, and includes broken versions of the message
+        # text in the comment before the value. To work around this, for any invalid
+        # // comment lines, we simply drop the line in the header after building it.
+        # Also, mc.exe apparently doesn't always write #define lines in
+        # deterministic order, so manually sort each block of #defines.
+        if header_dir:
+            header_file = os.path.join(
+                header_dir,
+                os.path.splitext(os.path.basename(input_file))[0] + '.h')
+            header_contents = []
+            with open(header_file, 'r') as f:
+                define_block = []  # The current contiguous block of #defines.
+                for line in f.readlines():
+                    if line.startswith('//') and '?' in line:
+                        continue
+                    if line.startswith('#define '):
+                        define_block.append(line)
+                        continue
+                    # On the first non-#define line, emit the sorted preceding #define
+                    # block.
+                    header_contents += sorted(define_block,
+                                              key=lambda s: s.split()[-1])
+                    define_block = []
+                    header_contents.append(line)
+                # If the .h file ends with a #define block, flush the final block.
+                header_contents += sorted(define_block,
+                                          key=lambda s: s.split()[-1])
+            with open(header_file, 'w') as f:
+                f.write(''.join(header_contents))
+
+        # mc.exe invocation and post-processing are complete, now compare the output
+        # in tmp_dir to the checked-in outputs.
+        diff = filecmp.dircmp(tmp_dir, source)
+        if diff.diff_files or set(diff.left_list) != set(diff.right_list):
+            print('mc.exe output different from files in %s, see %s' %
+                  (source, tmp_dir))
+            diff.report()
+            for f in diff.diff_files:
+                if f.endswith('.bin'): continue
+                fromfile = os.path.join(source, f)
+                tofile = os.path.join(tmp_dir, f)
+                print(''.join(
+                    difflib.unified_diff(
+                        open(fromfile).readlines(),
+                        open(tofile).readlines(), fromfile, tofile)))
+            delete_tmp_dir = False
+            sys.exit(1)
+    except subprocess.CalledProcessError as e:
+        print(e.output)
+        sys.exit(e.returncode)
+    finally:
+        if os.path.exists(tmp_dir) and delete_tmp_dir:
+            shutil.rmtree(tmp_dir)
+
+
+if __name__ == '__main__':
+    main()
diff --git a/third_party/gn/dxc/build/run_system_binary.py b/third_party/gn/dxc/build/run_system_binary.py
deleted file mode 100644
index ba7249b..0000000
--- a/third_party/gn/dxc/build/run_system_binary.py
+++ /dev/null
@@ -1,28 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2023 The Dawn Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import subprocess
-import sys
-
-env_file, bin, rest = sys.argv[1], sys.argv[2], sys.argv[3:]
-
-# Read the environment block from the file. This is stored in the format used
-# by CreateProcess. Drop last 2 NULs, one for list terminator, one for
-# trailing vs. separator.
-env_pairs = open(env_file).read()[:-2].split('\0')
-env_dict = dict([item.split('=', 1) for item in env_pairs])
-
-sys.exit(subprocess.call([bin] + rest, env=env_dict, shell=True))
diff --git a/third_party/gn/dxc/build/system_binary_action.gni b/third_party/gn/dxc/build/system_binary_action.gni
deleted file mode 100644
index 8b39f2a..0000000
--- a/third_party/gn/dxc/build/system_binary_action.gni
+++ /dev/null
@@ -1,37 +0,0 @@
-# Copyright 2023 The Dawn Authors
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# system_binary_action() is like action, except that it runs a system binary.
-# The binary can be in PATH or in the build directory environment file (so that
-# executables in the toolchain dirs are picked up).
-template("system_binary_action") {
-  assert(defined(invoker.args), "must set 'args' in $target_name")
-  assert(defined(invoker.outputs), "must set 'outputs' in $target_name")
-  assert(!defined(invoker.sources),
-         "use 'inputs' instead of 'sources' in $target_name")
-
-  action(target_name) {
-    forward_variables_from(invoker,
-                           [
-                             "inputs",
-                             "outputs",
-                           ])
-    script = "build/run_system_binary.py"
-    args = [
-             # Pass in the env file saved to the build directory that contains
-             # the VC paths in it.
-             "environment.$current_cpu",
-           ] + invoker.args
-  }
-}
diff --git a/third_party/gn/dxc/win_build_output/.gitattributes b/third_party/gn/dxc/win_build_output/.gitattributes
new file mode 100644
index 0000000..ca97392
--- /dev/null
+++ b/third_party/gn/dxc/win_build_output/.gitattributes
@@ -0,0 +1,3 @@
+# Don't change line endings in generated text files.
+mc/**/*.h   -text
+mc/**/*.rc  -text
diff --git a/third_party/gn/dxc/win_build_output/README.md b/third_party/gn/dxc/win_build_output/README.md
new file mode 100644
index 0000000..d56c247
--- /dev/null
+++ b/third_party/gn/dxc/win_build_output/README.md
@@ -0,0 +1,3 @@
+This directory contains files that can only be generated on Windows, but that are required for cross-compiling on non-Windows.
+
+* `mc/` contain files generated by `third_party/gn/dxc/build/message_compiler.py`.
diff --git a/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetw.h b/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetw.h
new file mode 100644
index 0000000..fc20d9c
--- /dev/null
+++ b/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetw.h
@@ -0,0 +1,1293 @@
+//**********************************************************************`

+//* This is an include file generated by Message Compiler.             *`

+//*                                                                    *`

+//* Copyright (c) Microsoft Corporation. All Rights Reserved.          *`

+//**********************************************************************`

+#pragma once

+

+//*****************************************************************************

+//

+// Notes on the ETW event code generated by MC:

+//

+// - Structures and arrays of structures are treated as an opaque binary blob.

+//   The caller is responsible for packing the data for the structure into a

+//   single region of memory, with no padding between values. The macro will

+//   have an extra parameter for the length of the blob.

+// - Arrays of nul-terminated strings must be packed by the caller into a

+//   single binary blob containing the correct number of strings, with a nul

+//   after each string. The size of the blob is specified in characters, and

+//   includes the final nul.

+// - Arrays of SID are treated as a single binary blob. The caller is

+//   responsible for packing the SID values into a single region of memory with

+//   no padding.

+// - The length attribute on the data element in the manifest is significant

+//   for values with intype win:UnicodeString, win:AnsiString, or win:Binary.

+//   The length attribute must be specified for win:Binary, and is optional for

+//   win:UnicodeString and win:AnsiString (if no length is given, the strings

+//   are assumed to be nul-terminated). For win:UnicodeString, the length is

+//   measured in characters, not bytes.

+// - For an array of win:UnicodeString, win:AnsiString, or win:Binary, the

+//   length attribute applies to every value in the array, so every value in

+//   the array must have the same length. The values in the array are provided

+//   to the macro via a single pointer -- the caller is responsible for packing

+//   all of the values into a single region of memory with no padding between

+//   values.

+// - Values of type win:CountedUnicodeString, win:CountedAnsiString, and

+//   win:CountedBinary can be generated and collected on Vista or later.

+//   However, they may not decode properly without the Windows 10 2018 Fall

+//   Update.

+// - Arrays of type win:CountedUnicodeString, win:CountedAnsiString, and

+//   win:CountedBinary must be packed by the caller into a single region of

+//   memory. The format for each item is a UINT16 byte-count followed by that

+//   many bytes of data. When providing the array to the generated macro, you

+//   must provide the total size of the packed array data, including the UINT16

+//   sizes for each item. In the case of win:CountedUnicodeString, the data

+//   size is specified in WCHAR (16-bit) units. In the case of

+//   win:CountedAnsiString and win:CountedBinary, the data size is specified in

+//   bytes.

+//

+//*****************************************************************************

+

+#include <wmistr.h>

+#include <evntrace.h>

+#include <evntprov.h>

+

+#ifndef ETW_INLINE

+  #ifdef _ETW_KM_

+    // In kernel mode, save stack space by never inlining templates.

+    #define ETW_INLINE DECLSPEC_NOINLINE __inline

+  #else

+    // In user mode, save code size by inlining templates as appropriate.

+    #define ETW_INLINE __inline

+  #endif

+#endif // ETW_INLINE

+

+#if defined(__cplusplus)

+extern "C" {

+#endif

+

+//

+// MCGEN_DISABLE_PROVIDER_CODE_GENERATION macro:

+// Define this macro to have the compiler skip the generated functions in this

+// header.

+//

+#ifndef MCGEN_DISABLE_PROVIDER_CODE_GENERATION

+

+//

+// MCGEN_USE_KERNEL_MODE_APIS macro:

+// Controls whether the generated code uses kernel-mode or user-mode APIs.

+// - Set to 0 to use Windows user-mode APIs such as EventRegister.

+// - Set to 1 to use Windows kernel-mode APIs such as EtwRegister.

+// Default is based on whether the _ETW_KM_ macro is defined (i.e. by wdm.h).

+// Note that the APIs can also be overridden directly, e.g. by setting the

+// MCGEN_EVENTWRITETRANSFER or MCGEN_EVENTREGISTER macros.

+//

+#ifndef MCGEN_USE_KERNEL_MODE_APIS

+  #ifdef _ETW_KM_

+    #define MCGEN_USE_KERNEL_MODE_APIS 1

+  #else

+    #define MCGEN_USE_KERNEL_MODE_APIS 0

+  #endif

+#endif // MCGEN_USE_KERNEL_MODE_APIS

+

+//

+// MCGEN_HAVE_EVENTSETINFORMATION macro:

+// Controls how McGenEventSetInformation uses the EventSetInformation API.

+// - Set to 0 to disable the use of EventSetInformation

+//   (McGenEventSetInformation will always return an error).

+// - Set to 1 to directly invoke MCGEN_EVENTSETINFORMATION.

+// - Set to 2 to to locate EventSetInformation at runtime via GetProcAddress

+//   (user-mode) or MmGetSystemRoutineAddress (kernel-mode).

+// Default is determined as follows:

+// - If MCGEN_EVENTSETINFORMATION has been customized, set to 1

+//   (i.e. use MCGEN_EVENTSETINFORMATION).

+// - Else if the target OS version has EventSetInformation, set to 1

+//   (i.e. use MCGEN_EVENTSETINFORMATION).

+// - Else set to 2 (i.e. try to dynamically locate EventSetInformation).

+// Note that an McGenEventSetInformation function will only be generated if one

+// or more provider in a manifest has provider traits.

+//

+#ifndef MCGEN_HAVE_EVENTSETINFORMATION

+  #ifdef MCGEN_EVENTSETINFORMATION             // if MCGEN_EVENTSETINFORMATION has been customized,

+    #define MCGEN_HAVE_EVENTSETINFORMATION   1 //   directly invoke MCGEN_EVENTSETINFORMATION(...).

+  #elif MCGEN_USE_KERNEL_MODE_APIS             // else if using kernel-mode APIs,

+    #if NTDDI_VERSION >= 0x06040000            //   if target OS is Windows 10 or later,

+      #define MCGEN_HAVE_EVENTSETINFORMATION 1 //     directly invoke MCGEN_EVENTSETINFORMATION(...).

+    #else                                      //   else

+      #define MCGEN_HAVE_EVENTSETINFORMATION 2 //     find "EtwSetInformation" via MmGetSystemRoutineAddress.

+    #endif                                     // else (using user-mode APIs)

+  #else                                        //   if target OS and SDK is Windows 8 or later,

+    #if WINVER >= 0x0602 && defined(EVENT_FILTER_TYPE_SCHEMATIZED)

+      #define MCGEN_HAVE_EVENTSETINFORMATION 1 //     directly invoke MCGEN_EVENTSETINFORMATION(...).

+    #else                                      //   else

+      #define MCGEN_HAVE_EVENTSETINFORMATION 2 //     find "EventSetInformation" via GetModuleHandleExW/GetProcAddress.

+    #endif

+  #endif

+#endif // MCGEN_HAVE_EVENTSETINFORMATION

+

+//

+// MCGEN Override Macros

+//

+// The following override macros may be defined before including this header

+// to control the APIs used by this header:

+//

+// - MCGEN_EVENTREGISTER

+// - MCGEN_EVENTUNREGISTER

+// - MCGEN_EVENTSETINFORMATION

+// - MCGEN_EVENTWRITETRANSFER

+//

+// If the the macro is undefined, the MC implementation will default to the

+// corresponding ETW APIs. For example, if the MCGEN_EVENTREGISTER macro is

+// undefined, the EventRegister[MyProviderName] macro will use EventRegister

+// in user mode and will use EtwRegister in kernel mode.

+//

+// To prevent issues from conflicting definitions of these macros, the value

+// of the override macro will be used as a suffix in certain internal function

+// names. Because of this, the override macros must follow certain rules:

+//

+// - The macro must be defined before any MC-generated header is included and

+//   must not be undefined or redefined after any MC-generated header is

+//   included. Different translation units (i.e. different .c or .cpp files)

+//   may set the macros to different values, but within a translation unit

+//   (within a single .c or .cpp file), the macro must be set once and not

+//   changed.

+// - The override must be an object-like macro, not a function-like macro

+//   (i.e. the override macro must not have a parameter list).

+// - The override macro's value must be a simple identifier, i.e. must be

+//   something that starts with a letter or '_' and contains only letters,

+//   numbers, and '_' characters.

+// - If the override macro's value is the name of a second object-like macro,

+//   the second object-like macro must follow the same rules. (The override

+//   macro's value can also be the name of a function-like macro, in which

+//   case the function-like macro does not need to follow the same rules.)

+//

+// For example, the following will cause compile errors:

+//

+//   #define MCGEN_EVENTWRITETRANSFER MyNamespace::MyClass::MyFunction // Value has non-identifier characters (colon).

+//   #define MCGEN_EVENTWRITETRANSFER GetEventWriteFunctionPointer(7)  // Value has non-identifier characters (parentheses).

+//   #define MCGEN_EVENTWRITETRANSFER(h,e,a,r,c,d) EventWrite(h,e,c,d) // Override is defined as a function-like macro.

+//   #define MY_OBJECT_LIKE_MACRO     MyNamespace::MyClass::MyEventWriteFunction

+//   #define MCGEN_EVENTWRITETRANSFER MY_OBJECT_LIKE_MACRO // Evaluates to something with non-identifier characters (colon).

+//

+// The following would be ok:

+//

+//   #define MCGEN_EVENTWRITETRANSFER  MyEventWriteFunction1  // OK, suffix will be "MyEventWriteFunction1".

+//   #define MY_OBJECT_LIKE_MACRO      MyEventWriteFunction2

+//   #define MCGEN_EVENTWRITETRANSFER  MY_OBJECT_LIKE_MACRO   // OK, suffix will be "MyEventWriteFunction2".

+//   #define MY_FUNCTION_LIKE_MACRO(h,e,a,r,c,d) MyNamespace::MyClass::MyEventWriteFunction3(h,e,c,d)

+//   #define MCGEN_EVENTWRITETRANSFER  MY_FUNCTION_LIKE_MACRO // OK, suffix will be "MY_FUNCTION_LIKE_MACRO".

+//

+#ifndef MCGEN_EVENTREGISTER

+  #if MCGEN_USE_KERNEL_MODE_APIS

+    #define MCGEN_EVENTREGISTER        EtwRegister

+  #else

+    #define MCGEN_EVENTREGISTER        EventRegister

+  #endif

+#endif // MCGEN_EVENTREGISTER

+#ifndef MCGEN_EVENTUNREGISTER

+  #if MCGEN_USE_KERNEL_MODE_APIS

+    #define MCGEN_EVENTUNREGISTER      EtwUnregister

+  #else

+    #define MCGEN_EVENTUNREGISTER      EventUnregister

+  #endif

+#endif // MCGEN_EVENTUNREGISTER

+#ifndef MCGEN_EVENTSETINFORMATION

+  #if MCGEN_USE_KERNEL_MODE_APIS

+    #define MCGEN_EVENTSETINFORMATION  EtwSetInformation

+  #else

+    #define MCGEN_EVENTSETINFORMATION  EventSetInformation

+  #endif

+#endif // MCGEN_EVENTSETINFORMATION

+#ifndef MCGEN_EVENTWRITETRANSFER

+  #if MCGEN_USE_KERNEL_MODE_APIS

+    #define MCGEN_EVENTWRITETRANSFER   EtwWriteTransfer

+  #else

+    #define MCGEN_EVENTWRITETRANSFER   EventWriteTransfer

+  #endif

+#endif // MCGEN_EVENTWRITETRANSFER

+

+//

+// MCGEN_EVENT_ENABLED macro:

+// Override to control how the EventWrite[EventName] macros determine whether

+// an event is enabled. The default behavior is for EventWrite[EventName] to

+// use the EventEnabled[EventName] macros.

+//

+#ifndef MCGEN_EVENT_ENABLED

+#define MCGEN_EVENT_ENABLED(EventName) EventEnabled##EventName()

+#endif

+

+//

+// MCGEN_EVENT_ENABLED_FORCONTEXT macro:

+// Override to control how the EventWrite[EventName]_ForContext macros

+// determine whether an event is enabled. The default behavior is for

+// EventWrite[EventName]_ForContext to use the

+// EventEnabled[EventName]_ForContext macros.

+//

+#ifndef MCGEN_EVENT_ENABLED_FORCONTEXT

+#define MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, EventName) EventEnabled##EventName##_ForContext(pContext)

+#endif

+

+//

+// MCGEN_ENABLE_CHECK macro:

+// Determines whether the specified event would be considered as enabled

+// based on the state of the specified context. Slightly faster than calling

+// McGenEventEnabled directly.

+//

+#ifndef MCGEN_ENABLE_CHECK

+#define MCGEN_ENABLE_CHECK(Context, Descriptor) (Context.IsEnabled && McGenEventEnabled(&Context, &Descriptor))

+#endif

+

+#if !defined(MCGEN_TRACE_CONTEXT_DEF)

+#define MCGEN_TRACE_CONTEXT_DEF

+// This structure is for use by MC-generated code and should not be used directly.

+typedef struct _MCGEN_TRACE_CONTEXT

+{

+    TRACEHANDLE            RegistrationHandle;

+    TRACEHANDLE            Logger;      // Used as pointer to provider traits.

+    ULONGLONG              MatchAnyKeyword;

+    ULONGLONG              MatchAllKeyword;

+    ULONG                  Flags;

+    ULONG                  IsEnabled;

+    UCHAR                  Level;

+    UCHAR                  Reserve;

+    USHORT                 EnableBitsCount;

+    PULONG                 EnableBitMask;

+    const ULONGLONG*       EnableKeyWords;

+    const UCHAR*           EnableLevel;

+} MCGEN_TRACE_CONTEXT, *PMCGEN_TRACE_CONTEXT;

+#endif // MCGEN_TRACE_CONTEXT_DEF

+

+#if !defined(MCGEN_LEVEL_KEYWORD_ENABLED_DEF)

+#define MCGEN_LEVEL_KEYWORD_ENABLED_DEF

+//

+// Determines whether an event with a given Level and Keyword would be

+// considered as enabled based on the state of the specified context.

+// Note that you may want to use MCGEN_ENABLE_CHECK instead of calling this

+// function directly.

+//

+FORCEINLINE

+BOOLEAN

+McGenLevelKeywordEnabled(

+    _In_ PMCGEN_TRACE_CONTEXT EnableInfo,

+    _In_ UCHAR Level,

+    _In_ ULONGLONG Keyword

+    )

+{

+    //

+    // Check if the event Level is lower than the level at which

+    // the channel is enabled.

+    // If the event Level is 0 or the channel is enabled at level 0,

+    // all levels are enabled.

+    //

+

+    if ((Level <= EnableInfo->Level) || // This also covers the case of Level == 0.

+        (EnableInfo->Level == 0)) {

+

+        //

+        // Check if Keyword is enabled

+        //

+

+        if ((Keyword == (ULONGLONG)0) ||

+            ((Keyword & EnableInfo->MatchAnyKeyword) &&

+             ((Keyword & EnableInfo->MatchAllKeyword) == EnableInfo->MatchAllKeyword))) {

+            return TRUE;

+        }

+    }

+

+    return FALSE;

+}

+#endif // MCGEN_LEVEL_KEYWORD_ENABLED_DEF

+

+#if !defined(MCGEN_EVENT_ENABLED_DEF)

+#define MCGEN_EVENT_ENABLED_DEF

+//

+// Determines whether the specified event would be considered as enabled based

+// on the state of the specified context. Note that you may want to use

+// MCGEN_ENABLE_CHECK instead of calling this function directly.

+//

+FORCEINLINE

+BOOLEAN

+McGenEventEnabled(

+    _In_ PMCGEN_TRACE_CONTEXT EnableInfo,

+    _In_ PCEVENT_DESCRIPTOR EventDescriptor

+    )

+{

+    return McGenLevelKeywordEnabled(EnableInfo, EventDescriptor->Level, EventDescriptor->Keyword);

+}

+#endif // MCGEN_EVENT_ENABLED_DEF

+

+#if !defined(MCGEN_CONTROL_CALLBACK)

+#define MCGEN_CONTROL_CALLBACK

+

+// This function is for use by MC-generated code and should not be used directly.

+DECLSPEC_NOINLINE __inline

+VOID

+__stdcall

+McGenControlCallbackV2(

+    _In_ LPCGUID SourceId,

+    _In_ ULONG ControlCode,

+    _In_ UCHAR Level,

+    _In_ ULONGLONG MatchAnyKeyword,

+    _In_ ULONGLONG MatchAllKeyword,

+    _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData,

+    _Inout_opt_ PVOID CallbackContext

+    )

+/*++

+

+Routine Description:

+

+    This is the notification callback for Windows Vista and later.

+

+Arguments:

+

+    SourceId - The GUID that identifies the session that enabled the provider.

+

+    ControlCode - The parameter indicates whether the provider

+                  is being enabled or disabled.

+

+    Level - The level at which the event is enabled.

+

+    MatchAnyKeyword - The bitmask of keywords that the provider uses to

+                      determine the category of events that it writes.

+

+    MatchAllKeyword - This bitmask additionally restricts the category

+                      of events that the provider writes.

+

+    FilterData - The provider-defined data.

+

+    CallbackContext - The context of the callback that is defined when the provider

+                      called EtwRegister to register itself.

+

+Remarks:

+

+    ETW calls this function to notify provider of enable/disable

+

+--*/

+{

+    PMCGEN_TRACE_CONTEXT Ctx = (PMCGEN_TRACE_CONTEXT)CallbackContext;

+    ULONG Ix;

+#ifndef MCGEN_PRIVATE_ENABLE_CALLBACK_V2

+    UNREFERENCED_PARAMETER(SourceId);

+    UNREFERENCED_PARAMETER(FilterData);

+#endif

+

+    if (Ctx == NULL) {

+        return;

+    }

+

+    switch (ControlCode) {

+

+        case EVENT_CONTROL_CODE_ENABLE_PROVIDER:

+            Ctx->Level = Level;

+            Ctx->MatchAnyKeyword = MatchAnyKeyword;

+            Ctx->MatchAllKeyword = MatchAllKeyword;

+            Ctx->IsEnabled = EVENT_CONTROL_CODE_ENABLE_PROVIDER;

+

+            for (Ix = 0; Ix < Ctx->EnableBitsCount; Ix += 1) {

+                if (McGenLevelKeywordEnabled(Ctx, Ctx->EnableLevel[Ix], Ctx->EnableKeyWords[Ix]) != FALSE) {

+                    Ctx->EnableBitMask[Ix >> 5] |= (1 << (Ix % 32));

+                } else {

+                    Ctx->EnableBitMask[Ix >> 5] &= ~(1 << (Ix % 32));

+                }

+            }

+            break;

+

+        case EVENT_CONTROL_CODE_DISABLE_PROVIDER:

+            Ctx->IsEnabled = EVENT_CONTROL_CODE_DISABLE_PROVIDER;

+            Ctx->Level = 0;

+            Ctx->MatchAnyKeyword = 0;

+            Ctx->MatchAllKeyword = 0;

+            if (Ctx->EnableBitsCount > 0) {

+#pragma warning(suppress: 26451) // Arithmetic overflow cannot occur, no matter the value of EnableBitCount

+                RtlZeroMemory(Ctx->EnableBitMask, (((Ctx->EnableBitsCount - 1) / 32) + 1) * sizeof(ULONG));

+            }

+            break;

+

+        default:

+            break;

+    }

+

+#ifdef MCGEN_PRIVATE_ENABLE_CALLBACK_V2

+    //

+    // Call user defined callback

+    //

+    MCGEN_PRIVATE_ENABLE_CALLBACK_V2(

+        SourceId,

+        ControlCode,

+        Level,

+        MatchAnyKeyword,

+        MatchAllKeyword,

+        FilterData,

+        CallbackContext

+        );

+#endif // MCGEN_PRIVATE_ENABLE_CALLBACK_V2

+

+    return;

+}

+

+#endif // MCGEN_CONTROL_CALLBACK

+

+#ifndef _mcgen_PENABLECALLBACK

+  #if MCGEN_USE_KERNEL_MODE_APIS

+    #define _mcgen_PENABLECALLBACK      PETWENABLECALLBACK

+  #else

+    #define _mcgen_PENABLECALLBACK      PENABLECALLBACK

+  #endif

+#endif // _mcgen_PENABLECALLBACK

+

+#if !defined(_mcgen_PASTE2)

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_PASTE2_imp(a, b) a##b

+#define _mcgen_PASTE2(a, b) _mcgen_PASTE2_imp(a, b)

+#endif // _mcgen_PASTE2

+

+#if !defined(_mcgen_PASTE3)

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_PASTE3_imp(a, b, c) a##b##_##c

+#define _mcgen_PASTE3(a, b, c) _mcgen_PASTE3_imp(a, b, c)

+#endif // _mcgen_PASTE3

+

+//

+// Macro validation

+//

+

+// Validate MCGEN_EVENTREGISTER:

+

+// Trigger an error if MCGEN_EVENTREGISTER is not an unqualified (simple) identifier:

+struct _mcgen_PASTE2(MCGEN_EVENTREGISTER_definition_must_be_an_unqualified_identifier_, MCGEN_EVENTREGISTER);

+

+// Trigger an error if MCGEN_EVENTREGISTER is redefined:

+typedef struct _mcgen_PASTE2(MCGEN_EVENTREGISTER_definition_must_be_an_unqualified_identifier_, MCGEN_EVENTREGISTER)

+    MCGEN_EVENTREGISTER_must_not_be_redefined_between_headers;

+

+// Trigger an error if MCGEN_EVENTREGISTER is defined as a function-like macro:

+typedef void MCGEN_EVENTREGISTER_must_not_be_a_functionLike_macro_MCGEN_EVENTREGISTER;

+typedef int _mcgen_PASTE2(MCGEN_EVENTREGISTER_must_not_be_a_functionLike_macro_, MCGEN_EVENTREGISTER);

+

+// Validate MCGEN_EVENTUNREGISTER:

+

+// Trigger an error if MCGEN_EVENTUNREGISTER is not an unqualified (simple) identifier:

+struct _mcgen_PASTE2(MCGEN_EVENTUNREGISTER_definition_must_be_an_unqualified_identifier_, MCGEN_EVENTUNREGISTER);

+

+// Trigger an error if MCGEN_EVENTUNREGISTER is redefined:

+typedef struct _mcgen_PASTE2(MCGEN_EVENTUNREGISTER_definition_must_be_an_unqualified_identifier_, MCGEN_EVENTUNREGISTER)

+    MCGEN_EVENTUNREGISTER_must_not_be_redefined_between_headers;

+

+// Trigger an error if MCGEN_EVENTUNREGISTER is defined as a function-like macro:

+typedef void MCGEN_EVENTUNREGISTER_must_not_be_a_functionLike_macro_MCGEN_EVENTUNREGISTER;

+typedef int _mcgen_PASTE2(MCGEN_EVENTUNREGISTER_must_not_be_a_functionLike_macro_, MCGEN_EVENTUNREGISTER);

+

+// Validate MCGEN_EVENTSETINFORMATION:

+

+// Trigger an error if MCGEN_EVENTSETINFORMATION is not an unqualified (simple) identifier:

+struct _mcgen_PASTE2(MCGEN_EVENTSETINFORMATION_definition_must_be_an_unqualified_identifier_, MCGEN_EVENTSETINFORMATION);

+

+// Trigger an error if MCGEN_EVENTSETINFORMATION is redefined:

+typedef struct _mcgen_PASTE2(MCGEN_EVENTSETINFORMATION_definition_must_be_an_unqualified_identifier_, MCGEN_EVENTSETINFORMATION)

+    MCGEN_EVENTSETINFORMATION_must_not_be_redefined_between_headers;

+

+// Trigger an error if MCGEN_EVENTSETINFORMATION is defined as a function-like macro:

+typedef void MCGEN_EVENTSETINFORMATION_must_not_be_a_functionLike_macro_MCGEN_EVENTSETINFORMATION;

+typedef int _mcgen_PASTE2(MCGEN_EVENTSETINFORMATION_must_not_be_a_functionLike_macro_, MCGEN_EVENTSETINFORMATION);

+

+// Validate MCGEN_EVENTWRITETRANSFER:

+

+// Trigger an error if MCGEN_EVENTWRITETRANSFER is not an unqualified (simple) identifier:

+struct _mcgen_PASTE2(MCGEN_EVENTWRITETRANSFER_definition_must_be_an_unqualified_identifier_, MCGEN_EVENTWRITETRANSFER);

+

+// Trigger an error if MCGEN_EVENTWRITETRANSFER is redefined:

+typedef struct _mcgen_PASTE2(MCGEN_EVENTWRITETRANSFER_definition_must_be_an_unqualified_identifier_, MCGEN_EVENTWRITETRANSFER)

+    MCGEN_EVENTWRITETRANSFER_must_not_be_redefined_between_headers;;

+

+// Trigger an error if MCGEN_EVENTWRITETRANSFER is defined as a function-like macro:

+typedef void MCGEN_EVENTWRITETRANSFER_must_not_be_a_functionLike_macro_MCGEN_EVENTWRITETRANSFER;

+typedef int _mcgen_PASTE2(MCGEN_EVENTWRITETRANSFER_must_not_be_a_functionLike_macro_, MCGEN_EVENTWRITETRANSFER);

+

+#ifndef McGenEventWrite_def

+#define McGenEventWrite_def

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define McGenEventWrite _mcgen_PASTE2(McGenEventWrite_, MCGEN_EVENTWRITETRANSFER)

+

+// This function is for use by MC-generated code and should not be used directly.

+DECLSPEC_NOINLINE __inline

+ULONG __stdcall

+McGenEventWrite(

+    _In_ PMCGEN_TRACE_CONTEXT Context,

+    _In_ PCEVENT_DESCRIPTOR Descriptor,

+    _In_opt_ LPCGUID ActivityId,

+    _In_range_(1, 128) ULONG EventDataCount,

+    _Pre_cap_(EventDataCount) EVENT_DATA_DESCRIPTOR* EventData

+    )

+{

+    const USHORT UNALIGNED* Traits;

+

+    // Some customized MCGEN_EVENTWRITETRANSFER macros might ignore ActivityId.

+    UNREFERENCED_PARAMETER(ActivityId);

+

+    Traits = (const USHORT UNALIGNED*)(UINT_PTR)Context->Logger;

+

+    if (Traits == NULL) {

+        EventData[0].Ptr = 0;

+        EventData[0].Size = 0;

+        EventData[0].Reserved = 0;

+    } else {

+        EventData[0].Ptr = (ULONG_PTR)Traits;

+        EventData[0].Size = *Traits;

+        EventData[0].Reserved = 2; // EVENT_DATA_DESCRIPTOR_TYPE_PROVIDER_METADATA

+    }

+

+    return MCGEN_EVENTWRITETRANSFER(

+        Context->RegistrationHandle,

+        Descriptor,

+        ActivityId,

+        NULL,

+        EventDataCount,

+        EventData);

+}

+#endif // McGenEventWrite_def

+

+#if !defined(McGenEventRegisterUnregister)

+#define McGenEventRegisterUnregister

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define McGenEventRegister _mcgen_PASTE2(McGenEventRegister_, MCGEN_EVENTREGISTER)

+

+#pragma warning(push)

+#pragma warning(disable:6103)

+// This function is for use by MC-generated code and should not be used directly.

+DECLSPEC_NOINLINE __inline

+ULONG __stdcall

+McGenEventRegister(

+    _In_ LPCGUID ProviderId,

+    _In_opt_ _mcgen_PENABLECALLBACK EnableCallback,

+    _In_opt_ PVOID CallbackContext,

+    _Inout_ PREGHANDLE RegHandle

+    )

+/*++

+

+Routine Description:

+

+    This function registers the provider with ETW.

+

+Arguments:

+

+    ProviderId - Provider ID to register with ETW.

+

+    EnableCallback - Callback to be used.

+

+    CallbackContext - Context for the callback.

+

+    RegHandle - Pointer to registration handle.

+

+Remarks:

+

+    Should not be called if the provider is already registered (i.e. should not

+    be called if *RegHandle != 0). Repeatedly registering a provider is a bug

+    and may indicate a race condition. However, for compatibility with previous

+    behavior, this function will return SUCCESS in this case.

+

+--*/

+{

+    ULONG Error;

+

+    if (*RegHandle != 0)

+    {

+        Error = 0; // ERROR_SUCCESS

+    }

+    else

+    {

+        Error = MCGEN_EVENTREGISTER(ProviderId, EnableCallback, CallbackContext, RegHandle);

+    }

+

+    return Error;

+}

+#pragma warning(pop)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define McGenEventUnregister _mcgen_PASTE2(McGenEventUnregister_, MCGEN_EVENTUNREGISTER)

+

+// This function is for use by MC-generated code and should not be used directly.

+DECLSPEC_NOINLINE __inline

+ULONG __stdcall

+McGenEventUnregister(_Inout_ PREGHANDLE RegHandle)

+/*++

+

+Routine Description:

+

+    Unregister from ETW and set *RegHandle = 0.

+

+Arguments:

+

+    RegHandle - the pointer to the provider registration handle

+

+Remarks:

+

+    If provider has not been registered (i.e. if *RegHandle == 0),

+    return SUCCESS. It is safe to call McGenEventUnregister even if the

+    call to McGenEventRegister returned an error.

+

+--*/

+{

+    ULONG Error;

+

+    if(*RegHandle == 0)

+    {

+        Error = 0; // ERROR_SUCCESS

+    }

+    else

+    {

+        Error = MCGEN_EVENTUNREGISTER(*RegHandle);

+        *RegHandle = (REGHANDLE)0;

+    }

+

+    return Error;

+}

+

+#endif // McGenEventRegisterUnregister

+

+#ifndef _mcgen_EVENT_BIT_SET

+  #if defined(_M_IX86) || defined(_M_X64)

+    // This macro is for use by MC-generated code and should not be used directly.

+    #define _mcgen_EVENT_BIT_SET(EnableBits, BitPosition) ((((const unsigned char*)EnableBits)[BitPosition >> 3] & (1u << (BitPosition & 7))) != 0)

+  #else // CPU type

+    // This macro is for use by MC-generated code and should not be used directly.

+    #define _mcgen_EVENT_BIT_SET(EnableBits, BitPosition) ((EnableBits[BitPosition >> 5] & (1u << (BitPosition & 31))) != 0)

+  #endif // CPU type

+#endif // _mcgen_EVENT_BIT_SET

+

+#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION

+

+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

+// Provider "Microsoft-Windows-DXCompiler-API" event count 16

+//+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

+

+// Provider GUID = 5c65fe8c-9f96-4bfd-9a87-9f8ebd45da64

+EXTERN_C __declspec(selectany) const GUID MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER = {0x5c65fe8c, 0x9f96, 0x4bfd, {0x9a, 0x87, 0x9f, 0x8e, 0xbd, 0x45, 0xda, 0x64}};

+

+#ifndef MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Traits

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Traits NULL

+#endif // MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Traits

+

+//

+// Channel

+//

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_CHANNEL_DXCompilerAnalytic 0x10

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_CHANNEL_DXCompilerAnalytic_KEYWORD 0x8000000000000000

+

+//

+// Tasks

+//

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_TASK_DXCompilerInitialization 0x1

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_TASK_DXCompilerShutdown 0x2

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_TASK_DXCompilerCreateInstance 0x3

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_TASK_DXCompilerIntelliSenseParse 0x4

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_TASK_DXCompilerCompile 0x5

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_TASK_DXCompilerPreprocess 0x6

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_TASK_DXCompilerDisassemble 0x7

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_TASK_DxcValidation 0x8

+

+//

+// Event Descriptors

+//

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerInitialization_Start = {0x0, 0x0, 0x10, 0x4, 0x1, 0x1, 0x8000000000000000};

+#define DXCompilerInitialization_Start_value 0x0

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerInitialization_Stop = {0x1, 0x0, 0x10, 0x4, 0x2, 0x1, 0x8000000000000000};

+#define DXCompilerInitialization_Stop_value 0x1

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerShutdown_Start = {0x2, 0x0, 0x10, 0x4, 0x1, 0x2, 0x8000000000000000};

+#define DXCompilerShutdown_Start_value 0x2

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerShutdown_Stop = {0x3, 0x0, 0x10, 0x4, 0x2, 0x2, 0x8000000000000000};

+#define DXCompilerShutdown_Stop_value 0x3

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerCreateInstance_Start = {0x4, 0x0, 0x10, 0x4, 0x1, 0x3, 0x8000000000000000};

+#define DXCompilerCreateInstance_Start_value 0x4

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerCreateInstance_Stop = {0x5, 0x0, 0x10, 0x4, 0x2, 0x3, 0x8000000000000000};

+#define DXCompilerCreateInstance_Stop_value 0x5

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerIntelliSenseParse_Start = {0x6, 0x0, 0x10, 0x4, 0x1, 0x4, 0x8000000000000000};

+#define DXCompilerIntelliSenseParse_Start_value 0x6

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerIntelliSenseParse_Stop = {0x7, 0x0, 0x10, 0x4, 0x2, 0x4, 0x8000000000000000};

+#define DXCompilerIntelliSenseParse_Stop_value 0x7

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerCompile_Start = {0x8, 0x0, 0x10, 0x4, 0x1, 0x5, 0x8000000000000000};

+#define DXCompilerCompile_Start_value 0x8

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerCompile_Stop = {0x9, 0x0, 0x10, 0x4, 0x2, 0x5, 0x8000000000000000};

+#define DXCompilerCompile_Stop_value 0x9

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerPreprocess_Start = {0xa, 0x0, 0x10, 0x4, 0x1, 0x6, 0x8000000000000000};

+#define DXCompilerPreprocess_Start_value 0xa

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerPreprocess_Stop = {0xb, 0x0, 0x10, 0x4, 0x2, 0x6, 0x8000000000000000};

+#define DXCompilerPreprocess_Stop_value 0xb

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerDisassemble_Start = {0xc, 0x0, 0x10, 0x4, 0x1, 0x7, 0x8000000000000000};

+#define DXCompilerDisassemble_Start_value 0xc

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DXCompilerDisassemble_Stop = {0xd, 0x0, 0x10, 0x4, 0x2, 0x7, 0x8000000000000000};

+#define DXCompilerDisassemble_Stop_value 0xd

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DxcValidation_Start = {0xe, 0x0, 0x10, 0x4, 0x1, 0x8, 0x8000000000000000};

+#define DxcValidation_Start_value 0xe

+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR DxcValidation_Stop = {0xf, 0x0, 0x10, 0x4, 0x2, 0x8, 0x8000000000000000};

+#define DxcValidation_Stop_value 0xf

+

+//

+// MCGEN_DISABLE_PROVIDER_CODE_GENERATION macro:

+// Define this macro to have the compiler skip the generated functions in this

+// header.

+//

+#ifndef MCGEN_DISABLE_PROVIDER_CODE_GENERATION

+

+//

+// Event Enablement Bits

+// These variables are for use by MC-generated code and should not be used directly.

+//

+EXTERN_C __declspec(selectany) DECLSPEC_CACHEALIGN ULONG Microsoft_Windows_DXCompiler_APIEnableBits[1];

+EXTERN_C __declspec(selectany) const ULONGLONG Microsoft_Windows_DXCompiler_APIKeywords[1] = {0x8000000000000000};

+EXTERN_C __declspec(selectany) const unsigned char Microsoft_Windows_DXCompiler_APILevels[1] = {4};

+

+//

+// Provider context

+//

+EXTERN_C __declspec(selectany) MCGEN_TRACE_CONTEXT MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context = {0, (ULONG_PTR)MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Traits, 0, 0, 0, 0, 0, 0, 1, Microsoft_Windows_DXCompiler_APIEnableBits, Microsoft_Windows_DXCompiler_APIKeywords, Microsoft_Windows_DXCompiler_APILevels};

+

+//

+// Provider REGHANDLE

+//

+#define Microsoft_Windows_DXCompiler_APIHandle (MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context.RegistrationHandle)

+

+//

+// This macro is set to 0, indicating that the EventWrite[Name] macros do not

+// have an Activity parameter. This is controlled by the -km and -um options.

+//

+#define MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_EventWriteActivity 0

+

+//

+// Register with ETW using the control GUID specified in the manifest.

+// Invoke this macro during module initialization (i.e. program startup,

+// DLL process attach, or driver load) to initialize the provider.

+// Note that if this function returns an error, the error means that

+// will not work, but no action needs to be taken -- even if EventRegister

+// returns an error, it is generally safe to use EventWrite and

+// EventUnregister macros (they will be no-ops if EventRegister failed).

+//

+#ifndef EventRegisterMicrosoft_Windows_DXCompiler_API

+#define EventRegisterMicrosoft_Windows_DXCompiler_API() McGenEventRegister(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER, McGenControlCallbackV2, &MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &Microsoft_Windows_DXCompiler_APIHandle)

+#endif

+

+//

+// Register with ETW using a specific control GUID (i.e. a GUID other than what

+// is specified in the manifest). Advanced scenarios only.

+//

+#ifndef EventRegisterByGuidMicrosoft_Windows_DXCompiler_API

+#define EventRegisterByGuidMicrosoft_Windows_DXCompiler_API(Guid) McGenEventRegister(&(Guid), McGenControlCallbackV2, &MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &Microsoft_Windows_DXCompiler_APIHandle)

+#endif

+

+//

+// Unregister with ETW and close the provider.

+// Invoke this macro during module shutdown (i.e. program exit, DLL process

+// detach, or driver unload) to unregister the provider.

+// Note that you MUST call EventUnregister before DLL or driver unload

+// (not optional): failure to unregister a provider before DLL or driver unload

+// will result in crashes.

+//

+#ifndef EventUnregisterMicrosoft_Windows_DXCompiler_API

+#define EventUnregisterMicrosoft_Windows_DXCompiler_API() McGenEventUnregister(&Microsoft_Windows_DXCompiler_APIHandle)

+#endif

+

+//

+// MCGEN_ENABLE_FORCONTEXT_CODE_GENERATION macro:

+// Define this macro to enable support for caller-allocated provider context.

+//

+#ifdef MCGEN_ENABLE_FORCONTEXT_CODE_GENERATION

+

+//

+// Advanced scenarios: Caller-allocated provider context.

+// Use when multiple differently-configured provider handles are needed,

+// e.g. for container-aware drivers, one context per container.

+//

+// Usage:

+//

+// - Caller enables the feature before including this header, e.g.

+//   #define MCGEN_ENABLE_FORCONTEXT_CODE_GENERATION 1

+// - Caller allocates memory, e.g. pContext = malloc(sizeof(McGenContext_Microsoft_Windows_DXCompiler_API));

+// - Caller registers the provider, e.g. EventRegisterMicrosoft_Windows_DXCompiler_API_ForContext(pContext);

+// - Caller writes events, e.g. EventWriteMyEvent_ForContext(pContext, ...);

+// - Caller unregisters, e.g. EventUnregisterMicrosoft_Windows_DXCompiler_API_ForContext(pContext);

+// - Caller frees memory, e.g. free(pContext);

+//

+

+typedef struct tagMcGenContext_Microsoft_Windows_DXCompiler_API {

+    // The fields of this structure are subject to change and should

+    // not be accessed directly. To access the provider's REGHANDLE,

+    // use Microsoft_Windows_DXCompiler_APIHandle_ForContext(pContext).

+    MCGEN_TRACE_CONTEXT Context;

+    ULONG EnableBits[1];

+} McGenContext_Microsoft_Windows_DXCompiler_API;

+

+#define EventUnregisterMicrosoft_Windows_DXCompiler_API_ForContext(pContext)           McGenEventUnregister(&(pContext)->Context.RegistrationHandle)

+#define EventRegisterMicrosoft_Windows_DXCompiler_API_ForContext(pContext)             _mcgen_PASTE2(_mcgen_RegisterForContext_Microsoft_Windows_DXCompiler_API_, MCGEN_EVENTREGISTER)(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER, pContext)

+#define EventRegisterByGuidMicrosoft_Windows_DXCompiler_API_ForContext(Guid, pContext) _mcgen_PASTE2(_mcgen_RegisterForContext_Microsoft_Windows_DXCompiler_API_, MCGEN_EVENTREGISTER)(&(Guid), pContext)

+

+//

+// Provider REGHANDLE for caller-allocated context.

+//

+#define Microsoft_Windows_DXCompiler_APIHandle_ForContext(pContext) ((pContext)->Context.RegistrationHandle)

+

+// This function is for use by MC-generated code and should not be used directly.

+// Initialize and register the caller-allocated context.

+__inline

+ULONG __stdcall

+_mcgen_PASTE2(_mcgen_RegisterForContext_Microsoft_Windows_DXCompiler_API_, MCGEN_EVENTREGISTER)(

+    _In_ LPCGUID pProviderId,

+    _Out_ McGenContext_Microsoft_Windows_DXCompiler_API* pContext)

+{

+    RtlZeroMemory(pContext, sizeof(*pContext));

+    pContext->Context.Logger = (ULONG_PTR)MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Traits;

+    pContext->Context.EnableBitsCount = 1;

+    pContext->Context.EnableBitMask = pContext->EnableBits;

+    pContext->Context.EnableKeyWords = Microsoft_Windows_DXCompiler_APIKeywords;

+    pContext->Context.EnableLevel = Microsoft_Windows_DXCompiler_APILevels;

+    return McGenEventRegister(

+        pProviderId,

+        McGenControlCallbackV2,

+        &pContext->Context,

+        &pContext->Context.RegistrationHandle);

+}

+

+// This function is for use by MC-generated code and should not be used directly.

+// Trigger a compile error if called with the wrong parameter type.

+FORCEINLINE

+_Ret_ McGenContext_Microsoft_Windows_DXCompiler_API*

+_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(_In_ McGenContext_Microsoft_Windows_DXCompiler_API* pContext)

+{

+    return pContext;

+}

+

+#endif // MCGEN_ENABLE_FORCONTEXT_CODE_GENERATION

+

+//

+// Enablement check macro for event "DXCompilerInitialization_Start"

+//

+#define EventEnabledDXCompilerInitialization_Start() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerInitialization_Start_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerInitialization_Start"

+//

+#define DxcEtw_DXCompilerInitialization_Start() \

+        MCGEN_EVENT_ENABLED(DXCompilerInitialization_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerInitialization_Start) : 0

+#define DxcEtw_DXCompilerInitialization_Start_AssumeEnabled() \

+        _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerInitialization_Start)

+#define DxcEtw_DXCompilerInitialization_Start_ForContext(pContext) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerInitialization_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Start(&(pContext)->Context, &DXCompilerInitialization_Start) : 0

+#define DxcEtw_DXCompilerInitialization_Start_ForContextAssumeEnabled(pContext) \

+        _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Start(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerInitialization_Start)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Start _mcgen_PASTE2(McTemplateU0_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerInitialization_Stop"

+//

+#define EventEnabledDXCompilerInitialization_Stop() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerInitialization_Stop_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerInitialization_Stop"

+//

+#define DxcEtw_DXCompilerInitialization_Stop(errorCode) \

+        MCGEN_EVENT_ENABLED(DXCompilerInitialization_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerInitialization_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerInitialization_Stop_AssumeEnabled(errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerInitialization_Stop, errorCode)

+#define DxcEtw_DXCompilerInitialization_Stop_ForContext(pContext, errorCode) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerInitialization_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Stop(&(pContext)->Context, &DXCompilerInitialization_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerInitialization_Stop_ForContextAssumeEnabled(pContext, errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Stop(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerInitialization_Stop, errorCode)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerInitialization_Stop _mcgen_PASTE2(McTemplateU0d_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerShutdown_Start"

+//

+#define EventEnabledDXCompilerShutdown_Start() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerShutdown_Start_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerShutdown_Start"

+//

+#define DxcEtw_DXCompilerShutdown_Start() \

+        MCGEN_EVENT_ENABLED(DXCompilerShutdown_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerShutdown_Start) : 0

+#define DxcEtw_DXCompilerShutdown_Start_AssumeEnabled() \

+        _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerShutdown_Start)

+#define DxcEtw_DXCompilerShutdown_Start_ForContext(pContext) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerShutdown_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Start(&(pContext)->Context, &DXCompilerShutdown_Start) : 0

+#define DxcEtw_DXCompilerShutdown_Start_ForContextAssumeEnabled(pContext) \

+        _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Start(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerShutdown_Start)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Start _mcgen_PASTE2(McTemplateU0_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerShutdown_Stop"

+//

+#define EventEnabledDXCompilerShutdown_Stop() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerShutdown_Stop_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerShutdown_Stop"

+//

+#define DxcEtw_DXCompilerShutdown_Stop(errorCode) \

+        MCGEN_EVENT_ENABLED(DXCompilerShutdown_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerShutdown_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerShutdown_Stop_AssumeEnabled(errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerShutdown_Stop, errorCode)

+#define DxcEtw_DXCompilerShutdown_Stop_ForContext(pContext, errorCode) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerShutdown_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Stop(&(pContext)->Context, &DXCompilerShutdown_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerShutdown_Stop_ForContextAssumeEnabled(pContext, errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Stop(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerShutdown_Stop, errorCode)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerShutdown_Stop _mcgen_PASTE2(McTemplateU0d_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerCreateInstance_Start"

+//

+#define EventEnabledDXCompilerCreateInstance_Start() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerCreateInstance_Start_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerCreateInstance_Start"

+//

+#define DxcEtw_DXCompilerCreateInstance_Start() \

+        MCGEN_EVENT_ENABLED(DXCompilerCreateInstance_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerCreateInstance_Start) : 0

+#define DxcEtw_DXCompilerCreateInstance_Start_AssumeEnabled() \

+        _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerCreateInstance_Start)

+#define DxcEtw_DXCompilerCreateInstance_Start_ForContext(pContext) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerCreateInstance_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Start(&(pContext)->Context, &DXCompilerCreateInstance_Start) : 0

+#define DxcEtw_DXCompilerCreateInstance_Start_ForContextAssumeEnabled(pContext) \

+        _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Start(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerCreateInstance_Start)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Start _mcgen_PASTE2(McTemplateU0_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerCreateInstance_Stop"

+//

+#define EventEnabledDXCompilerCreateInstance_Stop() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerCreateInstance_Stop_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerCreateInstance_Stop"

+//

+#define DxcEtw_DXCompilerCreateInstance_Stop(errorCode) \

+        MCGEN_EVENT_ENABLED(DXCompilerCreateInstance_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerCreateInstance_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerCreateInstance_Stop_AssumeEnabled(errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerCreateInstance_Stop, errorCode)

+#define DxcEtw_DXCompilerCreateInstance_Stop_ForContext(pContext, errorCode) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerCreateInstance_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Stop(&(pContext)->Context, &DXCompilerCreateInstance_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerCreateInstance_Stop_ForContextAssumeEnabled(pContext, errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Stop(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerCreateInstance_Stop, errorCode)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerCreateInstance_Stop _mcgen_PASTE2(McTemplateU0d_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerIntelliSenseParse_Start"

+//

+#define EventEnabledDXCompilerIntelliSenseParse_Start() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerIntelliSenseParse_Start_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerIntelliSenseParse_Start"

+//

+#define DxcEtw_DXCompilerIntelliSenseParse_Start() \

+        MCGEN_EVENT_ENABLED(DXCompilerIntelliSenseParse_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerIntelliSenseParse_Start) : 0

+#define DxcEtw_DXCompilerIntelliSenseParse_Start_AssumeEnabled() \

+        _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerIntelliSenseParse_Start)

+#define DxcEtw_DXCompilerIntelliSenseParse_Start_ForContext(pContext) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerIntelliSenseParse_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Start(&(pContext)->Context, &DXCompilerIntelliSenseParse_Start) : 0

+#define DxcEtw_DXCompilerIntelliSenseParse_Start_ForContextAssumeEnabled(pContext) \

+        _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Start(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerIntelliSenseParse_Start)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Start _mcgen_PASTE2(McTemplateU0_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerIntelliSenseParse_Stop"

+//

+#define EventEnabledDXCompilerIntelliSenseParse_Stop() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerIntelliSenseParse_Stop_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerIntelliSenseParse_Stop"

+//

+#define DxcEtw_DXCompilerIntelliSenseParse_Stop(errorCode) \

+        MCGEN_EVENT_ENABLED(DXCompilerIntelliSenseParse_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerIntelliSenseParse_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerIntelliSenseParse_Stop_AssumeEnabled(errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerIntelliSenseParse_Stop, errorCode)

+#define DxcEtw_DXCompilerIntelliSenseParse_Stop_ForContext(pContext, errorCode) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerIntelliSenseParse_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Stop(&(pContext)->Context, &DXCompilerIntelliSenseParse_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerIntelliSenseParse_Stop_ForContextAssumeEnabled(pContext, errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Stop(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerIntelliSenseParse_Stop, errorCode)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerIntelliSenseParse_Stop _mcgen_PASTE2(McTemplateU0d_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerCompile_Start"

+//

+#define EventEnabledDXCompilerCompile_Start() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerCompile_Start_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerCompile_Start"

+//

+#define DxcEtw_DXCompilerCompile_Start() \

+        MCGEN_EVENT_ENABLED(DXCompilerCompile_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerCompile_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerCompile_Start) : 0

+#define DxcEtw_DXCompilerCompile_Start_AssumeEnabled() \

+        _mcgen_TEMPLATE_FOR_DXCompilerCompile_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerCompile_Start)

+#define DxcEtw_DXCompilerCompile_Start_ForContext(pContext) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerCompile_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerCompile_Start(&(pContext)->Context, &DXCompilerCompile_Start) : 0

+#define DxcEtw_DXCompilerCompile_Start_ForContextAssumeEnabled(pContext) \

+        _mcgen_TEMPLATE_FOR_DXCompilerCompile_Start(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerCompile_Start)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerCompile_Start _mcgen_PASTE2(McTemplateU0_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerCompile_Stop"

+//

+#define EventEnabledDXCompilerCompile_Stop() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerCompile_Stop_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerCompile_Stop"

+//

+#define DxcEtw_DXCompilerCompile_Stop(errorCode) \

+        MCGEN_EVENT_ENABLED(DXCompilerCompile_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerCompile_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerCompile_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerCompile_Stop_AssumeEnabled(errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerCompile_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerCompile_Stop, errorCode)

+#define DxcEtw_DXCompilerCompile_Stop_ForContext(pContext, errorCode) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerCompile_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerCompile_Stop(&(pContext)->Context, &DXCompilerCompile_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerCompile_Stop_ForContextAssumeEnabled(pContext, errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerCompile_Stop(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerCompile_Stop, errorCode)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerCompile_Stop _mcgen_PASTE2(McTemplateU0d_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerPreprocess_Start"

+//

+#define EventEnabledDXCompilerPreprocess_Start() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerPreprocess_Start_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerPreprocess_Start"

+//

+#define DxcEtw_DXCompilerPreprocess_Start() \

+        MCGEN_EVENT_ENABLED(DXCompilerPreprocess_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerPreprocess_Start) : 0

+#define DxcEtw_DXCompilerPreprocess_Start_AssumeEnabled() \

+        _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerPreprocess_Start)

+#define DxcEtw_DXCompilerPreprocess_Start_ForContext(pContext) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerPreprocess_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Start(&(pContext)->Context, &DXCompilerPreprocess_Start) : 0

+#define DxcEtw_DXCompilerPreprocess_Start_ForContextAssumeEnabled(pContext) \

+        _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Start(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerPreprocess_Start)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Start _mcgen_PASTE2(McTemplateU0_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerPreprocess_Stop"

+//

+#define EventEnabledDXCompilerPreprocess_Stop() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerPreprocess_Stop_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerPreprocess_Stop"

+//

+#define DxcEtw_DXCompilerPreprocess_Stop(errorCode) \

+        MCGEN_EVENT_ENABLED(DXCompilerPreprocess_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerPreprocess_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerPreprocess_Stop_AssumeEnabled(errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerPreprocess_Stop, errorCode)

+#define DxcEtw_DXCompilerPreprocess_Stop_ForContext(pContext, errorCode) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerPreprocess_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Stop(&(pContext)->Context, &DXCompilerPreprocess_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerPreprocess_Stop_ForContextAssumeEnabled(pContext, errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Stop(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerPreprocess_Stop, errorCode)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerPreprocess_Stop _mcgen_PASTE2(McTemplateU0d_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerDisassemble_Start"

+//

+#define EventEnabledDXCompilerDisassemble_Start() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerDisassemble_Start_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerDisassemble_Start"

+//

+#define DxcEtw_DXCompilerDisassemble_Start() \

+        MCGEN_EVENT_ENABLED(DXCompilerDisassemble_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerDisassemble_Start) : 0

+#define DxcEtw_DXCompilerDisassemble_Start_AssumeEnabled() \

+        _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerDisassemble_Start)

+#define DxcEtw_DXCompilerDisassemble_Start_ForContext(pContext) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerDisassemble_Start) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Start(&(pContext)->Context, &DXCompilerDisassemble_Start) : 0

+#define DxcEtw_DXCompilerDisassemble_Start_ForContextAssumeEnabled(pContext) \

+        _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Start(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerDisassemble_Start)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Start _mcgen_PASTE2(McTemplateU0_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DXCompilerDisassemble_Stop"

+//

+#define EventEnabledDXCompilerDisassemble_Stop() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDXCompilerDisassemble_Stop_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DXCompilerDisassemble_Stop"

+//

+#define DxcEtw_DXCompilerDisassemble_Stop(errorCode) \

+        MCGEN_EVENT_ENABLED(DXCompilerDisassemble_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerDisassemble_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerDisassemble_Stop_AssumeEnabled(errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DXCompilerDisassemble_Stop, errorCode)

+#define DxcEtw_DXCompilerDisassemble_Stop_ForContext(pContext, errorCode) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DXCompilerDisassemble_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Stop(&(pContext)->Context, &DXCompilerDisassemble_Stop, errorCode) : 0

+#define DxcEtw_DXCompilerDisassemble_Stop_ForContextAssumeEnabled(pContext, errorCode) \

+        _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Stop(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DXCompilerDisassemble_Stop, errorCode)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DXCompilerDisassemble_Stop _mcgen_PASTE2(McTemplateU0d_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DxcValidation_Start"

+//

+#define EventEnabledDxcValidation_Start() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDxcValidation_Start_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DxcValidation_Start"

+//

+#define DxcEtw_DxcValidation_Start() \

+        MCGEN_EVENT_ENABLED(DxcValidation_Start) \

+        ? _mcgen_TEMPLATE_FOR_DxcValidation_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DxcValidation_Start) : 0

+#define DxcEtw_DxcValidation_Start_AssumeEnabled() \

+        _mcgen_TEMPLATE_FOR_DxcValidation_Start(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DxcValidation_Start)

+#define DxcEtw_DxcValidation_Start_ForContext(pContext) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DxcValidation_Start) \

+        ? _mcgen_TEMPLATE_FOR_DxcValidation_Start(&(pContext)->Context, &DxcValidation_Start) : 0

+#define DxcEtw_DxcValidation_Start_ForContextAssumeEnabled(pContext) \

+        _mcgen_TEMPLATE_FOR_DxcValidation_Start(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DxcValidation_Start)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DxcValidation_Start _mcgen_PASTE2(McTemplateU0_, MCGEN_EVENTWRITETRANSFER)

+

+//

+// Enablement check macro for event "DxcValidation_Stop"

+//

+#define EventEnabledDxcValidation_Stop() _mcgen_EVENT_BIT_SET(Microsoft_Windows_DXCompiler_APIEnableBits, 0)

+#define EventEnabledDxcValidation_Stop_ForContext(pContext) _mcgen_EVENT_BIT_SET(_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->EnableBits, 0)

+

+//

+// Event write macros for event "DxcValidation_Stop"

+//

+#define DxcEtw_DxcValidation_Stop(errorCode) \

+        MCGEN_EVENT_ENABLED(DxcValidation_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DxcValidation_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DxcValidation_Stop, errorCode) : 0

+#define DxcEtw_DxcValidation_Stop_AssumeEnabled(errorCode) \

+        _mcgen_TEMPLATE_FOR_DxcValidation_Stop(&MICROSOFT_WINDOWS_DXCOMPILER_PROVIDER_Context, &DxcValidation_Stop, errorCode)

+#define DxcEtw_DxcValidation_Stop_ForContext(pContext, errorCode) \

+        MCGEN_EVENT_ENABLED_FORCONTEXT(pContext, DxcValidation_Stop) \

+        ? _mcgen_TEMPLATE_FOR_DxcValidation_Stop(&(pContext)->Context, &DxcValidation_Stop, errorCode) : 0

+#define DxcEtw_DxcValidation_Stop_ForContextAssumeEnabled(pContext, errorCode) \

+        _mcgen_TEMPLATE_FOR_DxcValidation_Stop(&_mcgen_CheckContextType_Microsoft_Windows_DXCompiler_API(pContext)->Context, &DxcValidation_Stop, errorCode)

+

+// This macro is for use by MC-generated code and should not be used directly.

+#define _mcgen_TEMPLATE_FOR_DxcValidation_Stop _mcgen_PASTE2(McTemplateU0d_, MCGEN_EVENTWRITETRANSFER)

+

+#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION

+

+//

+// MCGEN_DISABLE_PROVIDER_CODE_GENERATION macro:

+// Define this macro to have the compiler skip the generated functions in this

+// header.

+//

+#ifndef MCGEN_DISABLE_PROVIDER_CODE_GENERATION

+

+//

+// Template Functions

+//

+

+//

+// Function for template "(default)" (and possibly others).

+// This function is for use by MC-generated code and should not be used directly.

+//

+#ifndef McTemplateU0_def

+#define McTemplateU0_def

+ETW_INLINE

+ULONG

+_mcgen_PASTE2(McTemplateU0_, MCGEN_EVENTWRITETRANSFER)(

+    _In_ PMCGEN_TRACE_CONTEXT Context,

+    _In_ PCEVENT_DESCRIPTOR Descriptor

+    )

+{

+#define McTemplateU0_ARGCOUNT 0

+

+    EVENT_DATA_DESCRIPTOR EventData[McTemplateU0_ARGCOUNT + 1];

+

+    return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0_ARGCOUNT + 1, EventData);

+}

+#endif // McTemplateU0_def

+

+//

+// Function for template "OperationResultTemplate" (and possibly others).

+// This function is for use by MC-generated code and should not be used directly.

+//

+#ifndef McTemplateU0d_def

+#define McTemplateU0d_def

+ETW_INLINE

+ULONG

+_mcgen_PASTE2(McTemplateU0d_, MCGEN_EVENTWRITETRANSFER)(

+    _In_ PMCGEN_TRACE_CONTEXT Context,

+    _In_ PCEVENT_DESCRIPTOR Descriptor,

+    _In_ const signed int  _Arg0

+    )

+{

+#define McTemplateU0d_ARGCOUNT 1

+

+    EVENT_DATA_DESCRIPTOR EventData[McTemplateU0d_ARGCOUNT + 1];

+

+    EventDataDescCreate(&EventData[1],&_Arg0, sizeof(const signed int)  );

+

+    return McGenEventWrite(Context, Descriptor, NULL, McTemplateU0d_ARGCOUNT + 1, EventData);

+}

+#endif // McTemplateU0d_def

+

+#endif // MCGEN_DISABLE_PROVIDER_CODE_GENERATION

+

+#if defined(__cplusplus)

+}

+#endif

+

+#define MSG_eventProviderName                0x90000001L

diff --git a/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetw.rc b/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetw.rc
new file mode 100644
index 0000000..af8a578
--- /dev/null
+++ b/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetw.rc
@@ -0,0 +1,3 @@
+LANGUAGE 0x9,0x1

+1 11 "dxcetw_MSG00001.bin"

+1 WEVT_TEMPLATE "dxcetwTEMP.BIN"

diff --git a/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetwTEMP.BIN b/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetwTEMP.BIN
new file mode 100644
index 0000000..a2913d6
--- /dev/null
+++ b/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetwTEMP.BIN
Binary files differ
diff --git a/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetw_MSG00001.bin b/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetw_MSG00001.bin
new file mode 100644
index 0000000..f7cb13e
--- /dev/null
+++ b/third_party/gn/dxc/win_build_output/mc/include/dxc/Tracing/dxcetw/dxcetw_MSG00001.bin
Binary files differ