Module: Windows::Memory

Defined in:
lib/windows/memory.rb

Constant Summary collapse

GHND =
0x0042
GMEM_FIXED =
0x0000
GMEM_MOVABLE =
0002
GMEM_ZEROINIT =
0x0040
GPTR =
0x0040
MEM_COMMIT =
0x1000
MEM_RESERVE =
0x2000
MEM_RESET =
0x80000
MEM_LARGE_PAGES =
0x20000000
MEM_PHYSICAL =
0x400000
MEM_TOP_DOWN =
0x100000
MEM_WRITE_WATCH =
0x200000
GlobalAlloc =
Win32API.new('kernel32', 'GlobalAlloc', 'II', 'I')
GlobalFlags =
Win32API.new('kernel32', 'GlobalFlags', 'I', 'I')
GlobalFree =
Win32API.new('kernel32', 'GlobalFree', 'I', 'I')
GlobalHandle =
Win32API.new('kernel32', 'GlobalHandle', 'P', 'I')
GlobalLock =
Win32API.new('kernel32', 'GlobalLock', 'L', 'L')
GlobalMemoryStatus =
Win32API.new('kernel32', 'GlobalMemoryStatus', 'P', 'V')
GlobalMemoryStatusEx =
Win32API.new('kernel32', 'GlobalMemoryStatusEx', 'P', 'V')
GlobalReAlloc =
Win32API.new('kernel32', 'GlobalReAlloc', 'III', 'I')
GlobalSize =
Win32API.new('kernel32', 'GlobalSize', 'I', 'I')
GlobalUnlock =
Win32API.new('kernel32', 'GlobalUnlock', 'I', 'I')
VirtualAlloc =
Win32API.new('kernel32', 'VirtualAlloc', 'LLLL', 'P')
VirtualAllocEx =
Win32API.new('kernel32', 'VirtualAllocEx', 'LLLLL', 'P')
VirtualFree =
Win32API.new('kernel32', 'VirtualFree', 'LLL', 'I')
VirtualFreeEx =
Win32API.new('kernel32', 'VirtualFreeEx', 'LLLL', 'I')
VirtualLock =
Win32API.new('kernel32', 'VirtualLock', 'PL', 'I')
VirtualProtect =
Win32API.new('kernel32', 'VirtualProtect', 'PLLP', 'I')
VirtualProtectEx =
Win32API.new('kernel32', 'VirtualProtectEx', 'LPLLP', 'I')
VirtualQuery =
Win32API.new('kernel32', 'VirtualQuery', 'LPL', 'L')
VirtualQueryEx =
Win32API.new('kernel32', 'VirtualQueryEx', 'LLPL', 'L')
VirtualUnlock =
Win32API.new('kernel32', 'VirtualUnlock', 'PL', 'I')
ZeroMemory =
Win32API.new('kernel32', 'RtlZeroMemory', 'PL', 'I')

Instance Method Summary collapse

Instance Method Details

#GlobalAlloc(flags, bytes) ⇒ Object



41
42
43
# File 'lib/windows/memory.rb', line 41

def GlobalAlloc(flags, bytes)
   GlobalAlloc.call(flags, bytes)
end

#GlobalFlags(handle) ⇒ Object



45
46
47
# File 'lib/windows/memory.rb', line 45

def GlobalFlags(handle)
   GlobalFlags.call(handle)
end

#GlobalFree(handle) ⇒ Object



49
50
51
# File 'lib/windows/memory.rb', line 49

def GlobalFree(handle)
   GlobalFree.call(handle)
end

#GlobalHandle(handle) ⇒ Object



53
54
55
# File 'lib/windows/memory.rb', line 53

def GlobalHandle(handle)
   GlobalHandle.call(handle)
end

#GlobalLock(handle) ⇒ Object



57
58
59
# File 'lib/windows/memory.rb', line 57

def GlobalLock(handle)
   GlobalLock.call(handle)
