Sync to Wine-20050725:
Felix Nawothnig <felix.nawothnig(a)t-online.de>
- Fix misuse of UrlCombineW.
Mike McCormack <mike(a)codeweavers.com>
- Fix -Wpointer-sign warnings.
Uwe Bonnes <bon(a)elektron.ikp.physik.tu-darmstadt.de>
- URLMonikerImpl_BindToStorage: Don't use a HeapAllocated pointer for
other purposes.
- URLMonikerImpl_BindToStorage: Escape special characters.
Jacek Caban <jack(a)itma.pwr.wroc.pl>
- Register protocols.
- Better module locking.
- Fix handling of pmkContext in CreateURLMoniker.
Modified: trunk/reactos/lib/urlmon/Makefile.in
Modified: trunk/reactos/lib/urlmon/regsvr.c
Added: trunk/reactos/lib/urlmon/rsrc.rc
Modified: trunk/reactos/lib/urlmon/sec_mgr.c
Modified: trunk/reactos/lib/urlmon/umon.c
Modified: trunk/reactos/lib/urlmon/umstream.c
Added: trunk/reactos/lib/urlmon/urlmon.inf
Modified: trunk/reactos/lib/urlmon/urlmon.xml
Modified: trunk/reactos/lib/urlmon/urlmon_main.c
Modified: trunk/reactos/lib/urlmon/urlmon_main.h
Added: trunk/reactos/w32api/include/advpub.h
_____
Modified: trunk/reactos/lib/urlmon/Makefile.in
--- trunk/reactos/lib/urlmon/Makefile.in 2005-08-12 18:09:06 UTC
(rev 17340)
+++ trunk/reactos/lib/urlmon/Makefile.in 2005-08-12 18:17:37 UTC
(rev 17341)
@@ -14,6 +14,8 @@
umstream.c \
urlmon_main.c
+RC_SRCS = rsrc.rc
+
SUBDIRS = tests
@MAKE_DLL_RULES@
_____
Modified: trunk/reactos/lib/urlmon/regsvr.c
--- trunk/reactos/lib/urlmon/regsvr.c 2005-08-12 18:09:06 UTC (rev
17340)
+++ trunk/reactos/lib/urlmon/regsvr.c 2005-08-12 18:17:37 UTC (rev
17341)
@@ -20,6 +20,7 @@
#define COM_NO_WINDOWS_H
#include <stdarg.h>
+#include <stdio.h>
#include <string.h>
#include "windef.h"
@@ -28,6 +29,7 @@
#include "wingdi.h"
#include "winreg.h"
#include "winerror.h"
+#include "advpub.h"
#include "objbase.h"
@@ -35,6 +37,9 @@
#include "wine/debug.h"
+#include "initguid.h"
+#include "urlmon_main.h"
+
WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
/*
@@ -511,6 +516,48 @@
"urlmon.dll",
"Apartment"
},
+ { &CLSID_CdlProtocol,
+ "CDL: Asynchronous Pluggable Protocol Handler",
+ NULL,
+ "urlmon.dll",
+ "Apartment"
+ },
+ { &CLSID_FileProtocol,
+ "file:, local: Asynchronous Pluggable Protocol Handler",
+ NULL,
+ "urlmon.dll",
+ "Apartment"
+ },
+ { &CLSID_FtpProtocol,
+ "ftp: Asynchronous Pluggable Protocol Handler",
+ NULL,
+ "urlmon.dll",
+ "Apartment"
+ },
+ { &CLSID_GopherProtocol,
+ "gopher: Asynchronous Pluggable Protocol Handler",
+ NULL,
+ "urlmon.dll",
+ "Apartment"
+ },
+ { &CLSID_HttpProtocol,
+ "http: Asynchronous Pluggable Protocol Handler",
+ NULL,
+ "urlmon.dll",
+ "Apartment"
+ },
+ { &CLSID_HttpsProtocol,
+ "https: Asynchronous Pluggable Protocol Handler",
+ NULL,
+ "urlmon.dll",
+ "Apartment"
+ },
+ { &CLSID_MkProtocol,
+ "mk: Asynchronous Pluggable Protocol Handler",
+ NULL,
+ "urlmon.dll",
+ "Apartment"
+ },
{ NULL } /* list terminator */
};
@@ -523,6 +570,58 @@
};
/***********************************************************************
+ * register_inf
+ */
+
+#define INF_SET_CLSID(clsid) \
+ pse[i].pszName = "CLSID_" #clsid; \
+ clsids[i++] = &CLSID_ ## clsid;
+
+static HRESULT register_inf(BOOL doregister)
+{
+ HRESULT hres;
+ HMODULE hAdvpack;
+ typeof(RegInstall) *pRegInstall;
+ STRTABLE strtable;
+ STRENTRY pse[7];
+ static CLSID const *clsids[34];
+ int i = 0;
+
+ static const WCHAR wszAdvpack[] =
{'a','d','v','p','a','c','k','.','d','l','l',0};
+
+ INF_SET_CLSID(CdlProtocol);
+ INF_SET_CLSID(FileProtocol);
+ INF_SET_CLSID(FtpProtocol);
+ INF_SET_CLSID(GopherProtocol);
+ INF_SET_CLSID(HttpProtocol);
+ INF_SET_CLSID(HttpsProtocol);
+ INF_SET_CLSID(MkProtocol);
+
+ for(i = 0; i < sizeof(pse)/sizeof(pse[0]); i++) {
+ pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, 39);
+ sprintf(pse[i].pszValue,
"{%08lX-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
+ clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3,
clsids[i]->Data4[0],
+ clsids[i]->Data4[1], clsids[i]->Data4[2],
clsids[i]->Data4[3], clsids[i]->Data4[4],
+ clsids[i]->Data4[5], clsids[i]->Data4[6],
clsids[i]->Data4[7]);
+ }
+
+ strtable.cEntries = sizeof(pse)/sizeof(pse[0]);
+ strtable.pse = pse;
+
+ hAdvpack = LoadLibraryW(wszAdvpack);
+ pRegInstall = (typeof(RegInstall)*)GetProcAddress(hAdvpack,
"RegInstall");
+
+ hres = pRegInstall(URLMON_hInstance, doregister ? "RegisterDll" :
"UnregisterDll", &strtable);
+
+ for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++)
+ HeapFree(GetProcessHeap(), 0, pse[i].pszValue);
+
+ return hres;
+}
+
+#undef INF_SET_CLSID
+
+/**********************************************************************
*
* DllRegisterServer (URLMON.@)
*/
HRESULT WINAPI URLMON_DllRegisterServer(void)
@@ -534,7 +633,9 @@
hr = register_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = register_interfaces(interface_list);
- return hr;
+ if(FAILED(hr))
+ return hr;
+ return register_inf(TRUE);
}
/***********************************************************************
@@ -549,5 +650,7 @@
hr = unregister_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = unregister_interfaces(interface_list);
- return hr;
+ if(FAILED(hr))
+ return hr;
+ return register_inf(FALSE);
}
_____
Copied: trunk/reactos/lib/urlmon/rsrc.rc (from rev 17340,
vendor/wine/dlls/urlmon/current/rsrc.rc)
Property changes on: trunk/reactos/lib/urlmon/rsrc.rc
___________________________________________________________________
Name: svn:keywords + Author Date Id Revision Name: svn:eol-style +
native
_____
Modified: trunk/reactos/lib/urlmon/sec_mgr.c
--- trunk/reactos/lib/urlmon/sec_mgr.c 2005-08-12 18:09:06 UTC (rev
17340)
+++ trunk/reactos/lib/urlmon/sec_mgr.c 2005-08-12 18:17:37 UTC (rev
17341)
@@ -43,7 +43,7 @@
const IInternetSecurityManagerVtbl* lpvtbl1; /* VTable relative to
the IInternetSecurityManager interface.*/
- ULONG ref; /* reference counter for this object */
+ LONG ref; /* reference counter for this object */
} SecManagerImpl;
@@ -82,8 +82,6 @@
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
- URLMON_LockModule();
-
return refCount;
}
@@ -97,10 +95,9 @@
/* destroy the object if there's no more reference on it */
if (!refCount){
HeapFree(GetProcessHeap(),0,This);
+ URLMON_UnlockModule();
}
- URLMON_UnlockModule();
-
return refCount;
}
@@ -201,6 +198,9 @@
This->ref = 1;
*ppobj = This;
+
+ URLMON_LockModule();
+
return S_OK;
}
@@ -210,7 +210,7 @@
*/
typedef struct {
const IInternetZoneManagerVtbl* lpVtbl;
- ULONG ref;
+ LONG ref;
} ZoneMgrImpl;
/********************************************************************
@@ -247,8 +247,6 @@
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
- URLMON_LockModule();
-
return refCount;
}
@@ -262,10 +260,10 @@
TRACE("(%p)->(ref before=%lu)\n",This, refCount + 1);
- if(!refCount)
+ if(!refCount) {
HeapFree(GetProcessHeap(), 0, This);
-
- URLMON_UnlockModule();
+ URLMON_UnlockModule();
+ }
return refCount;
}
@@ -457,6 +455,8 @@
ret->ref = 1;
*ppobj = (IInternetZoneManager*)ret;
+ URLMON_LockModule();
+
return S_OK;
}
_____
Modified: trunk/reactos/lib/urlmon/umon.c
--- trunk/reactos/lib/urlmon/umon.c 2005-08-12 18:09:06 UTC (rev
17340)
+++ trunk/reactos/lib/urlmon/umon.c 2005-08-12 18:17:37 UTC (rev
17341)
@@ -51,7 +51,7 @@
typedef struct {
const IBindingVtbl *lpVtbl;
- ULONG ref;
+ LONG ref;
LPWSTR URLName;
@@ -291,7 +291,7 @@
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;
@@ -340,8 +340,6 @@
TRACE("(%p)->(ref before=%lu)\n",This, refCount - 1);
- URLMON_LockModule();
-
return refCount;
}
@@ -359,10 +357,10 @@
if (!refCount) {
HeapFree(GetProcessHeap(),0,This->URLName);
HeapFree(GetProcessHeap(),0,This);
+
+ URLMON_UnlockModule();
}
- URLMON_UnlockModule();
-
return refCount;
}
@@ -600,7 +598,7 @@
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;
@@ -638,7 +636,7 @@
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';
@@ -799,9 +797,9 @@
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;
}
@@ -809,10 +807,10 @@
{
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());
@@ -1136,7 +1134,7 @@
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(lpszURL
Name));
memset(This, 0, sizeof(*This));
@@ -1170,6 +1168,8 @@
else
strcpyW(This->URLName,lpszURLName);
+ URLMON_LockModule();
+
return S_OK;
}
@@ -1255,11 +1255,12 @@
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);
}
}
_____
Modified: trunk/reactos/lib/urlmon/umstream.c
--- trunk/reactos/lib/urlmon/umstream.c 2005-08-12 18:09:06 UTC (rev
17340)
+++ trunk/reactos/lib/urlmon/umstream.c 2005-08-12 18:17:37 UTC (rev
17341)
@@ -253,7 +253,8 @@
DWORD dwOrigin,
ULARGE_INTEGER* plibNewPosition)
{
- DWORD pos, newposlo, newposhi;
+ DWORD pos, newposlo;
+ LONG newposhi;
IUMCacheStream *This = (IUMCacheStream *)iface;
@@ -262,7 +263,7 @@
pos = dlibMove.QuadPart; /* FIXME: truncates */
newposhi = 0;
newposlo = SetFilePointer( This->handle, pos, &newposhi, dwOrigin
);
- if( newposlo == INVALID_SET_FILE_POINTER )
+ if( newposlo == INVALID_SET_FILE_POINTER && GetLastError())
return E_FAIL;
if (plibNewPosition)
_____
Copied: trunk/reactos/lib/urlmon/urlmon.inf (from rev 17340,
vendor/wine/dlls/urlmon/current/urlmon.inf)
Property changes on: trunk/reactos/lib/urlmon/urlmon.inf
___________________________________________________________________
Name: svn:keywords + Author Date Id Revision Name: svn:eol-style +
native
_____
Modified: trunk/reactos/lib/urlmon/urlmon.xml
--- trunk/reactos/lib/urlmon/urlmon.xml 2005-08-12 18:09:06 UTC (rev
17340)
+++ trunk/reactos/lib/urlmon/urlmon.xml 2005-08-12 18:17:37 UTC (rev
17341)
@@ -23,5 +23,6 @@
<file>umon.c</file>
<file>umstream.c</file>
<file>urlmon_main.c</file>
+ <file>rsrc.rc</file>
<file>urlmon.spec</file>
</module>
_____
Modified: trunk/reactos/lib/urlmon/urlmon_main.c
--- trunk/reactos/lib/urlmon/urlmon_main.c 2005-08-12 18:09:06 UTC
(rev 17340)
+++ trunk/reactos/lib/urlmon/urlmon_main.c 2005-08-12 18:17:37 UTC
(rev 17341)
@@ -89,7 +89,7 @@
typedef struct {
IClassFactory ITF_IClassFactory;
- DWORD ref;
+ LONG ref;
HRESULT (*pfnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj);
} IClassFactoryImpl;
@@ -125,8 +125,6 @@
static ULONG WINAPI CF_AddRef(LPCLASSFACTORY iface)
{
IClassFactoryImpl *This = (IClassFactoryImpl *)iface;
- URLMON_LockModule();
-
return InterlockedIncrement(&This->ref);
}
@@ -136,11 +134,11 @@
ULONG ref = InterlockedDecrement(&This->ref);
- if (ref == 0)
- HeapFree(GetProcessHeap(), 0, This);
+ if (ref == 0) {
+ HeapFree(GetProcessHeap(), 0, This);
+ URLMON_UnlockModule();
+ }
- URLMON_UnlockModule();
-
return ref;
}
@@ -229,10 +227,12 @@
factory->ITF_IClassFactory.lpVtbl = &CF_Vtbl;
factory->ref = 1;
-
factory->pfnCreateInstance = object_creation[i].pfnCreateInstance;
*ppv = &(factory->ITF_IClassFactory);
+
+ URLMON_LockModule();
+
return S_OK;
}
_____
Modified: trunk/reactos/lib/urlmon/urlmon_main.h
--- trunk/reactos/lib/urlmon/urlmon_main.h 2005-08-12 18:09:06 UTC
(rev 17340)
+++ trunk/reactos/lib/urlmon/urlmon_main.h 2005-08-12 18:17:37 UTC
(rev 17341)
@@ -40,7 +40,7 @@
typedef struct
{
const IStreamVtbl *lpVtbl;
- DWORD ref;
+ LONG ref;
HANDLE handle;
BOOL closed;
WCHAR *pszFileName;
@@ -50,4 +50,13 @@
HRESULT UMCreateStreamOnCacheFile(LPCWSTR pszURL, DWORD dwSize,
LPWSTR pszFileName, HANDLE *phfile, IUMCacheStream **ppstr);
void UMCloseCacheFileStream(IUMCacheStream *pstr);
+DEFINE_GUID(CLSID_CdlProtocol, 0x3dd53d40, 0x7b8b, 0x11D0, 0xb0,0x13,
0x00,0xaa,0x00,0x59,0xce,0x02);
+DEFINE_GUID(CLSID_FileProtocol, 0x79EAC9E7, 0xBAF9, 0x11CE, 0x8C,0x82,
0x00,0xAA,0x00,0x4B,0xA9,0x0B);
+DEFINE_GUID(CLSID_FtpProtocol, 0x79EAC9E3, 0xBAF9, 0x11CE, 0x8C,0x82,
0x00,0xAA,0x00,0x4B,0xA9,0x0B);
+DEFINE_GUID(CLSID_GopherProtocol, 0x79EAC9E4, 0xBAF9, 0x11CE,
0x8C,0x82, 0x00,0xAA,0x00,0x4B,0xA9,0x0B);
+DEFINE_GUID(CLSID_HttpProtocol, 0x79EAC9E2, 0xBAF9, 0x11CE, 0x8C,0x82,
0x00,0xAA,0x00,0x4B,0xA9,0x0B);
+DEFINE_GUID(CLSID_HttpsProtocol, 0x79EAC9E5, 0xBAF9, 0x11CE, 0x8C,0x82,
0x00,0xAA,0x00,0x4B,0xA9,0x0B);
+DEFINE_GUID(CLSID_MkProtocol, 0x79EAC9E6, 0xBAF9, 0x11CE, 0x8C,0x82,
0x00,0xAA,0x00,0x4B,0xA9,0x0B);
+
+
#endif /* __WINE_URLMON_MAIN_H */
_____
Added: trunk/reactos/w32api/include/advpub.h
--- trunk/reactos/w32api/include/advpub.h 2005-08-12 18:09:06 UTC
(rev 17340)
+++ trunk/reactos/w32api/include/advpub.h 2005-08-12 18:17:37 UTC
(rev 17341)
@@ -0,0 +1,77 @@
+/*
+ * Copyright 2004 Huw D M Davies
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307
USA
+ */
+#ifndef __WINE_ADVPUB_H
+#define __WINE_ADVPUB_H
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+typedef struct _CabInfo {
+ PSTR pszCab;
+ PSTR pszInf;
+ PSTR pszSection;
+ char szSrcPath[MAX_PATH];
+ DWORD dwFlags;
+} CABINFO, *PCABINFO;
+
+typedef struct _StrEntry {
+ LPSTR pszName;
+ LPSTR pszValue;
+} STRENTRY, *LPSTRENTRY;
+
+typedef const STRENTRY CSTRENTRY;
+typedef CSTRENTRY *LPCSTRENTRY;
+
+typedef struct _StrTable {
+ DWORD cEntries;
+ LPSTRENTRY pse;
+} STRTABLE, *LPSTRTABLE;
+
+typedef const STRTABLE CSTRTABLE;
+typedef CSTRTABLE *LPCSTRTABLE;
+
+/* Flags for RunSetupCommand */
+#define RSC_FLAG_INF 0x00000001
+#define RSC_FLAG_SKIPDISKSPACECHECK 0x00000002
+#define RSC_FLAG_QUIET 0x00000004
+#define RSC_FLAG_NGCONV 0x00000008
+#define RSC_FLAG_UPDHLPDLLS 0x00000010
+#define RSC_FLAG_DELAYREGISTEROCX 0x00000200
+#define RSC_FLAG_SETUPAPI 0x00000400
+
+/* Flags for DelNode */
+#define ADN_DEL_IF_EMPTY 0x00000001
+#define ADN_DONT_DEL_SUBDIRS 0x00000002
+#define ADN_DONT_DEL_DIR 0x00000004
+
+HRESULT WINAPI RunSetupCommand(HWND hWnd,
+ LPCSTR szCmdName, LPCSTR szInfSection, LPCSTR szDir, LPCSTR
lpszTitle,
+ HANDLE *phEXE, DWORD dwFlags, LPVOID pvReserved);
+HRESULT WINAPI DelNode(LPCSTR pszFileOrDirName, DWORD dwFlags);
+DWORD WINAPI NeedRebootInit(VOID);
+BOOL WINAPI NeedReboot(DWORD dwRebootCheck);
+HRESULT WINAPI RegInstall(HMODULE hm, LPCSTR pszSection, LPCSTRTABLE
pstTable);
+HRESULT WINAPI GetVersionFromFile(LPSTR lpszFilename, LPDWORD pdwMSVer,
LPDWORD pdwLSVer, BOOL bVersion);
+HRESULT WINAPI GetVersionFromFileEx(LPSTR lpszFilename, LPDWORD
pdwMSVer, LPDWORD pdwLSVer, BOOL bVersion);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __WINE_ADVPUB_H */
Property changes on: trunk/reactos/w32api/include/advpub.h
___________________________________________________________________
Name: svn:keywords
+ Author Date Id Revision
Name: svn:eol-style
+ native