static BOOL COOKIE_crackUrlSimple(LPCWSTR lpszUrl, LPWSTR hostName, int hostNameLen, LPWSTR path, int pathLen)
{
URL_COMPONENTSW UrlComponents;
- BOOL rc;
UrlComponents.lpszExtraInfo = NULL;
UrlComponents.lpszPassword = NULL;
UrlComponents.dwHostNameLength = hostNameLen;
UrlComponents.dwUrlPathLength = pathLen;
- rc = InternetCrackUrlW(lpszUrl, 0, 0, &UrlComponents);
+ if (!InternetCrackUrlW(lpszUrl, 0, 0, &UrlComponents)) return FALSE;
/* discard the webpage off the end of the path */
- if (pathLen > 0 && path[pathLen-1] != '/')
+ if (UrlComponents.dwUrlPathLength)
{
- LPWSTR ptr;
- ptr = strrchrW(path,'/');
- if (ptr)
- *(++ptr) = 0;
- else
+ if (path[UrlComponents.dwUrlPathLength - 1] != '/')
{
- path[0] = '/';
- path[1] = 0;
+ WCHAR *ptr;
+ if ((ptr = strrchrW(path, '/'))) *(++ptr) = 0;
+ else
+ {
+ path[0] = '/';
+ path[1] = 0;
+ }
}
}
- return rc;
+ else if (pathLen >= 2)
+ {
+ path[0] = '/';
+ path[1] = 0;
+ }
+ return TRUE;
}
/* match a domain. domain must match if the domain is not NULL. path must match if the path is not NULL */
return FALSE;
}
- hostName[0] = path[0] = 0;
+ hostName[0] = 0;
ret = COOKIE_crackUrlSimple(lpszUrl, hostName, sizeof(hostName)/sizeof(hostName[0]), path, sizeof(path)/sizeof(path[0]));
if (!ret || !hostName[0]) return FALSE;
DWORD nASCIILength=WideCharToMultiByte(CP_ACP,0,lpwszComponent,dwwComponentLen,NULL,0,NULL,NULL);
if (*lppszComponent == NULL)
{
- int nASCIIOffset=WideCharToMultiByte(CP_ACP,0,lpwszStart,lpwszComponent-lpwszStart,NULL,0,NULL,NULL);
if (lpwszComponent)
- *lppszComponent = (LPSTR)lpszStart+nASCIIOffset;
+ {
+ int offset = WideCharToMultiByte(CP_ACP, 0, lpwszStart, lpwszComponent-lpwszStart, NULL, 0, NULL, NULL);
+ *lppszComponent = (LPSTR)lpszStart + offset;
+ }
else
*lppszComponent = NULL;
+
*dwComponentLen = nASCIILength;
}
else
InternetCrackUrlW should not include it */
if (dwUrlLength == -1) nLength--;
- lpwszUrl=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WCHAR)*nLength);
+ lpwszUrl = HeapAlloc(GetProcessHeap(), 0, nLength * sizeof(WCHAR));
MultiByteToWideChar(CP_ACP,0,lpszUrl,dwUrlLength,lpwszUrl,nLength);
memset(&UCW,0,sizeof(UCW));
--- /dev/null
+/*
+ * Copyright 2009 Aurimas Fišeras <aurimas@gmail.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+#include "resource.h"
+
+/* UTF-8 */
+#pragma code_page(65001)
+
+LANGUAGE LANG_LITHUANIAN, SUBLANG_NEUTRAL
+
+IDD_PROXYDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Įveskite tinklo slaptažodį"
+FONT 8, "MS Shell Dlg"
+{
+ LTEXT "Įveskite savo naudotojo vardą ir slaptažodį:", -1, 40, 6, 150, 15
+ LTEXT "Įgaliot. serv.", -1, 40, 26, 50, 10
+ LTEXT "Sritis", -1, 40, 46, 50, 10
+ LTEXT "Naudotojas", -1, 40, 66, 50, 10
+ LTEXT "Slaptažodis", -1, 40, 86, 50, 10
+ LTEXT "" IDC_PROXY, 80, 26, 150, 14, 0
+ LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
+ EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
+ EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
+ CHECKBOX "Į&rašyti šį slaptažodį (nesaugu)", IDC_SAVEPASSWORD,
+ 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Gerai", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
+ PUSHBUTTON "Atsisakyti", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
+}
+
+IDD_AUTHDLG DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 250, 154
+STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
+CAPTION "Reikalingas tapatumo nustatymas"
+FONT 8, "MS Shell Dlg"
+{
+ LTEXT "Įveskite savo naudotojo vardą ir slaptažodį:", -1, 40, 6, 150, 15
+ LTEXT "Serveris", -1, 40, 26, 50, 10
+ LTEXT "Sritis", -1, 40, 46, 50, 10
+ LTEXT "Naudotojas", -1, 40, 66, 50, 10
+ LTEXT "Slaptažodis", -1, 40, 86, 50, 10
+ LTEXT "" IDC_SERVER, 80, 26, 150, 14, 0
+ LTEXT "" IDC_REALM, 80, 46, 150, 14, 0
+ EDITTEXT IDC_USERNAME, 80, 66, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP
+ EDITTEXT IDC_PASSWORD, 80, 86, 150, 14, ES_AUTOHSCROLL | WS_BORDER | WS_TABSTOP | ES_PASSWORD
+ CHECKBOX "Į&rašyti šį slaptažodį (nesaugu)", IDC_SAVEPASSWORD,
+ 80, 106, 150, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
+ PUSHBUTTON "Gerai", IDOK, 98, 126, 56, 14, WS_GROUP | WS_TABSTOP | BS_DEFPUSHBUTTON
+ PUSHBUTTON "Atsisakyti", IDCANCEL, 158, 126, 56, 14, WS_GROUP | WS_TABSTOP
+}
+
+STRINGTABLE DISCARDABLE
+{
+ IDS_LANCONNECTION "Vietinio tinklo ryšys"
+}