URLMON: Register protocols
Jacek Caban
jack at itma.pwr.wroc.pl
Sat Jul 2 15:23:11 CDT 2005
First step to support pluggable protocols is
to register them. I used inf file. It's probably
the best way to do so. urlmon registers many
different things like zones and it will be easy
to add them all by inf file. I kept registering
coclasses as it is.
Changelog:
Register protocols
-------------- next part --------------
Index: dlls/urlmon/Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/urlmon/Makefile.in,v
retrieving revision 1.24
diff -u -p -r1.24 Makefile.in
--- dlls/urlmon/Makefile.in 9 May 2005 14:42:31 -0000 1.24
+++ dlls/urlmon/Makefile.in 2 Jul 2005 20:09:54 -0000
@@ -14,6 +14,8 @@ C_SRCS = \
umstream.c \
urlmon_main.c
+RC_SRCS = rsrc.rc
+
SUBDIRS = tests
@MAKE_DLL_RULES@
Index: dlls/urlmon/regsvr.c
===================================================================
RCS file: /home/wine/wine/dlls/urlmon/regsvr.c,v
retrieving revision 1.1
diff -u -p -r1.1 regsvr.c
--- dlls/urlmon/regsvr.c 19 Apr 2004 03:00:27 -0000 1.1
+++ dlls/urlmon/regsvr.c 2 Jul 2005 20:09:54 -0000
@@ -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 @@ static struct regsvr_coclass const cocla
"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 @@ static struct regsvr_interface const int
};
/***********************************************************************
+ * 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 @@ HRESULT WINAPI URLMON_DllRegisterServer(
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 @@ HRESULT WINAPI URLMON_DllUnregisterServe
hr = unregister_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = unregister_interfaces(interface_list);
- return hr;
+ if(FAILED(hr))
+ return hr;
+ return register_inf(FALSE);
}
Index: dlls/urlmon/urlmon_main.h
===================================================================
RCS file: /home/wine/wine/dlls/urlmon/urlmon_main.h,v
retrieving revision 1.9
diff -u -p -r1.9 urlmon_main.h
--- dlls/urlmon/urlmon_main.h 21 Jun 2005 20:53:14 -0000 1.9
+++ dlls/urlmon/urlmon_main.h 2 Jul 2005 20:09:54 -0000
@@ -50,4 +50,13 @@ typedef struct
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 */
--- /dev/null 1970-01-01 01:00:00.000000000 +0100
+++ dlls/urlmon/rsrc.rc 2005-07-02 21:39:43.000000000 +0200
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2005 Jacek Caban
+ *
+ * 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
+ */
+
+REGINST REGINST urlmon.inf
--- /dev/null 1970-01-01 01:00:00.000000000 +0100
+++ dlls/urlmon/urlmon.inf 2005-07-02 21:49:55.000000000 +0200
@@ -0,0 +1,29 @@
+[version]
+Signature="$CHICAGO$"
+
+
+[RegisterDll]
+AddReg=Protocols.Reg
+
+
+[UnregisterDll]
+DelReg=Protocols.Reg
+
+
+[Protocols.Reg]
+HKCR,"PROTOCOLS\Handler\cdl",,,"CDL: Asynchronous Pluggable Protocol Handler"
+HKCR,"PROTOCOLS\Handler\cdl","CLSID",,"%CLSID_CdlProtocol%"
+HKCR,"PROTOCOLS\Handler\file",,,"file:, local: Asynchronous Pluggable Protocol Handler"
+HKCR,"PROTOCOLS\Handler\file","CLSID",,"%CLSID_FileProtocol%"
+HKCR,"PROTOCOLS\Handler\local",,,"file:, local: Asynchronous Pluggable Protocol Handler"
+HKCR,"PROTOCOLS\Handler\local","CLSID",,"%CLSID_FileProtocol%"
+HKCR,"PROTOCOLS\Handler\ftp",,,"ftp: Asynchronous Pluggable Protocol Handler"
+HKCR,"PROTOCOLS\Handler\ftp","CLSID",,"%CLSID_FtpProtocol%"
+HKCR,"PROTOCOLS\Handler\gopher",,,"gopher: Asynchronous Pluggable Protocol Handler"
+HKCR,"PROTOCOLS\Handler\gopher","CLSID",,"%CLSID_GopherProtocol%"
+HKCR,"PROTOCOLS\Handler\http",,,"http: Asynchronous Pluggable Protocol Handler"
+HKCR,"PROTOCOLS\Handler\http","CLSID",,"%CLSID_HttpProtocol%"
+HKCR,"PROTOCOLS\Handler\https",,,"https: Asynchronous Pluggable Protocol Handler"
+HKCR,"PROTOCOLS\Handler\https","CLSID",,"%CLSID_HttpsProtocol%"
+HKCR,"PROTOCOLS\Handler\mk",,,"mk: Asynchronous Pluggable Protocol Handler"
+HKCR,"PROTOCOLS\Handler\mk","CLSID",,"%CLSID_MkProtocol%"
More information about the wine-patches
mailing list