2 * Copyright 2007 Jacek Caban for CodeWeavers
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #define WIN32_NO_STATUS
21 #define COM_NO_WINDOWS_H
31 #include <httprequest.h>
34 #include <wine/debug.h>
35 #include "winhttp_private.h"
37 static HINSTANCE instance
;
39 WINE_DEFAULT_DEBUG_CHANNEL(winhttp
);
41 /******************************************************************
44 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
48 case DLL_PROCESS_ATTACH
:
50 DisableThreadLibraryCalls(hInstDLL
);
52 case DLL_PROCESS_DETACH
:
60 typedef HRESULT (*fnCreateInstance
)( IUnknown
*outer
, void **obj
);
64 IClassFactory IClassFactory_iface
;
65 fnCreateInstance pfnCreateInstance
;
68 static inline struct winhttp_cf
*impl_from_IClassFactory( IClassFactory
*iface
)
70 return CONTAINING_RECORD( iface
, struct winhttp_cf
, IClassFactory_iface
);
73 static HRESULT WINAPI
requestcf_QueryInterface(
78 if (IsEqualGUID( riid
, &IID_IUnknown
) ||
79 IsEqualGUID( riid
, &IID_IClassFactory
))
81 IClassFactory_AddRef( iface
);
85 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
89 static ULONG WINAPI
requestcf_AddRef(
90 IClassFactory
*iface
)
95 static ULONG WINAPI
requestcf_Release(
96 IClassFactory
*iface
)
101 static HRESULT WINAPI
requestcf_CreateInstance(
102 IClassFactory
*iface
,
107 struct winhttp_cf
*cf
= impl_from_IClassFactory( iface
);
111 TRACE("%p, %s, %p\n", outer
, debugstr_guid(riid
), obj
);
115 return CLASS_E_NOAGGREGATION
;
117 hr
= cf
->pfnCreateInstance( outer
, (void **)&unknown
);
121 hr
= IUnknown_QueryInterface( unknown
, riid
, obj
);
125 IUnknown_Release( unknown
);
129 static HRESULT WINAPI
requestcf_LockServer(
130 IClassFactory
*iface
,
133 FIXME("%p, %d\n", iface
, dolock
);
137 static const struct IClassFactoryVtbl winhttp_cf_vtbl
=
139 requestcf_QueryInterface
,
142 requestcf_CreateInstance
,
146 static struct winhttp_cf request_cf
= { { &winhttp_cf_vtbl
}, WinHttpRequest_create
};
148 /******************************************************************
149 * DllGetClassObject (winhttp.@)
151 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
153 IClassFactory
*cf
= NULL
;
155 TRACE("%s, %s, %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
157 if (IsEqualGUID( rclsid
, &CLSID_WinHttpRequest
))
159 cf
= &request_cf
.IClassFactory_iface
;
161 if (!cf
) return CLASS_E_CLASSNOTAVAILABLE
;
162 return IClassFactory_QueryInterface( cf
, riid
, ppv
);
165 /******************************************************************
166 * DllCanUnloadNow (winhttp.@)
168 HRESULT WINAPI
DllCanUnloadNow(void)
173 /***********************************************************************
174 * DllRegisterServer (winhttp.@)
176 HRESULT WINAPI
DllRegisterServer(void)
178 return __wine_register_resources( instance
);
181 /***********************************************************************
182 * DllUnregisterServer (winhttp.@)
184 HRESULT WINAPI
DllUnregisterServer(void)
186 return __wine_unregister_resources( instance
);