4 * Copyright 2008 Hans Leidekker
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include "wuapi_private.h"
25 typedef HRESULT (*fnCreateInstance
)( LPVOID
*ppObj
);
29 IClassFactory IClassFactory_iface
;
30 fnCreateInstance pfnCreateInstance
;
33 static inline wucf
*impl_from_IClassFactory( IClassFactory
*iface
)
35 return CONTAINING_RECORD(iface
, wucf
, IClassFactory_iface
);
38 static HRESULT WINAPI
wucf_QueryInterface( IClassFactory
*iface
, REFIID riid
, LPVOID
*ppobj
)
40 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
41 IsEqualGUID(riid
, &IID_IClassFactory
))
43 IClassFactory_AddRef( iface
);
47 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
51 static ULONG WINAPI
wucf_AddRef( IClassFactory
*iface
)
56 static ULONG WINAPI
wucf_Release( IClassFactory
*iface
)
61 static HRESULT WINAPI
wucf_CreateInstance( IClassFactory
*iface
, LPUNKNOWN pOuter
,
62 REFIID riid
, LPVOID
*ppobj
)
64 wucf
*This
= impl_from_IClassFactory( iface
);
68 TRACE("%p %s %p\n", pOuter
, debugstr_guid(riid
), ppobj
);
73 return CLASS_E_NOAGGREGATION
;
75 r
= This
->pfnCreateInstance( (LPVOID
*)&punk
);
79 r
= IUnknown_QueryInterface( punk
, riid
, ppobj
);
80 IUnknown_Release( punk
);
84 static HRESULT WINAPI
wucf_LockServer( IClassFactory
*iface
, BOOL dolock
)
86 FIXME("(%p)->(%d)\n", iface
, dolock
);
90 static const struct IClassFactoryVtbl wucf_vtbl
=
99 static wucf sessioncf
= { { &wucf_vtbl
}, UpdateSession_create
};
100 static wucf updatescf
= { { &wucf_vtbl
}, AutomaticUpdates_create
};
101 static wucf sysinfocf
= { { &wucf_vtbl
}, SystemInformation_create
};
103 static HINSTANCE instance
;
105 BOOL WINAPI
DllMain( HINSTANCE hinst
, DWORD reason
, LPVOID lpv
)
109 case DLL_WINE_PREATTACH
:
110 return FALSE
; /* prefer native version */
111 case DLL_PROCESS_ATTACH
:
113 DisableThreadLibraryCalls( hinst
);
119 HRESULT WINAPI
DllGetClassObject( REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
121 IClassFactory
*cf
= NULL
;
123 TRACE("%s %s %p\n", debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
125 if (IsEqualGUID( rclsid
, &CLSID_UpdateSession
))
127 cf
= &sessioncf
.IClassFactory_iface
;
129 else if (IsEqualGUID( rclsid
, &CLSID_AutomaticUpdates
))
131 cf
= &updatescf
.IClassFactory_iface
;
133 else if (IsEqualGUID( rclsid
, &CLSID_SystemInformation
))
135 cf
= &sysinfocf
.IClassFactory_iface
;
137 if (!cf
) return CLASS_E_CLASSNOTAVAILABLE
;
138 return IClassFactory_QueryInterface( cf
, iid
, ppv
);
141 HRESULT WINAPI
DllCanUnloadNow( void )
146 /***********************************************************************
147 * DllRegisterServer (WUAPI.@)
149 HRESULT WINAPI
DllRegisterServer(void)
151 return __wine_register_resources( instance
);
154 /***********************************************************************
155 * DllUnregisterServer (WUAPI.@)
157 HRESULT WINAPI
DllUnregisterServer(void)
159 return __wine_unregister_resources( instance
);