ReactOS 0.4.16-dev-2528-g7139e57
main.c
Go to the documentation of this file.
1/*
2 * Copyright 2007 Jacek Caban for CodeWeavers
3 *
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.
8 *
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.
13 *
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
17 */
18
19#include <stdarg.h>
20
21#define COBJMACROS
22#include "windef.h"
23#include "winbase.h"
24#include "ws2tcpip.h"
25#include "objbase.h"
26#include "rpcproxy.h"
27#include "httprequest.h"
28#include "winhttp.h"
29
30#include "wine/debug.h"
31#include "winhttp_private.h"
32
34
36
37/******************************************************************
38 * DllMain (winhttp.@)
39 */
41{
42 switch(fdwReason)
43 {
45 winhttp_instance = hInstDLL;
47 break;
49 if (lpv) break;
52 break;
53 }
54 return TRUE;
55}
56
57typedef HRESULT (*fnCreateInstance)( void **obj );
58
60{
63};
64
65static inline struct winhttp_cf *impl_from_IClassFactory( IClassFactory *iface )
66{
67 return CONTAINING_RECORD( iface, struct winhttp_cf, IClassFactory_iface );
68}
69
71 IClassFactory *iface,
73 void **obj )
74{
75 if (IsEqualGUID( riid, &IID_IUnknown ) ||
77 {
78 IClassFactory_AddRef( iface );
79 *obj = iface;
80 return S_OK;
81 }
82 FIXME("interface %s not implemented\n", debugstr_guid(riid));
83 return E_NOINTERFACE;
84}
85
87 IClassFactory *iface )
88{
89 return 2;
90}
91
93 IClassFactory *iface )
94{
95 return 1;
96}
97
99 IClassFactory *iface,
101 REFIID riid,
102 void **obj )
103{
104 struct winhttp_cf *cf = impl_from_IClassFactory( iface );
106 HRESULT hr;
107
108 TRACE("%p, %s, %p\n", outer, debugstr_guid(riid), obj);
109
110 *obj = NULL;
111 if (outer)
113
114 hr = cf->pfnCreateInstance( (void **)&unknown );
115 if (FAILED(hr))
116 return hr;
117
118 hr = IUnknown_QueryInterface( unknown, riid, obj );
119 IUnknown_Release( unknown );
120 return hr;
121}
122
124 IClassFactory *iface,
125 BOOL dolock )
126{
127 FIXME("%p, %d\n", iface, dolock);
128 return S_OK;
129}
130
131static const struct IClassFactoryVtbl winhttp_cf_vtbl =
132{
138};
139
141
142/******************************************************************
143 * DllGetClassObject (winhttp.@)
144 */
146{
148
149 TRACE("%s, %s, %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
150
151 if (IsEqualGUID( rclsid, &CLSID_WinHttpRequest ))
152 {
153 cf = &request_cf.IClassFactory_iface;
154 }
155 if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
156 return IClassFactory_QueryInterface( cf, riid, ppv );
157}
static DWORD const fdwReason
void release_typelib(void)
Definition: apps.c:159
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
BOOL NTAPI DllMain(_In_ HINSTANCE hDll, _In_ ULONG dwReason, _In_opt_ PVOID pReserved)
Definition: main.c:33
#define FIXME(fmt,...)
Definition: precomp.h:53
const GUID IID_IUnknown
const GUID IID_IClassFactory
HRESULT hr
Definition: delayimp.cpp:573
static LPVOID LPUNKNOWN
Definition: dinput.c:53
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: main.c:166
static IClassFactoryImpl * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:63
static WCHAR unknown[MAX_STRING_RESOURCE_LEN]
Definition: object.c:1605
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
#define DLL_PROCESS_DETACH
Definition: compat.h:130
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
static ULONG WINAPI requestcf_AddRef(IClassFactory *iface)
Definition: main.c:86
static HRESULT WINAPI requestcf_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:123
static ULONG WINAPI requestcf_Release(IClassFactory *iface)
Definition: main.c:92
static const struct IClassFactoryVtbl winhttp_cf_vtbl
Definition: main.c:131
static HRESULT WINAPI requestcf_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
Definition: main.c:70
HRESULT(* fnCreateInstance)(void **obj)
Definition: main.c:57
static HRESULT WINAPI requestcf_CreateInstance(IClassFactory *iface, LPUNKNOWN outer, REFIID riid, void **obj)
Definition: main.c:98
HINSTANCE winhttp_instance
Definition: main.c:33
static struct winhttp_cf request_cf
Definition: main.c:140
void netconn_unload(void)
Definition: net.c:182
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT(* fnCreateInstance)(IUnknown *pUnkOuter, LPVOID *ppObj)
Definition: hnetcfg.c:37
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_guid
Definition: kernel32.h:35
static IUnknown * outer
Definition: compobj.c:82
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147
#define REFIID
Definition: guiddef.h:118
#define REFCLSID
Definition: guiddef.h:117
HRESULT WinHttpRequest_create(void **obj)
Definition: request.c:6155
#define TRACE(s)
Definition: solgame.cpp:4
IClassFactory IClassFactory_iface
Definition: main.c:61
fnCreateInstance pfnCreateInstance
Definition: main.c:62
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
#define HRESULT
Definition: msvc.h:7
#define WINAPI
Definition: msvc.h:6
#define E_NOINTERFACE
Definition: winerror.h:3479
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:3771
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:3772