Module: Windows::MSVCRT::Buffer

Defined in:
lib/windows/msvcrt/buffer.rb

Constant Summary collapse

Memcpy =
API.new('memcpy', 'PLL', 'P', MSVCRT_DLL)
Memccpy =
API.new('_memccpy', 'PPIL', 'P', MSVCRT_DLL)
Memchr =
API.new('memchr', 'PIL', 'P', MSVCRT_DLL)
Memcmp =
API.new('memcmp', 'PPL', 'I', MSVCRT_DLL)
Memicmp =
API.new('_memicmp', 'PPL', 'I', MSVCRT_DLL)
Memmove =
API.new('memmove', 'PPL', 'P', MSVCRT_DLL)
Memset =
API.new('memset', 'PLL', 'L', MSVCRT_DLL)
Swab =
API.new('_swab', 'PPI', 'V', MSVCRT_DLL)
MemcpyPLL =
API.new('memcpy', 'PLL', 'P', MSVCRT_DLL)
MemcpyLPL =
API.new('memcpy', 'LPL', 'P', MSVCRT_DLL)
MemcpyLLL =
API.new('memcpy', 'LLL', 'P', MSVCRT_DLL)
MemcpyPPL =
API.new('memcpy', 'PPL', 'P', MSVCRT_DLL)

Instance Method Summary collapse

Instance Method Details

#memccpy(dest, src, char, count) ⇒ Object



44
45
46
# File 'lib/windows/msvcrt/buffer.rb', line 44

def memccpy(dest, src, char, count)
   Memccpy.call(dest, src, char, count)
end

#memchr(buf, char, count) ⇒ Object



48
49
50
# File 'lib/windows/msvcrt/buffer.rb', line 48

def memchr(buf, char, count)
   Memchr.call(buf, char, count)
end

#memcmp(buf1, buf2, count) ⇒ Object



52
53
54
# File 'lib/windows/msvcrt/buffer.rb', line 52

def memcmp(buf1, buf2, count)
   Memcmp.call(buf1, buf2, count)
end

#memcpy(dest, src, size = src.length) ⇒ Object

Wrapper for the memcpy() function. Both the dest and src can be either a string or a memory address. If size is omitted, it defaults to the length of src.



28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/windows/msvcrt/buffer.rb', line 28

def memcpy(dest, src, size = src.length)
   if dest.is_a?(::Integer)
      if src.is_a?(::String)
         MemcpyLPL.call(dest, src, size)
      else
         MemcpyLLL.call(dest, src, size)
      end
   else
      if src.is_a?(::String)
         MemcpyPPL.call(dest, src, size)
      else
         MemcpyPLL.call(dest, src, size)
      end
   end
end

#memicmp(buf1, buf2, count) ⇒ Object



56
57
58
# File 'lib/windows/msvcrt/buffer.rb', line 56

def memicmp(buf1, buf2, count)
   Memicmp.call(buf1, buf2, count)
end

#memmove(dest, src, count) ⇒ Object



60
61
62
# File 'lib/windows/msvcrt/buffer.rb', line 60

def memmove(dest, src, count)
   Memmove.call(dest, src, count)
end

#memset(dest, char, count) ⇒ Object



64
65
66
# File 'lib/windows/msvcrt/buffer.rb', line 64

def memset(dest, char, count)
   Memset.call(dest, char, count)
end

#swab(src, dest, count) ⇒ Object



68
69
70
# File 'lib/windows/msvcrt/buffer.rb', line 68

def swab(src, dest, count)
   Swab.call(src, dest, count)
end