Warning: The magic method Math_Captcha::__wakeup() must have public visibility in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/wp-math-captcha.php on line 87

Warning: Cannot modify header information - headers already sent by (output started at /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 46

Warning: Cannot modify header information - headers already sent by (output started at /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49

Warning: Cannot modify header information - headers already sent by (output started at /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/includes/class-cookie-session.php on line 49

Warning: Undefined array key "action" in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-recentcomments/core.php on line 7

Warning: Undefined array key "action" in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-recentcomments/core.php on line 12

Warning: Cannot modify header information - headers already sent by (output started at /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /home/wwwroot/blog.gotocoding.com/wp-content/plugins/all-in-one-seo-pack/app/Common/Meta/Robots.php on line 89

Warning: Cannot modify header information - headers already sent by (output started at /home/wwwroot/blog.gotocoding.com/wp-content/plugins/wp-math-captcha/wp-math-captcha.php:87) in /home/wwwroot/blog.gotocoding.com/wp-includes/feed-rss2.php on line 8
Windows | 重归混沌的BLOG https://blog.gotocoding.com 师法天地, 道法自然 Fri, 28 Jul 2017 14:38:57 +0000 zh-Hans hourly 1 https://wordpress.org/?v=6.9 又是权限问题 https://blog.gotocoding.com/archives/305?utm_source=rss&utm_medium=rss&utm_campaign=another_bug_of_privilege https://blog.gotocoding.com/archives/305#respond Fri, 16 Jan 2015 02:56:07 +0000 http://blog.gotocoding.com/?p=305 阅读更多]]> 上周五发布了Beta版之后, 老板觉得这次加的功能挺多就试用了一下, 结果瞬间就崩了, 上去一顿猛批啊。 请他们试用了很久才发现又是因为权限问题。

在%ProgramFiles%下普通用户只有读取和执行的权限, 由于历史原因, 我们Client有一部分DLL是从其他地方copy到client.exe的当前目录下来动态加载的, 而这一版本恰好将管理员权限去掉了(因为Win7及以上版本在管理员权限不能访问网络共享路径), 两个巧合就碰撞到一起导致了这个bug的产生, 当然其实有些代码不是很规范, 不然应该只是加载某个DLL失败而已。

将所有需要动态释放的文件放到了一个与用户相关的目录, 使用DLL的绝对路径去LoadLibrary, 一开始没有任何问题, 直到完全卸载之后安装时就开始发现有些DLL加载不成功, 明明路径存在, LoadLibrary就是会fail。 在MSDN上找到这篇文章之后才找到问题所在, 使用绝对路径去LoadLibrary时, 被使用绝对路径去LoadLibrary的DLL如果静态依赖于另一个DLL, 那么这个被依赖的DLL就会被按照一定的目录顺序搜索, 不幸的是我们释放的DLL所在的路径恰好不在Windows的搜索中径范围之内。 使用MSDN推荐LoadLibrary(path, NULL, LOAD_WITH_ALTERED_SEARCH_PATH)将使用绝对路径加载的DLL所在的目录加入搜索范围问题即可解决。

又一次踩到权限的坑, 以后写代码一定要注意如非有必要尽量不使用root权限, 这样就不会碰到这种中途取消管理员权限之后产生的各种权限及附带引发的其他问题。

]]>
https://blog.gotocoding.com/archives/305/feed 0