Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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
share|improve this question
    
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
add comment

1 Answer 1

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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