A Registry Key object when created represents a Registry Key on the JNIOR, and contains a key name and key value. The key it represents is based on the Registry Key path you give it.
A Registry List object when created represents a registry folder on the JNIOR, and contains an array of Registry Keys. This is not recursive. The registry folder it represents is based on the registry folder path you give it.
You must get a Registry Key from the Library. The library is the authoritative source of all registry values. It will be alerted of updates to keys so it will always be up-to-date. The "registry get key" function allows you to create a registry key object in your code that represents the registry key on the JNIOR. Registry Key object will represent a registry key on the JNIOR according to the registry key name you give it.
123
// make calls to get the registry keys for $serialnumber and $versionipg::REGISTRY_KEY*serial_number_key=ipg::registry_get_key(m_uuid,"$serialnumber");ipg::REGISTRY_KEY*version_key=ipg::registry_get_key(m_uuid,"$version");
123
// Making a registryGetKey call defines a registry value for you to interact with// You need to 'get' a key before you can read from it or write to itvarserialNumberRegistryKey=_jmpConnection.RegistryGetKey("$serialnumber");
123
// Making a registryGetKey call defines a registry value for you to interact with// You need to 'get' a key before you can read from it or write to itRegistryKeyserialKey=jmpConnection.registryGetKey("$serialnumber");
123
# Making a registry_get_key call defines a registry value for you to interact with# You need to 'get' a key before you can read from it or write to itserial_number=jmp_connection.registry_get_key("$serialNumber")
You must get a Registry List from the Library. The library is the authoritative source of all registry values. It will be alerted of updates to keys so it will always be up-to-date. Similar to to the 'registry get key' function, the 'registry list keys' function allows you to create a registry list object in your code that represents the registry folder on the JNIOR. If the list contains another registry folder, that registry key in the list will have no value.
1
comingsoon...
1 2 3 4 5 6 7 8 9101112
// Making a registryListKeys call defines a registry list object for // you to interact with// A registry list object contains one value: an array of registy keys// from the registry folder you definedvarregistryList=_jmpConnection.RegistryListKeys("/");// The Keys attribute returns the registry key array from // the registry list objectregistryList.Keys()// Doing the length() call will get you the amount of keys in the arrayregistryList.length()
1 2 3 4 5 6 7 8 9101112
// Making a registryListKeys call defines a registry list object for // you to interact with// A registry list object contains one value: an array of registy keys// from the registry folder you definedRegistryListkeyList=jmpConnection.registryListKeys("/");// The getKeysArray helper function returns the registry key array from // the registry list objectkeyList.getKeysArray()// Doing the length() call will get you the amount of keys in the arraykeyList.getKeysArray().length()
When creating a registry list object in Python, it passes it through a C++ function. This is passed by reference in the Python DLL, because doing it by value would create a COPY of the array to interact with, and changes made to that copy would not apply to the original registry list. Passing by reference though requires us to assign it to a local array of registry keys. In our example below, you'll see we use the jmplib_py.RegistryKeys() call to assign to the registry key array reference to a local array for when we want to read or write to it.
1 2 3 4 5 6 7 8 91011121314
# Making a registryListKeys call defines a registry list object for # you to interact with# A registry list object contains one value: an array of registy keys# from the registry folder you definedkey_list=jmp_connection.registry_list("/")# When reading a registry list in Python, you must assign the keys# From the registry list to an array of Registry Keys# The .keys value returns the registry key array from # the registry list objectregistry_key_array=jmplib_py.RegistryKeys(key_list.keys)# Doing the length() call will get you the amount of keys in the arrayregistry_key_array.length()
Once you've created a registry key object, you then need to read it to get its value. You can read one or many keys at once. This function will block until the response is received.
1 2 3 4 5 6 7 8 9101112
// make calls to get the registry keys for $serialnumber and $versionipg::REGISTRY_KEY*serial_number_key=ipg::registry_get_key(m_uuid,"$serialnumber");ipg::REGISTRY_KEY*version_key=ipg::registry_get_key(m_uuid,"$version");// call the read_keys function. this allows us to pass a dynamic number// of keys. we just need to pass a count ahead so that the number of// dynamic keys to follow is knownipg::registry_read_keys(m_uuid,2,serial_number_key,version_key);// print our keys so that we can see the values that were readstd::cout<<serial_number_key->get_key_name()<<"="<<serial_number_key->get_value()<<std::endl;std::cout<<version_key->get_key_name()<<"="<<version_key->get_value();
1 2 3 4 5 6 7 8 9101112
// Making a RegistryReadKeys call allows you to grab the Name and // Value of one or more registry keys// Example reading a single registry keyvarserialNumberRegistryKey=_jmpConnection.RegistryGetKey("$serialnumber");_jmpConnection.RegistryReadKeys(SerialNumberRegistryKey);// Example reading multiple registry keys at oncevarserialNumberRegistryKey=_jmpConnection.RegistryGetKey("$serialnumber");varversionKey=_jmpConnection.RegistryGetKey("$version");varmodelKey=_jmpConnection.RegistryGetKey("$model");_jmpConnection.RegistryReadKeys(serialNumberRegistryKey,versionKey,modelKey);
1 2 3 4 5 6 7 8 91011121314151617
// Making a RegistryReadKeys call allows you to grab the Name and // Value of one or more registry keys// Example reading a single registry keyRegistryKeyregistryKeySerial=jmpConnection.registryGetKey("$serialnumber");jmpConnection.registryReadKeys(registryKeySerial);// Example reading multiple registry keys at onceRegistryKeyregistryKeySerial=jmpConnection.registryGetKey("$serialnumber");RegistryKeyregistryKeyVersion=jmpConnection.registryGetKey("$version");RegistryKeyregistryKeyModel=jmpConnection.registryGetKey("$model");jmpConnection.registryReadKeys(registryKeySerial,registryKeyVersion,registryKeyModel);// Example reading an array of registry keys returned from a registry // listRegistryListkeyList=jmpConnection.registryListKeys("IpConfig");jmpConnection.registryReadKeys(keyList.listKeys());
1 2 3 4 5 6 7 8 910111213141516171819
# Making a registry_read_keys call allows you to grab the Name and # Value of one or more registry keys# Example reading a single registry keyserial_number=jmp_connection.registry_get_key("$serialNumber")jmp_connection.registry_read_keys(serial_number)# Example reading multiple registry keys at onceserial_number=jmp_connection.registry_get_key("$serialNumber")version=jmp_connection.registry_get_key("$version")model=jmp_connection.registry_get_key("$model")jmp_connection.registry_read_keys(serial_number,version,model)# Example reading registry keys from a registry list# Requires using the registry_read_keys_arry when reading from# the returned registry key array from the jmplib_py.registry_keys() callroot_data=jmp_connection.registry_list("/")registry_keys=jmplib_py.RegistryKeys(root_data.keys)jmp_connection.registry_read_keys_array(registry_keys)
Once you've created a registry key object, you then need to write to it to change its value. You can write to one, or many keys.
1234
// get a key that we will encrypt and set the valueipg::REGISTRY_KEY*test_key=ipg::registry_get_key(m_uuid,"test/test");test_key->set_value("some value");ipg::registry_write_keys(m_uuid,1,test_key);
1 2 3 4 5 6 7 8 910111213141516
// Making a RegistryWriteKeys call allows you to grab the Name and // Value of one or more registry keys// Example writing a single registry keyRegistryKeyRegistryKeyTest=_jmpConnection.RegistryGetKey("test");RegistryKeyTest.SetKeyValue("writing to a registry key from Java.");_jmpConnection.RegistryWriteKeys(RegistryKeyTest);// Example writing multiple registry keys at onceRegistryKeyregistryKeyTest=_jmpConnection.RegistryGetKey("test");registryKeyTest.SetKeyValue("writing to a registry key from Java.");RegistryKeyregistryKeyTest2=_jmpConnection.RegistryGetKey("test2");registryKeyTest2.SetKeyValue("writing to second registry key from Java.");RegistryKeyregistryKeyTest3=_jmpConnection.RegistryGetKey("test3");registryKeyTest3.SetKeyValue("writing to a third registry key from Java.");_jmpConnection.RegistryWriteKeys(registryTest,registryTest2,registryTest3);
1 2 3 4 5 6 7 8 910111213141516
// Making a RegistryWriteKeys call allows you to grab the Name and // Value of one or more registry keys// Example writing a single registry keyRegistryKeyregistryKeyTest=jmpConnection.registryGetKey("test");registryKeyTest.setKeyValue("writing to a registry key from Java.");jmpConnection.registryWriteKeys(registryKeyTest);// Example writing multiple registry keys at onceRegistryKeyregistryKeyTest=jmpConnection.registryGetKey("test");registryKeyTest.setKeyValue("writing to a registry key from Java.");RegistryKeyregistryKeyTest2=jmpConnection.registryGetKey("test2");registryKeyTest2.setKeyValue("writing to second registry key from Java.");RegistryKeyregistryKeyTest3=jmpConnection.registryGetKey("test3");registryKeyTest3.setKeyValue("writing to a third registry key from Java.");jmpConnection.registryWriteKeys(registryTest,registryTest2,registryTest3);
1 2 3 4 5 6 7 8 9101112131415161718192021
# Making a RegistryWriteKeys call allows you to grab the Name and # Value of one or more registry keys# Example writing a single registry keyregistryKeyTest=jmp_connection.registry_get_key("test")registryKeyTest.value="writing to a registry key from Python."jmp_connection.registry_write(registryChange)# Example writing multiple registry keys at onceregistryKeyTest1=jmp_connection.registry_get_key("test")registryKeyTest1.value="writing to a registry key from Python."registryKeyTest2=jmp_connection.registry_get_key("test2")registryKeyTest2.value="writing to a second registry key from Python."registryKeyTest3=jmp_connection.registry_get_key("test3")registryKeyTest3.value="writing to a third registry key from Python."jmp_connection.registry_write_keys(registryKeyTest1,registryKeyTest2,registryKeyTest3)# Example writing registry keys from a registry array# Requires using the registry_write_keys_array when writingregistry_keys=[registryKeyTest1,registryKeyTest2,registryKeyTest3]jmp_connection.registry_write_keys_array(registry_keys)
Registry Keys can change for many reasons. Maybe someone else changed a value, maybe the registry is being written to with real-time information. You might want to be alerted about those changes. Reading all of the keys you want to know about over and over quickly can present unwanted overhead. The best way to handle this is to be alerted of the changes when they happen. To do this you will implement a function that will be called when a Registry Key changes.
Here are some examples
1 2 3 4 5 6 7 8 91011121314
...// the callback method that will be alerted when there is a registry key updatestaticvoidregistry_update_callback(constchar*uuid,constchar*key_name,constchar*value){std::cout<<std::format(" [{}] {}={}\n",uuid,key_name,value);}...// attach a callback to get the registry updatesipg::add_registry_update_callback(reinterpret_cast<ipg::RegistryUpdateCallbackFunction>(registry_update_callback));...
1 2 3 4 5 6 7 8 91011
// Defines the callback method that runs when a registry key is updatedprivatestaticvoidOnRegistryCallback(stringuuid,stringkey,stringvalue){Console.WriteLine($"{uuid}: Registry Key update: {key}={value}");}// Once the onRegistrykeyUpdate function is defined, you can// now add the registry listener to enable the callback.// This will check for changes to any registry keys, and run // the onRegistryKeyUpdate function when they occur._JmpLib.add_registry_update_callback(callback);
1 2 3 4 5 6 7 8 9101112
// Defines the callback method that runs when a registry key is updated@OverridepublicvoidonRegistryKeyUpdate(JmpConnectionjmpConnection,Stringkeyname,Stringkeyvalue){System.out.println("Key Name = "+keyname);System.out.println("Key Value = "+keyvalue);}// Once the onRegistrykeyUpdate function is defined, you can// now add the registry listener to enable the callback.// This will check for changes to any registry keys, and run // the onRegistryKeyUpdate function when they occur.JmpLib.addRegistryListener(this);
123456789
# Defines the callback method that runs when a registry key is updateddefon_registry_update(jmp_connection,key_name:str,value:str):print(f"Registry Update: {key_name}. Value: {value}")# Once the on_registry_update function is defined, you can# now add the registry listener to enable the callback.# This will check for changes to any registry keys, and run # the on_registry_update function when they occur.jmplib_py.add_registry_update_callback(on_registry_update)