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 static HINSTANCE instance
;
35 WINE_DEFAULT_DEBUG_CHANNEL(winhttp
);
37 /******************************************************************
40 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
44 case DLL_PROCESS_ATTACH
:
46 DisableThreadLibraryCalls(hInstDLL
);
48 case DLL_PROCESS_DETACH
:
56 typedef HRESULT (*fnCreateInstance
)( void **obj
);
60 IClassFactory IClassFactory_iface
;
61 fnCreateInstance pfnCreateInstance
;
64 static inline struct winhttp_cf
*impl_from_IClassFactory( IClassFactory
*iface
)
66 return CONTAINING_RECORD( iface
, struct winhttp_cf
, IClassFactory_iface
);
69 static HRESULT WINAPI
requestcf_QueryInterface(
74 if (IsEqualGUID( riid
, &IID_IUnknown
) ||
75 IsEqualGUID( riid
, &IID_IClassFactory
))
77 IClassFactory_AddRef( iface
);
81 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
85 static ULONG WINAPI
requestcf_AddRef(
86 IClassFactory
*iface
)
91 static ULONG WINAPI
requestcf_Release(
92 IClassFactory
*iface
)
97 static HRESULT WINAPI
requestcf_CreateInstance(
103 struct winhttp_cf
*cf
= impl_from_IClassFactory( iface
);
107 TRACE("%p, %s, %p\n", outer
, debugstr_guid(riid
), obj
);
111 return CLASS_E_NOAGGREGATION
;
113 hr
= cf
->pfnCreateInstance( (void **)&unknown
);
117 hr
= IUnknown_QueryInterface( unknown
, riid
, obj
);
118 IUnknown_Release( unknown
);
122 static HRESULT WINAPI
requestcf_LockServer(
123 IClassFactory
*iface
,
126 FIXME("%p, %d\n", iface
, dolock
);
130 static const struct IClassFactoryVtbl winhttp_cf_vtbl
=
132 requestcf_QueryInterface
,
135 requestcf_CreateInstance
,
139 static struct winhttp_cf request_cf
= { { &winhttp_cf_vtbl
}, WinHttpRequest_create
};
141 /******************************************************************
142 * DllGetClassObject (winhttp.@)
144 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
146 IClassFactory
*cf
= NULL
;
148 TRACE("%s, %s, %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
150 if (IsEqualGUID( rclsid
, &CLSID_WinHttpRequest
))
152 cf
= &request_cf
.IClassFactory_iface
;
154 if (!cf
) return CLASS_E_CLASSNOTAVAILABLE
;
155 return IClassFactory_QueryInterface( cf
, riid
, ppv
);
158 /******************************************************************
159 * DllCanUnloadNow (winhttp.@)
161 HRESULT WINAPI
DllCanUnloadNow(void)
166 /***********************************************************************
167 * DllRegisterServer (winhttp.@)
169 HRESULT WINAPI
DllRegisterServer(void)
171 return __wine_register_resources( instance
);
174 /***********************************************************************
175 * DllUnregisterServer (winhttp.@)
177 HRESULT WINAPI
DllUnregisterServer(void)
179 return __wine_unregister_resources( instance
);