Search code examples
pythonregistry

Python: Add an empty Binary Registry key


How to add a Registry key, of Binary type, that has no value? (zero-length binary value)

What should I give in the last argument in this function call?

    SetValueEx(registryKey, "myKey", 0, REG_BINARY, ???)

I would like the Registry key to be like:

Empty binary registry key


Solution

  • After some researching, I found that the missing arg is None.

    The code should be:

        SetValueEx(registryKey, "myKey", 0, REG_BINARY, None)