|
Boost-Build : |
From: Bojan Resnik (resnikb_at_[hidden])
Date: 2006-09-08 13:11:01
> >> Bojan Resnik wrote:
> >>
> >>> Sometimes, especially when needing to detect installed versions of
> >>> some third-party program, I need functions to enumerate registry
> >>> subkeys or registry values of a given key. I have written two new
> >>> builtin functions W32_REGKEYS and W32_REGVALUES which, given a
> >>> registry key path, return lists of its subkeys and values,
> >>> respectively.
> >>>
> >>> Example:
> >>> for local subkey in [ W32_REGKEYS "HKLM\\Software\\Microsoft" ]
> >>> {
> >>> ECHO $(subkey) ;
> >>> }
>
> Could this one be done by modifying the existing W32_GETREG to return
> subkeys? ... Hm, I guess that wouldn't since registry entries always
> have a value.
W32_GETREG already allows its second argument to be omitted, in
which case it returns the "default" value for the given key.
> >>>
> >>> for local value in [ W32_REGVALUES "HKCU\\Environment" ]
> >>> {
> >>> ECHO $(value) ;
> >>> }
>
> Maybe it's this particular example, but that one seems problematic. Does
> it return the "Data" part, the "Name" part, or both?
Just like W32_REGKEYS, it returns the names of values. To retrieve
data, one can use W32_GETREG with a returned name:
for local value in [ W32_REGVALUES "HKCU\\Environment" ]
{
ECHO $(value) "=" [ W32_GETREG "HKCU\\Environment" : "$(value)" ] ;
}
> I'd think that both of the above could be covered by just adding a
> single new rule W32_GETREG_KEYS to return the names and subkeys of the
> given entry.
Value names and subkeys are two different beasts - a registry key
has both, so how can you know which of the returned strings is a
subkey name and which is a value name?
-- Bojan Resnik
Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk