Skip to content

Instantly share code, notes, and snippets.

@cw2k
Created January 23, 2026 23:58
Show Gist options
  • Select an option

  • Save cw2k/909bc6dac80e8703722bac16c89e38af to your computer and use it in GitHub Desktop.

Select an option

Save cw2k/909bc6dac80e8703722bac16c89e38af to your computer and use it in GitHub Desktop.
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Skript for Virtual Guitarist - Wizoo / Steinberg 2002
#
# This VST-Plugin is bind at setup time to the
# VolumeSerialNumber of the Windows Drive
# If the check fails not styles are load, instead it just shows
# "Please re-install !"
#
# This Script mimics this behavior and recreates that number for you.
#
# SetupSysID‑Generator + automatische .reg‑Datei‑Erzeugung
#
# Hinweise zur Volume‑Seriennummer:
# Die Volume Serial Number des Systemlaufwerks (meist C:) kann man so ermitteln:
#
# 1. CMD:
# vol C:
# Ausgabe z.B.: "Volumeseriennummer: 1234-ABCD" → Wert: 1234ABCD
#
# 2. PowerShell:
# (Get-Volume -DriveLetter C).SerialNumber
#
# 3. WMI:
# (Get-WmiObject Win32_LogicalDisk -Filter "DeviceID='C:'").VolumeSerialNumber
#
# 4. Explorer:
# Rechtsklick auf C: → Eigenschaften → Seriennummer
#
# Dieses Skript erzeugt:
# - SetupSysID‑Bytes
# - Eine vollständige .reg‑Datei im Format "Windows Registry Editor Version 5.00"
#
# VolumeSerialNumber muss unten im Skript eingetragen werden !
#
#
# Alternativer Binary-Patch (Skript wird danach nicht mehr benötigt)
# in Virtual Acoustic Guitar.dll & Virtual Electric Guitar.dll nach
# 32 C0 5B 81 C4 00 01 00 00 C3 Suchen und Ersetzen mit:
# B0 01 ?? ?? ?? ?? ?? ?? ?? ??
#
from typing import List
# ------------------------------------------------------------
# CRC32‑Tabelle erzeugen
# ------------------------------------------------------------
def generate_crc32_table() -> List[int]:
table = []
for v0 in range(256):
crc = v0 << 24
for _ in range(8):
if crc & 0x80000000:
crc = ((crc << 1) ^ 0x04C11DB7) & 0xFFFFFFFF
else:
crc = (crc << 1) & 0xFFFFFFFF
table.append(crc)
return table
# ------------------------------------------------------------
# Seed aus SetupID berechnen
# ------------------------------------------------------------
def compute_seed_from_setupid(setup_id: str, crc_table: List[int]) -> int:
data = setup_id.encode("ascii")
if not data:
return 54372473
result = 0
for b in data:
index = ((result >> 24) ^ b) & 0xFF
result = ((result << 8) & 0xFFFFFFFF) ^ crc_table[index]
return result & 0xFFFFFFFF
# ------------------------------------------------------------
# Machine‑ID aus VolumeSerialNumber erzeugen
# ------------------------------------------------------------
def volume_serial_to_machine_id(volume_serial: int) -> bytes:
hex8 = f"{volume_serial:08X}"
machine_id = hex8 * 8
return machine_id.encode("ascii")
# ------------------------------------------------------------
# CRC über die ersten 20 Bytes der Machine‑ID
# ------------------------------------------------------------
def crc20_over_machine_id(machine_id: bytes, seed: int, crc_table: List[int]) -> int:
v6 = seed & 0xFFFFFFFF
for b in machine_id[:20]:
index = ((v6 >> 24) ^ b) & 0xFF
v6 = ((v6 << 8) & 0xFFFFFFFF) ^ crc_table[index]
return v6 & 0xFFFFFFFF
# ------------------------------------------------------------
# Inverse von sub_10004B90
# ------------------------------------------------------------
def scramble_char_inverse(scrambled: int, key_byte: int) -> int:
return ((scrambled ^ key_byte) + 8) & 0xFF
# ------------------------------------------------------------
# SetupSysID‑Bytes erzeugen
# ------------------------------------------------------------
def generate_setupsysid_bytes(setup_id: str, volume_serial: int) -> List[int]:
crc_table = generate_crc32_table()
seed = compute_seed_from_setupid(setup_id, crc_table)
machine_id = volume_serial_to_machine_id(volume_serial)
crc_val = crc20_over_machine_id(machine_id, seed, crc_table)
dec_str = str(crc_val + 1)
key = 83235
key_byte = (key >> 16) & 0xFF
result = []
for ch in dec_str.encode("ascii"):
result.append(scramble_char_inverse(ch, key_byte))
return result
# ------------------------------------------------------------
# Registry‑Format erzeugen
# ------------------------------------------------------------
def format_setupsysid_registry(bytes_list: List[int]) -> str:
return ",".join(f"{b:02x}" for b in bytes_list)
# ------------------------------------------------------------
# .reg‑Datei erzeugen
# ------------------------------------------------------------
def write_reg_file(path: str, setup_id: str, setupsysid_bytes: List[int], install_path: str):
reg_content = (
"Windows Registry Editor Version 5.00\n\n"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Steinberg\\Virtual Guitarist]\n"
f"\"SetupID\"=\"{setup_id}\"\n"
f"\"SetupSysID\"=hex:{format_setupsysid_registry(setupsysid_bytes)}\n"
f"\"Install Path\"=\"{install_path}\"\n"
)
with open(path, "w", encoding="utf-8") as f:
f.write(reg_content)
# ------------------------------------------------------------
# Beispiel
# ------------------------------------------------------------
if __name__ == "__main__":
setup_id = "575772700-1871391183-1045317431-4044084603"
volume_serial = 0x1234ABCD # Beispielwert
install_path = "C:\\Program Files (x86)\\VstPlugins\\Virtual Guitarist"
sysid_bytes = generate_setupsysid_bytes(setup_id, volume_serial)
write_reg_file("VirtualGuitarist.reg", setup_id, sysid_bytes, install_path)
print("SetupSysID‑Bytes:", sysid_bytes)
print("Reg‑Datei wurde erzeugt: VirtualGuitarist.reg")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment