|
最近发现用 _WinHttpCrackUrl 后面的 $iFlag = Default 会自动把 提交页面 中的url字符转换成 乱码 求解决 或者 让 crackurl的过程中 不处理 iflag的转换
$ICU_DECODE - 转换 "escape encoded" 字符(%xx) 为非 escaped 结构.
$ICU_ESCAPE - Escapes 若干字符为它们的转义序列 (%xx).
Func _WinHttpCrackUrl($sURL, $iFlag = Default)
If $iFlag = Default Or $iFlag = -1 Then $iFlag = $ICU_ESCAPE
Local $tURL_COMPONENTS = DllStructCreate("dword StructSize;" & _
"ptr SchemeName;" & _
"dword SchemeNameLength;" & _
"int Scheme;" & _
"ptr HostName;" & _
"dword HostNameLength;" & _
"word Port;" & _
"ptr UserName;" & _
"dword UserNameLength;" & _
"ptr Password;" & _
"dword PasswordLength;" & _
"ptr UrlPath;" & _
"dword UrlPathLength;" & _
"ptr ExtraInfo;" & _
"dword ExtraInfoLength")
DllStructSetData($tURL_COMPONENTS, 1, DllStructGetSize($tURL_COMPONENTS))
Local $tBuffers[6]
Local $iURLLen = StringLen($sURL)
For $i = 0 To 5
$tBuffers[$i] = DllStructCreate("wchar[" & $iURLLen + 1 & "]")
Next
DllStructSetData($tURL_COMPONENTS, "SchemeNameLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "SchemeName", DllStructGetPtr($tBuffers[0]))
DllStructSetData($tURL_COMPONENTS, "HostNameLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "HostName", DllStructGetPtr($tBuffers[1]))
DllStructSetData($tURL_COMPONENTS, "UserNameLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "UserName", DllStructGetPtr($tBuffers[2]))
DllStructSetData($tURL_COMPONENTS, "PasswordLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "Password", DllStructGetPtr($tBuffers[3]))
DllStructSetData($tURL_COMPONENTS, "UrlPathLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "UrlPath", DllStructGetPtr($tBuffers[4]))
DllStructSetData($tURL_COMPONENTS, "ExtraInfoLength", $iURLLen)
DllStructSetData($tURL_COMPONENTS, "ExtraInfo", DllStructGetPtr($tBuffers[5]))
Local $aCall = DllCall($hWINHTTPDLL__WINHTTP, "bool", "WinHttpCrackUrl", _
"wstr", $sURL, _
"dword", $iURLLen, _
"dword", $iFlag, _
"ptr", DllStructGetPtr($tURL_COMPONENTS))
If @error Or Not $aCall[0] Then Return SetError(1, 0, 0)
Local $aRet[8] = [DllStructGetData($tBuffers[0], 1), _
DllStructGetData($tURL_COMPONENTS, "Scheme"), _
DllStructGetData($tBuffers[1], 1), _
DllStructGetData($tURL_COMPONENTS, "Port"), _
DllStructGetData($tBuffers[2], 1), _
DllStructGetData($tBuffers[3], 1), _
DllStructGetData($tBuffers[4], 1), _
DllStructGetData($tBuffers[5], 1)]
Return $aRet
EndFunc ;==>_WinHttpCrackUrl |
|