Trait winsafe::prelude::kernel_Hlocal
source · pub trait kernel_Hlocal: Handle {
// Provided methods
fn LocalAlloc(
flags: Option<LMEM>,
num_bytes: usize
) -> SysResult<LocalFreeGuard> { ... }
fn LocalFlags(&self) -> SysResult<LMEM> { ... }
fn LocalLock(&self) -> SysResult<LocalUnlockGuard<'_, Self>> { ... }
fn LocalReAlloc(
&mut self,
num_bytes: usize,
flags: Option<LMEM>
) -> SysResult<()> { ... }
fn LocalSize(&self) -> SysResult<usize> { ... }
}
Available on crate feature
kernel
only.Expand description
This trait is enabled with the kernel
feature, and provides methods for
HLOCAL
.
Prefer importing this trait through the prelude:
use winsafe::prelude::*;
Provided Methods§
sourcefn LocalAlloc(
flags: Option<LMEM>,
num_bytes: usize
) -> SysResult<LocalFreeGuard>
fn LocalAlloc( flags: Option<LMEM>, num_bytes: usize ) -> SysResult<LocalFreeGuard>
LocalAlloc
function.
sourcefn LocalFlags(&self) -> SysResult<LMEM>
fn LocalFlags(&self) -> SysResult<LMEM>
LocalFlags
function.
sourcefn LocalLock(&self) -> SysResult<LocalUnlockGuard<'_, Self>>
fn LocalLock(&self) -> SysResult<LocalUnlockGuard<'_, Self>>
LocalLock
function.
Calls LocalSize
to
retrieve the size of the memory block.
§Examples
use winsafe::{self as w, prelude::*, co};
let hlocal = w::HLOCAL::LocalAlloc(
Some(co::LMEM::FIXED | co::LMEM::ZEROINIT),
120,
)?;
let mut block = hlocal.LocalLock()?;
block.as_mut_slice()[0] = 40;
// LocalUnlock() called automatically
// LocalFree() called automatically
sourcefn LocalReAlloc(
&mut self,
num_bytes: usize,
flags: Option<LMEM>
) -> SysResult<()>
fn LocalReAlloc( &mut self, num_bytes: usize, flags: Option<LMEM> ) -> SysResult<()>
LocalReAlloc
function.
Originally this method returns the handle to the reallocated memory object; here the original handle is automatically updated.
Object Safety§
This trait is not object safe.