System.Win32.Mem

Win32-2.14.0.0: A binding to Windows Win32 API.

Copyright | (c) Alastair Reid 1997-2003
License | BSD-style (see the file libraries/base/LICENSE)
Maintainer | Esa Ilari Vuokko <ei@vuokko.info>
Stability | provisional
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

System.Win32.Mem

Contents

- Global allocation
- Heap allocation
- Virtual allocation
  - Allocation
  - Locking
  - Protection
  - Freeing

Description

A collection of FFI declarations for interfacing with Win32.

Synopsis

- data MEMORY_BASIC_INFORMATION = MEMORY_BASIC_INFORMATION {
  - mbiBaseAddress :: Addr
  - mbiAllocationBase :: Addr
  - mbiAllocationProtect :: DWORD
  - mbiRegionSize :: SIZE_T
  - mbiState :: DWORD
  - mbiProtect :: DWORD
  - mbiType :: DWORD
  }
- copyMemory :: Ptr a -> Ptr a -> DWORD -> IO ()
- moveMemory :: Ptr a -> Ptr a -> DWORD -> IO ()
- fillMemory :: Ptr a -> DWORD -> BYTE -> IO ()
- zeroMemory :: Ptr a -> DWORD -> IO ()
- memset :: Ptr a -> CInt -> CSize -> IO ()
- getProcessHeap :: IO HANDLE
- getProcessHeaps :: DWORD -> Addr -> IO DWORD
- type HGLOBAL = Addr
- type GlobalAllocFlags = UINT
- gMEM_INVALID_HANDLE :: GlobalAllocFlags
- gMEM_FIXED :: GlobalAllocFlags
- gMEM_MOVEABLE :: GlobalAllocFlags
- gPTR :: GlobalAllocFlags
- gHND :: GlobalAllocFlags
- gMEM_DDESHARE :: GlobalAllocFlags
- gMEM_SHARE :: GlobalAllocFlags
- gMEM_LOWER :: GlobalAllocFlags
- gMEM_NOCOMPACT :: GlobalAllocFlags
- gMEM_NODISCARD :: GlobalAllocFlags
- gMEM_NOT_BANKED :: GlobalAllocFlags
- gMEM_NOTIFY :: GlobalAllocFlags
- gMEM_ZEROINIT :: GlobalAllocFlags
- globalAlloc :: GlobalAllocFlags -> DWORD -> IO HGLOBAL
- globalFlags :: HGLOBAL -> IO GlobalAllocFlags
- globalFree :: HGLOBAL -> IO HGLOBAL
- globalHandle :: Addr -> IO HGLOBAL
- globalLock :: HGLOBAL -> IO Addr
- globalReAlloc :: HGLOBAL -> DWORD -> GlobalAllocFlags -> IO HGLOBAL
- globalSize :: HGLOBAL -> IO DWORD
- globalUnlock :: HGLOBAL -> IO ()
- type HeapAllocFlags = DWORD
- hEAP_GENERATE_EXCEPTIONS :: HeapAllocFlags
- hEAP_NO_SERIALIZE :: HeapAllocFlags
- hEAP_ZERO_MEMORY :: HeapAllocFlags
- heapAlloc :: HANDLE -> HeapAllocFlags -> DWORD -> IO Addr
- heapCompact :: HANDLE -> HeapAllocFlags -> IO UINT
- heapCreate :: HeapAllocFlags -> DWORD -> DWORD -> IO HANDLE
- heapDestroy :: HANDLE -> IO ()
- heapFree :: HANDLE -> HeapAllocFlags -> Addr -> IO ()
- heapLock :: HANDLE -> IO ()
- heapReAlloc :: HANDLE -> HeapAllocFlags -> Addr -> DWORD -> IO Addr
- heapSize :: HANDLE -> HeapAllocFlags -> Addr -> IO DWORD
- heapUnlock :: HANDLE -> IO ()
- heapValidate :: HANDLE -> HeapAllocFlags -> Addr -> IO Bool
- virtualAlloc :: Addr -> DWORD -> VirtualAllocFlags -> ProtectFlags -> IO Addr
- virtualAllocEx :: HANDLE -> Addr -> DWORD -> VirtualAllocFlags -> ProtectFlags -> IO Addr
- type VirtualAllocFlags = DWORD
- mEM_COMMIT :: VirtualAllocFlags
- mEM_RESERVE :: VirtualAllocFlags
- virtualLock :: Addr -> DWORD -> IO ()
- virtualUnlock :: Addr -> DWORD -> IO ()
- virtualProtect :: Addr -> DWORD -> ProtectFlags -> IO ProtectFlags
- virtualProtectEx :: HANDLE -> Addr -> DWORD -> ProtectFlags -> IO ProtectFlags
- virtualQueryEx :: HANDLE -> LPVOID -> Ptr MEMORY_BASIC_INFORMATION -> SIZE_T -> IO DWORD
- type ProtectFlags = DWORD
- pAGE_READONLY :: ProtectFlags
- pAGE_READWRITE :: ProtectFlags
- pAGE_EXECUTE :: ProtectFlags
- pAGE_EXECUTE_READ :: ProtectFlags
- pAGE_EXECUTE_READWRITE :: ProtectFlags
- pAGE_GUARD :: ProtectFlags
- pAGE_NOACCESS :: ProtectFlags
- pAGE_NOCACHE :: ProtectFlags
- virtualFree :: Addr -> DWORD -> FreeFlags -> IO ()
- virtualFreeEx :: HANDLE -> Addr -> DWORD -> FreeFlags -> IO ()
- type FreeFlags = DWORD
- mEM_DECOMMIT :: FreeFlags
- mEM_RELEASE :: FreeFlags

