ReactOS 0.4.15-dev-7942-gd23573b
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#define COBJMACROS
20#include "config.h"
21#include "ws2tcpip.h"
22#include <stdarg.h>
23
24#include "windef.h"
25#include "winbase.h"
26#include "objbase.h"
27#include "rpcproxy.h"
28#include "httprequest.h"
29#include "winhttp.h"
30
31#include "wine/debug.h"
32#include "winhttp_private.h"
33
35
37
38/******************************************************************
39 * DllMain (winhttp.@)
40 */
41BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
42{
43 switch(fdwReason)
44 {
46 winhttp_instance = hInstDLL;
48 break;
50 if (lpv) break;
53 break;
54 }
55 return TRUE;
56}
57
58typedef HRESULT (*fnCreateInstance)( void **obj );
59
61{
64};
65
66static inline struct winhttp_cf *impl_from_IClassFactory( IClassFactory *iface )
67{
68 return CONTAINING_RECORD( iface, struct winhttp_cf, IClassFactory_iface );
69}
70
72 IClassFactory *iface,
74 void **obj )
75{
76 if (IsEqualGUID( riid, &IID_IUnknown ) ||
78 {
79 IClassFactory_AddRef( iface );
80 *obj = iface;
81 return S_OK;
82 }
83 FIXME("interface %s not implemented\n", debugstr_guid(riid));
84 return E_NOINTERFACE;
85}
86
88 IClassFactory *iface )
89{
90 return 2;
91}
92
94 IClassFactory *iface )
95{
96 return 1;
97}
98
100 IClassFactory *iface,
101 LPUNKNOWN outer,
102 REFIID riid,
103 void **obj )
104{
105 struct winhttp_cf *cf = impl_from_IClassFactory( iface );
107 HRESULT hr;
108
109 TRACE("%p, %s, %p\n", outer, debugstr_guid(riid), obj);
110
111 *obj = NULL;
112 if (outer)
114
115 hr = cf->pfnCreateInstance( (void **)&unknown );
116 if (FAILED(hr))
117 return hr;
118
119 hr = IUnknown_QueryInterface( unknown, riid, obj );
120 IUnknown_Release( unknown );
121 return hr;
122}
123
125 IClassFactory *iface,
126 BOOL dolock )
127{
128 FIXME("%p, %d\n", iface, dolock);
129 return S_OK;
130}
131
132static const struct IClassFactoryVtbl winhttp_cf_vtbl =
133{
139};
140
142
143/******************************************************************
144 * DllGetClassObject (winhttp.@)
145 */
147{
149
150 TRACE("%s, %s, %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
151
152 if (IsEqualGUID( rclsid, &CLSID_WinHttpRequest ))
153 {
154 cf = &request_cf.IClassFactory_iface;
155 }
156 if (!cf) return CLASS_E_CLASSNOTAVAILABLE;
157 return IClassFactory_QueryInterface( cf, riid, ppv );
158}
159
160/******************************************************************
161 * DllCanUnloadNow (winhttp.@)
162 */
164{
165 return S_FALSE;
166}
167
168/***********************************************************************
169 * DllRegisterServer (winhttp.@)
170 */
172{
174}
175
176/***********************************************************************
177 * DllUnregisterServer (winhttp.@)
178 */
180{
182}
void release_typelib(void)
Definition: apps.c:159
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
Definition: precomp.h:23
const GUID IID_IUnknown
const GUID IID_IClassFactory
#define FIXME(fmt,...)
Definition: debug.h:111
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: main.c:26
HRESULT WINAPI DllRegisterServer(void)
Definition: main.c:212
HRESULT WINAPI DllUnregisterServer(void)
Definition: main.c:220
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: main.c:166
HRESULT WINAPI DllCanUnloadNow(void)
Definition: main.c:204
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:87
static HRESULT WINAPI requestcf_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:124
static ULONG WINAPI requestcf_Release(IClassFactory *iface)
Definition: main.c:93
static const struct IClassFactoryVtbl winhttp_cf_vtbl
Definition: main.c:132
static HRESULT WINAPI requestcf_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
Definition: main.c:71
HRESULT(* fnCreateInstance)(void **obj)
Definition: main.c:58
static HRESULT WINAPI requestcf_CreateInstance(IClassFactory *iface, LPUNKNOWN outer, REFIID riid, void **obj)
Definition: main.c:99
HINSTANCE winhttp_instance
Definition: main.c:34
static struct winhttp_cf request_cf
Definition: main.c:141
void netconn_unload(void)
Definition: net.c:156
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 LPUNKNOWN
Definition: ndr_ole.c:49
#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:4782
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
HRESULT hr
Definition: shlfolder.c:183
#define TRACE(s)
Definition: solgame.cpp:4
IClassFactory IClassFactory_iface
Definition: main.c:62
fnCreateInstance pfnCreateInstance
Definition: main.c:63
#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 S_FALSE
Definition: winerror.h:2357
#define E_NOINTERFACE
Definition: winerror.h:2364
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663