This commit is contained in:
Ryan Levick 2019-09-24 13:25:51 +02:00
Родитель ba7b7b2de0
Коммит 758ba0cbfe
6 изменённых файлов: 2 добавлений и 25 удалений

Просмотреть файл

@ -39,7 +39,6 @@ pub fn generate(struct_item: &ItemStruct) -> HelperTokenStream {
let riid = unsafe { &*riid };
println!("Creating instance for {}", stringify!(#struct_ident));
if !aggr.is_null() && !winapi::shared::guiddef::IsEqualGUID(riid, &<dyn com::interfaces::iunknown::IUnknown as com::ComInterface>::IID) {
unsafe {
*ppv = std::ptr::null_mut::<winapi::ctypes::c_void>();

Просмотреть файл

@ -132,8 +132,6 @@ fn gen_inner_query_interface(
quote!(
pub(crate) fn inner_query_interface(&self, riid: *const winapi::shared::guiddef::IID, ppv: *mut *mut winapi::ctypes::c_void) -> HRESULT {
println!("Non delegating QI");
unsafe {
let riid = &*riid;
@ -141,11 +139,9 @@ fn gen_inner_query_interface(
*ppv = &self.#non_delegating_iunknown_field_ident as *const _ as *mut winapi::ctypes::c_void;
} #base_match_arms #aggr_match_arms else {
*ppv = std::ptr::null_mut::<winapi::ctypes::c_void>();
println!("Returning NO INTERFACE.");
return winapi::shared::winerror::E_NOINTERFACE;
}
println!("Successful!.");
self.inner_add_ref();
NOERROR
}
@ -183,8 +179,6 @@ fn gen_allocate_fn(
quote!(
fn allocate(#allocate_parameters) -> Box<#struct_ident> {
println!("Allocating new VTable for {}", stringify!(#struct_ident));
// Non-delegating methods.
unsafe extern "stdcall" fn non_delegatingegating_query_interface(
this: *mut *const <dyn com::interfaces::iunknown::IUnknown as com::ComInterface>::VTable,

Просмотреть файл

@ -45,7 +45,6 @@ pub fn generate(struct_item: &ItemStruct) -> HelperTokenStream {
// Bringing trait into scope to access IUnknown methods.
use com::interfaces::iunknown::IUnknown;
println!("Creating instance for {}", stringify!(#struct_ident));
if aggr != std::ptr::null_mut() {
return winapi::shared::winerror::CLASS_E_NOAGGREGATION;
}
@ -86,7 +85,6 @@ pub fn gen_lock_server() -> HelperTokenStream {
quote! {
// TODO: Implement correctly
fn lock_server(&self, _increment: winapi::shared::minwindef::BOOL) -> winapi::shared::winerror::HRESULT {
println!("LockServer called");
winapi::shared::winerror::S_OK
}
}
@ -97,7 +95,7 @@ pub fn gen_iunknown_impl(
aggr_map: &HashMap<Ident, Vec<Ident>>,
class_factory_ident: &Ident,
) -> HelperTokenStream {
let query_interface = gen_query_interface(class_factory_ident);
let query_interface = gen_query_interface();
let add_ref = crate::iunknown_impl::gen_add_ref();
let release = gen_release(&base_interface_idents, &aggr_map, class_factory_ident);
quote! {
@ -141,7 +139,7 @@ pub fn gen_release(
}
}
fn gen_query_interface(class_factory_ident: &Ident) -> HelperTokenStream {
fn gen_query_interface() -> HelperTokenStream {
let vptr_field_ident = macro_utils::vptr_field_ident(&get_iclass_factory_interface_ident());
quote! {
@ -149,8 +147,6 @@ fn gen_query_interface(class_factory_ident: &Ident) -> HelperTokenStream {
// Bringing trait into scope to access add_ref method.
use com::interfaces::iunknown::IUnknown;
println!("Querying interface on {}...", stringify!(#class_factory_ident));
let riid = &*riid;
if winapi::shared::guiddef::IsEqualGUID(riid, &<dyn com::interfaces::iunknown::IUnknown as com::ComInterface>::IID) | winapi::shared::guiddef::IsEqualGUID(riid, &<dyn com::interfaces::iclass_factory::IClassFactory as com::ComInterface>::IID) {
*ppv = &self.#vptr_field_ident as *const _ as *mut winapi::ctypes::c_void;
@ -179,7 +175,6 @@ pub fn gen_class_factory_impl(
use com::interfaces::iclass_factory::IClassFactory;
// allocate directly since no macros generated an `allocate` function
println!("Allocating new Vtable for {}...", stringify!(#class_factory_ident));
#base_inits
let out = #class_factory_ident {

Просмотреть файл

@ -45,8 +45,6 @@ pub fn gen_allocate_fn(
// Initialise all aggregated objects as NULL.
quote!(
fn allocate(#allocate_parameters) -> Box<#struct_ident> {
println!("Allocating new VTable for {}", stringify!(#struct_ident));
#base_inits
let out = #struct_ident {

Просмотреть файл

@ -41,7 +41,6 @@ pub fn gen_add_ref_implementation() -> HelperTokenStream {
quote!(
let value = self.#ref_count_ident.get().checked_add(1).expect("Overflow of reference count");
self.#ref_count_ident.set(value);
println!("Count now {}", value);
value
)
}
@ -114,7 +113,6 @@ fn gen_vptr_drops(base_interface_idents: &[Ident]) -> HelperTokenStream {
fn gen_com_object_drop(struct_ident: &Ident) -> HelperTokenStream {
quote!(
println!("Count is 0 for {}. Freeing memory...", stringify!(#struct_ident));
Box::from_raw(self as *const _ as *mut #struct_ident);
)
}
@ -132,7 +130,6 @@ pub fn gen_release_assign_new_count_to_var(
) -> HelperTokenStream {
quote!(
let #new_count_ident = self.#ref_count_ident.get();
println!("Count now {}", #new_count_ident);
)
}
@ -166,11 +163,9 @@ pub fn gen_query_interface(
*ppv = &self.#first_vptr_field as *const _ as *mut winapi::ctypes::c_void;
} #base_match_arms #aggr_match_arms else {
*ppv = std::ptr::null_mut::<winapi::ctypes::c_void>();
println!("Returning NO INTERFACE.");
return winapi::shared::winerror::E_NOINTERFACE;
}
println!("Successful!.");
self.add_ref();
NOERROR
}

Просмотреть файл

@ -41,7 +41,6 @@ pub fn register_keys(registry_keys_to_add: Vec<RegistryKeyInfo>) -> HRESULT {
for key_info in registry_keys_to_add.iter() {
let result = add_class_key(&key_info);
if result as u32 != ERROR_SUCCESS {
println!("Error creating key. error code: {}", result);
return SELFREG_E_CLASS;
}
}
@ -54,7 +53,6 @@ pub fn unregister_keys(registry_keys_to_remove: Vec<RegistryKeyInfo>) -> HRESULT
for key_info in registry_keys_to_remove.iter() {
let result = remove_class_key(&key_info);
if result as u32 != ERROR_SUCCESS {
println!("Error deleting key. error code: {}", result);
hr = SELFREG_E_CLASS;
}
}
@ -114,7 +112,6 @@ fn add_class_key(key_info: &RegistryKeyInfo) -> LSTATUS {
let key_handle = match create_class_key(key_info) {
Ok(key_handle) => key_handle,
Err(e) => {
println!("Error creating key. error code: {}", e);
return e;
}
};
@ -122,7 +119,6 @@ fn add_class_key(key_info: &RegistryKeyInfo) -> LSTATUS {
let key_handle = match set_class_key(key_handle, key_info) {
Ok(key_handle) => key_handle,
Err(e) => {
println!("Error setting key. error code: {}", e);
return e;
}
};