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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion .github/workflows/gen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
strategy:
fail-fast: false
matrix:
tool: [bindings, package, reactor, webview, win32, wdk, windows, yml, license, workspace, features]
tool: [bindings, package, reactor, webview, win32, wdk, winrt, roundtrip, yml, license, workspace, features]
steps:
- name: Checkout
uses: actions/checkout@v7
Expand Down
Binary file modified crates/libs/bindgen/default/Windows.Wdk.winmd
Binary file not shown.
Binary file modified crates/libs/bindgen/default/Windows.Win32.winmd
Binary file not shown.
Binary file modified crates/libs/bindgen/default/Windows.winmd
Binary file not shown.
13 changes: 8 additions & 5 deletions crates/libs/bindgen/default/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ committed `metadata/wdk/*.rdl` corpus is the snapshot.

## `Windows.winmd`

The WinRT metadata, generated in-house by `tool_windows` (`cargo run -p tool_windows`)
by merging the per-contract `.winmd` files from the Windows SDK Contracts NuGet package
with `windows-metadata` (the same merger `tool_win32`/`tool_wdk` use), replacing the
external `mdmerge` tool.
The WinRT metadata, generated in-house by `tool_winrt` (`cargo run -p tool_winrt`) by
merging the per-contract `.winmd` files from the Windows SDK Contracts NuGet package with
`windows-metadata` (the same merger `tool_win32`/`tool_wdk` use, replacing the external
`mdmerge` tool), decompiling the result to the committed `metadata/winrt` RDL snapshot, and
compiling that snapshot back into this winmd. As with `metadata/win32` and `metadata/wdk`,
the RDL is the reviewable source of truth: a WinRT metadata change shows up as a readable RDL
`git diff`, and `tool_roundtrip` re-validates the round-trip without the SDK.

- Source: <https://www.nuget.org/packages/Microsoft.Windows.SDK.Contracts>
- Version: `10.0.28000.2270` (pinned in `crates/tools/windows/src/main.rs`)
- Version: `10.0.28000.2270` (pinned in `crates/tools/winrt/src/main.rs`)

---

