[SOLVED] Registry Key Package

Questions about WAPT Packaging / Requests and help regarding Wapt packages.
Forum Rules
Community Forum Rules
* English support on www.reddit.com/r/wapt
* French community support is available on this forum
* Please prefix the topic title with [RESOLVED] if it is resolved.
* Please do not edit a topic that is tagged [RESOLVED]. Open a new topic referencing the old one.
* Specify the installed WAPT version, full version, and build number (2.2.1.11957 / 2.2.2.12337 / etc.) as well as the Enterprise/Discovery edition.
* Versions 1.8.2 and earlier are no longer supported. The only questions accepted regarding version 1.8.2 are related to upgrading to a supported version (2.1, 2.2, etc.).
* Specify the server OS (Linux/Windows) and version (Debian Buster/Bullseye - CentOS 7 - Windows Server 2012/2016/2019).
* Specify the OS of the administration/package creation machine and the machine with the problematic agent, if applicable (Windows 7/10/11/Debian 11/etc.).
* Avoid asking multiple questions when opening a topic, otherwise it may be ignored. If there are multiple topics, open separate topics, preferably one after the other and not all at the same time (i.e., do not spam the forum).
* Include code snippets, screenshots, and other images directly in the post. Links to Pastebin, Bitly, and other third-party sites will be systematically removed.
* As with any community forum, support is provided voluntarily by members. If you require commercial support, you can contact Tranquil IT's sales department at 02.40.97.57.55
Locked
eliottiph
Messages: 32
Registration: May 2, 2022 - 10:41

May 6, 2022 - 5:01 PM

- Installed WAPT version: WAPT 2.2.11899
- Server OS: Debian 10
- DHCP Server: Win19 Server
- Operating system of the administration/package creation machine: Windows Server 19


Good morning,

I'm trying to create a package to install a registry key.

Code: Select all

# -*- coding: utf-8 -*-
from setuphelpers import *
from setuphelpers_windows import *

def install():
        pass

def uninstall():
        pass

def session_setup():
    registry_set(HKEY_CURRENT_USER, r"SOFTWARE/Microsoft/Internet Explorer/BrowserEmulation/ClearableListData", 'UserFilter', '41,1f,00,00,53,08,ad,ba,03,00,00,00,8c,00,00,00,01,00,00,00,03,00,00,00,0c,00,00,00,61,b0,8c,da,26,49,d6,01,01,00,00,00,0f,00,31,00,36,00,34,00,2e,00,31,00,33,00,38,00,2e,00,32,00,34,00,32,00,2e,00,31,00,39,00,37,00,0c,00,00,00,80,a6,a4,f5,fb,55,d6,01,01,00,00,00,0b,00,31,00,30,00,2e,00,31,00,34,00,37,00,2e,00,30,00,2e,00,36,00,37,00,0c,00,00,00,07,6d,09,61,c6,ae,d7,01,01,00,00,00,0b,00,31,00,30,00,2e,00,31,00,34,00,37,00,2e,00,30,00,2e,00,35,00,38,00', type=winreg.REG_BINARY)
    print ('Installation de la clé de registre GCE')
Here is the error:

Code: Select all

Traceback (most recent call last):
  File "C:\Program Files (x86)\wapt\waptpackage.py", line 2974, in call_setup_hook
    hookdata = hook_func()
  File "c:\waptdev\keyregistry-GCE_0_PROD-wapt\setup.py", line 12, in session_setup
    registry_set(HKEY_CURRENT_USER, r"SOFTWARE/Microsoft/Internet Explorer/BrowserEmulation/ClearableListData", 'UserFilter', '41 1f 00 00 53 08 ad ba 03 00 00 00 8c 00 00 00 01 00 00 00 03 00 00 00 0c 00 00 00 61 b0 8c da 26 49 d6 01 01 00 00 00 0f 00 31 00 36 00 34 00 2e 00 31 00 33 00 38 00 2e 00 32 00 34 00 32 00 2e 00 31 00 39 00 37 00 0c 00 00 00 80 a6 a4 f5 fb 55 d6 01 01 00 00 00 0b 00 31 00 30 00 2e 00 31 00 34 00 37 00 2e 00 30 00 2e 00 36 00 37 00 0c 00 00 00 07 6d 09 61 c6 ae d7 01 01 00 00 00 0b 00 31 00 30 00 2e 00 31 00 34 00 37 00 2e 00 30 00 2e 00 35 00 38 00', type=winreg.REG_BINARY)
  File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 3825, in registry_set
    return reg_setvalue(key, keyname, value, type=type)
  File "C:\Program Files (x86)\wapt\setuphelpers_windows.py", line 447, in reg_setvalue
    return winreg.SetValueEx(key, name, 0, type, value)
TypeError: Objects of type 'str' can not be used as binary registry values
Thanks in advance.
Last edited by eliottiph on June 30, 2022 - 09:42, edited 2 times.
User avatar
htouvet
WAPT Expert
Messages: 436
Registration: March 16, 2015 - 10:48
Contact :

May 6, 2022 - 5:37 PM

The hexadecimal string needs to be decoded to transform it into binary data.

To do this, you need to import the "binascii" module and use the unhexlify function, I think.

Code: Select all

from setuphelpers_windows import *
import binascii

def install():
        pass

def uninstall():
        pass

def session_setup():
    bindata = binascii.unhexlify('41,1f,00,00,53,08,ad,ba,03,00,00,00,8c,00,00,00,01,00,00,00,03,00,00,00,0c,00,00,00,61,b0,8c,da,26,49,d6,01,01,00,00,00,0f,00,31,00,36,00,34,00,2e,00,31,00,33,00,38,00,2e,00,32,00,34,00,32,00,2e,00,31,00,39,00,37,00,0c,00,00,00,80,a6,a4,f5,fb,55,d6,01,01,00,00,00,0b,00,31,00,30,00,2e,00,31,00,34,00,37,00,2e,00,30,00,2e,00,36,00,37,00,0c,00,00,00,07,6d,09,61,c6,ae,d7,01,01,00,00,00,0b,00,31,00,30,00,2e,00,31,00,34,00,37,00,2e,00,30,00,2e,00,35,00,38,00'.replace(',',''))
    registry_set(HKEY_CURRENT_USER, r"SOFTWARE/Microsoft/Internet Explorer/BrowserEmulation/ClearableListData", 'UserFilter',bindata  , type=winreg.REG_BINARY)
    print ('Installation de la clé de registre GCE')
Tranquil IT
eliottiph
Messages: 32
Registration: May 2, 2022 - 10:41

May 10, 2022 - 3:53 PM

Hello htouvet,
Thank you very much for your help. :)

However, the target machine only installs the registry key on its local master account.

Is there a solution to overcome this and install the registry key on all sessions?

Thank you in advance.
eliottiph
Messages: 32
Registration: May 2, 2022 - 10:41

June 29, 2022 - 12:15

Hello,

I'm reviving this thread because I haven't received an answer to my last question yet, so I can't deploy my custom package, which is essential for my core system.

Could I please get some help?

Thanks in advance,

Eliott.
User avatar
sfonteneau
WAPT Expert
Messages: 2318
Registered: July 10, 2014 - 11:52 PM
Contact :

June 29, 2022 - 10:01 PM

eliottiph wrote: May 10, 2022 - 3:53 PM On the other hand, the targeted machine installs the registry key only on its local master account.
This will be executed in all sessions at session startup thanks to session-setup
Locked