ReactOS  0.4.15-dev-1384-g878186b
inseng_main.c File Reference
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "rpcproxy.h"
#include "urlmon.h"
#include "shlwapi.h"
#include "initguid.h"
#include "inseng.h"
#include "inseng_private.h"
#include "wine/debug.h"
Include dependency graph for inseng_main.c:

Go to the source code of this file.

Classes

struct  thread_info
 
class  InstallEngine
 
struct  downloadcb
 

Macros

#define COBJMACROS
 

Enumerations

enum  thread_operation { OP_DOWNLOAD, OP_INSTALL }
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (inseng)
 
static InstallEngineimpl_from_IInstallEngine2 (IInstallEngine2 *iface)
 
static struct downloadcbimpl_from_IBindStatusCallback (IBindStatusCallback *iface)
 
static InstallEngineimpl_from_IInstallEngineTiming (IInstallEngineTiming *iface)
 
static HRESULT WINAPI downloadcb_QueryInterface (IBindStatusCallback *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI downloadcb_AddRef (IBindStatusCallback *iface)
 
static ULONG WINAPI downloadcb_Release (IBindStatusCallback *iface)
 
static HRESULT WINAPI downloadcb_OnStartBinding (IBindStatusCallback *iface, DWORD reserved, IBinding *pbind)
 
static HRESULT WINAPI downloadcb_GetPriority (IBindStatusCallback *iface, LONG *priority)
 
static HRESULT WINAPI downloadcb_OnLowResource (IBindStatusCallback *iface, DWORD reserved)
 
static HRESULT WINAPI downloadcb_OnProgress (IBindStatusCallback *iface, ULONG progress, ULONG progress_max, ULONG status, const WCHAR *status_text)
 
static HRESULT WINAPI downloadcb_OnStopBinding (IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
 
static HRESULT WINAPI downloadcb_GetBindInfo (IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
 
static HRESULT WINAPI downloadcb_OnDataAvailable (IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
 
static HRESULT WINAPI downloadcb_OnObjectAvailable (IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
 
static HRESULT downloadcb_create (InstallEngine *engine, HANDLE event, char *file_name, char *id, char *display, DWORD dl_size, struct downloadcb **callback)
 
static HRESULT WINAPI InstallEngine_QueryInterface (IInstallEngine2 *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InstallEngine_AddRef (IInstallEngine2 *iface)
 
static ULONG WINAPI InstallEngine_Release (IInstallEngine2 *iface)
 
static void set_status (InstallEngine *This, DWORD status)
 
static HRESULT calc_sizes (IEnumCifComponents *enum_comp, DWORD operation, DWORD *size_download, DWORD *size_install)
 
static HRESULT get_next_component (IEnumCifComponents *enum_comp, DWORD operation, ICifComponent **ret_comp)
 
static HRESULT get_url (ICifComponent *comp, int index, char **url, DWORD *flags)
 
static charcombine_url (char *baseurl, char *url)
 
static HRESULT generate_moniker (char *baseurl, char *url, DWORD flags, IMoniker **moniker)
 
static charmerge_path (char *path1, char *path2)
 
static HRESULT download_url (InstallEngine *This, char *id, char *display, char *url, DWORD flags, DWORD dl_size)
 
static HRESULT process_component_dependencies (InstallEngine *This, ICifComponent *comp)
 
static HRESULT process_component (InstallEngine *This, ICifComponent *comp)
 
DWORD WINAPI thread_installation (LPVOID param)
 
static HRESULT start_installation (InstallEngine *This, DWORD operation, DWORD jobflags)
 
static HRESULT WINAPI InstallEngine_GetEngineStatus (IInstallEngine2 *iface, DWORD *status)
 
static HRESULT WINAPI InstallEngine_SetCifFile (IInstallEngine2 *iface, const char *cab_name, const char *cif_name)
 
static HRESULT WINAPI InstallEngine_DownloadComponents (IInstallEngine2 *iface, DWORD flags)
 
static HRESULT WINAPI InstallEngine_InstallComponents (IInstallEngine2 *iface, DWORD flags)
 
static HRESULT WINAPI InstallEngine_EnumInstallIDs (IInstallEngine2 *iface, UINT index, char **id)
 
static HRESULT WINAPI InstallEngine_EnumDownloadIDs (IInstallEngine2 *iface, UINT index, char **id)
 
static HRESULT WINAPI InstallEngine_IsComponentInstalled (IInstallEngine2 *iface, const char *id, DWORD *status)
 
static HRESULT WINAPI InstallEngine_RegisterInstallEngineCallback (IInstallEngine2 *iface, IInstallEngineCallback *callback)
 
static HRESULT WINAPI InstallEngine_UnregisterInstallEngineCallback (IInstallEngine2 *iface)
 
static HRESULT WINAPI InstallEngine_SetAction (IInstallEngine2 *iface, const char *id, DWORD action, DWORD priority)
 
static HRESULT WINAPI InstallEngine_GetSizes (IInstallEngine2 *iface, const char *id, COMPONENT_SIZES *sizes)
 
static HRESULT WINAPI InstallEngine_LaunchExtraCommand (IInstallEngine2 *iface, const char *inf_name, const char *section)
 
static HRESULT WINAPI InstallEngine_GetDisplayName (IInstallEngine2 *iface, const char *id, const char *name)
 
static HRESULT WINAPI InstallEngine_SetBaseUrl (IInstallEngine2 *iface, const char *base_name)
 
static HRESULT WINAPI InstallEngine_SetDownloadDir (IInstallEngine2 *iface, const char *download_dir)
 
static HRESULT WINAPI InstallEngine_SetInstallDrive (IInstallEngine2 *iface, char drive)
 
static HRESULT WINAPI InstallEngine_SetInstallOptions (IInstallEngine2 *iface, DWORD flags)
 
static HRESULT WINAPI InstallEngine_SetHWND (IInstallEngine2 *iface, HWND hwnd)
 
static HRESULT WINAPI InstallEngine_SetIStream (IInstallEngine2 *iface, IStream *stream)
 
static HRESULT WINAPI InstallEngine_Abort (IInstallEngine2 *iface, DWORD flags)
 
static HRESULT WINAPI InstallEngine_Suspend (IInstallEngine2 *iface)
 
static HRESULT WINAPI InstallEngine_Resume (IInstallEngine2 *iface)
 
static HRESULT WINAPI InstallEngine2_SetLocalCif (IInstallEngine2 *iface, const char *cif)
 
static HRESULT WINAPI InstallEngine2_GetICifFile (IInstallEngine2 *iface, ICifFile **cif_file)
 
static HRESULT WINAPI InstallEngineTiming_QueryInterface (IInstallEngineTiming *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InstallEngineTiming_AddRef (IInstallEngineTiming *iface)
 
static ULONG WINAPI InstallEngineTiming_Release (IInstallEngineTiming *iface)
 
static HRESULT WINAPI InstallEngineTiming_GetRates (IInstallEngineTiming *iface, DWORD *download, DWORD *install)
 
static HRESULT WINAPI InstallEngineTiming_GetInstallProgress (IInstallEngineTiming *iface, INSTALLPROGRESS *progress)
 
static HRESULT WINAPI ClassFactory_QueryInterface (IClassFactory *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI ClassFactory_AddRef (IClassFactory *iface)
 
static ULONG WINAPI ClassFactory_Release (IClassFactory *iface)
 
static HRESULT WINAPI ClassFactory_LockServer (IClassFactory *iface, BOOL fLock)
 
static HRESULT WINAPI InstallEngineCF_CreateInstance (IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
 
BOOL WINAPI DllMain (HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
 
HRESULT WINAPI DllGetClassObject (REFCLSID rclsid, REFIID iid, LPVOID *ppv)
 
HRESULT WINAPI DllCanUnloadNow (void)
 
HRESULT WINAPI DllRegisterServer (void)
 
HRESULT WINAPI DllUnregisterServer (void)
 
BOOL WINAPI CheckTrustEx (LPVOID a, LPVOID b, LPVOID c, LPVOID d, LPVOID e)
 
HRESULT WINAPI DllInstall (BOOL bInstall, LPCWSTR cmdline)
 

Variables

static HINSTANCE instance
 
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
 
static const IInstallEngine2Vtbl InstallEngine2Vtbl
 
static const IInstallEngineTimingVtbl InstallEngineTimingVtbl
 
static const IClassFactoryVtbl InstallEngineCFVtbl
 
static IClassFactory InstallEngineCF = { &InstallEngineCFVtbl }
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 22 of file inseng_main.c.

Enumeration Type Documentation

◆ thread_operation

Enumerator
OP_DOWNLOAD 
OP_INSTALL 

Definition at line 48 of file inseng_main.c.

49 {
52 };

Function Documentation

◆ calc_sizes()

static HRESULT calc_sizes ( IEnumCifComponents enum_comp,
DWORD  operation,
DWORD size_download,
DWORD size_install 
)
static

Definition at line 414 of file inseng_main.c.

415 {
416  ICifComponent *comp;
417  DWORD download = 0;
418  DWORD install = 0;
419  HRESULT hr;
420 
421  /* FIXME: what about inactive dependencies and how does
422  * INSTALLOPTIONS_FORCEDEPENDENCIES play into this ?*/
423 
424  hr = IEnumCifComponents_Reset(enum_comp);
425  if (FAILED(hr)) return hr;
426 
427  while (SUCCEEDED(IEnumCifComponents_Next(enum_comp, &comp)))
428  {
429  if (ICifComponent_GetInstallQueueState(comp) != ActionInstall)
430  continue;
431 
432  /* FIXME: handle install options and find out the default options*/
433  if (operation == OP_DOWNLOAD && ICifComponent_IsComponentDownloaded(comp) == S_FALSE)
434  download = ICifComponent_GetDownloadSize(comp);
435  /*
436  if (operation == OP_INSTALL && ICifComponent_IsComponentInstalled(comp) == S_FALSE)
437  install = ICifComponent_GetInstalledSize(comp);
438  */
439  }
440 
441  *size_download = download;
442  *size_install = install;
443 
444  return S_OK;
445 }
HRESULT hr
Definition: shlfolder.c:183
int install
Definition: msacm.c:1365
if SUCCEEDED(hr)
#define S_FALSE
Definition: winerror.h:2357
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:51

Referenced by start_installation().

◆ CheckTrustEx()

BOOL WINAPI CheckTrustEx ( LPVOID  a,
LPVOID  b,
LPVOID  c,
LPVOID  d,
LPVOID  e 
)

Definition at line 1326 of file inseng_main.c.

1327 {
1328  FIXME("%p %p %p %p %p\n", a, b, c, d, e );
1329  return TRUE;
1330 }
#define TRUE
Definition: types.h:120
#define e
Definition: ke_i.h:82
#define FIXME(fmt,...)
Definition: debug.h:111
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
const GLubyte * c
Definition: glext.h:8905
GLboolean GLboolean GLboolean GLboolean a
Definition: glext.h:6204
#define d
Definition: ke_i.h:81

◆ ClassFactory_AddRef()

static ULONG WINAPI ClassFactory_AddRef ( IClassFactory iface)
static

Definition at line 1227 of file inseng_main.c.

1228 {
1229  return 2;
1230 }

◆ ClassFactory_LockServer()

static HRESULT WINAPI ClassFactory_LockServer ( IClassFactory iface,
BOOL  fLock 
)
static

Definition at line 1237 of file inseng_main.c.

1238 {
1239  return S_OK;
1240 }
#define S_OK
Definition: intsafe.h:51

◆ ClassFactory_QueryInterface()

static HRESULT WINAPI ClassFactory_QueryInterface ( IClassFactory iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1206 of file inseng_main.c.

1207 {
1208  *ppv = NULL;
1209 
1210  if(IsEqualGUID(&IID_IUnknown, riid)) {
1211  TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
1212  *ppv = iface;
1213  }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
1214  TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
1215  *ppv = iface;
1216  }
1217 
1218  if(*ppv) {
1219  IUnknown_AddRef((IUnknown*)*ppv);
1220  return S_OK;
1221  }
1222 
1223  FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
1224  return E_NOINTERFACE;
1225 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112
const GUID IID_IClassFactory

◆ ClassFactory_Release()

static ULONG WINAPI ClassFactory_Release ( IClassFactory iface)
static

Definition at line 1232 of file inseng_main.c.

1233 {
1234  return 1;
1235 }

◆ combine_url()

static char* combine_url ( char baseurl,
char url 
)
static

Definition at line 510 of file inseng_main.c.

511 {
512  int len_base = strlen(baseurl);
513  int len_url = strlen(url);
514  char *combined;
515 
516  combined = heap_alloc(len_base + len_url + 2);
517  if (!combined) return NULL;
518 
519  strcpy(combined, baseurl);
520  if (len_base && combined[len_base-1] != '/')
521  strcat(combined, "/");
522  strcat(combined, url);
523 
524  return combined;
525 }
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static const WCHAR url[]
Definition: encode.c:1432
#define NULL
Definition: types.h:112
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by generate_moniker().

◆ DllCanUnloadNow()

HRESULT WINAPI DllCanUnloadNow ( void  )

Definition at line 1305 of file inseng_main.c.

1306 {
1307  return S_FALSE;
1308 }
#define S_FALSE
Definition: winerror.h:2357

◆ DllGetClassObject()

HRESULT WINAPI DllGetClassObject ( REFCLSID  rclsid,
REFIID  iid,
LPVOID ppv 
)

Definition at line 1291 of file inseng_main.c.

1292 {
1293  if(IsEqualGUID(rclsid, &CLSID_InstallEngine)) {
1294  TRACE("(CLSID_InstallEngine %s %p)\n", debugstr_guid(iid), ppv);
1295  return IClassFactory_QueryInterface(&InstallEngineCF, iid, ppv);
1296  }
1297 
1298  FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
1300 }
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define CLASS_E_CLASSNOTAVAILABLE
Definition: winerror.h:2663
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
static IClassFactory InstallEngineCF
Definition: inseng_main.c:1272
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ DllInstall()

HRESULT WINAPI DllInstall ( BOOL  bInstall,
LPCWSTR  cmdline 
)

Definition at line 1335 of file inseng_main.c.

1336 {
1337  FIXME("(%s, %s): stub\n", bInstall ? "TRUE" : "FALSE", debugstr_w(cmdline));
1338  return S_OK;
1339 }
TCHAR * cmdline
Definition: stretchblt.cpp:32
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define S_OK
Definition: intsafe.h:51

◆ DllMain()

BOOL WINAPI DllMain ( HINSTANCE  hInstDLL,
DWORD  fdwReason,
LPVOID  lpv 
)

Definition at line 1274 of file inseng_main.c.

1275 {
1276  switch(fdwReason)
1277  {
1278  case DLL_WINE_PREATTACH:
1279  return FALSE; /* prefer native version */
1280  case DLL_PROCESS_ATTACH:
1281  instance = hInstDLL;
1282  DisableThreadLibraryCalls(hInstDLL);
1283  break;
1284  }
1285  return TRUE;
1286 }
#define TRUE
Definition: types.h:120
BOOL WINAPI DisableThreadLibraryCalls(IN HMODULE hLibModule)
Definition: loader.c:85
#define DLL_PROCESS_ATTACH
Definition: compat.h:131
static HINSTANCE instance
Definition: inseng_main.c:46
#define FALSE
Definition: types.h:117

◆ DllRegisterServer()

HRESULT WINAPI DllRegisterServer ( void  )

Definition at line 1313 of file inseng_main.c.

1314 {
1316 }
HRESULT __wine_register_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:98
static HINSTANCE instance
Definition: inseng_main.c:46

◆ DllUnregisterServer()

HRESULT WINAPI DllUnregisterServer ( void  )

Definition at line 1321 of file inseng_main.c.

1322 {
1324 }
static HINSTANCE instance
Definition: inseng_main.c:46
HRESULT __wine_unregister_resources(HMODULE module) DECLSPEC_HIDDEN
Definition: register.c:110

◆ download_url()

static HRESULT download_url ( InstallEngine This,
char id,
char display,
char url,
DWORD  flags,
DWORD  dl_size 
)
static

Definition at line 569 of file inseng_main.c.

570 {
571  struct downloadcb *callback = NULL;
572  char *filename = NULL;
573  IUnknown *unk = NULL;
574  IMoniker *mon = NULL;
575  IBindCtx *bindctx = NULL;
576  HANDLE event = NULL;
577  HRESULT hr;
578 
579  if (!This->downloaddir)
580  {
581  WARN("No download directory set\n");
582  return E_FAIL;
583  }
584 
585  hr = generate_moniker(This->baseurl, url, flags, &mon);
586  if (FAILED(hr))
587  {
588  FIXME("Failed to create moniker\n");
589  return hr;
590  }
591 
592  event = CreateEventW(NULL, TRUE, FALSE, NULL);
593  if (!event)
594  {
595  IMoniker_Release(mon);
596  return E_FAIL;
597  }
598 
599  filename = strrchr(url, '/');
600  if (!filename) filename = url;
601 
602  filename = merge_path(This->downloaddir, filename);
603  if (!filename)
604  {
605  hr = E_OUTOFMEMORY;
606  goto error;
607  }
608 
610  if (FAILED(hr)) goto error;
611 
612  hr = CreateAsyncBindCtx(0, &callback->IBindStatusCallback_iface, NULL, &bindctx);
613  if(FAILED(hr)) goto error;
614 
615  hr = IMoniker_BindToStorage(mon, bindctx, NULL, &IID_IUnknown, (void**)&unk);
616  if (FAILED(hr)) goto error;
617  if (unk) IUnknown_Release(unk);
618 
620  IMoniker_Release(mon);
621  IBindCtx_Release(bindctx);
622 
624  hr = callback->hr;
625 
627  IBindStatusCallback_Release(&callback->IBindStatusCallback_iface);
628  return hr;
629 
630 error:
631  if (mon) IMoniker_Release(mon);
632  if (event) CloseHandle(event);
633  if (callback) IBindStatusCallback_Release(&callback->IBindStatusCallback_iface);
634  if (bindctx) IBindCtx_Release(bindctx);
636  return hr;
637 }
#define CloseHandle
Definition: compat.h:598
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
#define TRUE
Definition: types.h:120
#define WARN(fmt,...)
Definition: debug.h:112
_Check_return_ _CRTIMP _CONST_RETURN char *__cdecl strrchr(_In_z_ const char *_Str, _In_ int _Ch)
const char * filename
Definition: ioapi.h:135
#define E_FAIL
Definition: ddrawi.h:102
HANDLE WINAPI DECLSPEC_HOTPATCH CreateEventW(IN LPSECURITY_ATTRIBUTES lpEventAttributes OPTIONAL, IN BOOL bManualReset, IN BOOL bInitialState, IN LPCWSTR lpName OPTIONAL)
Definition: synch.c:651
int * display
Definition: x11stubs.c:12
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
static HRESULT downloadcb_create(InstallEngine *engine, HANDLE event, char *file_name, char *id, char *display, DWORD dl_size, struct downloadcb **callback)
Definition: inseng_main.c:320
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define FALSE
Definition: types.h:117
#define FIXME(fmt,...)
Definition: debug.h:111
static char * merge_path(char *path1, char *path2)
Definition: inseng_main.c:556
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
LONG HRESULT
Definition: typedefs.h:79
static const WCHAR url[]
Definition: encode.c:1432
const GUID IID_IUnknown
GLbitfield flags
Definition: glext.h:7161
struct _cl_event * event
Definition: glext.h:7739
HRESULT WINAPI CreateAsyncBindCtx(DWORD reserved, IBindStatusCallback *callback, IEnumFORMATETC *format, IBindCtx **pbind)
Definition: bindctx.c:899
static HRESULT generate_moniker(char *baseurl, char *url, DWORD flags, IMoniker **moniker)
Definition: inseng_main.c:527
#define NULL
Definition: types.h:112
#define INFINITE
Definition: serial.h:102
DWORD dl_size
Definition: inseng_main.c:93
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by process_component().

◆ downloadcb_AddRef()

static ULONG WINAPI downloadcb_AddRef ( IBindStatusCallback iface)
static

Definition at line 141 of file inseng_main.c.

142 {
145 
146  TRACE("(%p) ref = %d\n", This, ref);
147 
148  return ref;
149 }
Definition: send.c:48
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106

◆ downloadcb_create()

static HRESULT downloadcb_create ( InstallEngine engine,
HANDLE  event,
char file_name,
char id,
char display,
DWORD  dl_size,
struct downloadcb **  callback 
)
static

Definition at line 320 of file inseng_main.c.

322 {
323  struct downloadcb *cb;
324 
325  cb = heap_alloc_zero(sizeof(*cb));
326  if (!cb) return E_OUTOFMEMORY;
327 
328  cb->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl;
329  cb->ref = 1;
330  cb->hr = E_FAIL;
331  cb->id = id;
332  cb->display = display;
333  cb->engine = engine;
334  cb->dl_size = dl_size;
335  cb->dl_previous_kb = engine->thread.downloaded_kb;
336  cb->event_done = event;
337  cb->file_name = strAtoW(file_name);
338  if (!cb->file_name)
339  {
340  heap_free(cb);
341  return E_OUTOFMEMORY;
342  }
343 
344  IInstallEngine2_AddRef(&engine->IInstallEngine2_iface);
345 
346  *callback = cb;
347  return S_OK;
348 }
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
Definition: inseng_main.c:305
#define E_FAIL
Definition: ddrawi.h:102
int * display
Definition: x11stubs.c:12
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
IInstallEngine2 IInstallEngine2_iface
Definition: inseng_main.c:68
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
static LPWSTR strAtoW(const char *str)
struct _cl_event * event
Definition: glext.h:7739
#define S_OK
Definition: intsafe.h:51
static LPCWSTR file_name
Definition: protocol.c:147
struct thread_info thread
Definition: inseng_main.c:79
static HMODULE MODULEINFO DWORD cb
Definition: module.c:32
GLenum GLuint id
Definition: glext.h:5579
DWORD dl_size
Definition: inseng_main.c:93
InstallEngine * engine
Definition: inseng_main.c:96
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by download_url().

◆ downloadcb_GetBindInfo()

static HRESULT WINAPI downloadcb_GetBindInfo ( IBindStatusCallback iface,
DWORD grfBINDF,
BINDINFO *  pbindinfo 
)
static

Definition at line 274 of file inseng_main.c.

276 {
278 
279  TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
280 
281  *grfBINDF = BINDF_PULLDATA | BINDF_NEEDFILE;
282  return S_OK;
283 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106

◆ downloadcb_GetPriority()

static HRESULT WINAPI downloadcb_GetPriority ( IBindStatusCallback iface,
LONG priority 
)
static

Definition at line 179 of file inseng_main.c.

180 {
182 
183  FIXME("(%p)->(%p): stub\n", This, priority);
184 
185  return E_NOTIMPL;
186 }
#define FIXME(fmt,...)
Definition: debug.h:111
WDF_INTERRUPT_PRIORITY priority
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ downloadcb_OnDataAvailable()

static HRESULT WINAPI downloadcb_OnDataAvailable ( IBindStatusCallback iface,
DWORD  grfBSCF,
DWORD  dwSize,
FORMATETC *  pformatetc,
STGMEDIUM *  pstgmed 
)
static

Definition at line 285 of file inseng_main.c.

287 {
289 
290  TRACE("(%p)->(%08x %u %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
291 
292  return S_OK;
293 }
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

◆ downloadcb_OnLowResource()

static HRESULT WINAPI downloadcb_OnLowResource ( IBindStatusCallback iface,
DWORD  reserved 
)
static

Definition at line 188 of file inseng_main.c.

189 {
191 
192  FIXME("(%p)->(%u): stub\n", This, reserved);
193 
194  return E_NOTIMPL;
195 }
#define FIXME(fmt,...)
Definition: debug.h:111
r reserved
Definition: btrfs.c:2940
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ downloadcb_OnObjectAvailable()

static HRESULT WINAPI downloadcb_OnObjectAvailable ( IBindStatusCallback iface,
REFIID  riid,
IUnknown punk 
)
static

Definition at line 295 of file inseng_main.c.

297 {
299 
300  FIXME("(%p)->(%s %p): stub\n", This, debugstr_guid(riid), punk);
301 
302  return E_NOTIMPL;
303 }
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ downloadcb_OnProgress()

static HRESULT WINAPI downloadcb_OnProgress ( IBindStatusCallback iface,
ULONG  progress,
ULONG  progress_max,
ULONG  status,
const WCHAR status_text 
)
static

Definition at line 197 of file inseng_main.c.

199 {
201  HRESULT hr = S_OK;
202 
203  TRACE("%p)->(%u %u %u %s)\n", This, progress, progress_max, status, debugstr_w(status_text));
204 
205  switch(status)
206  {
207  case BINDSTATUS_BEGINDOWNLOADDATA:
208  if (!This->engine->thread.download_start)
209  This->engine->thread.download_start = GetTickCount64();
210  /* fall-through */
211  case BINDSTATUS_DOWNLOADINGDATA:
212  case BINDSTATUS_ENDDOWNLOADDATA:
213  This->engine->thread.downloaded_kb = This->dl_previous_kb + progress / 1024;
214  if (This->engine->callback)
215  {
216  hr = IInstallEngineCallback_OnComponentProgress(This->engine->callback,
217  This->id, INSTALLSTATUS_DOWNLOADING, This->display, NULL, progress / 1024, This->dl_size);
218  }
219  break;
220 
221  case BINDSTATUS_CACHEFILENAMEAVAILABLE:
222  This->cache_file = strdupW(status_text);
223  if (!This->cache_file)
224  {
225  ERR("Failed to allocate memory for cache file\n");
226  hr = E_OUTOFMEMORY;
227  }
228  break;
229 
230  case BINDSTATUS_CONNECTING:
231  case BINDSTATUS_SENDINGREQUEST:
232  case BINDSTATUS_MIMETYPEAVAILABLE:
233  case BINDSTATUS_FINDINGRESOURCE:
234  break;
235 
236  default:
237  FIXME("Unsupported status %u\n", status);
238  }
239 
240  return hr;
241 }
HRESULT hr
Definition: shlfolder.c:183
static WCHAR * strdupW(const WCHAR *src)
Definition: main.c:92
ULONGLONG WINAPI GetTickCount64(VOID)
Definition: GetTickCount64.c:9
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106
#define NULL
Definition: types.h:112
cd_progress_ptr progress
Definition: cdjpeg.h:152
Definition: ps.c:97

◆ downloadcb_OnStartBinding()

static HRESULT WINAPI downloadcb_OnStartBinding ( IBindStatusCallback iface,
DWORD  reserved,
IBinding pbind 
)
static

Definition at line 170 of file inseng_main.c.

171 {
173 
174  TRACE("(%p)->(%u %p)\n", This, reserved, pbind);
175 
176  return S_OK;
177 }
r reserved
Definition: btrfs.c:2940
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106

◆ downloadcb_OnStopBinding()

static HRESULT WINAPI downloadcb_OnStopBinding ( IBindStatusCallback iface,
HRESULT  hresult,
LPCWSTR  szError 
)
static

Definition at line 243 of file inseng_main.c.

244 {
246 
247  TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
248 
249  if (FAILED(hresult))
250  {
251  This->hr = hresult;
252  goto done;
253  }
254 
255  if (!This->cache_file)
256  {
257  This->hr = E_FAIL;
258  goto done;
259  }
260 
261  if (CopyFileW(This->cache_file, This->file_name, FALSE))
262  This->hr = S_OK;
263  else
264  {
265  ERR("CopyFile failed: %u\n", GetLastError());
266  This->hr = E_FAIL;
267  }
268 
269 done:
270  SetEvent(This->event_done);
271  return S_OK;
272 }
BOOL WINAPI DECLSPEC_HOTPATCH SetEvent(IN HANDLE hEvent)
Definition: synch.c:733
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1044
#define E_FAIL
Definition: ddrawi.h:102
#define FALSE
Definition: types.h:117
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI CopyFileW(IN LPCWSTR lpExistingFileName, IN LPCWSTR lpNewFileName, IN BOOL bFailIfExists)
Definition: copy.c:439
#define ERR(fmt,...)
Definition: debug.h:110
#define S_OK
Definition: intsafe.h:51
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106

◆ downloadcb_QueryInterface()

static HRESULT WINAPI downloadcb_QueryInterface ( IBindStatusCallback iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 116 of file inseng_main.c.

117 {
119 
121  {
122  TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
123  *ppv = &This->IBindStatusCallback_iface;
124  }
125  else if (IsEqualGUID(&IID_IBindStatusCallback, riid))
126  {
127  TRACE("(%p)->(IID_IBindStatusCallback %p)\n", This, ppv);
128  *ppv = &This->IBindStatusCallback_iface;
129  }
130  else
131  {
132  FIXME("(%p)->(%s %p) not found\n", This, debugstr_guid(riid), ppv);
133  *ppv = NULL;
134  return E_NOINTERFACE;
135  }
136 
137  IUnknown_AddRef((IUnknown *)*ppv);
138  return S_OK;
139 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:51
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ downloadcb_Release()

static ULONG WINAPI downloadcb_Release ( IBindStatusCallback iface)
static

Definition at line 151 of file inseng_main.c.

152 {
155 
156  TRACE("(%p) ref = %d\n", This, ref);
157 
158  if (!ref)
159  {
160  heap_free(This->file_name);
161  heap_free(This->cache_file);
162 
163  IInstallEngine2_Release(&This->engine->IInstallEngine2_iface);
164  heap_free(This);
165  }
166 
167  return ref;
168 }
Definition: send.c:48
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static struct downloadcb * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: inseng_main.c:106
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ generate_moniker()

static HRESULT generate_moniker ( char baseurl,
char url,
DWORD  flags,
IMoniker **  moniker 
)
static

Definition at line 527 of file inseng_main.c.

528 {
529  WCHAR *urlW;
530  HRESULT hr;
531 
532  if (flags & URLF_RELATIVEURL)
533  {
534  char *combined;
535  if (!baseurl)
536  return E_FAIL;
537 
538  combined = combine_url(baseurl, url);
539  if (!combined) return E_OUTOFMEMORY;
540 
541  urlW = strAtoW(combined);
542  heap_free(combined);
543  if (!urlW) return E_OUTOFMEMORY;
544  }
545  else
546  {
547  urlW = strAtoW(url);
548  if (!urlW) return E_OUTOFMEMORY;
549  }
550 
551  hr = CreateURLMoniker(NULL, urlW, moniker);
552  heap_free(urlW);
553  return hr;
554 }
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static char * combine_url(char *baseurl, char *url)
Definition: inseng_main.c:510
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:79
static const WCHAR url[]
Definition: encode.c:1432
GLbitfield flags
Definition: glext.h:7161
static LPWSTR strAtoW(const char *str)
#define NULL
Definition: types.h:112
Definition: main.c:39
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by download_url().

◆ get_next_component()

static HRESULT get_next_component ( IEnumCifComponents enum_comp,
DWORD  operation,
ICifComponent **  ret_comp 
)
static

Definition at line 447 of file inseng_main.c.

448 {
449  ICifComponent *comp;
450  HRESULT hr;
451 
452  hr = IEnumCifComponents_Reset(enum_comp);
453  if (FAILED(hr)) return hr;
454 
455  while (SUCCEEDED(IEnumCifComponents_Next(enum_comp, &comp)))
456  {
457  if (ICifComponent_GetInstallQueueState(comp) != ActionInstall)
458  continue;
459 
460  /* FIXME: handle install options and find out the default options*/
461  if (operation == OP_DOWNLOAD && ICifComponent_IsComponentDownloaded(comp) != S_FALSE)
462  continue;
463  if (operation == OP_INSTALL && ICifComponent_IsComponentInstalled(comp) != S_FALSE)
464  continue;
465 
466  *ret_comp = comp;
467  return S_OK;
468  }
469 
470  return S_FALSE;
471 }
HRESULT hr
Definition: shlfolder.c:183
if SUCCEEDED(hr)
#define S_FALSE
Definition: winerror.h:2357
LONG HRESULT
Definition: typedefs.h:79
#define S_OK
Definition: intsafe.h:51

Referenced by thread_installation().

◆ get_url()

static HRESULT get_url ( ICifComponent comp,
int  index,
char **  url,
DWORD flags 
)
static

Definition at line 473 of file inseng_main.c.

474 {
475  char *url_temp = NULL;
476  int size = MAX_PATH / 2;
477  HRESULT hr;
478 
479  /* FIXME: should we add an internal get function to prevent this ugly code ? */
480 
481  /* check if there is an url with such an index */
482  hr = ICifComponent_GetUrl(comp, index, NULL, 0, flags);
483  if (FAILED(hr))
484  {
485  *url = NULL;
486  *flags = 0;
487  return S_OK;
488  }
489 
490  do
491  {
492  size *= 2;
493  heap_free(url_temp);
494  url_temp = heap_alloc(size);
495  if (!url_temp) return E_OUTOFMEMORY;
496 
497  hr = ICifComponent_GetUrl(comp, index, url_temp, size, flags);
498  if (FAILED(hr))
499  {
500  heap_free(url_temp);
501  return hr;
502  }
503  }
504  while (strlen(url_temp) == size-1);
505 
506  *url = url_temp;
507  return S_OK;
508 }
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
GLuint index
Definition: glext.h:6031
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:79
static const WCHAR url[]
Definition: encode.c:1432
#define MAX_PATH
Definition: compat.h:34
GLbitfield flags
Definition: glext.h:7161
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by process_component().

◆ impl_from_IBindStatusCallback()

static struct downloadcb* impl_from_IBindStatusCallback ( IBindStatusCallback iface)
inlinestatic

Definition at line 106 of file inseng_main.c.

107 {
109 }
IBindStatusCallback IBindStatusCallback_iface
Definition: inseng_main.c:84
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by downloadcb_AddRef(), downloadcb_GetBindInfo(), downloadcb_GetPriority(), downloadcb_OnDataAvailable(), downloadcb_OnLowResource(), downloadcb_OnObjectAvailable(), downloadcb_OnProgress(), downloadcb_OnStartBinding(), downloadcb_OnStopBinding(), downloadcb_QueryInterface(), and downloadcb_Release().

◆ impl_from_IInstallEngine2()

◆ impl_from_IInstallEngineTiming()

static InstallEngine* impl_from_IInstallEngineTiming ( IInstallEngineTiming iface)
inlinestatic

Definition at line 111 of file inseng_main.c.

112 {
113  return CONTAINING_RECORD(iface, InstallEngine, IInstallEngineTiming_iface);
114 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by InstallEngineTiming_AddRef(), InstallEngineTiming_GetInstallProgress(), InstallEngineTiming_GetRates(), InstallEngineTiming_QueryInterface(), and InstallEngineTiming_Release().

◆ InstallEngine2_GetICifFile()

static HRESULT WINAPI InstallEngine2_GetICifFile ( IInstallEngine2 iface,
ICifFile **  cif_file 
)
static

Definition at line 1097 of file inseng_main.c.

1098 {
1100 
1101  TRACE("(%p)->(%p)\n", This, cif_file);
1102 
1103  if (!This->icif || !cif_file)
1104  return E_FAIL;
1105 
1106  ICifFile_AddRef(This->icif);
1107  *cif_file = This->icif;
1108  return S_OK;
1109 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define E_FAIL
Definition: ddrawi.h:102
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ InstallEngine2_SetLocalCif()

static HRESULT WINAPI InstallEngine2_SetLocalCif ( IInstallEngine2 iface,
const char cif 
)
static

Definition at line 1074 of file inseng_main.c.

1075 {
1077  HRESULT hr;
1078 
1079  TRACE("(%p)->(%s)\n", This, debugstr_a(cif));
1080 
1081  if (This->icif)
1082  ICifFile_Release(This->icif);
1083 
1084  set_status(This, ENGINESTATUS_LOADING);
1085 
1086  hr = GetICifFileFromFile(&This->icif, cif);
1087  if (SUCCEEDED(hr))
1088  set_status(This, ENGINESTATUS_READY);
1089  else
1090  {
1091  This->icif = NULL;
1092  set_status(This, ENGINESTATUS_NOTREADY);
1093  }
1094  return hr;
1095 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
static void set_status(InstallEngine *This, DWORD status)
Definition: inseng_main.c:406
HRESULT hr
Definition: shlfolder.c:183
if SUCCEEDED(hr)
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
HRESULT WINAPI GetICifFileFromFile(ICifFile **icif, const char *path)
Definition: icif.c:1732
#define NULL
Definition: types.h:112

◆ InstallEngine_Abort()

static HRESULT WINAPI InstallEngine_Abort ( IInstallEngine2 iface,
DWORD  flags 
)
static

Definition at line 1047 of file inseng_main.c.

1048 {
1050 
1051  FIXME("(%p)->(%x): stub\n", This, flags);
1052 
1053  return E_NOTIMPL;
1054 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
GLbitfield flags
Definition: glext.h:7161
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_AddRef()

static ULONG WINAPI InstallEngine_AddRef ( IInstallEngine2 iface)
static

Definition at line 376 of file inseng_main.c.

377 {
380 
381  TRACE("(%p) ref=%d\n", This, ref);
382 
383  return ref;
384 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
Definition: send.c:48
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53

◆ InstallEngine_DownloadComponents()

static HRESULT WINAPI InstallEngine_DownloadComponents ( IInstallEngine2 iface,
DWORD  flags 
)
static

Definition at line 828 of file inseng_main.c.

829 {
831 
832  TRACE("(%p)->(%x)\n", This, flags);
833 
834  /* The interface is not really threadsafe on windows, but we can at least prevent multiple installations */
835  if (InterlockedCompareExchange((LONG *)&This->status, ENGINESTATUS_INSTALLING, ENGINESTATUS_READY) != ENGINESTATUS_READY)
836  return E_FAIL;
837 
838  if (This->callback)
839  IInstallEngineCallback_OnEngineStatusChange(This->callback, ENGINESTATUS_INSTALLING, 0);
840 
842 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define InterlockedCompareExchange
Definition: interlocked.h:104
#define E_FAIL
Definition: ddrawi.h:102
long LONG
Definition: pedump.c:60
#define TRACE(s)
Definition: solgame.cpp:4
GLbitfield flags
Definition: glext.h:7161
static HRESULT start_installation(InstallEngine *This, DWORD operation, DWORD jobflags)
Definition: inseng_main.c:765

◆ InstallEngine_EnumDownloadIDs()

static HRESULT WINAPI InstallEngine_EnumDownloadIDs ( IInstallEngine2 iface,
UINT  index,
char **  id 
)
static

Definition at line 862 of file inseng_main.c.

863 {
866  ICifComponent *comp;
867  HRESULT hr;
868 
869  TRACE("(%p)->(%u %p)\n", This, index, id);
870 
871  if (!This->icif || !id)
872  return E_FAIL;
873 
874  hr = ICifFile_EnumComponents(This->icif, &enum_components, 0, NULL);
875  if (FAILED(hr)) return hr;
876 
877  for (;;)
878  {
879  hr = IEnumCifComponents_Next(enum_components, &comp);
880  if (FAILED(hr)) goto done;
881 
882  if (ICifComponent_GetInstallQueueState(comp) != ActionInstall)
883  continue;
884 
885  if (ICifComponent_IsComponentDownloaded(comp) != S_FALSE)
886  continue;
887 
888  if (index == 0)
889  {
890  char *id_src = component_get_id(comp);
891  *id = CoTaskMemAlloc(strlen(id_src) + 1);
892 
893  if (*id)
894  strcpy(*id, id_src);
895  else
896  hr = E_OUTOFMEMORY;
897  goto done;
898  }
899 
900  index--;
901  }
902 
903 done:
904  IEnumCifComponents_Release(enum_components);
905  return hr;
906 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
HRESULT hr
Definition: shlfolder.c:183
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static UINT enum_components(const WCHAR *usersid, DWORD ctx, DWORD index, DWORD *idx, WCHAR guid[39], MSIINSTALLCONTEXT *installed_ctx, LPWSTR sid, LPDWORD sid_len)
Definition: registry.c:1406
#define S_FALSE
Definition: winerror.h:2357
GLuint index
Definition: glext.h:6031
char * component_get_id(ICifComponent *iface)
Definition: icif.c:339
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
#define NULL
Definition: types.h:112
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:426

◆ InstallEngine_EnumInstallIDs()

static HRESULT WINAPI InstallEngine_EnumInstallIDs ( IInstallEngine2 iface,
UINT  index,
char **  id 
)
static

Definition at line 853 of file inseng_main.c.

854 {
856 
857  FIXME("(%p)->(%u %p): stub\n", This, index, id);
858 
859  return E_NOTIMPL;
860 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
GLuint index
Definition: glext.h:6031
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_GetDisplayName()

static HRESULT WINAPI InstallEngine_GetDisplayName ( IInstallEngine2 iface,
const char id,
const char name 
)
static

Definition at line 976 of file inseng_main.c.

977 {
979 
980  FIXME("(%p)->(%s %s): stub\n", This, debugstr_a(id), debugstr_a(name));
981 
982  return E_NOTIMPL;
983 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: name.c:38

◆ InstallEngine_GetEngineStatus()

static HRESULT WINAPI InstallEngine_GetEngineStatus ( IInstallEngine2 iface,
DWORD status 
)
static

Definition at line 806 of file inseng_main.c.

807 {
809 
810  TRACE("(%p)->(%p)\n", This, status);
811 
812  if (!status)
813  return E_FAIL;
814 
815  *status = This->status;
816  return S_OK;
817 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define E_FAIL
Definition: ddrawi.h:102
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
Definition: ps.c:97

◆ InstallEngine_GetSizes()

static HRESULT WINAPI InstallEngine_GetSizes ( IInstallEngine2 iface,
const char id,
COMPONENT_SIZES sizes 
)
static

Definition at line 958 of file inseng_main.c.

959 {
961 
962  FIXME("(%p)->(%s %p): stub\n", This, debugstr_a(id), sizes);
963 
964  return E_NOTIMPL;
965 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
#define E_NOTIMPL
Definition: ddrawi.h:99
static const struct @532 sizes[]

◆ InstallEngine_InstallComponents()

static HRESULT WINAPI InstallEngine_InstallComponents ( IInstallEngine2 iface,
DWORD  flags 
)
static

Definition at line 844 of file inseng_main.c.

845 {
847 
848  FIXME("(%p)->(%x): stub\n", This, flags);
849 
850  return E_NOTIMPL;
851 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
GLbitfield flags
Definition: glext.h:7161
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_IsComponentInstalled()

static HRESULT WINAPI InstallEngine_IsComponentInstalled ( IInstallEngine2 iface,
const char id,
DWORD status 
)
static

Definition at line 908 of file inseng_main.c.

909 {
911 
912  FIXME("(%p)->(%s %p): stub\n", This, debugstr_a(id), status);
913 
914  return E_NOTIMPL;
915 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
#define E_NOTIMPL
Definition: ddrawi.h:99
Definition: ps.c:97

◆ InstallEngine_LaunchExtraCommand()

static HRESULT WINAPI InstallEngine_LaunchExtraCommand ( IInstallEngine2 iface,
const char inf_name,
const char section 
)
static

Definition at line 967 of file inseng_main.c.

968 {
970 
971  FIXME("(%p)->(%s %s): stub\n", This, debugstr_a(inf_name), debugstr_a(section));
972 
973  return E_NOTIMPL;
974 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
Definition: parser.c:55
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_QueryInterface()

static HRESULT WINAPI InstallEngine_QueryInterface ( IInstallEngine2 iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 350 of file inseng_main.c.

351 {
353 
354  if(IsEqualGUID(&IID_IUnknown, riid)) {
355  TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
356  *ppv = &This->IInstallEngine2_iface;
357  }else if(IsEqualGUID(&IID_IInstallEngine, riid)) {
358  TRACE("(%p)->(IID_IInstallEngine %p)\n", This, ppv);
359  *ppv = &This->IInstallEngine2_iface;
360  }else if(IsEqualGUID(&IID_IInstallEngine2, riid)) {
361  TRACE("(%p)->(IID_IInstallEngine2 %p)\n", This, ppv);
362  *ppv = &This->IInstallEngine2_iface;
363  }else if(IsEqualGUID(&IID_IInstallEngineTiming, riid)) {
364  TRACE("(%p)->(IID_IInstallEngineTiming %p)\n", This, ppv);
365  *ppv = &This->IInstallEngineTiming_iface;
366  }else {
367  FIXME("(%p)->(%s %p) not found\n", This, debugstr_guid(riid), ppv);
368  *ppv = NULL;
369  return E_NOINTERFACE;
370  }
371 
372  IUnknown_AddRef((IUnknown *)*ppv);
373  return S_OK;
374 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ InstallEngine_RegisterInstallEngineCallback()

static HRESULT WINAPI InstallEngine_RegisterInstallEngineCallback ( IInstallEngine2 iface,
IInstallEngineCallback callback 
)
static

Definition at line 917 of file inseng_main.c.

918 {
920 
921  TRACE("(%p)->(%p)\n", This, callback);
922 
923  This->callback = callback;
924  return S_OK;
925 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51

◆ InstallEngine_Release()

static ULONG WINAPI InstallEngine_Release ( IInstallEngine2 iface)
static

Definition at line 386 of file inseng_main.c.

387 {
390 
391  TRACE("(%p) ref=%d\n", This, ref);
392 
393  if (!ref)
394  {
395  if (This->icif)
396  ICifFile_Release(This->icif);
397 
398  heap_free(This->baseurl);
399  heap_free(This->downloaddir);
400  heap_free(This);
401  }
402 
403  return ref;
404 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
Definition: send.c:48
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ InstallEngine_Resume()

static HRESULT WINAPI InstallEngine_Resume ( IInstallEngine2 iface)
static

Definition at line 1065 of file inseng_main.c.

1066 {
1068 
1069  FIXME("(%p): stub\n", This);
1070 
1071  return E_NOTIMPL;
1072 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_SetAction()

static HRESULT WINAPI InstallEngine_SetAction ( IInstallEngine2 iface,
const char id,
DWORD  action,
DWORD  priority 
)
static

Definition at line 937 of file inseng_main.c.

938 {
940  ICifComponent *comp;
941  HRESULT hr;
942 
943  TRACE("(%p)->(%s %u %u)\n", This, debugstr_a(id), action, priority);
944 
945  if (!This->icif)
946  return E_FAIL; /* FIXME: check error code */
947 
948  hr = ICifFile_FindComponent(This->icif, id, &comp);
949  if (FAILED(hr)) return hr;
950 
951  hr = ICifComponent_SetInstallQueueState(comp, action);
952  if (FAILED(hr)) return hr;
953 
954  hr = ICifComponent_SetCurrentPriority(comp, priority);
955  return hr;
956 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
HRESULT hr
Definition: shlfolder.c:183
#define E_FAIL
Definition: ddrawi.h:102
WDF_INTERRUPT_PRIORITY priority
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
const WCHAR * action
Definition: action.c:7783

◆ InstallEngine_SetBaseUrl()

static HRESULT WINAPI InstallEngine_SetBaseUrl ( IInstallEngine2 iface,
const char base_name 
)
static

Definition at line 985 of file inseng_main.c.

986 {
988 
989  TRACE("(%p)->(%s)\n", This, debugstr_a(base_name));
990 
991  if (This->baseurl)
992  heap_free(This->baseurl);
993 
994  This->baseurl = strdupA(base_name);
995  return This->baseurl ? S_OK : E_OUTOFMEMORY;
996 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define S_OK
Definition: intsafe.h:51
static LPSTR strdupA(LPCSTR str)
Definition: mimeole.c:482
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ InstallEngine_SetCifFile()

static HRESULT WINAPI InstallEngine_SetCifFile ( IInstallEngine2 iface,
const char cab_name,
const char cif_name 
)
static

Definition at line 819 of file inseng_main.c.

820 {
822 
823  FIXME("(%p)->(%s %s): stub\n", This, debugstr_a(cab_name), debugstr_a(cif_name));
824 
825  return E_NOTIMPL;
826 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_SetDownloadDir()

static HRESULT WINAPI InstallEngine_SetDownloadDir ( IInstallEngine2 iface,
const char download_dir 
)
static

Definition at line 998 of file inseng_main.c.

999 {
1001 
1002  TRACE("(%p)->(%s)\n", This, debugstr_a(download_dir));
1003 
1004  if (This->downloaddir)
1005  heap_free(This->downloaddir);
1006 
1007  This->downloaddir = strdupA(download_dir);
1008  return This->downloaddir ? S_OK : E_OUTOFMEMORY;
1009 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
#define S_OK
Definition: intsafe.h:51
static LPSTR strdupA(LPCSTR str)
Definition: mimeole.c:482
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ InstallEngine_SetHWND()

static HRESULT WINAPI InstallEngine_SetHWND ( IInstallEngine2 iface,
HWND  hwnd 
)
static

Definition at line 1029 of file inseng_main.c.

1030 {
1032 
1033  FIXME("(%p)->(%p): stub\n", This, hwnd);
1034 
1035  return E_NOTIMPL;
1036 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_SetInstallDrive()

static HRESULT WINAPI InstallEngine_SetInstallDrive ( IInstallEngine2 iface,
char  drive 
)
static

Definition at line 1011 of file inseng_main.c.

1012 {
1014 
1015  FIXME("(%p)->(%c): stub\n", This, drive);
1016 
1017  return E_NOTIMPL;
1018 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_SetInstallOptions()

static HRESULT WINAPI InstallEngine_SetInstallOptions ( IInstallEngine2 iface,
DWORD  flags 
)
static

Definition at line 1020 of file inseng_main.c.

1021 {
1023 
1024  FIXME("(%p)->(%x): stub\n", This, flags);
1025 
1026  return E_NOTIMPL;
1027 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
GLbitfield flags
Definition: glext.h:7161
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_SetIStream()

static HRESULT WINAPI InstallEngine_SetIStream ( IInstallEngine2 iface,
IStream stream 
)
static

Definition at line 1038 of file inseng_main.c.

1039 {
1041 
1042  FIXME("(%p)->(%p): stub\n", This, stream);
1043 
1044  return E_NOTIMPL;
1045 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
Definition: parse.h:22
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_Suspend()

static HRESULT WINAPI InstallEngine_Suspend ( IInstallEngine2 iface)
static

Definition at line 1056 of file inseng_main.c.

1057 {
1059 
1060  FIXME("(%p): stub\n", This);
1061 
1062  return E_NOTIMPL;
1063 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define FIXME(fmt,...)
Definition: debug.h:111
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallEngine_UnregisterInstallEngineCallback()

static HRESULT WINAPI InstallEngine_UnregisterInstallEngineCallback ( IInstallEngine2 iface)
static

Definition at line 927 of file inseng_main.c.

928 {
930 
931  TRACE("(%p)\n", This);
932 
933  This->callback = NULL;
934  return S_OK;
935 }
static InstallEngine * impl_from_IInstallEngine2(IInstallEngine2 *iface)
Definition: inseng_main.c:101
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112

◆ InstallEngineCF_CreateInstance()

static HRESULT WINAPI InstallEngineCF_CreateInstance ( IClassFactory iface,
IUnknown outer,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1242 of file inseng_main.c.

1244 {
1246  HRESULT hres;
1247 
1248  TRACE("(%p %s %p)\n", outer, debugstr_guid(riid), ppv);
1249 
1250  engine = heap_alloc_zero(sizeof(*engine));
1251  if(!engine)
1252  return E_OUTOFMEMORY;
1253 
1256  engine->ref = 1;
1257  engine->status = ENGINESTATUS_NOTREADY;
1258 
1259  hres = IInstallEngine2_QueryInterface(&engine->IInstallEngine2_iface, riid, ppv);
1260  IInstallEngine2_Release(&engine->IInstallEngine2_iface);
1261  return hres;
1262 }
static const IInstallEngineTimingVtbl InstallEngineTimingVtbl
Definition: inseng_main.c:1197
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
IInstallEngine2 IInstallEngine2_iface
Definition: inseng_main.c:68
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:79
IInstallEngineTiming IInstallEngineTiming_iface
Definition: inseng_main.c:69
static const IInstallEngine2Vtbl InstallEngine2Vtbl
Definition: inseng_main.c:1111
InstallEngine * engine
Definition: inseng_main.c:96

◆ InstallEngineTiming_AddRef()

static ULONG WINAPI InstallEngineTiming_AddRef ( IInstallEngineTiming iface)
static

Definition at line 1148 of file inseng_main.c.

1149 {
1151  return IInstallEngine2_AddRef(&This->IInstallEngine2_iface);
1152 }
static InstallEngine * impl_from_IInstallEngineTiming(IInstallEngineTiming *iface)
Definition: inseng_main.c:111

◆ InstallEngineTiming_GetInstallProgress()

static HRESULT WINAPI InstallEngineTiming_GetInstallProgress ( IInstallEngineTiming iface,
INSTALLPROGRESS progress 
)
static

Definition at line 1172 of file inseng_main.c.

1173 {
1175  ULONGLONG elapsed;
1176  static int once;
1177 
1178  if (!once)
1179  FIXME("(%p)->(%p): semi-stub\n", This, progress);
1180  else
1181  TRACE("(%p)->(%p): semi-stub\n", This, progress);
1182 
1183  progress->dwDownloadKBRemaining = max(This->thread.download_size, This->thread.downloaded_kb) - This->thread.downloaded_kb;
1184 
1185  elapsed = GetTickCount64() - This->thread.download_start;
1186  if (This->thread.download_start && This->thread.downloaded_kb && elapsed > 100)
1187  progress->dwDownloadSecsRemaining = (progress->dwDownloadKBRemaining * elapsed) / (This->thread.downloaded_kb * 1000);
1188  else
1189  progress->dwDownloadSecsRemaining = -1;
1190 
1191  progress->dwInstallKBRemaining = 0;
1192  progress->dwInstallSecsRemaining = -1;
1193 
1194  return S_OK;
1195 }
#define max(a, b)
Definition: svc.c:63
ULONGLONG WINAPI GetTickCount64(VOID)
Definition: GetTickCount64.c:9
#define FIXME(fmt,...)
Definition: debug.h:111
#define TRACE(s)
Definition: solgame.cpp:4
static InstallEngine * impl_from_IInstallEngineTiming(IInstallEngineTiming *iface)
Definition: inseng_main.c:111
uint64_t ULONGLONG
Definition: typedefs.h:67
#define S_OK
Definition: intsafe.h:51
cd_progress_ptr progress
Definition: cdjpeg.h:152

◆ InstallEngineTiming_GetRates()

static HRESULT WINAPI InstallEngineTiming_GetRates ( IInstallEngineTiming iface,
DWORD download,
DWORD install 
)
static

Definition at line 1160 of file inseng_main.c.

1161 {
1163 
1164  FIXME("(%p)->(%p, %p): stub\n", This, download, install);
1165 
1166  *download = 0;
1167  *install = 0;
1168 
1169  return S_OK;
1170 }
int install
Definition: msacm.c:1365
#define FIXME(fmt,...)
Definition: debug.h:111
static InstallEngine * impl_from_IInstallEngineTiming(IInstallEngineTiming *iface)
Definition: inseng_main.c:111
#define S_OK
Definition: intsafe.h:51

◆ InstallEngineTiming_QueryInterface()

static HRESULT WINAPI InstallEngineTiming_QueryInterface ( IInstallEngineTiming iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 1142 of file inseng_main.c.

1143 {
1145  return IInstallEngine2_QueryInterface(&This->IInstallEngine2_iface, riid, ppv);
1146 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static InstallEngine * impl_from_IInstallEngineTiming(IInstallEngineTiming *iface)
Definition: inseng_main.c:111

◆ InstallEngineTiming_Release()

static ULONG WINAPI InstallEngineTiming_Release ( IInstallEngineTiming iface)
static

Definition at line 1154 of file inseng_main.c.

1155 {
1157  return IInstallEngine2_Release(&This->IInstallEngine2_iface);
1158 }
static InstallEngine * impl_from_IInstallEngineTiming(IInstallEngineTiming *iface)
Definition: inseng_main.c:111

◆ merge_path()

static char* merge_path ( char path1,
char path2 
)
static

Definition at line 556 of file inseng_main.c.

557 {
558  int len = strlen(path1) + strlen(path2) + 2;
559  char *combined = heap_alloc(len);
560 
561  if (!combined) return NULL;
562  strcpy(combined, path1);
563  strcat(combined, "\\");
564  strcat(combined, path2);
565 
566  return combined;
567 }
static const WCHAR path2[]
Definition: path.c:29
char * strcat(char *DstString, const char *SrcString)
Definition: utclib.c:568
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static const WCHAR path1[]
Definition: path.c:28
GLenum GLsizei len
Definition: glext.h:6722
#define NULL
Definition: types.h:112
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388

Referenced by download_url().

◆ process_component()

static HRESULT process_component ( InstallEngine This,
ICifComponent comp 
)
static

Definition at line 658 of file inseng_main.c.

659 {
660  DWORD size_dl, size_install, phase;
661  char display[MAX_DISPLAYNAME_LENGTH+1];
662  char id[MAX_ID_LENGTH+1];
663  HRESULT hr;
664  int i;
665 
666  hr = ICifComponent_GetID(comp, id, sizeof(id));
667  if (FAILED(hr)) return hr;
668 
669  TRACE("processing component %s\n", debugstr_a(id));
670 
671  hr = ICifComponent_GetDescription(comp, display, sizeof(display));
672  if (FAILED(hr)) return hr;
673 
674  size_dl = (This->thread.operation == OP_DOWNLOAD) ? ICifComponent_GetDownloadSize(comp) : 0;
675  size_install = 0; /* (This->thread.operation == OP_INSTALL) ? ICifComponent_GetInstalledSize(comp) : 0; */
676 
677  if (This->callback)
678  {
679  IInstallEngineCallback_OnStartComponent(This->callback, id, size_dl, size_install, display);
680  IInstallEngineCallback_OnComponentProgress(This->callback, id, INSTALLSTATUS_INITIALIZING, display, NULL, 0, 0);
682  }
683 
685  if (FAILED(hr)) return hr;
686 
687  if (This->thread.operation == OP_DOWNLOAD)
688  {
689  for (i = 0;; i++)
690  {
691  DWORD flags;
692  char *url;
693 
695 
696  hr = get_url(comp, i, &url, &flags);
697  if (FAILED(hr)) goto done;
698  if (!url) break;
699 
700  TRACE("processing url %s\n", debugstr_a(url));
701 
702  hr = download_url(This, id, display, url, flags, size_dl);
703  heap_free(url);
704  if (FAILED(hr))
705  {
706  DWORD retry = 0;
707 
708  if (This->callback)
709  IInstallEngineCallback_OnEngineProblem(This->callback, ENGINEPROBLEM_DOWNLOADFAIL, &retry);
710  if (!retry) goto done;
711 
712  i--;
713  continue;
714  }
715 
717  /* FIXME: check trust */
718  IInstallEngineCallback_OnComponentProgress(This->callback, id, INSTALLSTATUS_CHECKINGTRUST, display, NULL, 0, 0);
719  }
720 
723  }
724  else
725  FIXME("Installation not yet implemented\n");
726 
727 done:
728  IInstallEngineCallback_OnStopComponent(This->callback, id, hr, phase, display, 0);
729  return hr;
730 }
HRESULT hr
Definition: shlfolder.c:183
#define TRUE
Definition: types.h:120
static HRESULT get_url(ICifComponent *comp, int index, char **url, DWORD *flags)
Definition: inseng_main.c:473
void component_set_downloaded(ICifComponent *iface, BOOL value)
Definition: icif.c:325
int * display
Definition: x11stubs.c:12
#define FIXME(fmt,...)
Definition: debug.h:111
static HRESULT download_url(InstallEngine *This, char *id, char *display, char *url, DWORD flags, DWORD dl_size)
Definition: inseng_main.c:569
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
static const WCHAR url[]
Definition: encode.c:1432
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
static HRESULT process_component_dependencies(InstallEngine *This, ICifComponent *comp)
Definition: inseng_main.c:639
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define NULL
Definition: types.h:112
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by thread_installation().

◆ process_component_dependencies()

static HRESULT process_component_dependencies ( InstallEngine This,
ICifComponent comp 
)
static

Definition at line 639 of file inseng_main.c.

640 {
641  char id[MAX_ID_LENGTH+1], type;
642  DWORD ver, build;
643  HRESULT hr;
644  int i;
645 
646  for (i = 0;; i++)
647  {
648  hr = ICifComponent_GetDependency(comp, i, id, sizeof(id), &type, &ver, &build);
649  if (SUCCEEDED(hr))
650  FIXME("Can't handle dependencies yet: %s\n", debugstr_a(id));
651  else
652  break;
653  }
654 
655  return S_OK;
656 }
HRESULT hr
Definition: shlfolder.c:183
if SUCCEEDED(hr)
#define FIXME(fmt,...)
Definition: debug.h:111
#define debugstr_a
Definition: kernel32.h:31
LONG HRESULT
Definition: typedefs.h:79
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:51
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545

Referenced by process_component().

◆ set_status()

static void set_status ( InstallEngine This,
DWORD  status 
)
static

Definition at line 406 of file inseng_main.c.

407 {
408  This->status = status;
409 
410  if (This->callback)
411  IInstallEngineCallback_OnEngineStatusChange(This->callback, status, 0);
412 }
static SERVICE_STATUS status
Definition: service.c:31
Definition: ps.c:97

Referenced by InstallEngine2_SetLocalCif(), and thread_installation().

◆ start_installation()

static HRESULT start_installation ( InstallEngine This,
DWORD  operation,
DWORD  jobflags 
)
static

Definition at line 765 of file inseng_main.c.

766 {
767  HANDLE thread;
768  HRESULT hr;
769 
770  This->thread.operation = operation;
771  This->thread.jobflags = jobflags;
772  This->thread.downloaded_kb = 0;
773  This->thread.download_start = 0;
774 
775  /* Windows sends the OnStartInstall event from a different thread,
776  * but OnStartInstall already contains the required download and install size.
777  * The only way to signal an error from the thread is to send an OnStopComponent /
778  * OnStopInstall signal which can only occur after OnStartInstall. We need to
779  * precompute the sizes here to be able inform the application about errors while
780  * calculating the required sizes. */
781 
782  hr = ICifFile_EnumComponents(This->icif, &This->thread.enum_comp, 0, NULL);
783  if (FAILED(hr)) return hr;
784 
785  hr = calc_sizes(This->thread.enum_comp, operation, &This->thread.download_size, &This->thread.install_size);
786  if (FAILED(hr)) goto error;
787 
788  IInstallEngine2_AddRef(&This->IInstallEngine2_iface);
789 
791  if (!thread)
792  {
793  IInstallEngine2_Release(&This->IInstallEngine2_iface);
794  hr = E_FAIL;
795  goto error;
796  }
797 
799  return S_OK;
800 
801 error:
802  IEnumCifComponents_Release(This->thread.enum_comp);
803  return hr;
804 }
#define CloseHandle
Definition: compat.h:598
HRESULT hr
Definition: shlfolder.c:183
#define error(str)
Definition: mkdosfs.c:1605
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT calc_sizes(IEnumCifComponents *enum_comp, DWORD operation, DWORD *size_download, DWORD *size_install)
Definition: inseng_main.c:414
HANDLE WINAPI DECLSPEC_HOTPATCH CreateThread(IN LPSECURITY_ATTRIBUTES lpThreadAttributes, IN DWORD dwStackSize, IN LPTHREAD_START_ROUTINE lpStartAddress, IN LPVOID lpParameter, IN DWORD dwCreationFlags, OUT LPDWORD lpThreadId)
Definition: thread.c:136
LONG HRESULT
Definition: typedefs.h:79
static HANDLE thread
Definition: service.c:33
DWORD WINAPI thread_installation(LPVOID param)
Definition: inseng_main.c:732
#define S_OK
Definition: intsafe.h:51
#define NULL
Definition: types.h:112

Referenced by InstallEngine_DownloadComponents().

◆ thread_installation()

DWORD WINAPI thread_installation ( LPVOID  param)

Definition at line 732 of file inseng_main.c.

733 {
735  ICifComponent *comp;
736  HRESULT hr;
737 
738  if (This->callback)
739  IInstallEngineCallback_OnStartInstall(This->callback, This->thread.download_size, This->thread.install_size);
740 
741  for (;;)
742  {
743  hr = get_next_component(This->thread.enum_comp, This->thread.operation, &comp);
744  if (FAILED(hr)) break;
745  if (hr == S_FALSE)
746  {
747  hr = S_OK;
748  break;
749  }
750 
751  hr = process_component(This, comp);
752  if (FAILED(hr)) break;
753  }
754 
755  if (This->callback)
756  IInstallEngineCallback_OnStopInstall(This->callback, hr, NULL, 0);
757 
758  IEnumCifComponents_Release(This->thread.enum_comp);
759  IInstallEngine2_Release(&This->IInstallEngine2_iface);
760 
761  set_status(This, ENGINESTATUS_READY);
762  return 0;
763 }
static HRESULT process_component(InstallEngine *This, ICifComponent *comp)
Definition: inseng_main.c:658
static void set_status(InstallEngine *This, DWORD status)
Definition: inseng_main.c:406
HRESULT hr
Definition: shlfolder.c:183
#define S_FALSE
Definition: winerror.h:2357
LONG HRESULT
Definition: typedefs.h:79
GLfloat param
Definition: glext.h:5796
#define S_OK
Definition: intsafe.h:51
static HRESULT get_next_component(IEnumCifComponents *enum_comp, DWORD operation, ICifComponent **ret_comp)
Definition: inseng_main.c:447
#define NULL
Definition: types.h:112

Referenced by start_installation().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( inseng  )

Variable Documentation

◆ BindStatusCallbackVtbl

const IBindStatusCallbackVtbl BindStatusCallbackVtbl
static
Initial value:
=
{
}
static HRESULT WINAPI downloadcb_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
Definition: inseng_main.c:295
static ULONG WINAPI downloadcb_Release(IBindStatusCallback *iface)
Definition: inseng_main.c:151
static HRESULT WINAPI downloadcb_OnStartBinding(IBindStatusCallback *iface, DWORD reserved, IBinding *pbind)
Definition: inseng_main.c:170
static HRESULT WINAPI downloadcb_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
Definition: inseng_main.c:243
static HRESULT WINAPI downloadcb_OnDataAvailable(IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
Definition: inseng_main.c:285
static HRESULT WINAPI downloadcb_OnLowResource(IBindStatusCallback *iface, DWORD reserved)
Definition: inseng_main.c:188
static HRESULT WINAPI downloadcb_OnProgress(IBindStatusCallback *iface, ULONG progress, ULONG progress_max, ULONG status, const WCHAR *status_text)
Definition: inseng_main.c:197
static HRESULT WINAPI downloadcb_GetPriority(IBindStatusCallback *iface, LONG *priority)
Definition: inseng_main.c:179
static ULONG WINAPI downloadcb_AddRef(IBindStatusCallback *iface)
Definition: inseng_main.c:141
static HRESULT WINAPI downloadcb_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv)
Definition: inseng_main.c:116
static HRESULT WINAPI downloadcb_GetBindInfo(IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
Definition: inseng_main.c:274

Definition at line 305 of file inseng_main.c.

Referenced by downloadcb_create().

◆ InstallEngine2Vtbl

const IInstallEngine2Vtbl InstallEngine2Vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI InstallEngine_GetSizes(IInstallEngine2 *iface, const char *id, COMPONENT_SIZES *sizes)
Definition: inseng_main.c:958
static HRESULT WINAPI InstallEngine_UnregisterInstallEngineCallback(IInstallEngine2 *iface)
Definition: inseng_main.c:927
static HRESULT WINAPI InstallEngine_RegisterInstallEngineCallback(IInstallEngine2 *iface, IInstallEngineCallback *callback)
Definition: inseng_main.c:917
static HRESULT WINAPI InstallEngine_SetHWND(IInstallEngine2 *iface, HWND hwnd)
Definition: inseng_main.c:1029
static HRESULT WINAPI InstallEngine_SetCifFile(IInstallEngine2 *iface, const char *cab_name, const char *cif_name)
Definition: inseng_main.c:819
static HRESULT WINAPI InstallEngine_Resume(IInstallEngine2 *iface)
Definition: inseng_main.c:1065
static ULONG WINAPI InstallEngine_AddRef(IInstallEngine2 *iface)
Definition: inseng_main.c:376
static HRESULT WINAPI InstallEngine_SetAction(IInstallEngine2 *iface, const char *id, DWORD action, DWORD priority)
Definition: inseng_main.c:937
static HRESULT WINAPI InstallEngine_SetInstallDrive(IInstallEngine2 *iface, char drive)
Definition: inseng_main.c:1011
static HRESULT WINAPI InstallEngine_SetIStream(IInstallEngine2 *iface, IStream *stream)
Definition: inseng_main.c:1038
static HRESULT WINAPI InstallEngine_SetDownloadDir(IInstallEngine2 *iface, const char *download_dir)
Definition: inseng_main.c:998
static HRESULT WINAPI InstallEngine_QueryInterface(IInstallEngine2 *iface, REFIID riid, void **ppv)
Definition: inseng_main.c:350
static HRESULT WINAPI InstallEngine_SetBaseUrl(IInstallEngine2 *iface, const char *base_name)
Definition: inseng_main.c:985
static HRESULT WINAPI InstallEngine_EnumDownloadIDs(IInstallEngine2 *iface, UINT index, char **id)
Definition: inseng_main.c:862
static HRESULT WINAPI InstallEngine_IsComponentInstalled(IInstallEngine2 *iface, const char *id, DWORD *status)
Definition: inseng_main.c:908
static HRESULT WINAPI InstallEngine_InstallComponents(IInstallEngine2 *iface, DWORD flags)
Definition: inseng_main.c:844
static HRESULT WINAPI InstallEngine_GetEngineStatus(IInstallEngine2 *iface, DWORD *status)
Definition: inseng_main.c:806
static HRESULT WINAPI InstallEngine_DownloadComponents(IInstallEngine2 *iface, DWORD flags)
Definition: inseng_main.c:828
static HRESULT WINAPI InstallEngine_Abort(IInstallEngine2 *iface, DWORD flags)
Definition: inseng_main.c:1047
static HRESULT WINAPI InstallEngine2_GetICifFile(IInstallEngine2 *iface, ICifFile **cif_file)
Definition: inseng_main.c:1097
static HRESULT WINAPI InstallEngine_SetInstallOptions(IInstallEngine2 *iface, DWORD flags)
Definition: inseng_main.c:1020
static ULONG WINAPI InstallEngine_Release(IInstallEngine2 *iface)
Definition: inseng_main.c:386
static HRESULT WINAPI InstallEngine2_SetLocalCif(IInstallEngine2 *iface, const char *cif)
Definition: inseng_main.c:1074
static HRESULT WINAPI InstallEngine_EnumInstallIDs(IInstallEngine2 *iface, UINT index, char **id)
Definition: inseng_main.c:853
static HRESULT WINAPI InstallEngine_Suspend(IInstallEngine2 *iface)
Definition: inseng_main.c:1056
static HRESULT WINAPI InstallEngine_GetDisplayName(IInstallEngine2 *iface, const char *id, const char *name)
Definition: inseng_main.c:976
static HRESULT WINAPI InstallEngine_LaunchExtraCommand(IInstallEngine2 *iface, const char *inf_name, const char *section)
Definition: inseng_main.c:967

Definition at line 1111 of file inseng_main.c.

Referenced by InstallEngineCF_CreateInstance().

◆ InstallEngineCF

IClassFactory InstallEngineCF = { &InstallEngineCFVtbl }
static

Definition at line 1272 of file inseng_main.c.

Referenced by DllGetClassObject().

◆ InstallEngineCFVtbl

const IClassFactoryVtbl InstallEngineCFVtbl
static
Initial value:
= {
}
static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL fLock)
Definition: inseng_main.c:1237
static HRESULT WINAPI InstallEngineCF_CreateInstance(IClassFactory *iface, IUnknown *outer, REFIID riid, void **ppv)
Definition: inseng_main.c:1242
static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
Definition: inseng_main.c:1227
static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
Definition: inseng_main.c:1232
static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppv)
Definition: inseng_main.c:1206

Definition at line 1264 of file inseng_main.c.

◆ InstallEngineTimingVtbl

const IInstallEngineTimingVtbl InstallEngineTimingVtbl
static
Initial value:
=
{
}
static ULONG WINAPI InstallEngineTiming_Release(IInstallEngineTiming *iface)
Definition: inseng_main.c:1154
static HRESULT WINAPI InstallEngineTiming_QueryInterface(IInstallEngineTiming *iface, REFIID riid, void **ppv)
Definition: inseng_main.c:1142
static HRESULT WINAPI InstallEngineTiming_GetRates(IInstallEngineTiming *iface, DWORD *download, DWORD *install)
Definition: inseng_main.c:1160
static HRESULT WINAPI InstallEngineTiming_GetInstallProgress(IInstallEngineTiming *iface, INSTALLPROGRESS *progress)
Definition: inseng_main.c:1172
static ULONG WINAPI InstallEngineTiming_AddRef(IInstallEngineTiming *iface)
Definition: inseng_main.c:1148

Definition at line 1197 of file inseng_main.c.

Referenced by InstallEngineCF_CreateInstance().

◆ instance

HINSTANCE instance
static

Definition at line 46 of file inseng_main.c.

Referenced by DllMain(), DllRegisterServer(), and DllUnregisterServer().