ReactOS  0.4.14-dev-606-g14ebc0b
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  */
41 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
42 {
43  switch(fdwReason)
44  {
45  case DLL_PROCESS_ATTACH:
46  winhttp_instance = hInstDLL;
47  DisableThreadLibraryCalls(hInstDLL);
48  break;
49  case DLL_PROCESS_DETACH:
50  if (lpv) break;
53  break;
54  }
55  return TRUE;
56 }
57 
58 typedef HRESULT (*fnCreateInstance)( void **obj );
59 
60 struct winhttp_cf
61 {
64 };
65 
66 static 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,
73  REFIID riid,
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 );
106  IUnknown *unknown;
107  HRESULT hr;
108 
109  TRACE("%p, %s, %p\n", outer, debugstr_guid(riid), obj);
110 
111  *obj = NULL;
112  if (outer)
113  return CLASS_E_NOAGGREGATION;
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 
132 static const struct IClassFactoryVtbl winhttp_cf_vtbl =
133 {
139 };
140 
142 
143 /******************************************************************
144  * DllGetClassObject (winhttp.@)
145  */
147 {
148  IClassFactory *cf = NULL;
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 }
static const struct IClassFactoryVtbl winhttp_cf_vtbl
Definition: main.c:132
#define HRESULT
Definition: msvc.h:7
#define REFIID
Definition: guiddef.h:118
#define TRUE
Definition: types.h:120
#define E_NOINTERFACE
Definition: winerror.h:2364
HRESULT hr
Definition: shlfolder.c:183
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
WINE_DEFAULT_DEBUG_CHANNEL(wmic)
REFIID riid
Definition: precomp.h:44
#define REFCLSID
Definition: guiddef.h:117
static ULONG WINAPI requestcf_AddRef(IClassFactory *iface)
Definition: main.c:87
REFIID LPVOID * ppv
Definition: atlbase.h:39
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:120
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
fnCreateInstance pfnCreateInstance
Definition: main.c:63
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
HRESULT WINAPI DllRegisterServer(void)
Definition: main.c:212
unsigned int BOOL
Definition: ntddk_ex.h:94
static LPUNKNOWN
Definition: ndr_ole.c:49
HRESULT WINAPI DllUnregisterServer(void)
Definition: main.c:220
#define FIXME(fmt,...)
Definition: debug.h:110
#define S_FALSE
Definition: winerror.h:2357
void netconn_unload(void)
Definition: net.c:156
smooth NULL
Definition: ftsmooth.c:416
HRESULT WinHttpRequest_create(void **obj)
Definition: request.c:4782
#define debugstr_guid
Definition: kernel32.h:35
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
#define DLL_PROCESS_DETACH
Definition: compat.h:119
#define TRACE(s)
Definition: solgame.cpp:4
static ULONG WINAPI requestcf_Release(IClassFactory *iface)
Definition: main.c:93
LONG HRESULT
Definition: typedefs.h:77
const GUID IID_IUnknown
#define WINAPI
Definition: msvc.h:6
static struct winhttp_cf * impl_from_IClassFactory(IClassFactory *iface)
Definition: main.c:66
unsigned long DWORD
Definition: ntddk_ex.h:95
static HRESULT WINAPI requestcf_QueryInterface(IClassFactory *iface, REFIID riid, void **obj)
Definition: main.c:71
Definition: id3.c:18
static HRESULT WINAPI requestcf_LockServer(IClassFactory *iface, BOOL dolock)
Definition: main.c:124
void release_typelib(void)
Definition: apps.c:159
HRESULT(* fnCreateInstance)(LPVOID *ppObj)
Definition: main.c:38
IClassFactory IClassFactory_iface
Definition: main.c:62
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110
#define CLASS_E_NOAGGREGATION
Definition: winerror.h:2662
static HRESULT WINAPI requestcf_CreateInstance(IClassFactory *iface, LPUNKNOWN outer, REFIID riid, void **obj)
Definition: main.c:99
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI DllCanUnloadNow(void)
Definition: main.c:204
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
unsigned int ULONG
Definition: retypes.h:1
const GUID IID_IClassFactory
HINSTANCE winhttp_instance
Definition: main.c:34
static struct winhttp_cf request_cf
Definition: main.c:141
HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
Definition: main.c:166
BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
Definition: main.c:26