ui_access

module pkg::alloy::comsource

COM on Windows, the package pkg::alloy::com (PLAN.md, F6b; a package of its own since F10, which window and text share): interface ids, calls through another object's table of functions, and the strings, arrays and variants UI Automation, the file dialogs, drops and DirectWrite pass, with UTF-16 text both ways. The tables' slots each user reads are checked against MinGW's headers by tests/windows/com_layout.sh.

## How it was built

Notes kept from each stage as it was finished, the sizes and numbers of their day; what changed since is in REVIEW.md and the history.

Built in F6b inside window and moved here in F10a: see pkg::alloy::window's notes.

fn initialize_olesource

exp fn initialize_ole()

fn free_task_memorysource

exp fn free_task_memory(memory: c_pointer)

const S_OKsource

exp const S_OK: i32 = 0;

const E_NOINTERFACEsource

exp const E_NOINTERFACE: i32 = (0x80004002 to u32) as i32;

fn guidsource

exp fn guid(text: &[u8]) -> [u8 : 16]

A GUID's 16 bytes from its text, d6dd68d1-86fd-4332-8666-9abedea2d24c: the first three groups little-endian, as Windows keeps them.

const IID_UNKNOWNsource

exp const IID_UNKNOWN: [u8 : 16] = guid(&"00000000-0000-0000-c000-000000000046");

fn is_guidsource

exp fn is_guid(at: c_pointer, id: &[u8 : 16]) -> bool

Whether the GUID at the address is this one.

fn methodsource

exp fn method<F: CFunction>(object: c_pointer, index: u64) -> F

An object's function at the index in its table, as the C prototype F, which takes the object first.

fn releasesource

exp fn release(object: c_pointer)

IUnknown's Release.

fn createsource

exp fn create(class: &[u8 : 16], iid: &[u8 : 16]) -> Option<c_pointer>

An object of the class with the interface, if one can be made.

fn putsource

exp fn put(out: c_pointer, value: c_pointer)

Writes an address into an out parameter.

fn free_bstrsource

exp fn free_bstr(text: c_pointer)

Frees a BSTR the program made and kept.

fn bstrsource

exp fn bstr(text: &[u8]) -> c_pointer

A BSTR holding the text, which its receiver frees.

type Variantsource

exp type Variant = struct

A VARIANT: its type, then its value.

Fields

exp kind: VarType
exp reserved: [u16 : 3]
exp value: u64
exp extra: u64

Functions

type VarTypesource

exp type VarType = enum : u16

Variants

Empty = 0
I4 = 3
R8 = 5
Bstr = 8
Bool = 11
Unknown = 13

fn Variant::emptysource

exp fn Variant::empty() -> Variant

fn Variant::integersource

exp fn Variant::integer(value: i32) -> Variant

fn Variant::booleansource

exp fn Variant::boolean(value: bool) -> Variant

fn Variant::numbersource

exp fn Variant::number(value: f64) -> Variant

fn Variant::textsource

exp fn Variant::text(text: &[u8]) -> Variant

fn Variant::unknownsource

exp fn Variant::unknown(object: c_pointer) -> Variant

A variant holding a COM object, which its receiver releases.

fn integerssource

exp fn integers(values: &[i32]) -> c_pointer

A SAFEARRAY of 32-bit integers, which its receiver destroys.

fn doublessource

exp fn doubles(values: &[f64]) -> c_pointer

A SAFEARRAY of doubles, which its receiver destroys.

fn unknownssource

exp fn unknowns(values: &[c_pointer]) -> c_pointer

A SAFEARRAY of COM objects, each given a reference of its own, which its receiver destroys.

fn widesource

exp fn wide(text: &[u8]) -> Vector<u16>

UTF-16 ending in a NUL, from UTF-8.

fn narrowsource

exp fn narrow(units: &[u16], lines: bool) -> String

UTF-8 from UTF-16 units, carriage returns left out when lines.

fn narrow_csource

exp fn narrow_c(at: c_pointer, lines: bool) -> String

UTF-8 from UTF-16 ending in a NUL, carriage returns left out when lines.