Module OpamStubs
OS-specific functions requiring C code on at least one platform.
Most functions are Windows-specific and raise an exception on other platforms.
include module type of sig ... end
type console_screen_buffer_info= OpamStubsTypes.console_screen_buffer_info={size : int * int;cursorPosition : int * int;attributes : int;window : int * int * int * int;maximumWindowSize : int * int;}type console_font_infoex= OpamStubsTypes.console_font_infoex={font : int;fontSize : int * int;fontFamily : int;fontWeight : int;faceName : string;}type handle= OpamStubsTypes.handletype stdhandle= OpamStubsTypes.stdhandle=|STD_INPUT_HANDLE|STD_OUTPUT_HANDLE|STD_ERROR_HANDLEtype registry_root= OpamStubsTypes.registry_root=|HKEY_CLASSES_ROOT|HKEY_CURRENT_CONFIG|HKEY_CURRENT_USER|HKEY_LOCAL_MACHINE|HKEY_USERStype 'a registry_value= 'a OpamStubsTypes.registry_value=|REG_SZ : string registry_valuetype shGFP_type= OpamStubsTypes.shGFP_type=|SHGFP_TYPE_CURRENT|SHGFP_TYPE_DEFAULTtype ('a, 'b, 'c) winmessage= ('a, 'b, 'c) OpamStubsTypes.winmessage=|WM_SETTINGCHANGE : (int, string, int) winmessage
val getpid : unit -> intOn Windows, this returns the actual process ID, rather than the non-unique faked process ID returned by the Microsoft C Runtime (see https://caml.inria.fr/mantis/view.php?id=4034).
On all other platforms, this is just an alias for
Unix.getpid.
val getCurrentProcessID : unit -> int32Windows only. As
getpid, but without the possibility of truncating the ID on 32-bit platforms.
val getConsoleScreenBufferInfo : handle -> console_screen_buffer_infoWindows only. Return current Console screen buffer information.
val setConsoleTextAttribute : handle -> int -> unitWindows only. Set the console's text attribute setting.
val fillConsoleOutputCharacter : handle -> char -> int -> (int * int) -> boolWindows only.
fillConsoleOutputCharacter buffer c n (x, y)writescntimes starting at the given coordinate (and wrapping if required).
val getConsoleMode : handle -> intWindows only. Returns the input/output mode of the console screen buffer referred to by the handle.
- raises Not_found
If the handle does not refer to a console.
val setConsoleMode : handle -> int -> boolWindows only. Sets the input/output mode of the console screen buffer referred to by the handle, returning
trueif the operation isr successful.
val getWindowsVersion : unit -> int * int * int * intWindows only. Returns the Windows version as
(major, minor, build, revision). This function only works if opam is compiled OCaml 4.06.0 or later, it returns(0, 0, 0, 0)otherwise.
val isWoW64 : unit -> boolReturns
falseunless this process is a 32-bit Windows process running in the WoW64 sub-system (i.e. is being run on 64-bit Windows).
val waitpids : int list -> int -> int * Unix.process_statusWindows only. Given a list
pidswithlengthelements,waitpids pids lengthbehaves likeUnix.wait, returning the pid and exit status of the first process to terminate.
val writeRegistry : registry_root -> string -> string -> 'a registry_value -> 'a -> unitWindows only.
writeRegistry root key name value_type valuesets the valuenameof typevalue_typein registry keykeyofroottovalue.- raises Failure
If the value could not be set.
- raises Not_found
If
keydoes not exist.
val getCurrentConsoleFontEx : handle -> bool -> console_font_infoexWindows only. Gets information on the current console output font.
val create_glyph_checker : string -> handle * handleWindows only. Given a font name, returns a pair consisting of a screen DC and a font object, which will have been selected into the DC.
- raises Failure
If anything goes wrong with the GDI calls.
val delete_glyph_checker : (handle * handle) -> unitWindows only. Given
(dc, font), deletes the font object and releases the DC.
val has_glyph : (handle * handle) -> OpamCompat.Uchar.t -> boolWindows only.
has_glyph (dc, font) scalarreturnstrueiffontcontains a glyph forscalar.- raises Failure
If the call to
GetGlyphIndicesWfails.
val isWoW64Process : int32 -> boolWindows only. General version of
isWoW64for any given process ID. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms684139.aspx
val process_putenv : int32 -> string -> string -> boolWindows only.
process_putenv pid name valuesets the environment variablenametovaluein given process ID (Unix.putenvmust also be called to update the value in the current process). This function must not be called if the target process is 32-bit and the current process is 64-bit or vice versa (outcomes vary from a no-op to a segfault).
val shGetFolderPath : int -> shGFP_type -> stringWindows only.
shGetFolderPath nFolder dwFlagsretrieves the location of a special folder by CSIDL value. See https://msdn.microsoft.com/en-us/library/windows/desktop/bb762181.aspx
val sendMessageTimeout : nativeint -> int -> int -> ('a, 'b, 'c) winmessage -> 'a -> 'b -> int * 'cWindows only.
sendMessageTimeout hwnd timeout flags message wParam lParamsends a message to the given handle, but is guaranteed to return withintimeoutmilliseconds. The result consists of two parts,fstis the return value from SendMessageTimeout,snddepends on both the message andfst. See https://msdn.microsoft.com/en-us/library/windows/desktop/ms644952.aspx