虽然我不迷信,但是老天看起来对我还不错
2010-10-26 01:03
225 查看
今天终于解决了最后一个issue,一个困扰了我好几天的issue,一个看起来不怎么样,但是却很恶心的issue。一个本以为很easy,但是却费了大劲,其实又很简单的issue,一个真想大骂一声TMD的issue,终于给我在睡觉前搞定了。为了这两个issue,这周末都没休息上,还搭上了一个周一。总结一下这两天来的工作成果,一个是有关于Exchange服务器上的issue,一个是关于EXT-GWT在IE8下界面的issue.
先说一下有关于Exchange服务器上的issue,
问题:
在Exchange2010的server上,对文件的操作权限是需要域用户的权限的。这样就导致了一个问题,当一个进程被windows服务启动起来的时候,会因为权限不足而导致失败。我们都知道windows服务的默认权限是system用户,一个比administrator具有更高权限的账户,但是它却不能在Exchange2010的server上创建文件。
解决:
或许可以通过配置域的policy来解决,但是那样会导致其他的一些问题,增加域中policy的复杂度。或者用域帐户来启动service,也许可行,但是同样会有一些问题,比如与其他system进程的交互等。所以比较合理的解决方案就是将启动的进程用CreateProcessAsUser或是CreateProcessWithLogonW的API来创建,这两个API都是根据提供的用户信息来启动用户session的进程。主要的区别就是使用CreateProcessAsUser前需要先LogonUser。说到LogonUser,不得不说一下
BOOL LogonUser( __in LPTSTR lpszUsername, __in_opt LPTSTR lpszDomain, __in LPTSTR lpszPassword, __in DWORD dwLogonType, __in DWORD dwLogonProvider, __out PHANDLE phToken);
第四个参数dwLogonType的含义, msdn上是这么介绍的:
The type of logon operation to perform. This parameter can be one of the following values, defined in Winbase.h.
所以你想创建一个特定用户session的进程,这个参数需要注意。另外,记住要调用DuplicateTokenEx函数把logon的Token给复制一份,否则你会改变当前进程的Token设置。
同时强调一下,对DLL的接口参数千万不要用C++标准库里的类型来传递,比如std::string作为传递字符的容器。否则,就是一个死,死都不知道怎么死。原因,一是C++库是非多线程安全的,这就意味这当你的DLL函数被用作多线程中,数据很可能会被莫名其妙的修改掉;二是,C++的对象析构发生的比较晚,当你卸载掉DLL模块后,如果这时再发生对原来模块里面的C++对象析构操作,那就是一个死,进程保准Crash掉。
第二个issue,
问题:
EXT-GWT创建的ComboBox,当元素个数超过30个后,并且被嵌套了多层的LayerContainer的情况下,在IE8里就无法弹出下拉列表。这实际上是一个EXT-GWT的一个Bug,但是为了解决这个Bug,花费了我2天的时间。试尽了各种办法,都无效。最搞笑的是,我自己手写了一个列表,在点击ComboBox时来弹出,都没有效果。基本上,可以说这应该是一个LayerContainer嵌套的bug。通过跟踪发现,在这种情况下的列表视图的Height属性都为0。我猜测是因为动态生成时通过计算当前Table的高度来求列表视图的高度而出的问题。
解决:
引用2.20版本的gxt.jar来解决。
先说一下有关于Exchange服务器上的issue,
问题:
在Exchange2010的server上,对文件的操作权限是需要域用户的权限的。这样就导致了一个问题,当一个进程被windows服务启动起来的时候,会因为权限不足而导致失败。我们都知道windows服务的默认权限是system用户,一个比administrator具有更高权限的账户,但是它却不能在Exchange2010的server上创建文件。
解决:
或许可以通过配置域的policy来解决,但是那样会导致其他的一些问题,增加域中policy的复杂度。或者用域帐户来启动service,也许可行,但是同样会有一些问题,比如与其他system进程的交互等。所以比较合理的解决方案就是将启动的进程用CreateProcessAsUser或是CreateProcessWithLogonW的API来创建,这两个API都是根据提供的用户信息来启动用户session的进程。主要的区别就是使用CreateProcessAsUser前需要先LogonUser。说到LogonUser,不得不说一下
BOOL LogonUser( __in LPTSTR lpszUsername, __in_opt LPTSTR lpszDomain, __in LPTSTR lpszPassword, __in DWORD dwLogonType, __in DWORD dwLogonProvider, __out PHANDLE phToken);
第四个参数dwLogonType的含义, msdn上是这么介绍的:
The type of logon operation to perform. This parameter can be one of the following values, defined in Winbase.h.
Value | Meaning |
---|---|
LOGON32_LOGON_BATCH | This logon type is intended for batch servers, where processes may be executing on behalf of a user without their direct intervention. This type is also for higher performance servers that process many plaintext authentication attempts at a time, such as mail or web servers. The LogonUser function does not cache credentials for this logon type. 这个参数适合于批处理,也就是没有界面,只做后台运算的进程 |
LOGON32_LOGON_INTERACTIVE | This logon type is intended for users who will be interactively using the computer, such as a user being logged on by a terminal server, remote shell, or similar process. This logon type has the additional expense of caching logon information for disconnected operations; therefore, it is inappropriate for some client/server applications, such as a mail server. 这个参数适合于界面的进程,如果你的service要和界面交互的话,必须用这个 |
LOGON32_LOGON_NETWORK | This logon type is intended for high performance servers to authenticate plaintext passwords. The LogonUser function does not cache credentials for this logon type. |
LOGON32_LOGON_NETWORK_CLEARTEXT | This logon type preserves the name and password in the authentication package, which allows the server to make connections to other network servers while impersonating the client. A server can accept plaintext credentials from a client, call LogonUser, verify that the user can access the system across the network, and still communicate with other servers. |
LOGON32_LOGON_NEW_CREDENTIALS | This logon type allows the caller to clone its current token and specify new credentials for outbound connections. The new logon session has the same local identifier but uses different credentials for other network connections. This logon type is supported only by the LOGON32_PROVIDER_WINNT50 logon provider. 这个需要window2003以上的系统支持 |
LOGON32_LOGON_SERVICE | Indicates a service-type logon. The account provided must have the service privilege enabled. 这个参数适合于创建一个service |
LOGON32_LOGON_UNLOCK | This logon type is for GINA DLLs that log on users who will be interactively using the computer. This logon type can generate a unique audit record that shows when the workstation was unlocked. |
同时强调一下,对DLL的接口参数千万不要用C++标准库里的类型来传递,比如std::string作为传递字符的容器。否则,就是一个死,死都不知道怎么死。原因,一是C++库是非多线程安全的,这就意味这当你的DLL函数被用作多线程中,数据很可能会被莫名其妙的修改掉;二是,C++的对象析构发生的比较晚,当你卸载掉DLL模块后,如果这时再发生对原来模块里面的C++对象析构操作,那就是一个死,进程保准Crash掉。
第二个issue,
问题:
EXT-GWT创建的ComboBox,当元素个数超过30个后,并且被嵌套了多层的LayerContainer的情况下,在IE8里就无法弹出下拉列表。这实际上是一个EXT-GWT的一个Bug,但是为了解决这个Bug,花费了我2天的时间。试尽了各种办法,都无效。最搞笑的是,我自己手写了一个列表,在点击ComboBox时来弹出,都没有效果。基本上,可以说这应该是一个LayerContainer嵌套的bug。通过跟踪发现,在这种情况下的列表视图的Height属性都为0。我猜测是因为动态生成时通过计算当前Table的高度来求列表视图的高度而出的问题。
解决:
引用2.20版本的gxt.jar来解决。
相关文章推荐
- 推荐一个比较不错JSON字符串处理网站,虽然性能不是很强,但是还不错比起其他的
- 推荐一个比较不错JSON字符串处理网站,虽然性能不是很强,但是还不错比起其他的
- 虽然我还没有测试过,但是我觉得有必要收藏一下,谢谢原创者
- 建立工程后刚开始编译出现了“error PRJ0003 : 生成 cmd.exe 时出错”这样的错误,虽然在debug中生成了.exe文件,但是无法执行,提示找不到mfc90ud.dll。
- 虽然微不足道但是很有用的JAVA基础—命名规则
- 虽然微不足道但是很有用的JAVA基础——集合简介
- 虽然AWS入华了,但是还有你不知道的事
- 21天战拖记——Day4:虽然今天学习时间少,但是效率非常高!(2014-05-07)
- 自己做过的2个项目,虽然不是很厉害,但是,努力学习中。
- 有些验证码看起来很容易但是没人做自动识别的原因分析
- 虽然Google的这个项目死了,但是它依然能给我们如此多借鉴
- 虽然很晚了,但是却很激动
- OpenGL学习----虽然是个小问题,但是困扰了我好久,我就觉得他是个大问题!!希望高手指教一二!
- 虽然不是经常的上51cto,但是到了这里如同到了家一样
- 用Vue的一个购物车(1),虽然是自己写的但是也是来源于脚本之家的案例,就算转载啦
- 2012年3月份工作总结 ~ 之 ~ PDF 作业对应 (虽然这个作业没有什么意思,但是非常值得总结)
- 虽然不信god,但是技术上还是算是有信yan的人吧
- 非阻塞模式下,虽然connect出错,但是getsockopt取得的错误却是0的问题
- 虽然微不足道但是很有用的JAVA基础—注释与文档标记
- 公司系统遇到的问题,虽然解决了,但是,不知道原因。贴下图片,供下次参考