# Documentation

data MEMORY_BASIC_INFORMATION Source #

Constructors

MEMORY_BASIC_INFORMATION |
Fields mbiBaseAddress :: Addr mbiAllocationBase :: Addr mbiAllocationProtect :: DWORD mbiRegionSize :: SIZE_T mbiState :: DWORD mbiProtect :: DWORD mbiType :: DWORD

#### Instances

Instances details

Storable MEMORY_BASIC_INFORMATION Source # |
Instance details Defined in System.Win32.Mem Methods sizeOf :: MEMORY_BASIC_INFORMATION -> Int # alignment :: MEMORY_BASIC_INFORMATION -> Int # peekElemOff :: Ptr MEMORY_BASIC_INFORMATION -> Int -> IO MEMORY_BASIC_INFORMATION # pokeElemOff :: Ptr MEMORY_BASIC_INFORMATION -> Int -> MEMORY_BASIC_INFORMATION -> IO () # peekByteOff :: Ptr b -> Int -> IO MEMORY_BASIC_INFORMATION # pokeByteOff :: Ptr b -> Int -> MEMORY_BASIC_INFORMATION -> IO () # peek :: Ptr MEMORY_BASIC_INFORMATION -> IO MEMORY_BASIC_INFORMATION # poke :: Ptr MEMORY_BASIC_INFORMATION -> MEMORY_BASIC_INFORMATION -> IO () #
Show MEMORY_BASIC_INFORMATION Source # |
Instance details Defined in System.Win32.Mem Methods showsPrec :: Int -> MEMORY_BASIC_INFORMATION -> ShowS # show :: MEMORY_BASIC_INFORMATION -> String # showList :: [MEMORY_BASIC_INFORMATION] -> ShowS #

copyMemory :: Ptr a -> Ptr a -> DWORD -> IO () Source #

moveMemory :: Ptr a -> Ptr a -> DWORD -> IO () Source #

fillMemory :: Ptr a -> DWORD -> BYTE -> IO () Source #

zeroMemory :: Ptr a -> DWORD -> IO () Source #

memset :: Ptr a -> CInt -> CSize -> IO () Source #

getProcessHeap :: IO HANDLE Source #

getProcessHeaps :: DWORD -> Addr -> IO DWORD Source #

type HGLOBAL = Addr Source #

# Global allocation

type GlobalAllocFlags = UINT Source #

gMEM_INVALID_HANDLE :: GlobalAllocFlags Source #

gMEM_FIXED :: GlobalAllocFlags Source #

gMEM_MOVEABLE :: GlobalAllocFlags Source #

gPTR :: GlobalAllocFlags Source #

gHND :: GlobalAllocFlags Source #

gMEM_DDESHARE :: GlobalAllocFlags Source #