end

#GlobalMemoryStatus(buf) ⇒ Object



61
62
63
# File 'lib/windows/memory.rb', line 61

def GlobalMemoryStatus(buf)
   GlobalMemoryStatus.call(buf)
end

#GlobalMemoryStatusEx(buf) ⇒ Object



65
66
67
# File 'lib/windows/memory.rb', line 65

def GlobalMemoryStatusEx(buf)
   GlobalMemoryStatusEx.call(buf)
end

#GlobalReAlloc(handle, bytes, flags) ⇒ Object



69
70
71
# File 'lib/windows/memory.rb', line 69

def GlobalReAlloc(handle, bytes, flags)
   GlobalReAlloc.call(handle, bytes, flags)
end

#GlobalSize(handle) ⇒ Object



73
74
75
# File 'lib/windows/memory.rb', line 73

def GlobalSize(handle)
   GlobalSize.call(handle)
end

#GlobalUnlock(handle) ⇒ Object



77
78
79
# File 'lib/windows/memory.rb', line 77

def GlobalUnlock(handle)
   GlobalUnlock.call(handle)
end

#VirtualAlloc(address, size, alloc_type, protect) ⇒ Object



81
82
83
# File 'lib/windows/memory.rb', line 81

def VirtualAlloc(address, size, alloc_type, protect)
   VirtualAlloc.call(address, size, alloc_type, protect)
end

#VirtualAllocEx(handle, address, size, alloc_type, protect) ⇒ Object



85
86
87
# File 'lib/windows/memory.rb', line 85

def VirtualAllocEx(handle, address, size, alloc_type, protect)
   VirtualAllocEx.call(handle, address, size, alloc_type, protect)
end

#VirtualFree(address, size, free_type) ⇒ Object



89
90
91
# File 'lib/windows/memory.rb', line 89

def VirtualFree(address, size, free_type)
   VirtualFree.call(address, size, free_type) != 0
end

#VirtualFreeEx(handle, address, size, free_type) ⇒ Object



93
94
95
# File 'lib/windows/memory.rb', line 93

def VirtualFreeEx(handle, address, size, free_type)
   VirtualFreeEx.call(handle, address, size, free_type) != 0
end

#VirtualLock(address, size) ⇒ Object



97
98
99
# File 'lib/windows/memory.rb', line 97

def VirtualLock(address, size)
   VirtualLock.call(address, size) != 0
end

#VirtualProtect(address, size, new_protect, old_protect) ⇒ Object



101
102
103
# File 'lib/windows/memory.rb', line 101

def VirtualProtect(address, size, new_protect, old_protect)
   VirtualProtect.call(address, size, new_protect, old_protect) != 0
end

#VirtualProtectEx(handle, address, size, new_protect, old_protect) ⇒ Object



105
106
107
# File 'lib/windows/memory.rb', line 105

def VirtualProtectEx(handle, address, size, new_protect, old_protect)
   VirtualProtectEx.call(handle, address, size, new_protect, old_protect) != 0
end

#VirtualQuery(address, buffer, length) ⇒ Object



109
110
111
# File 'lib/windows/memory.rb', line 109

def VirtualQuery(address, buffer, length)
   VirtualQuery.call(address, buffer, length)
end

#VirtualQueryEx(handle, address, buffer, length) ⇒ Object



113
114
115
# File 'lib/windows/memory.rb', line 113

def VirtualQueryEx(handle, address, buffer, length)
   VirtualQueryEx.call(handle, address, buffer, length)
end

#VirtualUnlock(address, size) ⇒ Object



117
118
119
# File 'lib/windows/memory.rb', line 117

def VirtualUnlock(address, size)
   VirtualUnlock.call(address, size) != 0
end

#ZeroMemory(dest, length) ⇒ Object



121
122
123
# File 'lib/windows/memory.rb', line 121

def ZeroMemory(dest, length)
   ZeroMemory.call(dest, length)
end