Inside Windows-Update

Automatic Update for Update

The component DLL also contains a type library that describes the IUpdate interface that we can now work with. Two functions of this interface are important for us:

long Initialize(long flag, IUnknown *unk)
BSTR GetSystemSpec(BSTR classes)

Initialize() must be the first function that we call when using the COM component. The semantics of the flag parameter are not known to us and we set this parameter to zero to imitate the behavior of the Windows Update Java Script code. Initialize() contacts the Microsoft server, checks for a newer version of the component, and automatically updates the component if necessary. The interface parameter must point to the IUnknown interface of an UpdateCompleteListener object, which is also described in the type library. This object seems to implement a callback function that is called when the component has been successfully updated.

If updating iuctl.dll is necessary but fails, Initialize() returns 1. If updating iuengine.dll is necessary but fails, Initialize() returns 2. If both DLLs require an update but updating fails, 3 is returned.

For the sake of simplicity we set the interface parameter to NULL. This seems to have the effect that updating either DLL always fails.