Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .pipelines/OneBranch.Official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ extends:
platform:
name: 'windows_undocked'
product: 'build_tools'

featureFlags:
WindowsHostVersion:
Version: 2022

cloudvault:
enabled: false

globalSdl:
isNativeCode: true
asyncSdl:
Expand Down
4 changes: 2 additions & 2 deletions .pipelines/OneBranch.PullRequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ extends:
platform:
name: 'windows_undocked'
product: 'build_tools'

featureFlags:
WindowsHostVersion:
Version: 2022

globalSdl:
isNativeCode: true
tsa:
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/jobs/OneBranchBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
ob_sdl_prefast_enabled: true
ob_sdl_prefast_runDuring: "Guardian"
ob_sdl_checkCompliantCompilerWarnings: true

ob_symbolsPublishing_enabled: ${{ parameters.OfficialBuild }}
ob_symbolsPublishing_symbolsFolder: '$(ob_outputDirectory)'
ob_symbolsPublishing_searchPattern: '**\*.pdb'
Expand Down
2 changes: 1 addition & 1 deletion .pipelines/jobs/OneBranchNuGet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
- job:
pool:
type: windows

variables:
ob_outputDirectory: '$(Build.SourcesDirectory)\out'
PackageVersion: ${{ parameters.NugetPackageVersion }}
Expand Down
8 changes: 4 additions & 4 deletions .pipelines/jobs/OneBranchVsix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
ob_sdl_prefast_enabled: true
ob_sdl_prefast_runDuring: 'Build'
ob_sdl_checkCompliantCompilerWarnings: true

steps:
- task: UseDotNet@2
continueOnError: true
Expand Down Expand Up @@ -82,7 +82,7 @@ jobs:
inputs:
artifactName: 'drop_build_arm64'
targetPath: '$(Build.SourcesDirectory)\arm64'

- task: DownloadPipelineArtifact@2
displayName: 'Download NuGet'
inputs:
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
signing_profile: external_distribution
files_to_sign: '**\*.dll'
search_root: '$(Agent.TempDirectory)\$(VsixFilename)'

- task: ArchiveFiles@2
displayName: 'Repack signed VSIX contents'
inputs:
Expand Down Expand Up @@ -146,4 +146,4 @@ jobs:
$(VsixFilename).pdb
$(VsixFilename).json
TargetFolder: '$(ob_outputDirectory)'

2 changes: 1 addition & 1 deletion .pipelines/variables/version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ parameters:
- name: OfficialBuild
type: boolean
default: false

