summaryrefslogtreecommitdiffstats
path: root/third_party/rust/winapi/src/winrt
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/rust/winapi/src/winrt')
-rw-r--r--third_party/rust/winapi/src/winrt/activation.rs13
-rw-r--r--third_party/rust/winapi/src/winrt/hstring.rs25
-rw-r--r--third_party/rust/winapi/src/winrt/inspectable.rs29
-rw-r--r--third_party/rust/winapi/src/winrt/mod.rs12
-rw-r--r--third_party/rust/winapi/src/winrt/roapi.rs60
-rw-r--r--third_party/rust/winapi/src/winrt/robuffer.rs12
-rw-r--r--third_party/rust/winapi/src/winrt/roerrorapi.rs103
-rw-r--r--third_party/rust/winapi/src/winrt/winstring.rs150
8 files changed, 404 insertions, 0 deletions
diff --git a/third_party/rust/winapi/src/winrt/activation.rs b/third_party/rust/winapi/src/winrt/activation.rs
new file mode 100644
index 0000000000..dca597bd17
--- /dev/null
+++ b/third_party/rust/winapi/src/winrt/activation.rs
@@ -0,0 +1,13 @@
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+use um::winnt::HRESULT;
+use winrt::inspectable::{IInspectable, IInspectableVtbl};
+RIDL!{#[uuid(0x00000035, 0x0000, 0x0000, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46)]
+interface IActivationFactory(IActivationFactoryVtbl): IInspectable(IInspectableVtbl) {
+ fn ActivateInstance(
+ instance: *mut *mut IInspectable,
+ ) -> HRESULT,
+}}
diff --git a/third_party/rust/winapi/src/winrt/hstring.rs b/third_party/rust/winapi/src/winrt/hstring.rs
new file mode 100644
index 0000000000..3eae6e0cb7
--- /dev/null
+++ b/third_party/rust/winapi/src/winrt/hstring.rs
@@ -0,0 +1,25 @@
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+//! This interface definition contains typedefs for Windows Runtime data types.
+use ctypes::c_char;
+use um::winnt::PVOID;
+DECLARE_HANDLE!{HSTRING, HSTRING__}
+#[cfg(target_pointer_width = "32")]
+UNION!{union HSTRING_HEADER_Reserved {
+ [u32; 5],
+ Reserved1 Reserved1_mut: PVOID,
+ Reserved2 Reserved2_mut: [c_char; 20],
+}}
+#[cfg(target_pointer_width = "64")]
+UNION!{union HSTRING_HEADER_Reserved {
+ [u64; 3],
+ Reserved1 Reserved1_mut: PVOID,
+ Reserved2 Reserved2_mut: [c_char; 24],
+}}
+STRUCT!{struct HSTRING_HEADER {
+ Reserved: HSTRING_HEADER_Reserved,
+}}
+DECLARE_HANDLE!{HSTRING_BUFFER, HSTRING_BUFFER__}
diff --git a/third_party/rust/winapi/src/winrt/inspectable.rs b/third_party/rust/winapi/src/winrt/inspectable.rs
new file mode 100644
index 0000000000..fb1e433151
--- /dev/null
+++ b/third_party/rust/winapi/src/winrt/inspectable.rs
@@ -0,0 +1,29 @@
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+use shared::guiddef::IID;
+use shared::minwindef::ULONG;
+use um::unknwnbase::{IUnknown, IUnknownVtbl};
+use um::winnt::HRESULT;
+use winrt::hstring::HSTRING;
+pub type LPINSPECTABLE = *mut IInspectable;
+ENUM!{enum TrustLevel {
+ BaseTrust = 0,
+ PartialTrust,
+ FullTrust,
+}}
+RIDL!{#[uuid(0xaf86e2e0, 0xb12d, 0x4c6a, 0x9c, 0x5a, 0xd7, 0xaa, 0x65, 0x10, 0x1e, 0x90)]
+interface IInspectable(IInspectableVtbl): IUnknown(IUnknownVtbl) {
+ fn GetIids(
+ iidCount: *mut ULONG,
+ iids: *mut *mut IID,
+ ) -> HRESULT,
+ fn GetRuntimeClassName(
+ className: *mut HSTRING,
+ ) -> HRESULT,
+ fn GetTrustLevel(
+ trustLevel: *mut TrustLevel,
+ ) -> HRESULT,
+}}
diff --git a/third_party/rust/winapi/src/winrt/mod.rs b/third_party/rust/winapi/src/winrt/mod.rs
new file mode 100644
index 0000000000..47e38676f1
--- /dev/null
+++ b/third_party/rust/winapi/src/winrt/mod.rs
@@ -0,0 +1,12 @@
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+#[cfg(feature = "activation")] pub mod activation;
+#[cfg(feature = "hstring")] pub mod hstring;
+#[cfg(feature = "inspectable")] pub mod inspectable;
+#[cfg(feature = "roapi")] pub mod roapi;
+#[cfg(feature = "robuffer")] pub mod robuffer;
+#[cfg(feature = "roerrorapi")] pub mod roerrorapi;
+#[cfg(feature = "winstring")] pub mod winstring;
diff --git a/third_party/rust/winapi/src/winrt/roapi.rs b/third_party/rust/winapi/src/winrt/roapi.rs
new file mode 100644
index 0000000000..47b988062c
--- /dev/null
+++ b/third_party/rust/winapi/src/winrt/roapi.rs
@@ -0,0 +1,60 @@
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+use shared::basetsd::{UINT32, UINT64};
+use shared::guiddef::REFIID;
+use um::objidl::IApartmentShutdown;
+use um::winnt::{HRESULT, VOID};
+use winrt::activation::IActivationFactory;
+use winrt::hstring::HSTRING;
+use winrt::inspectable::IInspectable;
+ENUM!{enum RO_INIT_TYPE {
+ RO_INIT_SINGLETHREADED = 0,
+ RO_INIT_MULTITHREADED = 1,
+}}
+pub enum RO_REGISTRATION_COOKIE__ {}
+pub type RO_REGISTRATION_COOKIE = *mut RO_REGISTRATION_COOKIE__;
+FN!{stdcall PFNGETACTIVATIONFACTORY(
+ HSTRING,
+ *mut *mut IActivationFactory,
+) -> HRESULT}
+extern "system" {
+ pub fn RoInitialize(
+ initType: RO_INIT_TYPE,
+ ) -> HRESULT;
+ pub fn RoUninitialize();
+ pub fn RoActivateInstance(
+ activatableClassId: HSTRING,
+ instance: *mut *mut IInspectable,
+ ) -> HRESULT;
+ pub fn RoRegisterActivationFactories(
+ activatableClassIds: *const HSTRING,
+ activationFactoryCallbacks: *const PFNGETACTIVATIONFACTORY,
+ count: UINT32,
+ cookie: *mut RO_REGISTRATION_COOKIE,
+ ) -> HRESULT;
+ pub fn RoRevokeActivationFactories(
+ cookie: RO_REGISTRATION_COOKIE,
+ );
+ pub fn RoGetActivationFactory(
+ activatableClassId: HSTRING,
+ iid: REFIID,
+ factory: *mut *mut VOID,
+ ) -> HRESULT;
+}
+DECLARE_HANDLE!{APARTMENT_SHUTDOWN_REGISTRATION_COOKIE, APARTMENT_SHUTDOWN_REGISTRATION_COOKIE__}
+extern "system" {
+ pub fn RoRegisterForApartmentShutdown(
+ callbackObject: *const IApartmentShutdown,
+ apartmentIdentifier: *mut UINT64,
+ regCookie: *mut APARTMENT_SHUTDOWN_REGISTRATION_COOKIE,
+ ) -> HRESULT;
+ pub fn RoUnregisterForApartmentShutdown(
+ regCookie: APARTMENT_SHUTDOWN_REGISTRATION_COOKIE,
+ ) -> HRESULT;
+ pub fn RoGetApartmentIdentifier(
+ apartmentIdentifier: *mut UINT64,
+ ) -> HRESULT;
+}
diff --git a/third_party/rust/winapi/src/winrt/robuffer.rs b/third_party/rust/winapi/src/winrt/robuffer.rs
new file mode 100644
index 0000000000..b0192fbe28
--- /dev/null
+++ b/third_party/rust/winapi/src/winrt/robuffer.rs
@@ -0,0 +1,12 @@
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+use um::objidl::IMarshal;
+use um::winnt::HRESULT;
+extern "system" {
+ pub fn RoGetBufferMarshaler(
+ bufferMarshaler: *mut *mut IMarshal,
+ ) -> HRESULT;
+}
diff --git a/third_party/rust/winapi/src/winrt/roerrorapi.rs b/third_party/rust/winapi/src/winrt/roerrorapi.rs
new file mode 100644
index 0000000000..aa9f683a51
--- /dev/null
+++ b/third_party/rust/winapi/src/winrt/roerrorapi.rs
@@ -0,0 +1,103 @@
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+use shared::basetsd::{UINT32, UINT_PTR};
+use shared::minwindef::{BOOL, BYTE, UINT, USHORT};
+use um::restrictederrorinfo::IRestrictedErrorInfo;
+use um::unknwnbase::IUnknown;
+use um::winnt::{HRESULT, PCWSTR, PVOID, VOID};
+use winrt::hstring::HSTRING;
+ENUM!{enum RO_ERROR_REPORTING_FLAGS {
+ RO_ERROR_REPORTING_NONE = 0x00000000,
+ RO_ERROR_REPORTING_SUPPRESSEXCEPTIONS = 0x00000001,
+ RO_ERROR_REPORTING_FORCEEXCEPTIONS = 0x00000002,
+ RO_ERROR_REPORTING_USESETERRORINFO = 0x00000004,
+ RO_ERROR_REPORTING_SUPPRESSSETERRORINFO = 0x00000008,
+}}
+extern "system" {
+ pub fn RoGetErrorReportingFlags(
+ pflags: *mut UINT32,
+ ) -> HRESULT;
+ pub fn RoSetErrorReportingFlags(
+ flags: UINT32,
+ ) -> HRESULT;
+ pub fn RoResolveRestrictedErrorInfoReference(
+ reference: PCWSTR,
+ ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo ,
+ ) -> HRESULT;
+ pub fn SetRestrictedErrorInfo(
+ pRestrictedErrorInfo: *const IRestrictedErrorInfo,
+ ) -> HRESULT;
+ pub fn GetRestrictedErrorInfo(
+ ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo,
+ ) -> HRESULT;
+ pub fn RoOriginateErrorW(
+ error: HRESULT,
+ cchMax: UINT,
+ message: PCWSTR,
+ ) -> BOOL;
+ pub fn RoOriginateError(
+ error: HRESULT,
+ message: HSTRING,
+ ) -> BOOL;
+ pub fn RoTransformErrorW(
+ oldError: HRESULT,
+ newError: HRESULT,
+ cchMax: UINT,
+ message: PCWSTR,
+ ) -> BOOL;
+ pub fn RoTransformError(
+ oldError: HRESULT,
+ newError: HRESULT,
+ message: HSTRING,
+ ) -> BOOL;
+ pub fn RoCaptureErrorContext(
+ hr: HRESULT,
+ ) -> HRESULT;
+ pub fn RoFailFastWithErrorContext(
+ hrError: HRESULT,
+ );
+ pub fn RoOriginateLanguageException(
+ error: HRESULT,
+ message: HSTRING,
+ languageException: *const IUnknown,
+ ) -> BOOL;
+ pub fn RoClearError();
+ pub fn RoReportUnhandledError(
+ pRestrictedErrorInfo: *const IRestrictedErrorInfo,
+ ) -> HRESULT;
+}
+FN!{stdcall PINSPECT_MEMORY_CALLBACK(
+ *const VOID,
+ UINT_PTR,
+ UINT32,
+ *mut BYTE,
+) -> HRESULT}
+extern "system" {
+ pub fn RoInspectThreadErrorInfo(
+ targetTebAddress: UINT_PTR,
+ machine: USHORT,
+ readMemoryCallback: PINSPECT_MEMORY_CALLBACK,
+ context: PVOID,
+ targetErrorInfoAddress: *mut UINT_PTR,
+ ) -> HRESULT;
+ pub fn RoInspectCapturedStackBackTrace(
+ targetErrorInfoAddress: UINT_PTR,
+ machine: USHORT,
+ readMemoryCallback: PINSPECT_MEMORY_CALLBACK,
+ context: PVOID,
+ frameCount: *mut UINT32,
+ targetBackTraceAddress: *mut UINT_PTR,
+ ) -> HRESULT;
+ pub fn RoGetMatchingRestrictedErrorInfo(
+ hrIn: HRESULT,
+ ppRestrictedErrorInfo: *mut *mut IRestrictedErrorInfo,
+ ) -> HRESULT;
+ pub fn RoReportFailedDelegate(
+ punkDelegate: *const IUnknown,
+ pRestrictedErrorInfo: *const IRestrictedErrorInfo,
+ ) -> HRESULT;
+ pub fn IsErrorPropagationEnabled() -> BOOL;
+}
diff --git a/third_party/rust/winapi/src/winrt/winstring.rs b/third_party/rust/winapi/src/winrt/winstring.rs
new file mode 100644
index 0000000000..ecbfcdf2a6
--- /dev/null
+++ b/third_party/rust/winapi/src/winrt/winstring.rs
@@ -0,0 +1,150 @@
+// Licensed under the Apache License, Version 2.0
+// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option.
+// All files in the project carrying such notice may not be copied, modified, or distributed
+// except according to those terms.
+use shared::basetsd::{INT32, UINT32, UINT_PTR};
+use shared::minwindef::{BOOL, BYTE, UCHAR, ULONG, USHORT};
+use um::winnt::{HRESULT, PCWSTR, VOID, WCHAR};
+use winrt::hstring::{HSTRING, HSTRING_BUFFER, HSTRING_HEADER};
+extern "system" {
+ pub fn WindowsCreateString(
+ sourceString: PCWSTR,
+ length: UINT32,
+ string: *mut HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsCreateStringReference(
+ sourceString: PCWSTR,
+ length: UINT32,
+ hstringHeader: *mut HSTRING_HEADER,
+ string: *mut HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsDeleteString(
+ string: HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsDuplicateString(
+ string: HSTRING,
+ newString: *mut HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsGetStringLen(
+ string: HSTRING,
+ ) -> UINT32;
+ pub fn WindowsGetStringRawBuffer(
+ string: HSTRING,
+ length: *mut UINT32,
+ ) -> PCWSTR;
+ pub fn WindowsIsStringEmpty(
+ string: HSTRING,
+ ) -> BOOL;
+ pub fn WindowsStringHasEmbeddedNull(
+ string: HSTRING,
+ hasEmbedNull: *mut BOOL,
+ ) -> HRESULT;
+ pub fn WindowsCompareStringOrdinal(
+ string1: HSTRING,
+ string2: HSTRING,
+ result: *mut INT32,
+ ) -> HRESULT;
+ pub fn WindowsSubstring(
+ string: HSTRING,
+ startIndex: UINT32,
+ newString: *mut HSTRING,
+ ) -> HSTRING;
+ pub fn WindowsSubstringWithSpecifiedLength(
+ string: HSTRING,
+ startIndex: UINT32,
+ length: UINT32,
+ newString: *mut HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsConcatString(
+ string1: HSTRING,
+ string2: HSTRING,
+ newString: *mut HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsReplaceString(
+ string: HSTRING,
+ stringReplaced: HSTRING,
+ stringReplaceWith: HSTRING,
+ newString: *mut HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsTrimStringStart(
+ string: HSTRING,
+ trimString: HSTRING,
+ newString: *mut HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsTrimStringEnd(
+ string: HSTRING,
+ trimString: HSTRING,
+ newString: *mut HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsPreallocateStringBuffer(
+ length: UINT32,
+ charBuffer: *mut *mut WCHAR,
+ bufferHandle: *mut HSTRING_BUFFER,
+ ) -> HRESULT;
+ pub fn WindowsPromoteStringBuffer(
+ bufferHandle: HSTRING_BUFFER,
+ string: *mut HSTRING,
+ ) -> HRESULT;
+ pub fn WindowsDeleteStringBuffer(
+ bufferHandle: HSTRING_BUFFER,
+ ) -> HRESULT;
+}
+FN!{stdcall PINSPECT_HSTRING_CALLBACK(
+ *const VOID,
+ UINT_PTR,
+ UINT32,
+ *mut BYTE,
+) -> HRESULT}
+extern "system" {
+ pub fn WindowsInspectString(
+ targetHString: UINT_PTR,
+ machine: USHORT,
+ callback: PINSPECT_HSTRING_CALLBACK,
+ context: *const VOID,
+ length: *mut UINT32,
+ targetStringAddress: *mut UINT_PTR,
+ ) -> HRESULT;
+ pub fn HSTRING_UserSize(
+ pFlags: *const ULONG,
+ StartingSize: ULONG,
+ ppidl: *const HSTRING,
+ ) -> ULONG;
+ pub fn HSTRING_UserMarshal(
+ pFlags: *const ULONG,
+ pBuffer: *mut UCHAR,
+ ppidl: *const HSTRING,
+ ) -> *mut UCHAR;
+ pub fn HSTRING_UserUnmarshal(
+ pFlags: *const ULONG,
+ pBuffer: *const UCHAR,
+ ppidl: *mut HSTRING,
+ ) -> *mut UCHAR;
+ pub fn HSTRING_UserFree(
+ pFlags: *const ULONG,
+ ppidl: *const HSTRING,
+ );
+ #[cfg(target_arch = "x86_64")]
+ pub fn HSTRING_UserSize64(
+ pFlags: *const ULONG,
+ StartingSize: ULONG,
+ ppidl: *const HSTRING,
+ ) -> ULONG;
+ #[cfg(target_arch = "x86_64")]
+ pub fn HSTRING_UserMarshal64(
+ pFlags: *const ULONG,
+ pBuffer: *mut UCHAR,
+ ppidl: *const HSTRING,
+ ) -> *mut UCHAR;
+ #[cfg(target_arch = "x86_64")]
+ pub fn HSTRING_UserUnmarshal64(
+ pFlags: *const ULONG,
+ pBuffer: *const UCHAR,
+ ppidl: *mut HSTRING,
+ ) -> *mut UCHAR;
+ #[cfg(target_arch = "x86_64")]
+ pub fn HSTRING_UserFree64(
+ pFlags: *const ULONG,
+ ppidl: *const HSTRING,
+ );
+}