[SOLVED]: Syntax for creating an empty registry key

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
croquebert
Messages: 33
Registration: March 30, 2022 - 5:41 PM

April 8, 2024 - 1:49 PM

Context:
WAPT version: 2.2.3 Enterprise
Server OS: Debian 12
OS administration console: Win10pro
OS package dev station: Win10pro

Good morning,,

I want to create an empty registry key (containing no value other than the default one) as created by the standard registry editor.

If I use the syntax:

Code: Select all

registry_set(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\CLETEST', None, None)
This does create a CLETEST registry key, but it also creates a value containing no data named None (of type REG_SZ) inside the CLETEST key, which results in the following via a registry export:

Code: Select all

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\CLETEST]
"None"=""
Whereas, via the classic registry utility, a creation results in:

Code: Select all

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\CLETEST]
Thanks in advance.

CR
Last edited by croquebert on 08 Apr 2024 - 16:19, edited 1 time.
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

April 8, 2024 - 2:52 PM

Hi Christophe,

I'm not sure if the necessary components are in the setuphelpers, but you can try with winreg:

Code: Select all

import winreg
from setuphelpers import *
winreg.CreateKey(HKEY_LOCAL_MACHINE,r'SOFTWARE\WOW6432Node\CLETEST')
Sincerely,
Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
croquebert
Messages: 33
Registration: March 30, 2022 - 5:41 PM

April 8, 2024 - 4:14 PM

Hi Denis,

Thanks for the feedback.

Your method does indeed work.
I wasn't sure I'd read the setuphelpers documentation correctly, hence my question.

For now, I'm still using setuphelpers, but I'm removing the "None" value immediately afterward.

If I ever need to create only what's necessary (because there might be something like Inotify on registry hive elements), then I'll use the winreg import.

We can consider the issue resolved, thanks.

Christophe.
User avatar
dcardon
WAPT Expert
Messages: 1932
Registration: June 18, 2014 - 09:58
Location: Saint Sébastien sur Loire
Contact :

April 8, 2024 - 5:09 PM

Thanks for your feedback, Christophe :-)
Denis
Denis Cardon - Tranquil IT
Share your experiences on WAPT! Send us your blog and article URLs in the "Your Opinion of the forum, and we'll feature them on the WAPT
Locked