How to add dll-override to wine config from command-line?
This is exceprt code that does what you want, from a tool you want to look into: winetricks:
w_override_dlls()
{
w_skip_windows w_override_dlls && return
_W_mode=$1
case $_W_mode in
*=*)
w_die "w_override_dlls: unknown mode $_W_mode.
Usage: 'w_override_dlls mode[,mode] dll ...'." ;;
disabled)
_W_mode="" ;;
esac
shift
echo Using $_W_mode override for following DLLs: $@
cat > "$W_TMP"/override-dll.reg <<_EOF_
REGEDIT4
[HKEY_CURRENT_USER\Software\Wine\DllOverrides]
_EOF_
while test "$1" != ""
do
case "$1" in
comctl32)
rm -rf "$W_WINDIR_UNIX"/winsxs/manifests/x86_microsoft.windows.common-controls_6595b64144ccf1df_6.0.2600.2982_none_deadbeef.manifest
;;
esac
if [ "$_W_mode" = default ]
then
# To delete a registry key, give an unquoted dash as value
echo "\"*$1\"=-" >> "$W_TMP"/override-dll.reg
else
# 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
fi
shift
done
w_try_regedit "$W_TMP_WIN"\\override-dll.reg
unset _W_mode
}
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.
Sasha
Updated on September 18, 2022Comments
-
Sasha over 1 year
I know that I can add dll-overrides from wineconfig GUI:
WINEPREFIX="$somedir" winecfg
I know that I can temporarily add dll-overrides from command-line by specifying
WINEDLLOVERRIDES
environment variable:WINEPREFIX="$somedir" WINEDLLOVERRIDES="$somedlloverrides" wine "$pathtoexe"
But this will not change wine configs, just temporarily use changed settings.
I want to change wine config (specifically: add dll-override) from command-line.
Is there command-line tool that will help me to do it?
-
Sasha about 10 yearsP.S.: May be I should ask it on stackoverflow.com or unix.stackexchange.com?