I distribute a Win32 Delphi application that uses ADVAPI32.DLL to call some encryption and decryption routines. It works great on modern versions of Windows, but a few customers use some very old versions of Windows, like Windows Vista and unpatched Windows 7. For those customers, the version of ADVAPI32.Dll is obsolete and sometimes causes decryption errors. I know that advapi32.dll is a "known" system DLL, and as such it cannot be loaded locally (I mean, from my app folder instead of System32), so how can I solve this issue? I tried using a renamed local copy of the DLL but that didnt work either...
2 Answers
First and foremost, you are not legally allowed to redistribute advapi32.dll. Second, you cannot reliably run newer system DLLs on old systems, they come with dependencies and you need to provide the updated dependencies. Many system DLLs have special protection mechanisms preventing from loading an incorrect one as part of elementary DLL hijacking prevention security mechanisms. And finally, CryptDecrypt
and friends, as well as other similar functions are working perfectly fine in Vista and Windows 7. If you encounter issues, is either a bug in your code, or you are simply not respecting the stated restrictions of Crypto API for said platforms. So better post the code you use, and the error you get on those older systems.

- 288,378
- 40
- 442
- 569
Even if you are able to load a different version of advapi32.dll
, there is no guarantee that it will actually work on the target systems.
The advapi32.dll
is only an interface dll that provides the "public API". Internally it delegates much functionality to the windows kernel, so if this interface changes or the kernel of the target system does not implement a function, your app will crash. You should think of advapi32.dll
more as an interface than an implementation - you call methods provided by it but it may do different things on different platforms that provide a version of the dll.
On Windows Nano Server the advapi32.dll is only a forwarding dll that delegates API calls to other DLLs ("OneCore" API).

- 94,744
- 25
- 252
- 217