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
19 #include "winhttp_private.h"
22 #include <httprequest.h>
24 static HINSTANCE instance
;
26 /******************************************************************
29 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
33 case DLL_PROCESS_ATTACH
:
35 DisableThreadLibraryCalls(hInstDLL
);
37 case DLL_PROCESS_DETACH
:
45 typedef HRESULT (*fnCreateInstance
)( void **obj
);
49 IClassFactory IClassFactory_iface
;
50 fnCreateInstance pfnCreateInstance
;
53 static inline struct winhttp_cf
*impl_from_IClassFactory( IClassFactory
*iface
)
55 return CONTAINING_RECORD( iface
, struct winhttp_cf
, IClassFactory_iface
);
58 static HRESULT WINAPI
requestcf_QueryInterface(
63 if (IsEqualGUID( riid
, &IID_IUnknown
) ||
64 IsEqualGUID( riid
, &IID_IClassFactory
))
66 IClassFactory_AddRef( iface
);
70 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
74 static ULONG WINAPI
requestcf_AddRef(
75 IClassFactory
*iface
)
80 static ULONG WINAPI
requestcf_Release(
81 IClassFactory
*iface
)
86 static HRESULT WINAPI
requestcf_CreateInstance(
92 struct winhttp_cf
*cf
= impl_from_IClassFactory( iface
);
96 TRACE("%p, %s, %p\n", outer
, debugstr_guid(riid
), obj
);
100 return CLASS_E_NOAGGREGATION
;
102 hr
= cf
->pfnCreateInstance( (void **)&unknown
);
106 hr
= IUnknown_QueryInterface( unknown
, riid
, obj
);
107 IUnknown_Release( unknown
);
111 static HRESULT WINAPI
requestcf_LockServer(
112 IClassFactory
*iface
,
115 FIXME("%p, %d\n", iface
, dolock
);
119 static const struct IClassFactoryVtbl winhttp_cf_vtbl
=
121 requestcf_QueryInterface
,
124 requestcf_CreateInstance
,
128 static struct winhttp_cf request_cf
= { { &winhttp_cf_vtbl
}, WinHttpRequest_create
};
130 /******************************************************************
131 * DllGetClassObject (winhttp.@)
133 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
135 IClassFactory
*cf
= NULL
;
137 TRACE("%s, %s, %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
139 if (IsEqualGUID( rclsid
, &CLSID_WinHttpRequest
))
141 cf
= &request_cf
.IClassFactory_iface
;
143 if (!cf
) return CLASS_E_CLASSNOTAVAILABLE
;
144 return IClassFactory_QueryInterface( cf
, riid
, ppv
);
147 /******************************************************************
148 * DllCanUnloadNow (winhttp.@)
150 HRESULT WINAPI
DllCanUnloadNow(void)
155 /***********************************************************************
156 * DllRegisterServer (winhttp.@)
158 HRESULT WINAPI
DllRegisterServer(void)
160 return __wine_register_resources( instance
);
163 /***********************************************************************
164 * DllUnregisterServer (winhttp.@)
166 HRESULT WINAPI
DllUnregisterServer(void)
168 return __wine_unregister_resources( instance
);