I broke something in my winecfg. Thus, It won't run any Windows apps in wine anymore. (I cannot afford to mv .wine and reinstall).

How do I override a dll using the command line. I disabled rpcrt4.dll by accident and want to undo it.

When launching winecfg or any windows application like MS Word, Wine prints this error message:

err:module:import_dll Library rpcrt4.dll (which is needed by L"C:\\windows\\system32\\explorer.exe") not found
  • err:module:import_dll Library rpcrt4.dll (which is needed by L"C:\\windows\\system32\\explorer.exe") not found – nvidia-96needed Feb 12 '13 at 6:47

Firstly, try using winetricks on the command-line to revert just your winecfg dll settings back to defaults with:

winetricks alldlls=default

If this doesn't solve the problem, you can use WINEDLLOVERRIDES; it is an environmental variable that can be used with wine to specify the dll overrides you want (or don't require). As stated on the manpage, WINEDLLOVERRIDES

Defines the override type and load order of dlls used in the loading process for any dll. There are currently two types of libraries that can be loaded into a process' address space: native windows dlls (native), wine internal dlls (builtin). The type may be abbreviated with the first letter of the type (n, b). The library may also be disabled (''). Each sequence of orders must be separated by commas.

You can either export the environmental variable, or use env and specify the variable to be used with the wine command (if you don't specify a WINEPREFIX it will use the default):

env WINEDLLOVERRIDES="rpcrt4=b,n" wine exe_to_run

This will specify that the builtin version should be tried, then the native version. If you instead use "rpcrt4=", then that dll will remain disabled and wine will not run at all.

If you want to export the value to the shell for that session, you can run

export WINEDLLOVERRIDES="rpcrt4=b,n" 

This will not affect the settings in winecfg, and they will remain the same. This environmental variable, and many other useful ones available with wine are only temporary and merely affect the shell in which they are used, either by exporting the variable or using env each time to state the variable and then run wine with that variable as it launches your program. You could also specify environmental variables in a bash script that launched your wine programs.

For more information, please see man wine, the Ubuntu manpages online, and the useful wine FAQ.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.