Skip to content

Commit

Permalink
Return property store from class factory when IInitializeWithStream::…
Browse files Browse the repository at this point in the history
…IID is passed (#46)

* Update dll.rs

* reducing redundancy

* cargo fmt

* cargo clippy

---------

Co-authored-by: Kagami Sascha Rosylight <[email protected]>
  • Loading branch information
Dry-Leaf and saschanaz authored Dec 7, 2024
1 parent 12dacf7 commit be1fd2e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion benches/benchmark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ fn basic() {
}

fn criterion_benchmark(c: &mut Criterion) {
c.bench_function("alien.jxl", |b| b.iter(|| basic()));
c.bench_function("alien.jxl", |b| b.iter(basic));
}

criterion_group!(benches, criterion_benchmark);
Expand Down
7 changes: 5 additions & 2 deletions src/dll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,11 @@ use crate::{
use windows as Windows;
use windows::core::{implement, IUnknown, Interface, GUID, HRESULT};
use windows::Win32::{
Foundation::*, System::Com::IClassFactory_Impl, System::LibraryLoader::GetModuleFileNameW,
Foundation::*,
System::Com::IClassFactory_Impl,
System::LibraryLoader::GetModuleFileNameW,
System::SystemServices::DLL_PROCESS_ATTACH,
UI::Shell::PropertiesSystem::{IInitializeWithStream, IPropertyStore},
};

static mut DLL_INSTANCE: HINSTANCE = HINSTANCE(std::ptr::null_mut());
Expand Down Expand Up @@ -39,7 +42,7 @@ impl IClassFactory_Impl for ClassFactory_Impl {
let unknown: IUnknown = JXLWICBitmapDecoder::default().into();
unknown.query(iid, object).ok()
}
windows::Win32::UI::Shell::PropertiesSystem::IPropertyStore::IID => {
IPropertyStore::IID | IInitializeWithStream::IID => {
let unknown: IUnknown = JXLPropertyStore::default().into();
unknown.query(iid, object).ok()
}
Expand Down
2 changes: 1 addition & 1 deletion src/winstream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl<'a> From<&'a IStream> for WinStream<'a> {
}
}

impl<'a> Read for WinStream<'a> {
impl Read for WinStream<'_> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, std::io::Error> {
let mut bytes_read = 0u32;
unsafe {
Expand Down

0 comments on commit be1fd2e

Please sign in to comment.