Register protocols.

This commit is contained in:
Jacek Caban 2005-07-05 14:06:43 +00:00 committed by Alexandre Julliard
parent db6a238f28
commit 1a182a7629
6 changed files with 165 additions and 2 deletions

View File

@ -1,3 +1,4 @@
Makefile
liburlmon.def
rsrc.res
urlmon.dll.dbg.c

View File

@ -14,6 +14,8 @@ C_SRCS = \
umstream.c \
urlmon_main.c
RC_SRCS = rsrc.rc
SUBDIRS = tests
@MAKE_DLL_RULES@

View File

@ -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 coclass_list[] = {
"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 */
};
@ -522,6 +569,58 @@ static struct regsvr_interface const interface_list[] = {
{ NULL } /* list terminator */
};
/***********************************************************************
* 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.@)
*/
@ -534,7 +633,9 @@ HRESULT WINAPI URLMON_DllRegisterServer(void)
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_DllUnregisterServer(void)
hr = unregister_coclasses(coclass_list);
if (SUCCEEDED(hr))
hr = unregister_interfaces(interface_list);
return hr;
if(FAILED(hr))
return hr;
return register_inf(FALSE);
}

19
dlls/urlmon/rsrc.rc Normal file
View File

@ -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

29
dlls/urlmon/urlmon.inf Normal file
View File

@ -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%"

View File

@ -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 */