This is exceprt code that does what you want, from a tool you want to look into: winetricks:
w_skip_windows w_override_dlls && return
case $_W_mode in
w_die "w_override_dlls: unknown mode $_W_mode.
Usage: 'w_override_dlls mode[,mode] dll ...'." ;;
echo Using $_W_mode override for following DLLs: $@
cat > "$W_TMP"/override-dll.reg <<_EOF_
while test "$1" != ""
case "$1" in
rm -rf "$W_WINDIR_UNIX"/winsxs/manifests/x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef.manifest
if [ "$_W_mode" = default ]
# To delete a registry key, give an unquoted dash as value
echo "\"*$1\"=-" >> "$W_TMP"/override-dll.reg
# Note: if you want to override even DLLs loaded with an absolute
# path, you need to add an asterisk:
echo "\"*$1\"=\"$_W_mode\"" >> "$W_TMP"/override-dll.reg
#echo "\"$1\"=\"$_W_mode\"" >> "$W_TMP"/override-dll.reg
This bash function first creates a
override-dll.reg file in temp directory, then tries to import it into selected prefix using
regedit. You can specify overrides like:
w_override_dlls native,builtin comctl32
Another useful function sets the override for specific application, like:
w_override_app_dlls winecfg.exe builtin comctl32
What you can do is write your own bash script using this as inspiration, or extend winetricks own functionality (google for writing winetricks verb metadata) for your use cases, or just use winetricks functions as a library.