Граф коммитов

1437 Коммитов

Автор SHA1 Сообщение Дата
Kenny Kerr f69ba3d2f6
Remove "std" writer from `windows-bindgen` (#3130) 2024-06-26 12:41:28 -05:00
Kenny Kerr 707e0bb329
Lock down `windows-core` internals (#3129) 2024-06-26 10:35:16 -05:00
Kenny Kerr 472b563a8b
Add `windows-strings` crate (#3125) 2024-06-25 16:54:16 -05:00
Kenny Kerr a3b18ea4e2
Remove unnecessary test `cfg` checks (#3124) 2024-06-25 09:05:00 -05:00
Kenny Kerr 863a7cf1d0
Add flexible registry type and byte query support (#3120) 2024-06-23 08:31:37 -05:00
Mateusz Mikuła 2ec4e06d36
Test cross-compilation with stable gnullvm targets (#3104) 2024-06-20 15:02:01 -05:00
Kenny Kerr bfb55f3541
Remove unused dependencies (#3117) 2024-06-20 15:01:39 -05:00
sivadeilra f6f985d023
Don't compile `windows` and `windows-sys` in unit test mode (#3112) 2024-06-19 15:49:34 -05:00
Kenny Kerr d331301dac
Update Win32 metadata (#3111) 2024-06-19 12:38:45 -05:00
sivadeilra 48db09f2d3
Remove remaining recursive calls to `cargo` (#3113) 2024-06-18 16:23:39 -05:00
sivadeilra d33dcf71d5
Simplify how extension code for `windows` crate works (#3110) 2024-06-18 07:47:19 -05:00
Kenny Kerr 139ca3c88f
Support some edge cases for the next Win32 metadata update (#3109) 2024-06-17 15:24:55 -05:00
Kenny Kerr f639d7ea3c
Remove `mio` test dependency (#3107) 2024-06-17 08:18:02 -05:00
Kenny Kerr 977f1da608
Allow `unused` to deal with new warning about "unused" private fields in structs (#3103) 2024-06-15 19:45:45 -05:00
Kenny Kerr cd1e09684a
Use tools to generate bindings for library crates (#3102) 2024-06-14 17:02:34 -05:00
Kenny Kerr 7f1a7ff663
Harden detection of missing nested types (#3099) 2024-06-14 11:01:52 -05:00
Kenny Kerr a2a4e1e1b8
The `Debug` derive macro does not need to be qualified (#3097) 2024-06-13 12:04:35 -05:00
Kenny Kerr 827533f764
Workaround for false dead code warning (#3098) 2024-06-13 10:57:22 -05:00
sivadeilra a8bb33ced9
COM interface impls move to outer implementation (#3065) 2024-06-13 09:01:30 -05:00
sivadeilra 66d876944d
Use `malloc` on non-Windows platforms (#3095) 2024-06-12 20:38:52 -05:00
dependabot[bot] 8e0e96d972
Bump braces from 3.0.2 to 3.0.3 in /web/features (#3092) 2024-06-12 07:36:54 -05:00
sivadeilra 573076a0f0
Change tests/standalone so that a tool regenerates its sources (#3091) 2024-06-11 20:24:29 -05:00
sivadeilra 56fd381690
Allow `windows-result` to work on non-Windows platforms (#3082) 2024-06-11 17:06:06 -05:00
Kenny Kerr 66ad6d930f
Infer return type in generated bindings (#3090) 2024-06-11 17:01:07 -05:00
Kenny Kerr 0d4a1af5a4
Simplify pointer writes in generated code (#3089) 2024-06-11 17:00:50 -05:00
Kenny Kerr 7c615c48b1
Disable docs and tests for test crates (#3085) 2024-06-10 14:14:47 -05:00
Kenny Kerr e185bcda58
Simplify standalone test by calling `windows-bindgen` directly (#3086) 2024-06-10 12:15:28 -05:00
Kenny Kerr ab879a7dfa
Fix default `rustfmt` for repo (#3084) 2024-06-10 11:17:09 -05:00
Kenny Kerr 6526106931 Update readme 2024-06-10 08:22:16 -05:00
Kenny Kerr 15947886be
Release 0.57.0 (#3081) 2024-06-07 12:29:25 -05:00
Kenny Kerr 21d17ab998
Add WinRT `noexcept` support (#3070) 2024-06-06 19:07:15 -05:00
sivadeilra 7d94387a7c
Optimize `IUnknown` identity checks (#3073) 2024-06-06 19:06:46 -05:00
Kenny Kerr 4572dcd6ae
Remove `unused_qualifications` (#3078) 2024-06-06 19:05:41 -05:00
sivadeilra a623c3f27f
Fix warnings from Rust 1.80.0 nightly (#3074) 2024-06-06 13:05:57 -05:00
Kenny Kerr 0940e1f635
Check for null pointers in core `IInspectable` implementation (#3057) 2024-06-04 09:58:46 -05:00
sivadeilra 8b4a185e56
Use default rustfmt config for most crates (#3064)
Use the default configuration for rustfmt in all crates, except for the `windows` and `windows-sys` crates.
---------

Co-authored-by: Arlie Davis <ardavis@microsoft.com>
2024-06-03 12:44:21 -07:00
sivadeilra b8586add80
Fix Debug impls for COM interfaces (#3066)
* Fix Debug impls for COM interfaces

Currently, the Debug impl for COM interfaces shows the recursive
interface chain, like so:

```
IDWriteFontFace5(IDWriteFontFace4(IDWriteFontFace3(IDWriteFontFace2(IDWriteFontFace(0xNNN)))))
```

That's not very useful. This PR trims it down to just the current interface:

```
IDWriteFontFace5(0xNNN)
```

* fix build break

---------

Co-authored-by: Arlie Davis <ardavis@microsoft.com>
2024-06-03 11:09:23 -07:00
sivadeilra dbc3932513
Fix bug in COM interface chain support (#3060)
The definition of a COM interface may inherit from another interface.
These are known as "interface chains". The `#[implement]` macro allows
designers to specify only the minimal set of interface chains that are
needed for a given COM object implementation. The `#[implement]` macro
(and the `#[interface]` macro) work together to pull in the
implementations of all interfaces along the chain.

Unfortunately there is a bug in the implementation of `QueryInterface`
for interface chains. The current `QueryInterface` implementation will
only check the IIDs of the interfaces at the root of the chian, i.e.
the "most-derived" interface. `QueryInterface` will not search the IIDs
of interfaces that are in the inheritance chain.

This bug is demonstrated (detected) by the new unit tests in
`crates/tests/implement_core/src/com_chain.rs`. This PR fixes the bug
by generating an `fn matches()` method that checks the current IID and
then checks the parent interface (if any) by calling its `match()`
method. This fixes the unit test.

Co-authored-by: Arlie Davis <ardavis@microsoft.com>
2024-05-29 14:13:19 -07:00
sivadeilra 71f8c2a4d9
Fix handling of COM interfaces with same method name (#3059)
It is common in COM interfaces for different interfaces to have methods
that have the same name, especially for interface "versions" that
extend the semantics of the underlying interfaces.  For example,
look at many of the inheritance relationships in COM interfaces in
DirectWrite (IDWriteTextFormat, IDWriteTextFormat2, IDWriteTextFormat3,
etc.)

This fixes the handling of this situation. All that is necessary is to
use the syntax which explicitly selects a specific trait, when invoking
IFoo_Impl methods. This PR adds unit test coverage for this situation.

Co-authored-by: Arlie Davis <ardavis@microsoft.com>
2024-05-25 20:26:14 -07:00
Kenny Kerr 0bd3bff819
Add `cppwinrt` crate and sample (#3054) 2024-05-25 19:46:28 -07:00
Kenny Kerr 92e4fd722a
Switch to `windows-2022` hosted runners (#3056)
Co-authored-by: Rafael Rivera <rafael@withinwindows.com>
2024-05-25 09:11:44 -07:00
sivadeilra ccd334fa75
Dynamic casting to COM implementation (#3055)
This provides a new feature for COM developers using the windows-rs crate.
It allows for safe dynamic casting from IUnknown to an implementation object.
It is based on Rust's Any trait.

Any type that is marked with #[implement], except for those that contain
non-static lifetimes, can be used with dynamic casting.

Example:

```rust
struct MyApp { ... }

fn main() {
    let my_app = ComObject::new(MyApp { ... });
    let iunknown: IUnknown = my_app.to_interface();
    do_stuff(&iunknown);
}

fn do_stuff(unknown: &IUnknown) -> Result<()> {
    let my_app: ComObject<MyApp> = unknown.cast_object()?;
    my_app.internal_method();
    Ok(())
}
```

Co-authored-by: Arlie Davis <ardavis@microsoft.com>
2024-05-25 09:11:16 -07:00
Kenny Kerr 40d35fabf5
Fix alignment issue in `windows-registry` value iterator (#3052) 2024-05-23 11:16:55 -05:00
Kenny Kerr d06694abd4
Add `no-default-features` yml workflow (#3053) 2024-05-23 11:16:07 -05:00
Chris Denton 92ecfbdfe7
Re-enable `unexpected_cfgs` (#3050) 2024-05-22 08:53:29 -05:00
sivadeilra 80a293e686
Fix soundness hole in `ComObject` (#3051) 2024-05-22 08:44:31 -05:00
Kenny Kerr 9288a7b54c Fix workflow merge 2024-05-20 14:10:27 -05:00
Kenny Kerr 8a2db86c1f
Add C++ test client (#3046) 2024-05-20 14:08:30 -05:00
sivadeilra 1172cf2889
Allow `windows`, `windows-core`, and others to be compiled and used in `no_std` environments. (#3047) 2024-05-20 13:55:58 -05:00
Marijn Suijten 78a40347f6
Improve formatting of the bindgen/default readme (#3045) 2024-05-16 20:49:33 -05:00