shelluihelper.c 12.5 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
/*
 * Copyright 2012 Jacek Caban for CodeWeavers
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
 */

#include "ieframe.h"

#include "wine/debug.h"

WINE_DEFAULT_DEBUG_CHANNEL(ieframe);

struct ShellUIHelper {
    IShellUIHelper2 IShellUIHelper2_iface;
    LONG ref;
};

static inline ShellUIHelper *impl_from_IShellUIHelper2(IShellUIHelper2 *iface)
{
    return CONTAINING_RECORD(iface, ShellUIHelper, IShellUIHelper2_iface);
}

static HRESULT WINAPI ShellUIHelper2_QueryInterface(IShellUIHelper2 *iface, REFIID riid, void **ppv)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);

    if(IsEqualGUID(&IID_IUnknown, riid)) {
        TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
        *ppv = &This->IShellUIHelper2_iface;
    }else if(IsEqualGUID(&IID_IDispatch, riid)) {
        TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
        *ppv = &This->IShellUIHelper2_iface;
    }else if(IsEqualGUID(&IID_IShellUIHelper, riid)) {
        TRACE("(%p)->(IID_IShellUIHelper %p)\n", This, ppv);
        *ppv = &This->IShellUIHelper2_iface;
48
    }else if(IsEqualGUID(&IID_IShellUIHelper2, riid)) {
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378
        TRACE("(%p)->(IID_IShellUIHelper2 %p)\n", This, ppv);
        *ppv = &This->IShellUIHelper2_iface;
    }else {
        WARN("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppv);
        *ppv = NULL;
        return E_NOINTERFACE;
    }

    IUnknown_AddRef((IUnknown*)*ppv);
    return S_OK;
}

static ULONG WINAPI ShellUIHelper2_AddRef(IShellUIHelper2 *iface)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    LONG ref = InterlockedIncrement(&This->ref);

    TRACE("(%p) ref=%d\n", This, ref);

    return ref;
}

static ULONG WINAPI ShellUIHelper2_Release(IShellUIHelper2 *iface)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    LONG ref = InterlockedDecrement(&This->ref);

    TRACE("(%p) ref=%d\n", This, ref);

    if(!ref)
        heap_free(This);

    return ref;
}

static HRESULT WINAPI ShellUIHelper2_GetTypeInfoCount(IShellUIHelper2 *iface, UINT *pctinfo)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);

    TRACE("(%p)->(%p)\n", This, pctinfo);

    *pctinfo = 1;
    return S_OK;
}

static HRESULT WINAPI ShellUIHelper2_GetTypeInfo(IShellUIHelper2 *iface, UINT iTInfo, LCID lcid, LPTYPEINFO *ppTInfo)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%d %d %p)\n", This, iTInfo, lcid, ppTInfo);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_GetIDsOfNames(IShellUIHelper2 *iface, REFIID riid, LPOLESTR *rgszNames, UINT cNames,
        LCID lcid, DISPID *rgDispId)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s %p %d %d %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
          lcid, rgDispId);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_Invoke(IShellUIHelper2 *iface, DISPID dispIdMember,
        REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult,
        EXCEPINFO *pExepInfo, UINT *puArgErr)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%d %s %d %08x %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
          lcid, wFlags, pDispParams, pVarResult, pExepInfo, puArgErr);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_ResetFirstBootMode(IShellUIHelper2 *iface)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->()\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_ResetSafeMode(IShellUIHelper2 *iface)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->()\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_RefreshOfflineDesktop(IShellUIHelper2 *iface)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->()\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_AddFavourite(IShellUIHelper2 *iface, BSTR URL, VARIANT *Title)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s %s)\n", This, debugstr_w(URL), debugstr_variant(Title));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_AddChannel(IShellUIHelper2 *iface, BSTR URL)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s)\n", This, debugstr_w(URL));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_AddDesktopComponent(IShellUIHelper2 *iface, BSTR URL, BSTR Type,
        VARIANT *Left, VARIANT *Top, VARIANT *Width, VARIANT *Height)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s %s %s %s %s %s)\n", This, debugstr_w(URL), debugstr_w(Type), debugstr_variant(Left),
          debugstr_variant(Top), debugstr_variant(Width), debugstr_variant(Height));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_IsSubscribed(IShellUIHelper2 *iface, BSTR URL, VARIANT_BOOL *pBool)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s %p)\n", This, debugstr_w(URL), pBool);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_NavigateAndFind(IShellUIHelper2 *iface, BSTR URL, BSTR strQuery, VARIANT *varTargetFrame)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(URL), debugstr_w(strQuery), debugstr_variant(varTargetFrame));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_ImportExportFavourites(IShellUIHelper2 *iface, VARIANT_BOOL fImport, BSTR strImpExpPath)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%x %s)\n", This, fImport, debugstr_w(strImpExpPath));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_AutoCompleteSaveForm(IShellUIHelper2 *iface, VARIANT *Form)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s)\n", This, debugstr_variant(Form));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_AutoScan(IShellUIHelper2 *iface, BSTR strSearch, BSTR strFailureUrl, VARIANT *pvarTargetFrame)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s %s %s)\n", This, debugstr_w(strSearch), debugstr_w(strFailureUrl), debugstr_variant(pvarTargetFrame));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_AutoCompleteAttach(IShellUIHelper2 *iface, VARIANT *Reserved)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s)\n", This, debugstr_variant(Reserved));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_ShowBrowserUI(IShellUIHelper2 *iface, BSTR bstrName, VARIANT *pvarIn, VARIANT *pvarOut)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s %s %p)\n", This, debugstr_w(bstrName), debugstr_variant(pvarIn), pvarOut);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_AddSearchProvider(IShellUIHelper2 *iface, BSTR URL)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s)\n", This, debugstr_w(URL));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_RunOnceShown(IShellUIHelper2 *iface)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->()\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_SkipRunOnce(IShellUIHelper2 *iface)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->()\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_CustomizeSettings(IShellUIHelper2 *iface, VARIANT_BOOL fSQM,
        VARIANT_BOOL fPhishing, BSTR bstrLocale)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%x %x %s)\n", This, fSQM, fPhishing, debugstr_w(bstrLocale));
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_SqmEnabled(IShellUIHelper2 *iface, VARIANT_BOOL *pfEnabled)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%p)\n", This, pfEnabled);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_PhishingEnabled(IShellUIHelper2 *iface, VARIANT_BOOL *pfEnabled)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%p)\n", This, pfEnabled);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_BrandImageUri(IShellUIHelper2 *iface, BSTR *pbstrUri)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%p)\n", This, pbstrUri);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_SkipTabsWelcome(IShellUIHelper2 *iface)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->()\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_DiagnoseConnection(IShellUIHelper2 *iface)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->()\n", This);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_CustomizeClearType(IShellUIHelper2 *iface, VARIANT_BOOL fSet)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%x)\n", This, fSet);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_IsSearchProviderInstalled(IShellUIHelper2 *iface, BSTR URL, DWORD *pdwResult)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%s %p)\n", This, debugstr_w(URL), pdwResult);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_IsSearchMigrated(IShellUIHelper2 *iface, VARIANT_BOOL *pfMigrated)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%p)\n", This, pfMigrated);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_DefaultSearchProvider(IShellUIHelper2 *iface, BSTR *pbstrName)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%p)\n", This, pbstrName);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_RunOnceRequiredSettingsComplete(IShellUIHelper2 *iface, VARIANT_BOOL fComplete)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%x)\n", This, fComplete);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_RunOnceHasShown(IShellUIHelper2 *iface, VARIANT_BOOL *pfShown)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%p)\n", This, pfShown);
    return E_NOTIMPL;
}