Expand Down
32 changes: 17 additions & 15 deletions crates/libs/collections/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1381,19 +1381,19 @@ impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'sta
impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'static>
IObservableMap<K, V>
{
pub fn MapChanged<F>(&self, vhnd: F) -> windows_core::Result<windows_core::EventRevoker>
pub fn MapChanged<F>(&self, handler: F) -> windows_core::Result<windows_core::EventRevoker>
where
F: Fn(windows_core::Ref<Self>, windows_core::Ref<IMapChangedEventArgs<K>>) + Send + 'static,
{
let vhnd = <MapChangedEventHandler<K, V>>::new(move |a0, a1| {
vhnd(a0, a1);
let handler = <MapChangedEventHandler<K, V>>::new(move |a0, a1| {
handler(a0, a1);
Ok(())
});
unsafe {
let mut result__ = core::mem::zeroed();
let token__ = (windows_core::Interface::vtable(self).MapChanged)(
windows_core::Interface::as_raw(self),
windows_core::Interface::as_raw(&vhnd),
windows_core::Interface::as_raw(&handler),
&mut result__,
)
.map(|| result__)?;
Expand Down Expand Up @@ -1537,7 +1537,7 @@ where
{
fn MapChanged(
&self,
vhnd: windows_core::Ref<MapChangedEventHandler<K, V>>,
handler: windows_core::Ref<MapChangedEventHandler<K, V>>,
) -> windows_core::Result<i64>;
fn RemoveMapChanged(&self, token: i64) -> windows_core::Result<()>;
}
Expand All @@ -1552,13 +1552,13 @@ impl<K: windows_core::RuntimeType + 'static, V: windows_core::RuntimeType + 'sta
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
vhnd: *mut core::ffi::c_void,
handler: *mut core::ffi::c_void,
result__: *mut i64,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
match IObservableMap_Impl::MapChanged(this, core::mem::transmute_copy(&vhnd)) {
match IObservableMap_Impl::MapChanged(this, core::mem::transmute_copy(&handler)) {
Ok(ok__) => {
result__.write(ok__);
windows_core::HRESULT(0)
Expand Down Expand Up @@ -1654,19 +1654,19 @@ impl<T: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<IVector<
const QUERY: bool = true;
}
impl<T: windows_core::RuntimeType + 'static> IObservableVector<T> {
pub fn VectorChanged<F>(&self, vhnd: F) -> windows_core::Result<windows_core::EventRevoker>
pub fn VectorChanged<F>(&self, handler: F) -> windows_core::Result<windows_core::EventRevoker>
where
F: Fn(windows_core::Ref<Self>, windows_core::Ref<IVectorChangedEventArgs>) + Send + 'static,
{
let vhnd = <VectorChangedEventHandler<T>>::new(move |a0, a1| {
vhnd(a0, a1);
let handler = <VectorChangedEventHandler<T>>::new(move |a0, a1| {
handler(a0, a1);
Ok(())
});
unsafe {
let mut result__ = core::mem::zeroed();
let token__ = (windows_core::Interface::vtable(self).VectorChanged)(
windows_core::Interface::as_raw(self),
windows_core::Interface::as_raw(&vhnd),
windows_core::Interface::as_raw(&handler),
&mut result__,
)
.map(|| result__)?;
Expand Down Expand Up @@ -1863,7 +1863,7 @@ where
{
fn VectorChanged(
&self,
vhnd: windows_core::Ref<VectorChangedEventHandler<T>>,
handler: windows_core::Ref<VectorChangedEventHandler<T>>,
) -> windows_core::Result<i64>;
fn RemoveVectorChanged(&self, token: i64) -> windows_core::Result<()>;
}
Expand All @@ -1875,14 +1875,16 @@ impl<T: windows_core::RuntimeType + 'static> IObservableVector_Vtbl<T> {
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
vhnd: *mut core::ffi::c_void,
handler: *mut core::ffi::c_void,
result__: *mut i64,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
match IObservableVector_Impl::VectorChanged(this, core::mem::transmute_copy(&vhnd))
{
match IObservableVector_Impl::VectorChanged(
this,
core::mem::transmute_copy(&handler),
) {
Ok(ok__) => {
result__.write(ok__);
windows_core::HRESULT(0)
Expand Down
70 changes: 32 additions & 38 deletions crates/libs/future/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,14 +746,14 @@ windows_core::imp::interface_hierarchy!(
);
windows_core::imp::required_hierarchy!(IAsyncAction, IAsyncInfo);
impl IAsyncAction {
pub fn SetCompleted<P0>(&self, handler: P0) -> windows_core::Result<()>
pub fn SetCompleted<P0>(&self, value: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<AsyncActionCompletedHandler>,
{
unsafe {
(windows_core::Interface::vtable(self).SetCompleted)(
windows_core::Interface::as_raw(self),
handler.param().abi(),
value.param().abi(),
)
.ok()
}
Expand Down Expand Up @@ -832,7 +832,7 @@ impl windows_core::RuntimeName for IAsyncAction {
pub trait IAsyncAction_Impl: IAsyncInfo_Impl {
fn SetCompleted(
&self,
handler: windows_core::Ref<AsyncActionCompletedHandler>,
value: windows_core::Ref<AsyncActionCompletedHandler>,
) -> windows_core::Result<()>;
fn Completed(&self) -> windows_core::Result<AsyncActionCompletedHandler>;
fn GetResults(&self) -> windows_core::Result<()>;
Expand All @@ -841,12 +841,12 @@ impl IAsyncAction_Vtbl {
pub const fn new<Identity: IAsyncAction_Impl, const OFFSET: isize>() -> Self {
unsafe extern "system" fn SetCompleted<Identity: IAsyncAction_Impl, const OFFSET: isize>(
this: *mut core::ffi::c_void,
handler: *mut core::ffi::c_void,
value: *mut core::ffi::c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IAsyncAction_Impl::SetCompleted(this, core::mem::transmute_copy(&handler)).into()
IAsyncAction_Impl::SetCompleted(this, core::mem::transmute_copy(&value)).into()
}
}
unsafe extern "system" fn Completed<Identity: IAsyncAction_Impl, const OFFSET: isize>(
Expand Down Expand Up @@ -941,14 +941,14 @@ impl<TProgress: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<
const QUERY: bool = true;
}
impl<TProgress: windows_core::RuntimeType + 'static> IAsyncActionWithProgress<TProgress> {
pub fn SetProgress<P0>(&self, handler: P0) -> windows_core::Result<()>
pub fn SetProgress<P0>(&self, value: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<AsyncActionProgressHandler<TProgress>>,
{
unsafe {
(windows_core::Interface::vtable(self).SetProgress)(
windows_core::Interface::as_raw(self),
handler.param().abi(),
value.param().abi(),
)
.ok()
}
Expand All @@ -963,14 +963,14 @@ impl<TProgress: windows_core::RuntimeType + 'static> IAsyncActionWithProgress<TP
.and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn SetCompleted<P0>(&self, handler: P0) -> windows_core::Result<()>
pub fn SetCompleted<P0>(&self, value: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<AsyncActionWithProgressCompletedHandler<TProgress>>,
{
unsafe {
(windows_core::Interface::vtable(self).SetCompleted)(
windows_core::Interface::as_raw(self),
handler.param().abi(),
value.param().abi(),
)
.ok()
}
Expand Down Expand Up @@ -1064,12 +1064,12 @@ where
{
fn SetProgress(
&self,
handler: windows_core::Ref<AsyncActionProgressHandler<TProgress>>,
value: windows_core::Ref<AsyncActionProgressHandler<TProgress>>,
) -> windows_core::Result<()>;
fn Progress(&self) -> windows_core::Result<AsyncActionProgressHandler<TProgress>>;
fn SetCompleted(
&self,
handler: windows_core::Ref<AsyncActionWithProgressCompletedHandler<TProgress>>,
value: windows_core::Ref<AsyncActionWithProgressCompletedHandler<TProgress>>,
) -> windows_core::Result<()>;
fn Completed(&self)
-> windows_core::Result<AsyncActionWithProgressCompletedHandler<TProgress>>;
Expand All @@ -1084,16 +1084,13 @@ impl<TProgress: windows_core::RuntimeType + 'static> IAsyncActionWithProgress_Vt
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
handler: *mut core::ffi::c_void,
value: *mut core::ffi::c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IAsyncActionWithProgress_Impl::SetProgress(
this,
core::mem::transmute_copy(&handler),
)
.into()
IAsyncActionWithProgress_Impl::SetProgress(this, core::mem::transmute_copy(&value))
.into()
}
}
unsafe extern "system" fn Progress<
Expand Down Expand Up @@ -1123,16 +1120,13 @@ impl<TProgress: windows_core::RuntimeType + 'static> IAsyncActionWithProgress_Vt
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
handler: *mut core::ffi::c_void,
value: *mut core::ffi::c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IAsyncActionWithProgress_Impl::SetCompleted(
this,
core::mem::transmute_copy(&handler),
)
.into()
IAsyncActionWithProgress_Impl::SetCompleted(this, core::mem::transmute_copy(&value))
.into()
}
}
unsafe extern "system" fn Completed<
Expand Down Expand Up @@ -1417,14 +1411,14 @@ impl<TResult: windows_core::RuntimeType + 'static> windows_core::imp::CanInto<IA
const QUERY: bool = true;
}
impl<TResult: windows_core::RuntimeType + 'static> IAsyncOperation<TResult> {
pub fn SetCompleted<P0>(&self, handler: P0) -> windows_core::Result<()>
pub fn SetCompleted<P0>(&self, value: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<AsyncOperationCompletedHandler<TResult>>,
{
unsafe {
(windows_core::Interface::vtable(self).SetCompleted)(
windows_core::Interface::as_raw(self),
handler.param().abi(),
value.param().abi(),
)
.ok()
}
Expand Down Expand Up @@ -1512,7 +1506,7 @@ where
{
fn SetCompleted(
&self,
handler: windows_core::Ref<AsyncOperationCompletedHandler<TResult>>,
value: windows_core::Ref<AsyncOperationCompletedHandler<TResult>>,
) -> windows_core::Result<()>;
fn Completed(&self) -> windows_core::Result<AsyncOperationCompletedHandler<TResult>>;
fn GetResults(&self) -> windows_core::Result<TResult>;
Expand All @@ -1525,12 +1519,12 @@ impl<TResult: windows_core::RuntimeType + 'static> IAsyncOperation_Vtbl<TResult>
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
handler: *mut core::ffi::c_void,
value: *mut core::ffi::c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IAsyncOperation_Impl::SetCompleted(this, core::mem::transmute_copy(&handler)).into()
IAsyncOperation_Impl::SetCompleted(this, core::mem::transmute_copy(&value)).into()
}
}
unsafe extern "system" fn Completed<
Expand Down Expand Up @@ -1665,14 +1659,14 @@ impl<TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::Runt
impl<TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::RuntimeType + 'static>
IAsyncOperationWithProgress<TResult, TProgress>
{
pub fn SetProgress<P0>(&self, handler: P0) -> windows_core::Result<()>
pub fn SetProgress<P0>(&self, value: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<AsyncOperationProgressHandler<TResult, TProgress>>,
{
unsafe {
(windows_core::Interface::vtable(self).SetProgress)(
windows_core::Interface::as_raw(self),
handler.param().abi(),
value.param().abi(),
)
.ok()
}
Expand All @@ -1689,14 +1683,14 @@ impl<TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::Runt
.and_then(|| windows_core::Type::from_abi(result__))
}
}
pub fn SetCompleted<P0>(&self, handler: P0) -> windows_core::Result<()>
pub fn SetCompleted<P0>(&self, value: P0) -> windows_core::Result<()>
where
P0: windows_core::Param<AsyncOperationWithProgressCompletedHandler<TResult, TProgress>>,
{
unsafe {
(windows_core::Interface::vtable(self).SetCompleted)(
windows_core::Interface::as_raw(self),
handler.param().abi(),
value.param().abi(),
)
.ok()
}
Expand Down Expand Up @@ -1797,12 +1791,12 @@ where
{
fn SetProgress(
&self,
handler: windows_core::Ref<AsyncOperationProgressHandler<TResult, TProgress>>,
value: windows_core::Ref<AsyncOperationProgressHandler<TResult, TProgress>>,
) -> windows_core::Result<()>;
fn Progress(&self) -> windows_core::Result<AsyncOperationProgressHandler<TResult, TProgress>>;
fn SetCompleted(
&self,
handler: windows_core::Ref<AsyncOperationWithProgressCompletedHandler<TResult, TProgress>>,
value: windows_core::Ref<AsyncOperationWithProgressCompletedHandler<TResult, TProgress>>,
) -> windows_core::Result<()>;
fn Completed(
&self,
Expand All @@ -1823,14 +1817,14 @@ impl<TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::Runt
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
handler: *mut core::ffi::c_void,
value: *mut core::ffi::c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IAsyncOperationWithProgress_Impl::SetProgress(
this,
core::mem::transmute_copy(&handler),
core::mem::transmute_copy(&value),
)
.into()
}
Expand Down Expand Up @@ -1864,14 +1858,14 @@ impl<TResult: windows_core::RuntimeType + 'static, TProgress: windows_core::Runt
const OFFSET: isize,
>(
this: *mut core::ffi::c_void,
handler: *mut core::ffi::c_void,
value: *mut core::ffi::c_void,
) -> windows_core::HRESULT {
unsafe {
let this: &Identity =
&*((this as *const *const ()).offset(OFFSET) as *const Identity);
IAsyncOperationWithProgress_Impl::SetCompleted(
this,
core::mem::transmute_copy(&handler),
core::mem::transmute_copy(&value),
)
.into()
}
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/rdl/src/emit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn write_type(namespace: &str, item: &metadata::Type) -> TokenStream {
use metadata::Type::*;
match item {
Bool => quote! { bool },
Char => quote! { u16 },
Char => quote! { Char16 },
I8 => quote! { i8 },
U8 => quote! { u8 },
I16 => quote! { i16 },
Expand Down
Loading
Loading