Click here to Skip to main content
15,898,134 members
Please Sign up or sign in to vote.
1.00/5 (3 votes)
See more:
I have developed a win32 console applicaion using VS-2010. The application needs some dll files to be present in system32 in order to run. So my plan is to copy the required dll files into system 32, before running the application. I tried "CopyFile" to copy the dlls, but getting the error- "Access Denied". Looking for suggestions.
Posted
Comments
Sergey Alexandrovich Kryukov 4-Jun-15 9:44am    
Why trying to do such a nasty thing?
—SA
Shrinivas Kattimani 4-Jun-15 23:45pm    
It is because, when i distribute the exe, users should not take the burden of searching the required dlls and then placing it in the system directory.
Sergey Alexandrovich Kryukov 5-Jun-15 0:24am    
Who suggested you to create a burden for the users? What are you even talking about?
You got two reasonable answers which create no burden, unlike what you are trying to do. Are you going to accept them?
—SA

It is not recommended to install application specific DLLs to the Windows system directory. Just copy the DLL's to the same directory where your application is stored. That is the first directory where an application looks for required DLL's.
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 4-Jun-15 9:48am    
Sure, a 5.
See also Solution 2 for some more detail.
—SA
Apparently, access is denied. The system tries to protect itself and their users from the nasty things you are trying to do. I just wonder if you devised some steps to remove the DLL if you can copy it. You could create some installation package and run it as administrator, but it would make the problem even nastier :-(.

This is not a legitimate way of deploying applications. If the DLL is used in your own application, nothing prevents you from having it in the same directory where your other executable files are. If you want to develop a system where you have several products reusing the same DLL, you still can keep them in the same executable directory or place them in sub-directories. You still can load the DLL from a parent directory. There are many other possibilities for non-intrusive deployment schema.

See also:
http://en.wikipedia.org/wiki/DLL_Hell[^],
https://msdn.microsoft.com/en-us/library/ms973843.aspx[^],
https://msdn.microsoft.com/en-us/library/ms973843.aspx[^],
http://en.wikipedia.org/wiki/Dependency_hell[^],
http://en.wikipedia.org/wiki/Portable_application[^].

—SA
 
Share this answer
 
v3
Comments
Andreas Gieriet 4-Jun-15 16:07pm    
I also wonder about "[...] needs some dll files to be present in system32 [...]".
My 5!
Cheers
Andi
Sergey Alexandrovich Kryukov 4-Jun-15 16:31pm    
Thank you Andi. And thank you for reading and the comment on my proverb. :-)
—SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900