static HRESULT WINAPI ShellUIHelper2_SearchGuideUrl(IShellUIHelper2 *iface, BSTR *pbstrUrl)
{
    ShellUIHelper *This = impl_from_IShellUIHelper2(iface);
    FIXME("(%p)->(%p)\n", This, pbstrUrl);
    return E_NOTIMPL;
}

static const IShellUIHelper2Vtbl ShellUIHelper2Vtbl = {
    ShellUIHelper2_QueryInterface,
    ShellUIHelper2_AddRef,
    ShellUIHelper2_Release,
    ShellUIHelper2_GetTypeInfoCount,
    ShellUIHelper2_GetTypeInfo,
    ShellUIHelper2_GetIDsOfNames,
    ShellUIHelper2_Invoke,
    ShellUIHelper2_ResetFirstBootMode,
    ShellUIHelper2_ResetSafeMode,
    ShellUIHelper2_RefreshOfflineDesktop,
    ShellUIHelper2_AddFavourite,
    ShellUIHelper2_AddChannel,
    ShellUIHelper2_AddDesktopComponent,
    ShellUIHelper2_IsSubscribed,
    ShellUIHelper2_NavigateAndFind,
    ShellUIHelper2_ImportExportFavourites,
    ShellUIHelper2_AutoCompleteSaveForm,
    ShellUIHelper2_AutoScan,
    ShellUIHelper2_AutoCompleteAttach,
    ShellUIHelper2_ShowBrowserUI,
    ShellUIHelper2_AddSearchProvider,
    ShellUIHelper2_RunOnceShown,
    ShellUIHelper2_SkipRunOnce,
    ShellUIHelper2_CustomizeSettings,
    ShellUIHelper2_SqmEnabled,
    ShellUIHelper2_PhishingEnabled,
    ShellUIHelper2_BrandImageUri,
    ShellUIHelper2_SkipTabsWelcome,
    ShellUIHelper2_DiagnoseConnection,
    ShellUIHelper2_CustomizeClearType,
    ShellUIHelper2_IsSearchProviderInstalled,
    ShellUIHelper2_IsSearchMigrated,
    ShellUIHelper2_DefaultSearchProvider,
    ShellUIHelper2_RunOnceRequiredSettingsComplete,
    ShellUIHelper2_RunOnceHasShown,
    ShellUIHelper2_SearchGuideUrl
};

HRESULT create_shell_ui_helper(IShellUIHelper2 **_ret)
{
    ShellUIHelper *ret;

    ret = heap_alloc(sizeof(*ret));
    if(!ret)
        return E_OUTOFMEMORY;

    ret->IShellUIHelper2_iface.lpVtbl = &ShellUIHelper2Vtbl;
    ret->ref = 1;

    *_ret = &ret->IShellUIHelper2_iface;
    return S_OK;
}