11-07-2024 09:42 AM
I need to check if a registry key exist:
Unluckly not-a-number/path/refnum does not work on registry refnums ... it always returns FALSE regardless of whether the registry exists or not.
How can I check for registry key existence?
Best regards,
Mike
11-07-2024 09:59 AM
@michele.santucci wrote:
How can I check for registry key existence?
Obviously try to read your key and check Error Out instead of refnum.
11-07-2024 10:23 AM
The registry key refnum is not a real refnum (well it actually is a queue refnum, but casted into a datalog refnum to hide the internal implementation and not let a user manipulate the content in the queue). The Is Not a Refnum node sees that the refnum is a datalog refnum and then queries the datalog cookie jar for validity and that cookie jar tells the function, no this is not a refnum that I ever have seen.
What usually works but isn't quite foolproof, is a comparison to be unequal to the Not a Refnum constant. The only foolproof way is to try to access the registry refnum, for instance by calling Query Registry Key Info.vi. If that returns an error -600, you got almost certainly an invalid refnum.