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 #define WIN32_NO_STATUS
21 #define COM_NO_WINDOWS_H
31 #include <httprequest.h>
34 #include <wine/debug.h>
35 #include "winhttp_private.h"
37 static HINSTANCE instance
;
39 WINE_DEFAULT_DEBUG_CHANNEL(winhttp
);
41 /******************************************************************
44 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID lpv
)
48 case DLL_PROCESS_ATTACH
:
50 DisableThreadLibraryCalls(hInstDLL
);
52 case DLL_PROCESS_DETACH
:
59 typedef HRESULT (*fnCreateInstance
)( IUnknown
*outer
, void **obj
);
63 IClassFactory IClassFactory_iface
;
64 fnCreateInstance pfnCreateInstance
;
67 static inline struct winhttp_cf
*impl_from_IClassFactory( IClassFactory
*iface
)
69 return CONTAINING_RECORD( iface
, struct winhttp_cf
, IClassFactory_iface
);
72 static HRESULT WINAPI
requestcf_QueryInterface(
77 if (IsEqualGUID( riid
, &IID_IUnknown
) ||
78 IsEqualGUID( riid
, &IID_IClassFactory
))
80 IClassFactory_AddRef( iface
);
84 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
88 static ULONG WINAPI
requestcf_AddRef(
89 IClassFactory
*iface
)
94 static ULONG WINAPI
requestcf_Release(
95 IClassFactory
*iface
)
100 static HRESULT WINAPI
requestcf_CreateInstance(
101 IClassFactory
*iface
,
106 struct winhttp_cf
*cf
= impl_from_IClassFactory( iface
);
110 TRACE("%p, %s, %p\n", outer
, debugstr_guid(riid
), obj
);
114 return CLASS_E_NOAGGREGATION
;
116 hr
= cf
->pfnCreateInstance( outer
, (void **)&unknown
);
120 hr
= IUnknown_QueryInterface( unknown
, riid
, obj
);
124 IUnknown_Release( unknown
);
128 static HRESULT WINAPI
requestcf_LockServer(
129 IClassFactory
*iface
,
132 FIXME("%p, %d\n", iface
, dolock
);
136 static const struct IClassFactoryVtbl winhttp_cf_vtbl
=
138 requestcf_QueryInterface
,
141 requestcf_CreateInstance
,
145 static struct winhttp_cf request_cf
= { { &winhttp_cf_vtbl
}, WinHttpRequest_create
};
147 /******************************************************************
148 * DllGetClassObject (winhttp.@)
150 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
152 IClassFactory
*cf
= NULL
;
154 TRACE("%s, %s, %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
156 if (IsEqualGUID( rclsid
, &CLSID_WinHttpRequest
))
158 cf
= &request_cf
.IClassFactory_iface
;
160 if (!cf
) return CLASS_E_CLASSNOTAVAILABLE
;
161 return IClassFactory_QueryInterface( cf
, riid
, ppv
);
164 /******************************************************************
165 * DllCanUnloadNow (winhttp.@)
167 HRESULT WINAPI
DllCanUnloadNow(void)
172 /***********************************************************************
173 * DllRegisterServer (winhttp.@)
175 HRESULT WINAPI
DllRegisterServer(void)
177 return __wine_register_resources( instance
);
180 /***********************************************************************
181 * DllUnregisterServer (winhttp.@)
183 HRESULT WINAPI
DllUnregisterServer(void)
185 return __wine_unregister_resources( instance
);