Skip to content

Commit

Permalink
Remove unnecessary closure from generated code (#3228)
Browse files Browse the repository at this point in the history
  • Loading branch information
kennykerr authored Aug 27, 2024
1 parent 5580c02 commit 9f5ec21
Show file tree
Hide file tree
Showing 38 changed files with 302 additions and 302 deletions.
2 changes: 1 addition & 1 deletion crates/libs/bindgen/src/rust/functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ fn gen_win_function(writer: &Writer, namespace: &str, def: metadata::MethodDef)
pub unsafe fn #name<#generics>(#params) -> windows_core::Result<#return_type> #where_clause {
#link
let result__ = #name(#args);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ where
{
windows_targets::link!("msajapi.dll" "system" fn AllJoynConnectToBus(connectionspec : windows_core::PCWSTR) -> super::super::Foundation:: HANDLE);
let result__ = AllJoynConnectToBus(connectionspec.param().abi());
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[cfg(feature = "Win32_Security")]
#[inline]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,13 @@ where
pub unsafe fn BluetoothFindFirstDevice(pbtsp: *const BLUETOOTH_DEVICE_SEARCH_PARAMS, pbtdi: *mut BLUETOOTH_DEVICE_INFO) -> windows_core::Result<HBLUETOOTH_DEVICE_FIND> {
windows_targets::link!("bluetoothapis.dll" "system" fn BluetoothFindFirstDevice(pbtsp : *const BLUETOOTH_DEVICE_SEARCH_PARAMS, pbtdi : *mut BLUETOOTH_DEVICE_INFO) -> HBLUETOOTH_DEVICE_FIND);
let result__ = BluetoothFindFirstDevice(pbtsp, pbtdi);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn BluetoothFindFirstRadio(pbtfrp: *const BLUETOOTH_FIND_RADIO_PARAMS, phradio: *mut super::super::Foundation::HANDLE) -> windows_core::Result<HBLUETOOTH_RADIO_FIND> {
windows_targets::link!("bluetoothapis.dll" "system" fn BluetoothFindFirstRadio(pbtfrp : *const BLUETOOTH_FIND_RADIO_PARAMS, phradio : *mut super::super::Foundation:: HANDLE) -> HBLUETOOTH_RADIO_FIND);
let result__ = BluetoothFindFirstRadio(pbtfrp, phradio);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn BluetoothFindNextDevice<P0>(hfind: P0, pbtdi: *mut BLUETOOTH_DEVICE_INFO) -> windows_core::Result<()>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1889,7 +1889,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDevRegKeyA(deviceinfoset : HDEVINFO, deviceinfodata : *const SP_DEVINFO_DATA, scope : u32, hwprofile : u32, keytype : u32, infhandle : *const core::ffi::c_void, infsectionname : windows_core::PCSTR) -> super::super::System::Registry:: HKEY);
let result__ = SetupDiCreateDevRegKeyA(deviceinfoset.param().abi(), deviceinfodata, scope, hwprofile, keytype, core::mem::transmute(infhandle.unwrap_or(std::ptr::null())), infsectionname.param().abi());
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[cfg(feature = "Win32_System_Registry")]
#[inline]
Expand All @@ -1900,7 +1900,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDevRegKeyW(deviceinfoset : HDEVINFO, deviceinfodata : *const SP_DEVINFO_DATA, scope : u32, hwprofile : u32, keytype : u32, infhandle : *const core::ffi::c_void, infsectionname : windows_core::PCWSTR) -> super::super::System::Registry:: HKEY);
let result__ = SetupDiCreateDevRegKeyW(deviceinfoset.param().abi(), deviceinfodata, scope, hwprofile, keytype, core::mem::transmute(infhandle.unwrap_or(std::ptr::null())), infsectionname.param().abi());
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiCreateDeviceInfoA<P0, P1, P2, P3>(deviceinfoset: P0, devicename: P1, classguid: *const windows_core::GUID, devicedescription: P2, hwndparent: P3, creationflags: SETUP_DI_DEVICE_CREATION_FLAGS, deviceinfodata: Option<*mut SP_DEVINFO_DATA>) -> windows_core::Result<()>
Expand All @@ -1920,7 +1920,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInfoList(classguid : *const windows_core::GUID, hwndparent : super::super::Foundation:: HWND) -> HDEVINFO);
let result__ = SetupDiCreateDeviceInfoList(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), hwndparent.param().abi());
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiCreateDeviceInfoListExA<P0, P1>(classguid: Option<*const windows_core::GUID>, hwndparent: P0, machinename: P1, reserved: Option<*const core::ffi::c_void>) -> windows_core::Result<HDEVINFO>
Expand All @@ -1930,7 +1930,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInfoListExA(classguid : *const windows_core::GUID, hwndparent : super::super::Foundation:: HWND, machinename : windows_core::PCSTR, reserved : *const core::ffi::c_void) -> HDEVINFO);
let result__ = SetupDiCreateDeviceInfoListExA(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), hwndparent.param().abi(), machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null())));
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiCreateDeviceInfoListExW<P0, P1>(classguid: Option<*const windows_core::GUID>, hwndparent: P0, machinename: P1, reserved: Option<*const core::ffi::c_void>) -> windows_core::Result<HDEVINFO>
Expand All @@ -1940,7 +1940,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInfoListExW(classguid : *const windows_core::GUID, hwndparent : super::super::Foundation:: HWND, machinename : windows_core::PCWSTR, reserved : *const core::ffi::c_void) -> HDEVINFO);
let result__ = SetupDiCreateDeviceInfoListExW(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), hwndparent.param().abi(), machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null())));
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiCreateDeviceInfoW<P0, P1, P2, P3>(deviceinfoset: P0, devicename: P1, classguid: *const windows_core::GUID, devicedescription: P2, hwndparent: P3, creationflags: SETUP_DI_DEVICE_CREATION_FLAGS, deviceinfodata: Option<*mut SP_DEVINFO_DATA>) -> windows_core::Result<()>
Expand Down Expand Up @@ -1971,7 +1971,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInterfaceRegKeyA(deviceinfoset : HDEVINFO, deviceinterfacedata : *const SP_DEVICE_INTERFACE_DATA, reserved : u32, samdesired : u32, infhandle : *const core::ffi::c_void, infsectionname : windows_core::PCSTR) -> super::super::System::Registry:: HKEY);
let result__ = SetupDiCreateDeviceInterfaceRegKeyA(deviceinfoset.param().abi(), deviceinterfacedata, reserved, samdesired, core::mem::transmute(infhandle.unwrap_or(std::ptr::null())), infsectionname.param().abi());
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[cfg(feature = "Win32_System_Registry")]
#[inline]
Expand All @@ -1982,7 +1982,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiCreateDeviceInterfaceRegKeyW(deviceinfoset : HDEVINFO, deviceinterfacedata : *const SP_DEVICE_INTERFACE_DATA, reserved : u32, samdesired : u32, infhandle : *const core::ffi::c_void, infsectionname : windows_core::PCWSTR) -> super::super::System::Registry:: HKEY);
let result__ = SetupDiCreateDeviceInterfaceRegKeyW(deviceinfoset.param().abi(), deviceinterfacedata, reserved, samdesired, core::mem::transmute(infhandle.unwrap_or(std::ptr::null())), infsectionname.param().abi());
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiCreateDeviceInterfaceW<P0, P1>(deviceinfoset: P0, deviceinfodata: *const SP_DEVINFO_DATA, interfaceclassguid: *const windows_core::GUID, referencestring: P1, creationflags: u32, deviceinterfacedata: Option<*mut SP_DEVICE_INTERFACE_DATA>) -> windows_core::Result<()>
Expand Down Expand Up @@ -2211,7 +2211,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiGetClassDevsA(classguid : *const windows_core::GUID, enumerator : windows_core::PCSTR, hwndparent : super::super::Foundation:: HWND, flags : SETUP_DI_GET_CLASS_DEVS_FLAGS) -> HDEVINFO);
let result__ = SetupDiGetClassDevsA(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), enumerator.param().abi(), hwndparent.param().abi(), flags);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiGetClassDevsExA<P0, P1, P2, P3>(classguid: Option<*const windows_core::GUID>, enumerator: P0, hwndparent: P1, flags: SETUP_DI_GET_CLASS_DEVS_FLAGS, deviceinfoset: P2, machinename: P3, reserved: Option<*const core::ffi::c_void>) -> windows_core::Result<HDEVINFO>
Expand All @@ -2223,7 +2223,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiGetClassDevsExA(classguid : *const windows_core::GUID, enumerator : windows_core::PCSTR, hwndparent : super::super::Foundation:: HWND, flags : SETUP_DI_GET_CLASS_DEVS_FLAGS, deviceinfoset : HDEVINFO, machinename : windows_core::PCSTR, reserved : *const core::ffi::c_void) -> HDEVINFO);
let result__ = SetupDiGetClassDevsExA(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), enumerator.param().abi(), hwndparent.param().abi(), flags, deviceinfoset.param().abi(), machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null())));
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiGetClassDevsExW<P0, P1, P2, P3>(classguid: Option<*const windows_core::GUID>, enumerator: P0, hwndparent: P1, flags: SETUP_DI_GET_CLASS_DEVS_FLAGS, deviceinfoset: P2, machinename: P3, reserved: Option<*const core::ffi::c_void>) -> windows_core::Result<HDEVINFO>
Expand All @@ -2235,7 +2235,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiGetClassDevsExW(classguid : *const windows_core::GUID, enumerator : windows_core::PCWSTR, hwndparent : super::super::Foundation:: HWND, flags : SETUP_DI_GET_CLASS_DEVS_FLAGS, deviceinfoset : HDEVINFO, machinename : windows_core::PCWSTR, reserved : *const core::ffi::c_void) -> HDEVINFO);
let result__ = SetupDiGetClassDevsExW(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), enumerator.param().abi(), hwndparent.param().abi(), flags, deviceinfoset.param().abi(), machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null())));
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiGetClassDevsW<P0, P1>(classguid: Option<*const windows_core::GUID>, enumerator: P0, hwndparent: P1, flags: SETUP_DI_GET_CLASS_DEVS_FLAGS) -> windows_core::Result<HDEVINFO>
Expand All @@ -2245,7 +2245,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiGetClassDevsW(classguid : *const windows_core::GUID, enumerator : windows_core::PCWSTR, hwndparent : super::super::Foundation:: HWND, flags : SETUP_DI_GET_CLASS_DEVS_FLAGS) -> HDEVINFO);
let result__ = SetupDiGetClassDevsW(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), enumerator.param().abi(), hwndparent.param().abi(), flags);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[cfg(feature = "Win32_UI_Controls")]
#[inline]
Expand Down Expand Up @@ -2697,7 +2697,7 @@ where
pub unsafe fn SetupDiOpenClassRegKey(classguid: Option<*const windows_core::GUID>, samdesired: u32) -> windows_core::Result<super::super::System::Registry::HKEY> {
windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenClassRegKey(classguid : *const windows_core::GUID, samdesired : u32) -> super::super::System::Registry:: HKEY);
let result__ = SetupDiOpenClassRegKey(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), samdesired);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[cfg(feature = "Win32_System_Registry")]
#[inline]
Expand All @@ -2707,7 +2707,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenClassRegKeyExA(classguid : *const windows_core::GUID, samdesired : u32, flags : u32, machinename : windows_core::PCSTR, reserved : *const core::ffi::c_void) -> super::super::System::Registry:: HKEY);
let result__ = SetupDiOpenClassRegKeyExA(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), samdesired, flags, machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null())));
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[cfg(feature = "Win32_System_Registry")]
#[inline]
Expand All @@ -2717,7 +2717,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenClassRegKeyExW(classguid : *const windows_core::GUID, samdesired : u32, flags : u32, machinename : windows_core::PCWSTR, reserved : *const core::ffi::c_void) -> super::super::System::Registry:: HKEY);
let result__ = SetupDiOpenClassRegKeyExW(core::mem::transmute(classguid.unwrap_or(std::ptr::null())), samdesired, flags, machinename.param().abi(), core::mem::transmute(reserved.unwrap_or(std::ptr::null())));
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[cfg(feature = "Win32_System_Registry")]
#[inline]
Expand All @@ -2727,7 +2727,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenDevRegKey(deviceinfoset : HDEVINFO, deviceinfodata : *const SP_DEVINFO_DATA, scope : u32, hwprofile : u32, keytype : u32, samdesired : u32) -> super::super::System::Registry:: HKEY);
let result__ = SetupDiOpenDevRegKey(deviceinfoset.param().abi(), deviceinfodata, scope, hwprofile, keytype, samdesired);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiOpenDeviceInfoA<P0, P1, P2>(deviceinfoset: P0, deviceinstanceid: P1, hwndparent: P2, openflags: u32, deviceinfodata: Option<*mut SP_DEVINFO_DATA>) -> windows_core::Result<()>
Expand Down Expand Up @@ -2766,7 +2766,7 @@ where
{
windows_targets::link!("setupapi.dll" "system" fn SetupDiOpenDeviceInterfaceRegKey(deviceinfoset : HDEVINFO, deviceinterfacedata : *const SP_DEVICE_INTERFACE_DATA, reserved : u32, samdesired : u32) -> super::super::System::Registry:: HKEY);
let result__ = SetupDiOpenDeviceInterfaceRegKey(deviceinfoset.param().abi(), deviceinterfacedata, reserved, samdesired);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn SetupDiOpenDeviceInterfaceW<P0, P1>(deviceinfoset: P0, devicepath: P1, openflags: u32, deviceinterfacedata: Option<*mut SP_DEVICE_INTERFACE_DATA>) -> windows_core::Result<()>
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/windows/src/Windows/Win32/Foundation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ where
{
windows_targets::link!("kernel32.dll" "system" fn GlobalFree(hmem : HGLOBAL) -> HGLOBAL);
let result__ = GlobalFree(hmem.param().abi());
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn LocalFree<P0>(hmem: P0) -> HLOCAL
Expand Down
2 changes: 1 addition & 1 deletion crates/libs/windows/src/Windows/Win32/Graphics/Gdi/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ where
{
windows_targets::link!("gdi32.dll" "system" fn CreateDIBSection(hdc : HDC, pbmi : *const BITMAPINFO, usage : DIB_USAGE, ppvbits : *mut *mut core::ffi::c_void, hsection : super::super::Foundation:: HANDLE, offset : u32) -> HBITMAP);
let result__ = CreateDIBSection(hdc.param().abi(), pbmi, usage, ppvbits, hsection.param().abi(), offset);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn CreateDIBitmap<P0>(hdc: P0, pbmih: Option<*const BITMAPINFOHEADER>, flinit: u32, pjbits: Option<*const core::ffi::c_void>, pbmi: Option<*const BITMAPINFO>, iusage: DIB_USAGE) -> HBITMAP
Expand Down
4 changes: 2 additions & 2 deletions crates/libs/windows/src/Windows/Win32/Graphics/OpenGL/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ where
{
windows_targets::link!("opengl32.dll" "system" fn wglCreateContext(param0 : super::Gdi:: HDC) -> HGLRC);
let result__ = wglCreateContext(param0.param().abi());
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[cfg(feature = "Win32_Graphics_Gdi")]
#[inline]
Expand All @@ -2019,7 +2019,7 @@ where
{
windows_targets::link!("opengl32.dll" "system" fn wglCreateLayerContext(param0 : super::Gdi:: HDC, param1 : i32) -> HGLRC);
let result__ = wglCreateLayerContext(param0.param().abi(), param1);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn wglDeleteContext<P0>(param0: P0) -> windows_core::Result<()>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ where
{
windows_targets::link!("winspool.drv" "system" fn AddPrinterA(pname : windows_core::PCSTR, level : u32, pprinter : *const u8) -> super::super::Foundation:: HANDLE);
let result__ = AddPrinterA(pname.param().abi(), level, pprinter);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn AddPrinterConnection2A<P0, P1>(hwnd: P0, pszname: P1, dwlevel: u32, pconnectioninfo: *const core::ffi::c_void) -> super::super::Foundation::BOOL
Expand Down Expand Up @@ -205,7 +205,7 @@ where
{
windows_targets::link!("winspool.drv" "system" fn AddPrinterW(pname : windows_core::PCWSTR, level : u32, pprinter : *const u8) -> super::super::Foundation:: HANDLE);
let result__ = AddPrinterW(pname.param().abi(), level, pprinter);
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[cfg(feature = "Win32_Graphics_Gdi")]
#[inline]
Expand Down Expand Up @@ -1295,7 +1295,7 @@ where
{
windows_targets::link!("winspool.drv" "system" fn GetSpoolFileHandle(hprinter : super::super::Foundation:: HANDLE) -> super::super::Foundation:: HANDLE);
let result__ = GetSpoolFileHandle(hprinter.param().abi());
(!result__.is_invalid()).then(|| result__).ok_or_else(windows_core::Error::from_win32)
(!result__.is_invalid()).then_some(result__).ok_or_else(windows_core::Error::from_win32)
}
#[inline]
pub unsafe fn ImpersonatePrinterClient<P0>(htoken: P0) -> super::super::Foundation::BOOL
Expand Down
Loading

0 comments on commit 9f5ec21

Please sign in to comment.