variables:
MajorVersion: "2"
MinorVersion: "0"
Expand Down
4 changes: 1 addition & 3 deletions about_module.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,17 +39,15 @@ First, write all header files in the following pattern:
#pragma once
#ifndef WINRT_XXX_H
#define WINRT_XXX_H
#pragma push_macro("WINRT_EXPORT")
#undef WINRT_EXPORT
#if !defined(WINRT_MODULE) // legacy header path
#ifndef WINRT_MODULE // legacy header path
#define WINRT_EXPORT
#include <winrt/base.h>
#include <dep headers>
#else
#define WINRT_EXPORT export
#endif
// declarations/definitions
#pragma pop_macro("WINRT_EXPORT")
#endif
```

Expand Down
13 changes: 7 additions & 6 deletions build_nuget.cmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
rem @echo off

nuget >nul 2>&1
if %errorlevel% neq 0 (
echo NuGet is not available. Please install NuGet CLI from https://www.nuget.org/downloads and add it to PATH.
exit /b 1
)
if not exist ".\.nuget" mkdir ".\.nuget"
if not exist ".\.nuget\nuget.exe" powershell -Command "$ProgressPreference = 'SilentlyContinue' ; Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile .\.nuget\nuget.exe"

call .nuget\nuget.exe restore cppwinrt.slnx
call .nuget\nuget.exe restore natvis\cppwinrtvisualizer.slnx
call .nuget\nuget.exe restore test\nuget\NugetTest.slnx

set target_version=%1
if "%target_version%"=="" set target_version=3.0.0.0
Expand All @@ -19,4 +20,4 @@ call msbuild /m /p:Configuration=Release,Platform=x64,CppWinRTBuildVersion=%targ
call msbuild /m /p:Configuration=Release,Platform=arm64,CppWinRTBuildVersion=%target_version% cppwinrt.slnx /t:cppwinrt

rem Build nuget
nuget pack nuget\YexuanXiao.CppWinRTPlus.nuspec -Properties target_version=%target_version%;cppwinrt_exe_x86=%cd%\_build\x86\Release\cppwinrt.exe;cppwinrt_exe_amd64=%cd%\_build\x64\Release\cppwinrt.exe;cppwinrt_exe_arm64=%cd%\_build\arm64\Release\cppwinrt.exe;cppwinrt_fast_fwd_x86=%cd%\_build\x86\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=%cd%\_build\x64\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=%cd%\_build\arm64\Release\cppwinrt_fast_forwarder.lib
.nuget\nuget pack nuget\YexuanXiao.CppWinRTPlus.nuspec -Properties target_version=%target_version%;cppwinrt_exe_x86=%cd%\_build\x86\Release\cppwinrt.exe;cppwinrt_exe_amd64=%cd%\_build\x64\Release\cppwinrt.exe;cppwinrt_exe_arm64=%cd%\_build\arm64\Release\cppwinrt.exe;cppwinrt_fast_fwd_x86=%cd%\_build\x86\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_x64=%cd%\_build\x64\Release\cppwinrt_fast_forwarder.lib;cppwinrt_fast_fwd_arm64=%cd%\_build\arm64\Release\cppwinrt_fast_forwarder.lib
2 changes: 1 addition & 1 deletion cppwinrt.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@
<Project Path="scratch/scratch.vcxproj">
<BuildDependency Project="cppwinrt/cppwinrt.vcxproj" />
</Project>
</Solution>
</Solution>
4 changes: 2 additions & 2 deletions cppwinrt/cmd_reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ namespace cppwinrt
}

std::filesystem::path normalized = std::filesystem::absolute(path).lexically_normal();

std::wstring const& sv = normalized.native();

if (sv.starts_with(LR"(\\?\)") || sv.starts_with(LR"(\\.\)")) {
return normalized;
}
Expand Down
10 changes: 5 additions & 5 deletions cppwinrt/code_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,20 +129,20 @@ namespace cppwinrt
static void write_module_aware_export_includes_start(writer& w)
{
w.write(R"(
#if !defined(WINRT_MODULE)
#ifndef WINRT_MODULE
)");
}

static void write_module_aware_export_includes_end(writer& w)
{
w.write(R"(
#endif
w.write(R"(#endif

)");
}

[[nodiscard]] static finish_with wrap_module_aware_includes_guard(writer& w, bool enable_module)
[[nodiscard]] static finish_with wrap_module_aware_includes_guard(writer& w, bool enable)
{
if (enable_module)
if (enable)
{
write_module_aware_export_includes_start(w);
return { w, write_module_aware_export_includes_end };
Expand Down
93 changes: 28 additions & 65 deletions cppwinrt/file_writers.h
Original file line number Diff line number Diff line change
Expand Up @@ -192,20 +192,14 @@ namespace cppwinrt
write_preamble(w);
write_open_file_guard(w, ns, '0');

if (settings.modules)
{
write_module_aware_export_includes_start(w);
}
auto wrap_includes_guard = wrap_module_aware_includes_guard(w, !w.depends.empty() && settings.modules);

for (auto&& depends : w.depends)
{
auto wrap_type = wrap_type_namespace(w, depends.first);
w.write_each<write_forward>(depends.second);
}

if (settings.modules)
{
write_module_aware_export_includes_end(w);
for (auto&& depends : w.depends)
{
auto wrap_type = wrap_type_namespace(w, depends.first);
w.write_each<write_forward>(depends.second);
}
}

w.save_header('0');
Expand Down Expand Up @@ -238,21 +232,15 @@ namespace cppwinrt
write_preamble(w);
write_open_file_guard(w, ns, '1');

if (settings.modules)
{
write_module_aware_export_includes_start(w);
}
auto wrap_includes_guard = wrap_module_aware_includes_guard(w, settings.modules);

for (auto&& depends : w.depends)
{
w.write_depends(depends.first, '0');
}

w.write_depends(w.type_namespace, '0');
for (auto&& depends : w.depends)
{
w.write_depends(depends.first, '0');
}

if (settings.modules)
{
write_module_aware_export_includes_end(w);
w.write_depends(w.type_namespace, '0');
}

w.save_header('1');
Expand Down Expand Up @@ -290,21 +278,15 @@ namespace cppwinrt

char const impl = promote ? '2' : '1';

if (settings.modules)
{
write_module_aware_export_includes_start(w);
}
auto wrap_includes_guard = wrap_module_aware_includes_guard(w, settings.modules);

for (auto&& depends : w.depends)
{
w.write_depends(depends.first, impl);
}

w.write_depends(w.type_namespace, '1');
for (auto&& depends : w.depends)
{
w.write_depends(depends.first, impl);
}

if (settings.modules)
{
write_module_aware_export_includes_end(w);
w.write_depends(w.type_namespace, '1');
}

w.save_header('2');
Expand All @@ -318,9 +300,7 @@ namespace cppwinrt
// Provide minimal textual includes required for macros / intrinsics / feature-test macros.
// In Debug builds, include <crtdbg.h> to provide _ASSERTE for WINRT_ASSERT.
// Provide winrt/module.h to define the WINRT_IMPL_* macros (macros are not shared via import).
w.write(R"(
module;

w.write(R"(module;
#define WINRT_MODULE
#include <intrin.h>
#include <cstddef>
Expand All @@ -329,7 +309,6 @@ module;
#include <crtdbg.h>
#endif
#include "winrt/module.h"

)");
}

Expand Down Expand Up @@ -391,7 +370,7 @@ export module winrt.numerics;
#include <directxmath.h>

#define _WINDOWS_NUMERICS_NAMESPACE_ winrt::Windows::Foundation::Numerics
#define _WINDOWS_NUMERICS_BEGIN_NAMESPACE_ export namespace winrt::Windows::Foundation::Numerics
#define _WINDOWS_NUMERICS_BEGIN_NAMESPACE_ export extern "C++" namespace winrt::Windows::Foundation::Numerics
#define _WINDOWS_NUMERICS_END_NAMESPACE_
#include <windowsnumerics.impl.h>
#undef _WINDOWS_NUMERICS_NAMESPACE_
Expand Down Expand Up @@ -551,12 +530,6 @@ export import winrt.base;

w.write('\n');

w.write(R"(#pragma push_macro("WINRT_EXPORT")
#undef WINRT_EXPORT
#define WINRT_EXPORT export

)");

// Export forward declarations for all projected types in this SCC. This provides names early enough for any
// SCC-internal cycles that show up in the impl headers.
for (auto&& ns : namespaces)
Expand All @@ -578,10 +551,6 @@ export import winrt.base;
w.write_each<write_forward>(members.contracts);
}

w.write(R"(#pragma pop_macro("WINRT_EXPORT")

)");

// Pull in the per-namespace impl headers in a stable phase order so that all forward declarations are present
// before definitions, regardless of SCC member ordering.
for (auto&& ns : namespaces)
Expand Down Expand Up @@ -661,24 +630,18 @@ export import winrt.base;
write_preamble(w);
write_open_file_guard(w, ns);

if (settings.modules)
{
write_module_aware_export_includes_start(w);
}

write_version_assert(w);
write_parent_depends(w, c, ns);
auto wrap_includes_guard = wrap_module_aware_includes_guard(w, settings.modules);

for (auto&& depends : w.depends)
{
w.write_depends(depends.first, '2');
}
write_version_assert(w);
write_parent_depends(w, c, ns);

w.write_depends(w.type_namespace, '2');
for (auto&& depends : w.depends)
{
w.write_depends(depends.first, '2');
}

if (settings.modules)
{
write_module_aware_export_includes_end(w);
w.write_depends(w.type_namespace, '2');
}

w.save_header();
Expand Down
2 changes: 1 addition & 1 deletion fast_fwd/arm64/thunks.asm
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
; Get method address from owner abi vtable
ldr x0, [x1]
ldr x15, [x0, x12, lsl #3]

; Verify indirect call target
adrp x12, __guard_check_icall_fptr
ldr x12, [x12, __guard_check_icall_fptr]
Expand Down
2 changes: 1 addition & 1 deletion fast_fwd/win32/thunks.asm
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ InvokeForwarder PROC
mov ecx, dword ptr[esp + 4]
mov edx, dword ptr[ecx + 4]
mov [esp + 4], edx

; Add offset and index
add eax, dword ptr [ecx + 8]

Expand Down
2 changes: 1 addition & 1 deletion natvis/cppwinrt_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ TypeSig ResolveGenericTypePart(DkmProcess* process, iter& it, sent const& end)
{
return TypeSig{ FindGuidType() };
}

TypeDef type = FindSimpleType(process, partName);
auto tickPos = partName.rfind('`');
if (tickPos == partName.npos)
Expand Down
2 changes: 1 addition & 1 deletion natvis/object_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ HRESULT object_visualizer::CreateEvaluationResult(_Deref_out_ DkmEvaluationResul
auto valueHome = make_com_ptr(m_pVisualizedExpression->ValueHome());
com_ptr<DkmPointerValueHome> pPointerValueHome = valueHome.as<DkmPointerValueHome>();
auto address = pPointerValueHome->Address();

com_ptr<DkmString> pValue;
DkmEvaluationResultFlags_t evalResultFlags = DkmEvaluationResultFlags::ReadOnly | DkmEvaluationResultFlags::Expandable;
if (requires_refresh(address, m_pVisualizedExpression->InspectionContext()->EvaluationFlags()))
Expand Down
4 changes: 2 additions & 2 deletions natvis/property_visualizer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ HRESULT property_visualizer::GetChildren(

// Need to create a DkmArray of DkmChildVisualizedExpression that contain the evaluation results and return that.
DkmAllocArray(initialChildren.Length, pVisualizedInitialChildren);

for (DWORD i = 0; i < initialChildren.Length; i++)
{
auto pCurrEvaluationResult = make_com_ptr(initialChildren.Members[i]);
Expand Down Expand Up @@ -67,7 +67,7 @@ HRESULT property_visualizer::GetItems(
IF_FAIL_RET(m_pVisualizedExpression->GetItemsCallback(pEnumContext, StartIndex, Count, &evaluationResults));

DkmAllocArray(evaluationResults.Length, pItems);

for (DWORD i = 0; i < evaluationResults.Length; i++)
{
auto pCurrEvaluationResult = make_com_ptr(evaluationResults.Members[i]);
Expand Down
Loading