将dll复制到system32的C / C ++程序 [英] C/C++ program to copy dll into system32

查看:65
本文介绍了将dll复制到system32的C / C ++程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用VS-2010开发了一个win32控制台应用程序。应用程序需要在system32中存在一些dll文件才能运行。所以我的计划是在运行应用程序之前将所需的dll文件复制到系统32中。我试过CopyFile复制dll,但得到错误 - 拒绝访问。寻找建议。

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.

推荐答案

不建议将特定于应用程序的DLL安装到Windows系统目录中。只需将DLL复制到存储应用程序的同一目录即可。这是应用程序查找所需DLL的第一个目录。
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.


显然,访问被拒绝。系统试图保护自己和用户免受您正在尝试的令人讨厌的事情。我只是想知道你是否设计了一些步骤来删除DLL,如果你可以复制它。您可以创建一些安装包并以管理员身份运行它,但这会使问题变得更加糟糕:-(



这不是部署应用程序的合法方式。如果DLL在您自己的应用程序中使用,没有什么可以阻止您将它放在您的其他可执行文件所在的同一目录中。如果您想开发一个系统,您有几个产品重用相同的DLL,您仍然可以保留它们相同的可执行目录或将它们放在子目录中。您仍然可以从父目录加载DLL。非侵入式部署架构还有许多其他可能性。



另请参阅:

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
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


这篇关于将dll复制到system32的C / C ++程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