typedef struct {
const IBindingVtbl *lpVtbl;
- ULONG ref;
+ LONG ref;
LPWSTR URLName;
const IMonikerVtbl* lpvtbl; /* VTable relative to the IMoniker interface.*/
- ULONG ref; /* reference counter for this object */
+ LONG ref; /* reference counter for this object */
LPOLESTR URLName; /* URL string identified by this URLmoniker */
} URLMonikerImpl;
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
- URLMON_LockModule();
-
return refCount;
}
if (!refCount) {
HeapFree(GetProcessHeap(),0,This->URLName);
HeapFree(GetProcessHeap(),0,This);
- }
- URLMON_UnlockModule();
+ URLMON_UnlockModule();
+ }
return refCount;
}
if(SUCCEEDED(hres)) {
WCHAR *urlcopy, *tmpwc;
URL_COMPONENTSW url;
- WCHAR *host, *path, *user, *pass;
+ WCHAR *host, *path, *partial_path, *user, *pass;
DWORD lensz = sizeof(bind->expected_size);
DWORD dwService = 0;
BOOL bSuccess;
memset(&url, 0, sizeof(url));
url.dwStructSize = sizeof(url);
url.dwSchemeLength = url.dwHostNameLength = url.dwUrlPathLength = url.dwUserNameLength = url.dwPasswordLength = 1;
- InternetCrackUrlW(urlcopy, 0, 0, &url);
+ InternetCrackUrlW(urlcopy, 0, ICU_ESCAPE, &url);
host = HeapAlloc(GetProcessHeap(), 0, (url.dwHostNameLength + 1) * sizeof(WCHAR));
memcpy(host, url.lpszHostName, url.dwHostNameLength * sizeof(WCHAR));
host[url.dwHostNameLength] = '\0';
break;
case INTERNET_SCHEME_FILE:
- path = bind->URLName + 5; /* Skip the "file:" part */
- if ((path[0] != '/' && path[0] != '\\') ||
- (path[1] != '/' && path[1] != '\\'))
+ partial_path = bind->URLName + 5; /* Skip the "file:" part */
+ if ((partial_path[0] != '/' && partial_path[0] != '\\') ||
+ (partial_path[1] != '/' && partial_path[1] != '\\'))
{
hres = E_FAIL;
}
{
HANDLE h;
- path += 2;
- if (path[0] == '/' || path[0] == '\\')
- ++path;
- h = CreateFileW(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
+ partial_path += 2;
+ if (partial_path[0] == '/' || partial_path[0] == '\\')
+ ++partial_path;
+ h = CreateFileW(partial_path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
if (h == (HANDLE) HFILE_ERROR)
{
hres = HRESULT_FROM_WIN32(GetLastError());
static HRESULT URLMonikerImpl_Construct(URLMonikerImpl* This, LPCOLESTR lpszLeftURLName, LPCOLESTR lpszURLName)
{
HRESULT hres;
- DWORD sizeStr;
+ DWORD sizeStr = INTERNET_MAX_URL_LENGTH;
TRACE("(%p,%s,%s)\n",This,debugstr_w(lpszLeftURLName),debugstr_w(lpszURLName));
memset(This, 0, sizeof(*This));
else
strcpyW(This->URLName,lpszURLName);
+ URLMON_LockModule();
+
return S_OK;
}
return E_OUTOFMEMORY;
if(pmkContext) {
- CLSID clsid;
IBindCtx* bind;
- IMoniker_GetClassID(pmkContext, &clsid);
- if(IsEqualCLSID(&clsid, &CLSID_StdURLMoniker) && SUCCEEDED(CreateBindCtx(0, &bind))) {
- URLMonikerImpl_GetDisplayName(pmkContext, bind, NULL, &lefturl);
+ DWORD dwMksys = 0;
+ IMoniker_IsSystemMoniker(pmkContext, &dwMksys);
+ if(dwMksys == MKSYS_URLMONIKER && SUCCEEDED(CreateBindCtx(0, &bind))) {
+ IMoniker_GetDisplayName(pmkContext, bind, NULL, &lefturl);
+ TRACE("lefturl = %s\n", debugstr_w(lefturl));
IBindCtx_Release(bind);
}
}