WinHTTP错误信息处理
2015-05-12 09:52
716 查看
WinHTTP错误信息处理
Not all WinHTTP API functions report errors in the same way.WinHTTP API各种函数返回错误的方式不尽相同。
Some functions, such as
WinHttpSetTimeouts, return a BOOL that indicates failure whenFALSE. If
FALSE is returned, callers interested in the error should callGetLastError. If
GetLastError is called when the function succeded (returned anything butFALSE), the returned value is unpredictable and may change between Windows versions, Service Packs, or even between calls to the same function.
如WinHttpSetTimeouts函数返回一个BOOL值,这个值代表成果或失败。如果失败,请调用GetLastError获取具体的失败代码,如果返回的是成功,我们又调用了GetLastError,返回的错误值号就是不可预料的,这取决于Windows的版本,补丁号等等。
Some functions, such as
WinHttpConnect, return an
HINTERNET pseudo handle. These functions are exactly the same, except failure is indicated by returningNULL. If
NULL is returned, callers interested in the error should callGetLastError. If
GetLastError is called when the function succeded (returned anything butNULL), the returned value is unpredictable and may change between Windows versions, Service Packs, or even between calls to the same function.
一些函数,如WinHttpConnect返回一个WinHttpConnect伪句柄。这些函数如果失败会返回NULL。如果返回空,调用者同样可以用GetLastError获取具体错误代码,如果GetLastError是在函数成功时调用的,返回的错误值号就是不可预料的,这取决于Windows的版本,补丁号等等。
Some functions, such as
WinHttpGetProxyResult, return a DWORD error code and there is no need to call any other functions for more error information. For these functions,GetLastError
should not be called. If GetLastError is called, regardless of the success or failure of the function, the returned value is unpredictable and may change between Windows versions, Service Packs, or even between calls to the same function.
一些函数,如WinHttpGetProxyResult返回一个DWORD错误代码,这就不需要我们再调用任何辅助函数来确定错误代码了。对这些函数不能使用GetLastError,如果调用了GetLastError,不管函数成功与否,返回的错误值号就是不可预料的,这取决于Windows的版本,补丁号等等。
相关文章推荐
- 在Eclipse Galileo中配置Tomcat及代码显示HttpServlet相关错误信息处理方法
- 苹果审核的Crash错误信息处理.
- 『MySQL』MySQL 错误信息及处理方法记录
- HTTP 错误 404.3 - Not Found 由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序。如果应下载文件,请添加 MIME 映射。
- Win7中IIS出现“HTTP 错误 404.17 - Not Found 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理。”错误(已解决)
- IIS发不报错“HTTP 错误 404.17 - Not Found 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理。”
- AngularJS 中利用 Interceptors 来统一处理 HTTP 的错误
- word文档错误“您正在处理的信息有可能丢失”解决方法
- 如何利用PHP自定义错误处理器处理出错信息?
- HTTP 错误 500.21 - Internal Server Error 处理程序“PageHandlerFactory-ISAPI-4.0_32bit”在其模块
- HTTP 错误 500.21 - Internal Server Error处理程序“PageHandlerFactory-Integrated”在其模块列表中有一个错误模块“ManagedP
- 配置GoldenGate意外处理及记录Oracle错误信息(1)
- IIS 之 HTTP错误信息提示
- HTTP 错误 404.3 - Not Found 由于扩展配置问题而无法提供您请求的页面。如果该页面是脚本,请添加处理程序。如果应下载文件,请添加 MIME 映射。
- HTTP 错误 404.17 - Not Found 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理。
- iis部署网站(asp.net或者wcf)出现HTTP 错误 404.17 - Not Found 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理。
- HTTP 错误 403.9 - 禁止访问:连接的用户过多 Internet 信息服务
- struts2表单校验与错误信息处理
- HTTP 错误 500.21 - Internal Server Error 处理程序“PageHandlerFactory-ISAPI-4.0_32bit”在其模块
- 【转载】HTTP 错误 404.17 - Not Found 请求的内容似乎是脚本,因而将无法由静态文件处理程序来处理