(get-resource section entry [ value-box file #:type type]) → (or/c #f string? bytes? exact-integer? #t) section : string? entry : string?
value-box : (or/f #f (box/c (or/c string? bytes? exact-integer?))) = #f file : (or/c #f fail-path?) = #f type : (or/c 'string 'bytes 'integer) = derived-from-value-box
The resource value is keyed on the combination of section and entry. The result is #f if no value is found for the specified section and entry. If value-box is a box, then the result is #t if a value is found, and the box is filled with the value; when value-box is #f, the result is the found value.
The type argument determines how a value in the resource is converted to a Racket value. If value-box is a box, then the default type is derived from the initial box content, otherwise the default type is 'string.
Registry values of any format can be extracted. Values using the registry format REG_SZ are treated as strings, and values with the format REG_DWORD are treated as 32-bit signed integers. All other formats are treated as raw bytes. Data from the registry is converted to the requested type as follows:
Resources from ".ini" files are always strings, and are converted like REG_SZ registry values.
To get the “default” value for a registry entry, use a trailing backslash. For example, the following expression gets a command line for starting a browser:
(get-resource "HKEY_CLASSES_ROOT" "htmlfile\\shell\\open\\command\\")
(write-resource section entry value [ file #:type type #:create-key? create-key?]) → boolean? section : string? entry : string? value : (or/c string? bytes? exact-integer?) file : (or/c path-string? #f) = #f type : (or/c 'string 'bytes 'integer) = 'string create-key? : any/c = #f
The resource value is keyed on the combination of section and entry. If create-key? is false when writing to the registry, the resource entry must already exist, otherwise the write fails. The result is #f if the write fails or #t if it succeeds.
The type argument determines the format of the value written to the registry: 'string writes using the REG_SZ format, 'bytes writes using the REG_BINARY format, and 'dword writes using the REG_DWORD format. Any kind of value can be converted for any kind of type using the inverse of the conversions for get-resource.
When writing to an ".ini" file, the format is always a string, independent of type.