gMEM_SHARE :: GlobalAllocFlags Source #

gMEM_LOWER :: GlobalAllocFlags Source #

gMEM_NOCOMPACT :: GlobalAllocFlags Source #

gMEM_NODISCARD :: GlobalAllocFlags Source #

gMEM_NOT_BANKED :: GlobalAllocFlags Source #

gMEM_NOTIFY :: GlobalAllocFlags Source #

gMEM_ZEROINIT :: GlobalAllocFlags Source #

globalAlloc :: GlobalAllocFlags -> DWORD -> IO HGLOBAL Source #

globalFlags :: HGLOBAL -> IO GlobalAllocFlags Source #

globalFree :: HGLOBAL -> IO HGLOBAL Source #

globalHandle :: Addr -> IO HGLOBAL Source #

globalLock :: HGLOBAL -> IO Addr Source #

globalReAlloc :: HGLOBAL -> DWORD -> GlobalAllocFlags -> IO HGLOBAL Source #

globalSize :: HGLOBAL -> IO DWORD Source #

globalUnlock :: HGLOBAL -> IO () Source #

# Heap allocation

type HeapAllocFlags = DWORD Source #

hEAP_GENERATE_EXCEPTIONS :: HeapAllocFlags Source #

hEAP_NO_SERIALIZE :: HeapAllocFlags Source #

hEAP_ZERO_MEMORY :: HeapAllocFlags Source #

heapAlloc :: HANDLE -> HeapAllocFlags -> DWORD -> IO Addr Source #

heapCompact :: HANDLE -> HeapAllocFlags -> IO UINT Source #

heapCreate :: HeapAllocFlags -> DWORD -> DWORD -> IO HANDLE Source #

heapDestroy :: HANDLE -> IO () Source #

heapFree :: HANDLE -> HeapAllocFlags -> Addr -> IO () Source #

heapLock :: HANDLE -> IO () Source #

heapReAlloc :: HANDLE -> HeapAllocFlags -> Addr -> DWORD -> IO Addr Source #

heapSize :: HANDLE -> HeapAllocFlags -> Addr -> IO DWORD Source #

heapUnlock :: HANDLE -> IO () Source #

heapValidate :: HANDLE -> HeapAllocFlags -> Addr -> IO Bool Source #

# Virtual allocation

## Allocation

virtualAlloc :: Addr -> DWORD -> VirtualAllocFlags -> ProtectFlags -> IO Addr Source #

virtualAllocEx :: HANDLE -> Addr -> DWORD -> VirtualAllocFlags -> ProtectFlags -> IO Addr Source #

type VirtualAllocFlags = DWORD Source #

mEM_COMMIT :: VirtualAllocFlags Source #

mEM_RESERVE :: VirtualAllocFlags Source #

## Locking

virtualLock :: Addr -> DWORD -> IO () Source #

virtualUnlock :: Addr -> DWORD -> IO () Source #

## Protection

virtualProtect :: Addr -> DWORD -> ProtectFlags -> IO ProtectFlags Source #

virtualProtectEx :: HANDLE -> Addr -> DWORD -> ProtectFlags -> IO ProtectFlags Source #

virtualQueryEx :: HANDLE -> LPVOID -> Ptr MEMORY_BASIC_INFORMATION -> SIZE_T -> IO DWORD Source #

type ProtectFlags = DWORD Source #

pAGE_READONLY :: ProtectFlags Source #

pAGE_READWRITE :: ProtectFlags Source #

pAGE_EXECUTE :: ProtectFlags Source #

pAGE_EXECUTE_READ :: ProtectFlags Source #

pAGE_EXECUTE_READWRITE :: ProtectFlags Source #

pAGE_GUARD :: ProtectFlags Source #

pAGE_NOACCESS :: ProtectFlags Source #

pAGE_NOCACHE :: ProtectFlags Source #

## Freeing

virtualFree :: Addr -> DWORD -> FreeFlags -> IO () Source #

virtualFreeEx :: HANDLE -> Addr -> DWORD -> FreeFlags -> IO () Source #

type FreeFlags = DWORD Source #

mEM_DECOMMIT :: FreeFlags Source #

mEM_RELEASE :: FreeFlags Source #