mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-03 00:08:32 +00:00
urlmon: Added AsyncInstallDistributionUnit implementation.
This commit is contained in:
parent
8012d4ae71
commit
59055c4d45
|
@ -3,8 +3,10 @@ IMPORTLIB = urlmon
|
|||
IMPORTS = uuid ole32 oleaut32 shell32 rpcrt4 shlwapi wininet user32 advapi32
|
||||
EXTRADEFS = -D_URLMON_ -DENTRY_PREFIX=URLMON_ -DPROXY_DELEGATION -DWINE_REGISTER_DLL \
|
||||
-DPROXY_CLSID_IS="{0x79EAC9F1,0xBAF9,0x11CE,{0x8C,0x82,0x00,0xAA,0x00,0x4B,0xA9,0x0B}}"
|
||||
DELAYIMPORTS = advpack
|
||||
|
||||
C_SRCS = \
|
||||
axinstall.c \
|
||||
bindctx.c \
|
||||
binding.c \
|
||||
bindprot.c \
|
||||
|
|
399
dlls/urlmon/axinstall.c
Normal file
399
dlls/urlmon/axinstall.c
Normal file
|
@ -0,0 +1,399 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define OEMRESOURCE
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
#include "urlmon_main.h"
|
||||
#include "resource.h"
|
||||
|
||||
#include "advpub.h"
|
||||
#include "fdi.h"
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
|
||||
|
||||
static const WCHAR ctxW[] = {'c','t','x',0};
|
||||
static const WCHAR cab_extW[] = {'.','c','a','b',0};
|
||||
static const WCHAR infW[] = {'i','n','f',0};
|
||||
static const WCHAR dllW[] = {'d','l','l',0};
|
||||
static const WCHAR ocxW[] = {'o','c','x',0};
|
||||
|
||||
enum install_type {
|
||||
INSTALL_UNKNOWN,
|
||||
INSTALL_DLL,
|
||||
INSTALL_INF
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
IUri *uri;
|
||||
IBindStatusCallback *callback;
|
||||
BOOL release_on_stop;
|
||||
BOOL cancel;
|
||||
WCHAR *install_file;
|
||||
const WCHAR *cache_file;
|
||||
const WCHAR *tmp_dir;
|
||||
const WCHAR *file_name;
|
||||
enum install_type install_type;
|
||||
HWND hwnd;
|
||||
int counter;
|
||||
INT_PTR timer;
|
||||
} install_ctx_t;
|
||||
|
||||
static void release_install_ctx(install_ctx_t *ctx)
|
||||
{
|
||||
if(ctx->uri)
|
||||
IUri_Release(ctx->uri);
|
||||
if(ctx->callback)
|
||||
IBindStatusCallback_Release(ctx->callback);
|
||||
heap_free(ctx->install_file);
|
||||
heap_free(ctx);
|
||||
}
|
||||
|
||||
static inline BOOL file_exists(const WCHAR *file_name)
|
||||
{
|
||||
return GetFileAttributesW(file_name) != INVALID_FILE_ATTRIBUTES;
|
||||
}
|
||||
|
||||
static HRESULT extract_cab_file(install_ctx_t *ctx)
|
||||
{
|
||||
size_t path_len, file_len;
|
||||
WCHAR *ptr;
|
||||
HRESULT hres;
|
||||
|
||||
hres = ExtractFilesW(ctx->cache_file, ctx->tmp_dir, 0, NULL, NULL, 0);
|
||||
if(FAILED(hres)) {
|
||||
WARN("ExtractFilesW failed: %08x\n", hres);
|
||||
return hres;
|
||||
}
|
||||
|
||||
path_len = strlenW(ctx->tmp_dir);
|
||||
file_len = strlenW(ctx->file_name);
|
||||
ctx->install_file = heap_alloc((path_len+file_len+2)*sizeof(WCHAR));
|
||||
if(!ctx->install_file)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
memcpy(ctx->install_file, ctx->tmp_dir, path_len*sizeof(WCHAR));
|
||||
ctx->install_file[path_len] = '\\';
|
||||
memcpy(ctx->install_file+path_len+1, ctx->file_name, (file_len+1)*sizeof(WCHAR));
|
||||
|
||||
/* NOTE: Assume that file_name contains ".cab" extension */
|
||||
ptr = ctx->install_file+path_len+1+file_len-3;
|
||||
|
||||
memcpy(ptr, infW, sizeof(infW));
|
||||
if(file_exists(ctx->install_file)) {
|
||||
ctx->install_type = INSTALL_INF;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
memcpy(ptr, dllW, sizeof(dllW));
|
||||
if(file_exists(ctx->install_file)) {
|
||||
ctx->install_type = INSTALL_DLL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
memcpy(ptr, ocxW, sizeof(ocxW));
|
||||
if(file_exists(ctx->install_file)) {
|
||||
ctx->install_type = INSTALL_DLL;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
FIXME("No known install file\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
||||
static HRESULT setup_dll(install_ctx_t *ctx)
|
||||
{
|
||||
HMODULE module;
|
||||
HRESULT hres;
|
||||
|
||||
HRESULT (WINAPI *reg_func)(void);
|
||||
|
||||
module = LoadLibraryW(ctx->install_file);
|
||||
if(!module)
|
||||
return E_FAIL;
|
||||
|
||||
reg_func = (void*)GetProcAddress(module, "DllRegisterServer");
|
||||
if(reg_func) {
|
||||
hres = reg_func();
|
||||
}else {
|
||||
WARN("no DllRegisterServer function\n");
|
||||
hres = E_FAIL;
|
||||
}
|
||||
|
||||
FreeLibrary(module);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT install_cab_file(install_ctx_t *ctx)
|
||||
{
|
||||
WCHAR tmp_path[MAX_PATH], tmp_dir[MAX_PATH];
|
||||
BOOL res = FALSE, leave_temp = FALSE;
|
||||
DWORD i;
|
||||
HRESULT hres;
|
||||
|
||||
GetTempPathW(sizeof(tmp_path)/sizeof(WCHAR), tmp_path);
|
||||
|
||||
for(i=0; !res && i < 100; i++) {
|
||||
GetTempFileNameW(tmp_path, NULL, GetTickCount() + i*17037, tmp_dir);
|
||||
res = CreateDirectoryW(tmp_dir, NULL);
|
||||
}
|
||||
if(!res)
|
||||
return E_FAIL;
|
||||
|
||||
ctx->tmp_dir = tmp_dir;
|
||||
|
||||
TRACE("Using temporary directory %s\n", debugstr_w(tmp_dir));
|
||||
|
||||
hres = extract_cab_file(ctx);
|
||||
if(SUCCEEDED(hres)) {
|
||||
if(ctx->callback)
|
||||
IBindStatusCallback_OnProgress(ctx->callback, 0, 0, BINDSTATUS_INSTALLINGCOMPONENTS, ctx->install_file);
|
||||
|
||||
switch(ctx->install_type) {
|
||||
case INSTALL_INF:
|
||||
hres = RunSetupCommandW(ctx->hwnd, ctx->install_file, NULL, ctx->tmp_dir, NULL, NULL, RSC_FLAG_INF, NULL);
|
||||
if(FAILED(hres))
|
||||
WARN("RunSetupCommandW failed: %08x\n", hres);
|
||||
break;
|
||||
case INSTALL_DLL:
|
||||
FIXME("Installing DLL, registering in temporary location\n");
|
||||
hres = setup_dll(ctx);
|
||||
if(SUCCEEDED(hres))
|
||||
leave_temp = TRUE;
|
||||
break;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
}
|
||||
|
||||
if(!leave_temp)
|
||||
RemoveDirectoryW(ctx->tmp_dir);
|
||||
return hres;
|
||||
}
|
||||
|
||||
static void update_counter(install_ctx_t *ctx, HWND hwnd)
|
||||
{
|
||||
WCHAR text[100];
|
||||
|
||||
if(--ctx->counter <= 0) {
|
||||
HWND button_hwnd;
|
||||
|
||||
KillTimer(hwnd, ctx->timer);
|
||||
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALL, text, sizeof(text)/sizeof(WCHAR));
|
||||
|
||||
button_hwnd = GetDlgItem(hwnd, ID_AXINSTALL_INSTALL_BTN);
|
||||
EnableWindow(button_hwnd, TRUE);
|
||||
}else {
|
||||
WCHAR buf[100];
|
||||
LoadStringW(urlmon_instance, IDS_AXINSTALL_INSTALLN, buf, sizeof(buf)/sizeof(WCHAR));
|
||||
sprintfW(text, buf, ctx->counter);
|
||||
}
|
||||
|
||||
SetDlgItemTextW(hwnd, ID_AXINSTALL_INSTALL_BTN, text);
|
||||
}
|
||||
|
||||
static BOOL init_warning_dialog(HWND hwnd, install_ctx_t *ctx)
|
||||
{
|
||||
BSTR display_uri;
|
||||
HRESULT hres;
|
||||
|
||||
if(!SetPropW(hwnd, ctxW, ctx))
|
||||
return FALSE;
|
||||
|
||||
hres = IUri_GetDisplayUri(ctx->uri, &display_uri);
|
||||
if(FAILED(hres))
|
||||
return FALSE;
|
||||
|
||||
SetDlgItemTextW(hwnd, ID_AXINSTALL_LOCATION, display_uri);
|
||||
SysFreeString(display_uri);
|
||||
|
||||
SendDlgItemMessageW(hwnd, ID_AXINSTALL_ICON, STM_SETICON,
|
||||
(WPARAM)LoadIconW(0, (const WCHAR*)OIC_WARNING), 0);
|
||||
|
||||
ctx->counter = 4;
|
||||
update_counter(ctx, hwnd);
|
||||
ctx->timer = SetTimer(hwnd, 1, 1000, NULL);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static INT_PTR WINAPI warning_proc(HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam)
|
||||
{
|
||||
switch(msg) {
|
||||
case WM_INITDIALOG: {
|
||||
if(!init_warning_dialog(hwnd, (install_ctx_t*)lparam))
|
||||
EndDialog(hwnd, 0);
|
||||
return TRUE;
|
||||
}
|
||||
case WM_COMMAND:
|
||||
switch(wparam) {
|
||||
case ID_AXINSTALL_INSTALL_BTN: {
|
||||
install_ctx_t *ctx = GetPropW(hwnd, ctxW);
|
||||
if(ctx)
|
||||
ctx->cancel = FALSE;
|
||||
EndDialog(hwnd, 0);
|
||||
return FALSE;
|
||||
}
|
||||
case IDCANCEL:
|
||||
EndDialog(hwnd, 0);
|
||||
return FALSE;
|
||||
}
|
||||
case WM_TIMER:
|
||||
update_counter(GetPropW(hwnd, ctxW), hwnd);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL install_warning(install_ctx_t *ctx)
|
||||
{
|
||||
IWindowForBindingUI *window_iface;
|
||||
HWND parent_hwnd = NULL;
|
||||
HRESULT hres;
|
||||
|
||||
if(!ctx->callback) {
|
||||
FIXME("no callback\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hres = IBindStatusCallback_QueryInterface(ctx->callback, &IID_IWindowForBindingUI, (void**)&window_iface);
|
||||
if(FAILED(hres))
|
||||
return FALSE;
|
||||
|
||||
hres = IWindowForBindingUI_GetWindow(window_iface, &IID_ICodeInstall, &ctx->hwnd);
|
||||
IWindowForBindingUI_Release(window_iface);
|
||||
if(FAILED(hres))
|
||||
return FALSE;
|
||||
|
||||
ctx->cancel = TRUE;
|
||||
DialogBoxParamW(urlmon_instance, MAKEINTRESOURCEW(ID_AXINSTALL_WARNING_DLG), parent_hwnd, warning_proc, (LPARAM)ctx);
|
||||
return !ctx->cancel;
|
||||
}
|
||||
|
||||
static HRESULT install_file(install_ctx_t *ctx, const WCHAR *cache_file)
|
||||
{
|
||||
BSTR path;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("%s\n", debugstr_w(cache_file));
|
||||
|
||||
ctx->cache_file = cache_file;
|
||||
|
||||
if(!install_warning(ctx)) {
|
||||
TRACE("Installation cancelled\n");
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
hres = IUri_GetPath(ctx->uri, &path);
|
||||
if(SUCCEEDED(hres)) {
|
||||
const WCHAR *ptr, *ptr2, *ext;
|
||||
|
||||
ptr = strrchrW(path, '/');
|
||||
if(!ptr)
|
||||
ptr = path;
|
||||
else
|
||||
ptr++;
|
||||
|
||||
ptr2 = strrchrW(ptr, '\\');
|
||||
if(ptr2)
|
||||
ptr = ptr2+1;
|
||||
|
||||
ctx->file_name = ptr;
|
||||
ext = strrchrW(ptr, '.');
|
||||
if(!ext)
|
||||
ext = ptr;
|
||||
|
||||
if(!strcmpW(ext, cab_extW)) {
|
||||
hres = install_cab_file(ctx);
|
||||
}else {
|
||||
FIXME("Unsupported extention %s\n", debugstr_w(ext));
|
||||
hres = E_NOTIMPL;
|
||||
}
|
||||
SysFreeString(path);
|
||||
}
|
||||
|
||||
return hres;
|
||||
}
|
||||
|
||||
static void failure_msgbox(install_ctx_t *ctx, HRESULT hres)
|
||||
{
|
||||
WCHAR buf[1024], fmt[1024];
|
||||
|
||||
LoadStringW(urlmon_instance, IDS_AXINSTALL_FAILURE, fmt, sizeof(fmt)/sizeof(WCHAR));
|
||||
sprintfW(buf, fmt, hres);
|
||||
MessageBoxW(ctx->hwnd, buf, NULL, MB_OK);
|
||||
}
|
||||
|
||||
static HRESULT distunit_on_stop(void *ctx, const WCHAR *cache_file, HRESULT hresult, const WCHAR *error_str)
|
||||
{
|
||||
install_ctx_t *install_ctx = ctx;
|
||||
|
||||
TRACE("(%p %s %08x %s)\n", ctx, debugstr_w(cache_file), hresult, debugstr_w(error_str));
|
||||
|
||||
if(hresult == S_OK) {
|
||||
hresult = install_file(install_ctx, cache_file);
|
||||
if(FAILED(hresult))
|
||||
failure_msgbox(ctx, hresult);
|
||||
}
|
||||
|
||||
if(install_ctx->callback)
|
||||
IBindStatusCallback_OnStopBinding(install_ctx->callback, hresult, error_str);
|
||||
|
||||
if(install_ctx->release_on_stop)
|
||||
release_install_ctx(install_ctx);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AsyncInstallDistributionUnit (URLMON.@)
|
||||
*/
|
||||
HRESULT WINAPI AsyncInstallDistributionUnit(const WCHAR *szDistUnit, const WCHAR *szTYPE, const WCHAR *szExt,
|
||||
DWORD dwFileVersionMS, DWORD dwFileVersionLS, const WCHAR *szURL, IBindCtx *pbc, void *pvReserved, DWORD flags)
|
||||
{
|
||||
install_ctx_t *ctx;
|
||||
HRESULT hres;
|
||||
|
||||
TRACE("(%s %s %s %x %x %s %p %p %x)\n", debugstr_w(szDistUnit), debugstr_w(szTYPE), debugstr_w(szExt),
|
||||
dwFileVersionMS, dwFileVersionLS, debugstr_w(szURL), pbc, pvReserved, flags);
|
||||
|
||||
if(szDistUnit || szTYPE || szExt)
|
||||
FIXME("Unsupported arguments\n");
|
||||
|
||||
ctx = heap_alloc_zero(sizeof(*ctx));
|
||||
if(!ctx)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
hres = CreateUri(szURL, 0, 0, &ctx->uri);
|
||||
if(FAILED(hres)) {
|
||||
heap_free(ctx);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
ctx->callback = bsc_from_bctx(pbc);
|
||||
|
||||
hres = download_to_cache(ctx->uri, distunit_on_stop, ctx, ctx->callback);
|
||||
if(hres == MK_S_ASYNCHRONOUS)
|
||||
ctx->release_on_stop = TRUE;
|
||||
else
|
||||
release_install_ctx(ctx);
|
||||
|
||||
return hres;
|
||||
}
|
|
@ -66,7 +66,7 @@ static IBindStatusCallback *bsch_from_bctx(IBindCtx *bctx)
|
|||
return SUCCEEDED(hres) ? bsc : NULL;
|
||||
}
|
||||
|
||||
static IBindStatusCallback *bsc_from_bctx(IBindCtx *bctx)
|
||||
IBindStatusCallback *bsc_from_bctx(IBindCtx *bctx)
|
||||
{
|
||||
BindStatusCallback *holder;
|
||||
IBindStatusCallback *bsc;
|
||||
|
|
|
@ -31,6 +31,10 @@ typedef struct {
|
|||
IBinding *binding;
|
||||
LPWSTR file_name;
|
||||
LPWSTR cache_file;
|
||||
DWORD bindf;
|
||||
|
||||
stop_cache_binding_proc_t onstop_proc;
|
||||
void *ctx;
|
||||
} DownloadBSC;
|
||||
|
||||
static inline DownloadBSC *impl_from_IBindStatusCallback(IBindStatusCallback *iface)
|
||||
|
@ -189,6 +193,7 @@ static HRESULT WINAPI DownloadBSC_OnStopBinding(IBindStatusCallback *iface,
|
|||
HRESULT hresult, LPCWSTR szError)
|
||||
{
|
||||
DownloadBSC *This = impl_from_IBindStatusCallback(iface);
|
||||
HRESULT hres = S_OK;
|
||||
|
||||
TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
|
||||
|
||||
|
@ -204,7 +209,9 @@ static HRESULT WINAPI DownloadBSC_OnStopBinding(IBindStatusCallback *iface,
|
|||
}
|
||||
}
|
||||
|
||||
if(This->callback)
|
||||
if(This->onstop_proc)
|
||||
hres = This->onstop_proc(This->ctx, This->cache_file, hresult, szError);
|
||||
else if(This->callback)
|
||||
IBindStatusCallback_OnStopBinding(This->callback, hresult, szError);
|
||||
|
||||
if(This->binding) {
|
||||
|
@ -212,7 +219,7 @@ static HRESULT WINAPI DownloadBSC_OnStopBinding(IBindStatusCallback *iface,
|
|||
This->binding = NULL;
|
||||
}
|
||||
|
||||
return S_OK;
|
||||
return hres;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI DownloadBSC_GetBindInfo(IBindStatusCallback *iface,
|
||||
|
@ -235,7 +242,7 @@ static HRESULT WINAPI DownloadBSC_GetBindInfo(IBindStatusCallback *iface,
|
|||
ReleaseBindInfo(&bindinfo);
|
||||
}
|
||||
|
||||
*grfBINDF = BINDF_PULLDATA | BINDF_NEEDFILE | (bindf & BINDF_ENFORCERESTRICTED);
|
||||
*grfBINDF = BINDF_PULLDATA | BINDF_NEEDFILE | (bindf & BINDF_ENFORCERESTRICTED) | This->bindf;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
@ -323,39 +330,84 @@ static const IServiceProviderVtbl ServiceProviderVtbl = {
|
|||
DwlServiceProvider_QueryService
|
||||
};
|
||||
|
||||
static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_name, IBindStatusCallback **ret_callback)
|
||||
static HRESULT DownloadBSC_Create(IBindStatusCallback *callback, LPCWSTR file_name, DownloadBSC **ret_callback)
|
||||
{
|
||||
DownloadBSC *ret = heap_alloc(sizeof(*ret));
|
||||
DownloadBSC *ret;
|
||||
|
||||
ret = heap_alloc_zero(sizeof(*ret));
|
||||
if(!ret)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
ret->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl;
|
||||
ret->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
|
||||
ret->ref = 1;
|
||||
ret->file_name = heap_strdupW(file_name);
|
||||
ret->cache_file = NULL;
|
||||
ret->binding = NULL;
|
||||
|
||||
if(file_name) {
|
||||
ret->file_name = heap_strdupW(file_name);
|
||||
if(!ret->file_name) {
|
||||
heap_free(ret);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
}
|
||||
|
||||
if(callback)
|
||||
IBindStatusCallback_AddRef(callback);
|
||||
ret->callback = callback;
|
||||
|
||||
*ret_callback = &ret->IBindStatusCallback_iface;
|
||||
*ret_callback = ret;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
HRESULT create_default_callback(IBindStatusCallback **ret)
|
||||
{
|
||||
IBindStatusCallback *callback;
|
||||
DownloadBSC *callback;
|
||||
HRESULT hres;
|
||||
|
||||
hres = DownloadBSC_Create(NULL, NULL, &callback);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = wrap_callback(callback, ret);
|
||||
IBindStatusCallback_Release(callback);
|
||||
hres = wrap_callback(&callback->IBindStatusCallback_iface, ret);
|
||||
IBindStatusCallback_Release(&callback->IBindStatusCallback_iface);
|
||||
return hres;
|
||||
}
|
||||
|
||||
HRESULT download_to_cache(IUri *uri, stop_cache_binding_proc_t proc, void *ctx, IBindStatusCallback *callback)
|
||||
{
|
||||
DownloadBSC *dwl_bsc;
|
||||
IBindCtx *bindctx;
|
||||
IMoniker *mon;
|
||||
IUnknown *unk;
|
||||
HRESULT hres;
|
||||
|
||||
hres = DownloadBSC_Create(callback, NULL, &dwl_bsc);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
dwl_bsc->onstop_proc = proc;
|
||||
dwl_bsc->ctx = ctx;
|
||||
dwl_bsc->bindf = BINDF_ASYNCHRONOUS;
|
||||
|
||||
hres = CreateAsyncBindCtx(0, &dwl_bsc->IBindStatusCallback_iface, NULL, &bindctx);
|
||||
IBindStatusCallback_Release(&dwl_bsc->IBindStatusCallback_iface);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = CreateURLMonikerEx2(NULL, uri, &mon, 0);
|
||||
if(FAILED(hres)) {
|
||||
IBindCtx_Release(bindctx);
|
||||
return hres;
|
||||
}
|
||||
|
||||
hres = IMoniker_BindToStorage(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
|
||||
IMoniker_Release(mon);
|
||||
IBindCtx_Release(bindctx);
|
||||
if(SUCCEEDED(hres) && unk)
|
||||
IUnknown_Release(unk);
|
||||
return hres;
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* URLDownloadToFileW (URLMON.@)
|
||||
*
|
||||
|
@ -375,7 +427,7 @@ HRESULT create_default_callback(IBindStatusCallback **ret)
|
|||
HRESULT WINAPI URLDownloadToFileW(LPUNKNOWN pCaller, LPCWSTR szURL, LPCWSTR szFileName,
|
||||
DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB)
|
||||
{
|
||||
IBindStatusCallback *callback;
|
||||
DownloadBSC *callback;
|
||||
IUnknown *unk;
|
||||
IMoniker *mon;
|
||||
IBindCtx *bindctx;
|
||||
|
@ -390,8 +442,8 @@ HRESULT WINAPI URLDownloadToFileW(LPUNKNOWN pCaller, LPCWSTR szURL, LPCWSTR szFi
|
|||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
hres = CreateAsyncBindCtx(0, callback, NULL, &bindctx);
|
||||
IBindStatusCallback_Release(callback);
|
||||
hres = CreateAsyncBindCtx(0, &callback->IBindStatusCallback_iface, NULL, &bindctx);
|
||||
IBindStatusCallback_Release(&callback->IBindStatusCallback_iface);
|
||||
if(FAILED(hres))
|
||||
return hres;
|
||||
|
||||
|
|
26
dlls/urlmon/resource.h
Normal file
26
dlls/urlmon/resource.h
Normal file
|
@ -0,0 +1,26 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
#define ID_AXINSTALL_WARNING_DLG 1000
|
||||
#define ID_AXINSTALL_LOCATION 1001
|
||||
#define ID_AXINSTALL_INSTALL_BTN 1002
|
||||
#define ID_AXINSTALL_ICON 1003
|
||||
|
||||
#define IDS_AXINSTALL_FAILURE 1100
|
||||
#define IDS_AXINSTALL_INSTALLN 1101
|
||||
#define IDS_AXINSTALL_INSTALL 1102
|
|
@ -16,6 +16,41 @@
|
|||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <windef.h>
|
||||
#include <winuser.h>
|
||||
#include <commctrl.h>
|
||||
|
||||
#include "resource.h"
|
||||
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_DEFAULT
|
||||
|
||||
ID_AXINSTALL_WARNING_DLG DIALOG 0, 0, 260, 115
|
||||
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "Security Warning"
|
||||
FONT 8, "MS Shell Dlg"
|
||||
{
|
||||
CONTROL "Do you want to install this software?",
|
||||
100, "static", SS_LEFT | WS_CHILD | WS_VISIBLE, 10, 10, 240, 23
|
||||
CONTROL "Location:", 101, "static", SS_LEFT | WS_CHILD | WS_VISIBLE, 10, 26, 40, 13
|
||||
CONTROL "", ID_AXINSTALL_LOCATION, "static", SS_LEFT | WS_CHILD | WS_VISIBLE, 50, 26, 200, 13
|
||||
DEFPUSHBUTTON "Don't install", IDCANCEL, 200, 48, 50, 14, WS_GROUP | WS_TABSTOP
|
||||
PUSHBUTTON "", ID_AXINSTALL_INSTALL_BTN, 144, 48, 50, 14, WS_GROUP | WS_TABSTOP | WS_DISABLED
|
||||
CONTROL "", 102, "static", SS_ETCHEDHORZ, 10, 70, 240, 1
|
||||
ICON "", ID_AXINSTALL_ICON, 10, 82, 32, 32, WS_CHILD | WS_VISIBLE
|
||||
CONTROL "When installed, ActiveX has full access to your computer." \
|
||||
"Do not click install unless you have absolute trust in the above source.",
|
||||
22002, "static", SS_LEFT | WS_CHILD | WS_VISIBLE, 46, 80, 194, 23
|
||||
}
|
||||
|
||||
STRINGTABLE
|
||||
{
|
||||
IDS_AXINSTALL_FAILURE "Installation of component failed: %08x"
|
||||
IDS_AXINSTALL_INSTALLN "Install (%d)"
|
||||
IDS_AXINSTALL_INSTALL "Install"
|
||||
}
|
||||
|
||||
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
|
||||
|
||||
/* @makedep: urlmon.rgs */
|
||||
1 WINE_REGISTRY urlmon.rgs
|
||||
|
||||
|
|
|
@ -950,14 +950,3 @@ HRESULT WINAPI GetSoftwareUpdateInfo( LPCWSTR szDistUnit, LPSOFTDISTINFO psdi )
|
|||
FIXME("%s %p\n", debugstr_w(szDistUnit), psdi );
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* AsyncInstallDistributionUnit (URLMON.@)
|
||||
*/
|
||||
HRESULT WINAPI AsyncInstallDistributionUnit( LPCWSTR szDistUnit, LPCWSTR szTYPE,
|
||||
LPCWSTR szExt, DWORD dwFileVersionMS, DWORD dwFileVersionLS,
|
||||
LPCWSTR szURL, IBindCtx *pbc, LPVOID pvReserved, DWORD flags )
|
||||
{
|
||||
FIXME(": stub\n");
|
||||
return E_NOTIMPL;
|
||||
}
|
||||
|
|
|
@ -38,6 +38,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(urlmon);
|
|||
DEFINE_GUID(CLSID_CUri, 0xDF2FCE13, 0x25EC, 0x45BB, 0x9D,0x4C, 0xCE,0xCD,0x47,0xC2,0x43,0x0C);
|
||||
|
||||
LONG URLMON_refCount = 0;
|
||||
HINSTANCE urlmon_instance;
|
||||
|
||||
static HMODULE hCabinet = NULL;
|
||||
static DWORD urlmon_tls = TLS_OUT_OF_INDEXES;
|
||||
|
@ -151,6 +152,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
|||
|
||||
switch(fdwReason) {
|
||||
case DLL_PROCESS_ATTACH:
|
||||
urlmon_instance = hinstDLL;
|
||||
init_session();
|
||||
break;
|
||||
|
||||
|
|
|
@ -64,6 +64,8 @@ extern LONG URLMON_refCount DECLSPEC_HIDDEN;
|
|||
static inline void URLMON_LockModule(void) { InterlockedIncrement( &URLMON_refCount ); }
|
||||
static inline void URLMON_UnlockModule(void) { InterlockedDecrement( &URLMON_refCount ); }
|
||||
|
||||
extern HINSTANCE urlmon_instance;
|
||||
|
||||
IInternetProtocolInfo *get_protocol_info(LPCWSTR) DECLSPEC_HIDDEN;
|
||||
HRESULT get_protocol_handler(IUri*,CLSID*,BOOL*,IClassFactory**) DECLSPEC_HIDDEN;
|
||||
IInternetProtocol *get_mime_filter(LPCWSTR) DECLSPEC_HIDDEN;
|
||||
|
@ -78,6 +80,10 @@ HRESULT bind_to_object(IMoniker*,IUri*,IBindCtx*,REFIID,void**ppv) DECLSPEC_HIDD
|
|||
|
||||
HRESULT create_default_callback(IBindStatusCallback**) DECLSPEC_HIDDEN;
|
||||
HRESULT wrap_callback(IBindStatusCallback*,IBindStatusCallback**) DECLSPEC_HIDDEN;
|
||||
IBindStatusCallback *bsc_from_bctx(IBindCtx*) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef HRESULT (*stop_cache_binding_proc_t)(void*,const WCHAR*,HRESULT,const WCHAR*);
|
||||
HRESULT download_to_cache(IUri*,stop_cache_binding_proc_t,void*,IBindStatusCallback*) DECLSPEC_HIDDEN;
|
||||
|
||||
typedef struct ProtocolVtbl ProtocolVtbl;
|
||||
|
||||
|
@ -289,4 +295,17 @@ static inline LPWSTR heap_strdupAtoW(const char *str)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline char *heap_strdupWtoA(const WCHAR *str)
|
||||
{
|
||||
char *ret = NULL;
|
||||
|
||||
if(str) {
|
||||
size_t size = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
|
||||
ret = heap_alloc(size);
|
||||
WideCharToMultiByte(CP_ACP, 0, str, -1, ret, size, NULL, NULL);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* __WINE_URLMON_MAIN_H */
|
||||
|
|
Loading…
Reference in a new issue