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
:
46 typedef HRESULT (*fnCreateInstance
)( void **obj
);
50 IClassFactory IClassFactory_iface
;
51 fnCreateInstance pfnCreateInstance
;
54 static inline struct winhttp_cf
*impl_from_IClassFactory( IClassFactory
*iface
)
56 return CONTAINING_RECORD( iface
, struct winhttp_cf
, IClassFactory_iface
);
59 static HRESULT WINAPI
requestcf_QueryInterface(
64 if (IsEqualGUID( riid
, &IID_IUnknown
) ||
65 IsEqualGUID( riid
, &IID_IClassFactory
))
67 IClassFactory_AddRef( iface
);
71 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
75 static ULONG WINAPI
requestcf_AddRef(
76 IClassFactory
*iface
)
81 static ULONG WINAPI
requestcf_Release(
82 IClassFactory
*iface
)
87 static HRESULT WINAPI
requestcf_CreateInstance(
93 struct winhttp_cf
*cf
= impl_from_IClassFactory( iface
);
97 TRACE("%p, %s, %p\n", outer
, debugstr_guid(riid
), obj
);
101 return CLASS_E_NOAGGREGATION
;
103 hr
= cf
->pfnCreateInstance( (void **)&unknown
);
107 hr
= IUnknown_QueryInterface( unknown
, riid
, obj
);
108 IUnknown_Release( unknown
);
112 static HRESULT WINAPI
requestcf_LockServer(
113 IClassFactory
*iface
,
116 FIXME("%p, %d\n", iface
, dolock
);
120 static const struct IClassFactoryVtbl winhttp_cf_vtbl
=
122 requestcf_QueryInterface
,
125 requestcf_CreateInstance
,
129 static struct winhttp_cf request_cf
= { { &winhttp_cf_vtbl
}, WinHttpRequest_create
};
131 /******************************************************************
132 * DllGetClassObject (winhttp.@)
134 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID riid
, LPVOID
*ppv
)
136 IClassFactory
*cf
= NULL
;
138 TRACE("%s, %s, %p\n", debugstr_guid(rclsid
), debugstr_guid(riid
), ppv
);
140 if (IsEqualGUID( rclsid
, &CLSID_WinHttpRequest
))
142 cf
= &request_cf
.IClassFactory_iface
;
144 if (!cf
) return CLASS_E_CLASSNOTAVAILABLE
;
145 return IClassFactory_QueryInterface( cf
, riid
, ppv
);
148 /******************************************************************
149 * DllCanUnloadNow (winhttp.@)
151 HRESULT WINAPI
DllCanUnloadNow(void)
156 /***********************************************************************
157 * DllRegisterServer (winhttp.@)
159 HRESULT WINAPI
DllRegisterServer(void)
161 return __wine_register_resources( instance
);
164 /***********************************************************************
165 * DllUnregisterServer (winhttp.@)
167 HRESULT WINAPI
DllUnregisterServer(void)
169 return __wine_unregister_resources( instance
);