File: windows_api.enabled.ml

package info (click to toggle)
zeroinstall-injector 2.18-2.2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 3,500 kB
  • sloc: ml: 26,524; xml: 2,700; ansic: 319; sh: 236; makefile: 133; python: 105
file content (24 lines) | stat: -rw-r--r-- 888 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
(* Copyright (C) 2019, Thomas Leonard
   See the README file for details, or visit http://0install.net. *)

module W = Zeroinstall_windows

let v ~wow64 =
  let read_registry fn key value ~key64 =
    try
      match wow64, key64 with
      | true, false -> Some (fn key value W.KEY_WOW64_32KEY)
      | true, true -> Some (fn key value W.KEY_WOW64_64KEY)
      | false, false -> Some (fn key value W.KEY_WOW64_NONE)
      | false, true -> None
    with Failure msg ->
      Logging.log_debug "Error getting registry value %s:%s: %s" key value msg;
      None
  in
  object
    method get_appdata = W.win_get_appdata ()
    method get_local_appdata = W.win_get_local_appdata ()
    method get_common_appdata = W.win_get_common_appdata ()
    method read_registry_string = read_registry W.win_read_registry_string
    method read_registry_int = read_registry W.win_read_registry_int
  end