== Parameters ( win32-api ) Long: 'L' Integer: 'I' Pointer: 'P' Void: 'V' String: 'S' Callback: 'K' # win32-api only == Windows Data Types BOOL => 'I' (or 'B', win32-api only) DWORD => 'L' HANDLE => 'L' LPDWORD => 'P' (or 'L') LPTSTR => 'P' LPCTSTR => 'S' UINT => 'L' VOID => 'V' WORD => 'I' LPVOID => 'L' (or 'P') CALLBACK => 'K' == C Data Types void => 'V' void* => 'P' char* => 'P' const char* => 'L' int => 'I' long => 'L' struct => 'P' struct* => 'P' == Notes In practice most LPVOID types should be designated as 'L' because this usually means the function is looking for an address. Check the documentation for details. If using the windows-api library, you can use 'B' instead of 'I' for the return type for functions that return a BOOL. ===== Definitions from windows-api (api.rb) # Verbose data types that can be used instead of single letters DATA_TYPES = { 'ATOM' => 'I', 'BOOL' => 'B', 'BOOLEAN' => 'B', 'BYTE' => 'I', 'CALLBACK' => 'K', 'CHAR' => 'I', 'COLORREF' => 'L', 'DWORD' => 'L', 'DWORDLONG' => 'L', 'DWORD_PTR' => 'P', 'DWORD32' => 'I', 'DWORD64' => 'L', 'HACCEL' => 'L', 'HANDLE' => 'L', 'HBITMAP' => 'L', 'HBRUSH' => 'L', 'HCOLORSPACE' => 'L', 'HCONV' => 'L', 'HDC' => 'L', 'HFILE' => 'I', 'HKEY' => 'L', 'HFONT' => 'L', 'HINSTANCE' => 'L', 'HKEY' => 'L', 'HLOCAL' => 'L', 'HMENU' => 'L', 'HMODULE' => 'L', 'HRESULT' => 'L', 'HWND' => 'L', 'INT' => 'I', 'INT_PTR' => 'P', 'INT32' => 'I', 'INT64' => 'L', 'LANGID' => 'I', 'LCID' => 'L', 'LCTYPE' => 'L', 'LONG' => 'L', 'LONGLONG' => 'L', 'LONG_PTR' => 'P', 'LONG32' => 'L', 'LONG64' => 'L', 'LPARAM' => 'P', 'LPBOOL' => 'P', 'LPBYTE' => 'P', 'LPCOLORREF' => 'P', 'LPCSTR' => 'P', 'LPCTSTR' => 'P', 'LPCVOID' => 'L', 'LPCWSTR' => 'P', 'LPDWORD' => 'P', 'LPHANDLE' => 'P', 'LPINT' => 'P', 'LPLONG' => 'P', 'LPSTR' => 'P', 'LPTSTR' => 'P', 'LPVOID' => 'L', 'LPWORD' => 'P', 'LPWSTR' => 'P', 'LRESULT' => 'P', 'PBOOL' => 'P', 'PBOOLEAN' => 'P', 'PBYTE' => 'P', 'PHKEY' => 'P', 'SC_HANDLE' => 'L', 'SC_LOCK' => 'L', 'SERVICE_STATUS_HANDLE' => 'L', 'SHORT' => 'I', 'SIZE_T' => 'P', 'TCHAR' => 'L', 'UINT' => 'I', 'UINT_PTR' => 'P', 'UINT32' => 'I', 'UINT64' => 'L', 'ULONG' => 'L', 'ULONGLONG' => 'L', 'ULONG_PTR' => 'P', 'ULONG32' => 'L', 'ULONG64' => 'L', 'USHORT' => 'I', 'USN' => 'L', 'WINAPI' => 'L', 'WORD' => 'I' } Win::Library shortcuts (Mostly in line with Array#pack) TYPES = { V: :void, # For functions that return nothing (return type void). v: :void, # For functions that return nothing (return type void). C: :uchar, #– 8-bit unsigned character (byte) c: :char, # 8-bit character (byte) # :int8 – 8-bit signed integer # :uint8 – 8-bit unsigned integer S: :ushort, # – 16-bit unsigned integer (Win32API: used for string) s: :short, # – 16-bit signed integer # :uint16 – 16-bit unsigned integer # :int16 – 16-bit signed integer I: :uint, # 32-bit unsigned integer i: :int, # 32-bit signed integer # :uint32 – 32-bit unsigned integer # :int32 – 32-bit signed integer L: :ulong, # unsigned long int – platform-specific size l: :long, # long int – platform-specific size (http://groups.google.com/group/ruby-ffi/browse_thread/thread/4762fc77130339b1) # :int64 – 64-bit signed integer # :uint64 – 64-bit unsigned integer # :long_long – 64-bit signed integer # :ulong_long – 64-bit unsigned integer F: :float, # 32-bit floating point D: :double, # 64-bit floating point (double-precision) P: :pointer, # pointer – platform-specific size p: :string, # C-style (NULL-terminated) character string (Win32API: S) B: :bool # (?? 1 byte in C++) #For function argument type only: # :buffer_in – Similar to :pointer, but optimized for Buffers that the function can only read (not write). # :buffer_out – Similar to :pointer, but optimized for Buffers that the function can only write (not read). # :buffer_inout – Similar to :pointer, but may be optimized for Buffers. # :varargs – Variable arguments }