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
27 #include "httprequest.h"
30 #include "wine/debug.h"
31 #include "winhttp_private.h"
33 HINSTANCE winhttp_instance
;
35 WINE_DEFAULT_DEBUG_CHANNEL(winhttp
);
37 /******************************************************************
40 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
44 case DLL_PROCESS_ATTACH
:
45 winhttp_instance
= hInstDLL
;
46 DisableThreadLibraryCalls(hInstDLL
);
48 case DLL_PROCESS_DETACH
:
57 typedef HRESULT (*fnCreateInstance
)( void **obj
);
61 IClassFactory IClassFactory_iface
;
62 fnCreateInstance pfnCreateInstance
;
65 static inline struct winhttp_cf
*impl_from_IClassFactory( IClassFactory
*iface
)
67 return CONTAINING_RECORD( iface
, struct winhttp_cf
, IClassFactory_iface
);
70 static HRESULT WINAPI
requestcf_QueryInterface(
75 if (IsEqualGUID( riid
, &IID_IUnknown
) ||
76 IsEqualGUID( riid
, &IID_IClassFactory
))
78 IClassFactory_AddRef( iface
);
82 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
86 static ULONG WINAPI
requestcf_AddRef(
87 IClassFactory
*iface
)
92 static ULONG WINAPI
requestcf_Release(
93 IClassFactory
*iface
)
98 static HRESULT WINAPI
requestcf_CreateInstance(
104 struct winhttp_cf
*cf
= impl_from_IClassFactory( iface
);
108 TRACE("%p, %s, %p\n", outer
, debugstr_guid(riid
), obj
);
112 return CLASS_E_NOAGGREGATION
;
114 hr
= cf
->pfnCreateInstance( (void **)&unknown
);
118 hr
= IUnknown_QueryInterface( unknown
, riid
, obj
);
119 IUnknown_Release( unknown
);
123 static HRESULT WINAPI
requestcf_LockServer(
124 IClassFactory
*iface
,
127 FIXME("%p, %d\n", iface
, dolock
);
131 static const struct IClassFactoryVtbl winhttp_cf_vtbl
=
133 requestcf_QueryInterface
,
136 requestcf_CreateInstance
,
140 static struct winhttp_cf request_cf
= { { &winhttp_cf_vtbl
}, WinHttpRequest_create
};
142 /******************************************************************
143 * DllGetClassObject (winhttp.@)
145 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
147 IClassFactory
*cf
= NULL
;
149 TRACE("%s, %s, %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
151 if (IsEqualGUID( rclsid
, &CLSID_WinHttpRequest
))
153 cf
= &request_cf
.IClassFactory_iface
;
155 if (!cf
) return CLASS_E_CLASSNOTAVAILABLE
;
156 return IClassFactory_QueryInterface( cf
, riid
, ppv
);