This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use super::*; | |
#[derive(Default)] | |
pub struct Gen<'a> { | |
pub namespace: &'a str, | |
pub sys: bool, | |
pub flatten: bool, | |
pub cfg: bool, | |
pub doc: bool, | |
pub min_enum: bool, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::io::prelude::*; | |
fn main() { | |
let mut file = std::fs::File::create(r#"C:\git\check_all.cmd"#).unwrap(); | |
let reader = reader::TypeReader::get_mut(); | |
let root = reader.types.get_namespace("Windows").unwrap(); | |
write_features(&mut file, root.namespace, root) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AI = [] | |
AI_MachineLearning = ["AI", "Foundation", "Foundation_Collections"] | |
AI_MachineLearning_Preview = ["AI_MachineLearning", "Foundation_Collections"] | |
ApplicationModel = [] | |
ApplicationModel_Activation = ["ApplicationModel"] | |
ApplicationModel_AppExtensions = ["ApplicationModel"] | |
ApplicationModel_AppService = ["ApplicationModel", "Foundation"] | |
ApplicationModel_Appointments = ["ApplicationModel"] | |
ApplicationModel_Appointments_AppointmentsProvider = ["ApplicationModel_Appointments"] | |
ApplicationModel_Appointments_DataProvider = ["ApplicationModel_Appointments"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() { | |
use reader::*; | |
let reader = TypeReader::get_mut(); | |
fn walk(tree: &TypeTree) { | |
for (_, entry) in &tree.types { | |
match &entry.def { | |
ElementType::TypeDef(def) => { | |
if def.has_attribute("SupportedArchitectureAttribute") { | |
assert!(def.kind() == TypeKind::Struct || def.kind() == TypeKind::Delegate); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C++/winRT via https://github.com/microsoft/cppwinrt | |
#include "winrt/Windows.System.Power.h" | |
int main() | |
{ | |
auto start = std::chrono::high_resolution_clock::now(); | |
for (int i = 0; i < 10'000'000; i++) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use Windows::Win32::System::Com::*; | |
use Windows::Win32::UI::Accessibility::*; | |
use Windows::Win32::UI::WindowsAndMessaging::*; | |
use Windows::UI::UIAutomation::*; | |
fn main() -> Result<()> { | |
unsafe { | |
CoInitializeEx(std::ptr::null_mut(), COINIT_MULTITHREADED)?; | |
let window = FindWindowA(None, "Calculator"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fn main() -> Result<()> { | |
unsafe { | |
let scm = OpenSCManagerA(None, None, GENERIC_READ); | |
let service = OpenServiceA(scm, "Fax", GENERIC_READ); | |
let mut buffer_size = 0; | |
QueryServiceStatusEx( | |
service, | |
SC_STATUS_PROCESS_INFO, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub fn file_bytes(filename: &std::path::PathBuf) -> &'static [u8] { | |
let mut filename = String::from(filename.as_path().to_str().expect("Unexpected file name")); | |
filename.push('\0'); | |
let file = unsafe { | |
CreateFileA( | |
filename.as_bytes().as_ptr(), | |
FILE_GENERIC_READ, | |
FILE_SHARE_READ, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[implement( | |
extend Windows::UI::Xaml::Application, | |
override OnLaunched, | |
Windows::Foundation::IStringable, | |
)] | |
struct App { | |
} | |
impl App { | |
fn OnLaunched(&self, _: &LaunchActivatedEventArgs) -> Result<()> { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Windows.AI.MachineLearning": { | |
"Windows.Foundation", | |
"Windows.Foundation.Collections", | |
}, | |
"Windows.AI.MachineLearning.Preview": { | |
"Windows.Foundation.Collections", | |
}, | |
"Windows.ApplicationModel.AppService": { | |
"Windows.Foundation", |