Module: WinFFI

Extended by:
LibBase
Defined in:
lib/win-ffi/core.rb,
lib/win-ffi/kernel32.rb,
lib/win-ffi/core/struct.rb,
lib/win-ffi/core/version.rb,
lib/win-ffi/core/lib_base.rb,
lib/win-ffi/core/macro/util.rb,
lib/win-ffi/core/struct/guid.rb,
lib/win-ffi/core/struct/luid.rb,
lib/win-ffi/core/struct/rect.rb,
lib/win-ffi/core/struct/size.rb,
lib/win-ffi/core/string_utils.rb,
lib/win-ffi/core/struct/point.rb,
lib/win-ffi/core/typedef/core.rb,
lib/win-ffi/core/boolean_utils.rb,
lib/win-ffi/core/enum/firmware_type.rb,
lib/win-ffi/core/wide_inline_string.rb,
lib/win-ffi/core/wide_string_pointer.rb,
lib/win-ffi/core/enum/load_resource_flags.rb,
lib/win-ffi/core/struct/security_attributes.rb,
lib/win-ffi/kernel32/enum/version/win32_winnt.rb,
lib/win-ffi/kernel32/struct/os_version_info_ex.rb

Defined Under Namespace

Modules: BooleanUtils, Kernel32, LibBase, StringUtils Classes: FFIStruct, GUID, LUID, OSVERSIONINFOEX, POINT, RECT, SECURITY_ATTRIBUTES, SIZE, WideInlineString, WideStringPointer

Constant Summary collapse

VERSION =
'1.0.0'
Architecture =

“i386-mingw32” | “x64-mingw32”

WindowsVersion =
OSVERSIONINFOEX.new.get!
FirmwareType =
enum :firmware_type,
[
  :Unknown, 0,
  :Bios,    1,
  :Uefi,    2,
  :Max,     3
]
LoadResourceFlags =
enum :load_resource_flags,
                         [
    :DEFAULTCOLOR, 0x00000000, # The default flag; it does nothing. All it means is "not :MONOCHROME".


    :MONOCHROME,    0x00000001, # Loads the image in black and white.

    :COLOR,         0x00000002,
    :COPYRETURNORG, 0x00000004,
    :COPYDELETEORG, 0x00000008,
    :LOADFROMFILE,  0x00000010, # Loads the stand-alone image from the file specified by lpszName (icon, cursor, or

    # bitmap file).

    :LOADTRANSPARENT, 0x00000020, # Retrieves the color value of the first pixel in the image and replaces the

    # corresponding entry in the color table with the default window_class color (COLOR_WINDOW). All pixels in the image

    # that use that entry become the default window_class color. This value applies only to images that have corresponding

    # color tables.

    :DEFAULTSIZE, 0x00000040, # Uses the width or height specified by the system metric values for cursors or icons,

    # if the cxDesired or cyDesired values are set to zero. If this flag is not specified and cxDesired and

    # cyDesired are set to zero, the function uses the actual resource size. If the resource contains multiple

    # images, the function uses the size of the first image.

    :VGACOLOR,        0x00000080, # Uses true VGA colors.

    :LOADMAP3DCOLORS, 0x00001000, # Searches the color table for the image and replaces the following shades of gray

    # with the corresponding 3-D color.

    #Dk Gray, RGB(128,128,128) with COLOR_3DSHADOW

    #Gray, RGB(192,192,192) with COLOR_3DFACE

    #Lt Gray, RGB(223,223,223) with COLOR_3DLIGHT

    # Do not use this option if you are loading a bitmap with a color depth greater than 8bpp.


    :CREATEDIBSECTION, 0x00002000, # When the uType parameter specifies IMAGE_BITMAP, causes the function to return

    # a DIB section bitmap rather than a compatible bitmap. This flag is useful for loading a bitmap without mapping

    # it to the colors of the display device.

    # Do not use this option if you are loading a bitmap with a color depth greater than 8bpp.

    # If fuLoad includes both the :LOADTRANSPARENT and :LOADMAP3DCOLORS values, :LOADTRANSPARENT takes precedence.

    # However, the color table entry is replaced with COLOR_3DFACE rather than COLOR_WINDOW.

    :COPYFROMRESOURCE, 0x00004000,
    :SHARED,           0x00008000, # Shares the image handle if the image is loaded multiple times. If :SHARED is not set, a

    # second call to LoadImage for the same resource will load the image again and return a different handle.

    # When you use this flag, the system will destroy the resource when it is no longer needed.

    # Do not use :SHARED for images that have non-standard sizes, that may change after loading, or that are loaded

    # from a file. When loading a system icon or cursor, you must use :SHARED or the function will fail to load the

    # resource. This function finds the first image in the cache with the requested resource name, regardless of the

    # size requested.

]

Class Method Summary collapse

Instance Method Summary collapse

Methods included from LibBase

encoded_function, extended, string_from_byte_array

Class Method Details

.encodingObject



15
16
17
# File 'lib/win-ffi/core/lib_base.rb', line 15

def self.encoding
  @encoding
end

.encoding=(encoding) ⇒ Object



19
20
21
# File 'lib/win-ffi/core/lib_base.rb', line 19

def self.encoding=(encoding)
  @encoding = encoding
end

.loggerObject



7
8
9
# File 'lib/win-ffi/core/lib_base.rb', line 7

def self.logger
  @logger
end

Instance Method Details

#hibyte(w) ⇒ Object



22
23
24
# File 'lib/win-ffi/core/macro/util.rb', line 22

def hibyte(w)
  w >> 8
end

#hiword(l) ⇒ Object



14
15
16
# File 'lib/win-ffi/core/macro/util.rb', line 14

def hiword(l)
  l >> 16
end

#lobyte(w) ⇒ Object



18
19
20
# File 'lib/win-ffi/core/macro/util.rb', line 18

def lobyte(w)
  w & 0xff
end

#loword(l) ⇒ Object



10
11
12
# File 'lib/win-ffi/core/macro/util.rb', line 10

def loword(l)
  l & 0xffff
end

#makelong(a, b) ⇒ Object Also known as: makelresult, makelparam, makewparam



6
7
8
# File 'lib/win-ffi/core/macro/util.rb', line 6

def makelong(a, b)
  ((a & 0xffff) | ((b & 0xffff) << 16))
end

#makeword(a, b) ⇒ Object



2
3
4
# File 'lib/win-ffi/core/macro/util.rb', line 2

def makeword(a, b)
  ((a & 0xff) | ((b & 0xff) << 8))
end

#point_to_points(pt) ⇒ Object



31
32
33
# File 'lib/win-ffi/core/macro/util.rb', line 31

def point_to_points(pt)
  makelong(pt.x, pt.y)
end

#points_to_point(pt, pts) ⇒ Object



26
27
28
29
# File 'lib/win-ffi/core/macro/util.rb', line 26

def points_to_point(pt, pts)
  pt.x = loword(pts)
  pt.y = hiword(pts)
end