ReactOS 0.4.15-dev-7889-g76290a6
addons.c File Reference
#include "appwiz.h"
#include <stdio.h>
#include <msi.h>
Include dependency graph for addons.c:

Go to the source code of this file.

Classes

struct  addon_info_t
 
struct  SHA_CTX
 

Macros

#define GECKO_VERSION   "2.40"
 
#define ARCH_STRING   ""
 
#define GECKO_SHA   "???"
 

Typedefs

typedef struct SHA_CTXPSHA_CTX
 

Enumerations

enum  install_res { INSTALL_OK = 0 , INSTALL_FAILED , INSTALL_NEXT }
 

Functions

void WINAPI A_SHAInit (PSHA_CTX)
 
void WINAPI A_SHAUpdate (PSHA_CTX, const unsigned char *, UINT)
 
void WINAPI A_SHAFinal (PSHA_CTX, PULONG)
 
static BOOL sha_check (const WCHAR *file_name)
 
static void set_status (DWORD id)
 
static enum install_res install_file (const WCHAR *file_name)
 
static enum install_res install_from_unix_file (const char *dir, const char *subdir, const char *file_name)
 
static enum install_res install_from_registered_dir (void)
 
static HRESULT WINAPI InstallCallback_QueryInterface (IBindStatusCallback *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InstallCallback_AddRef (IBindStatusCallback *iface)
 
static ULONG WINAPI InstallCallback_Release (IBindStatusCallback *iface)
 
static HRESULT WINAPI InstallCallback_OnStartBinding (IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib)
 
static HRESULT WINAPI InstallCallback_GetPriority (IBindStatusCallback *iface, LONG *pnPriority)
 
static HRESULT WINAPI InstallCallback_OnLowResource (IBindStatusCallback *iface, DWORD dwReserved)
 
static HRESULT WINAPI InstallCallback_OnProgress (IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
 
static HRESULT WINAPI InstallCallback_OnStopBinding (IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
 
static HRESULT WINAPI InstallCallback_GetBindInfo (IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
 
static HRESULT WINAPI InstallCallback_OnDataAvailable (IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
 
static HRESULT WINAPI InstallCallback_OnObjectAvailable (IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
 
static DWORD WINAPI download_proc (PVOID arg)
 
static INT_PTR CALLBACK installer_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
 
BOOL install_addon (addon_t addon_type, HWND hwnd_parent)
 

Variables

static const addon_info_t addons_info []
 
static const addon_info_taddon
 
static HWND install_dialog = NULL
 
static CRITICAL_SECTION csLock
 
static IBindingdownload_binding = NULL
 
static WCHAR GeckoUrl [] = L"https://svn.reactos.org/amine/wine_gecko-2.40-x86.msi"
 
static const CHAR mshtml_keyA []
 
static const IBindStatusCallbackVtbl InstallCallbackVtbl
 
static IBindStatusCallback InstallCallback = { &InstallCallbackVtbl }
 

Macro Definition Documentation

◆ ARCH_STRING

#define ARCH_STRING   ""

Definition at line 35 of file addons.c.

◆ GECKO_SHA

#define GECKO_SHA   "???"

Definition at line 36 of file addons.c.

◆ GECKO_VERSION

#define GECKO_VERSION   "2.40"

Definition at line 28 of file nsiface.idl.

Typedef Documentation

◆ PSHA_CTX

typedef struct SHA_CTX * PSHA_CTX

Enumeration Type Documentation

◆ install_res

Enumerator
INSTALL_OK 
INSTALL_FAILED 
INSTALL_NEXT 

Definition at line 131 of file addons.c.

131 {
132 INSTALL_OK = 0,
135};
@ INSTALL_OK
Definition: addons.c:132
@ INSTALL_NEXT
Definition: addons.c:134
@ INSTALL_FAILED
Definition: addons.c:133

Function Documentation

◆ A_SHAFinal()

void WINAPI A_SHAFinal ( PSHA_CTX  Context,
PULONG  Result 
)

Definition at line 171 of file sha1.c.

172{
173 INT Pad, Index;
174 UCHAR Buffer[72];
175 ULONG *Count;
176 ULONG BufferContentSize, LengthHi, LengthLo;
177
178 BufferContentSize = Context->Count[1] & 63;
179 if (BufferContentSize >= 56)
180 Pad = 56 + 64 - BufferContentSize;
181 else
182 Pad = 56 - BufferContentSize;
183
184 LengthHi = (Context->Count[0] << 3) | (Context->Count[1] >> (32 - 3));
185 LengthLo = (Context->Count[1] << 3);
186
187 memset(Buffer + 1, 0, Pad - 1);
188 Buffer[0] = 0x80;
189 Count = (ULONG*)(Buffer + Pad);
190 Count[0] = DWORD2BE(LengthHi);
191 Count[1] = DWORD2BE(LengthLo);
193
194 for (Index = 0; Index < 5; Index++)
195 Result[Index] = DWORD2BE(Context->State[Index]);
196
198}
char * Pad(char *Str, char PadChar, ULONG Length)
Definition: cabman.cxx:29
Definition: bufpool.h:45
int Count
Definition: noreturn.cpp:7
VOID NTAPI A_SHAUpdate(PSHA_CTX Context, const unsigned char *Buffer, ULONG BufferSize)
Definition: sha1.c:128
#define DWORD2BE(x)
Definition: sha1.c:26
VOID NTAPI A_SHAInit(PSHA_CTX Context)
Definition: sha1.c:102
#define memset(x, y, z)
Definition: compat.h:39
int32_t INT
Definition: typedefs.h:58
uint32_t ULONG
Definition: typedefs.h:59
_In_ WDFCOLLECTION _In_ ULONG Index
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
Definition: wsk.h:409
unsigned char UCHAR
Definition: xmlstorage.h:181

Referenced by sha_check(), and VerifyInteg().

◆ A_SHAInit()

void WINAPI A_SHAInit ( PSHA_CTX  Context)

Definition at line 102 of file sha1.c.

103{
104 /* SHA1 initialization constants */
105 Context->State[0] = 0x67452301;
106 Context->State[1] = 0xEFCDAB89;
107 Context->State[2] = 0x98BADCFE;
108 Context->State[3] = 0x10325476;
109 Context->State[4] = 0xC3D2E1F0;
110 Context->Count[0] =
111 Context->Count[1] = 0;
112}

Referenced by sha_check(), and VerifyInteg().

◆ A_SHAUpdate()

void WINAPI A_SHAUpdate ( PSHA_CTX  Context,
const unsigned char Buffer,
UINT  BufferSize 
)

Definition at line 128 of file sha1.c.

129{
130 ULONG BufferContentSize;
131
132 BufferContentSize = Context->Count[1] & 63;
133 Context->Count[1] += BufferSize;
134 if (Context->Count[1] < BufferSize)
135 Context->Count[0]++;
136 Context->Count[0] += (BufferSize >> 29);
137
138 if (BufferContentSize + BufferSize < 64)
139 {
140 memcpy(&Context->Buffer[BufferContentSize], Buffer,
141 BufferSize);
142 }
143 else
144 {
145 while (BufferContentSize + BufferSize >= 64)
146 {
147 memcpy(Context->Buffer + BufferContentSize, Buffer,
148 64 - BufferContentSize);
149 Buffer += 64 - BufferContentSize;
150 BufferSize -= 64 - BufferContentSize;
151 SHA1Transform(Context->State, Context->Buffer);
152 BufferContentSize = 0;
153 }
154 memcpy(Context->Buffer + BufferContentSize, Buffer, BufferSize);
155 }
156}
#define BufferSize
Definition: mmc.h:75
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static void SHA1Transform(ULONG State[5], UCHAR Buffer[64])
Definition: sha1.c:42
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:254

Referenced by sha_check(), and VerifyInteg().

◆ download_proc()

static DWORD WINAPI download_proc ( PVOID  arg)
static

Definition at line 357 of file addons.c.

358{
359 WCHAR message[256];
360 WCHAR tmp_dir[MAX_PATH], tmp_file[MAX_PATH];
361 HRESULT hres, hrCoInit;
362
364
365 GetTempPathW(sizeof(tmp_dir)/sizeof(WCHAR), tmp_dir);
366 GetTempFileNameW(tmp_dir, NULL, 0, tmp_file);
367
368 TRACE("using temp file %s\n", debugstr_w(tmp_file));
369
371 if(FAILED(hres)) {
372 if (LoadStringW(hApplet, IDS_DWL_FAILED, message, sizeof(message) / sizeof(WCHAR))) {
373 /* If the user aborted the download, DO NOT display the message box */
374 if (hres == E_ABORT) {
375 TRACE("Downloading of Gecko package aborted!\n");
376 } else {
378 }
379 }
380 ERR("URLDownloadToFile failed: %08x\n", hres);
381 } else {
382 if(sha_check(tmp_file)) {
383 install_file(tmp_file);
384 }else {
385 if(LoadStringW(hApplet, IDS_INVALID_SHA, message, sizeof(message)/sizeof(WCHAR))) {
387 }
388 }
389 }
390
391 DeleteFileW(tmp_file);
393
394 if (SUCCEEDED(hrCoInit))
396
397 return 0;
398}
static BOOL sha_check(const WCHAR *file_name)
Definition: addons.c:80
static HWND install_dialog
Definition: addons.c:61
static enum install_res install_file(const WCHAR *file_name)
Definition: addons.c:137
static WCHAR GeckoUrl[]
Definition: addons.c:65
#define ERR(fmt,...)
Definition: debug.h:110
#define NULL
Definition: types.h:112
HINSTANCE hApplet
Definition: access.c:17
#define IDS_INVALID_SHA
Definition: resource.h:36
#define IDS_DWL_FAILED
Definition: resource.h:37
#define MAX_PATH
Definition: compat.h:34
BOOL WINAPI DeleteFileW(IN LPCWSTR lpFileName)
Definition: delete.c:39
DWORD WINAPI GetTempPathW(IN DWORD count, OUT LPWSTR path)
Definition: path.c:2080
HRESULT WINAPI DECLSPEC_HOTPATCH CoInitializeEx(LPVOID lpReserved, DWORD dwCoInit)
Definition: compobj.c:2002
void WINAPI DECLSPEC_HOTPATCH CoUninitialize(void)
Definition: compobj.c:2067
UINT WINAPI GetTempFileNameW(IN LPCWSTR lpPathName, IN LPCWSTR lpPrefixString, IN UINT uUnique, OUT LPWSTR lpTempFileName)
Definition: filename.c:84
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
HRESULT hres
Definition: protocol.c:465
@ COINIT_MULTITHREADED
Definition: objbase.h:279
#define TRACE(s)
Definition: solgame.cpp:4
Definition: tftpd.h:60
HRESULT WINAPI URLDownloadToFileW(LPUNKNOWN pCaller, LPCWSTR szURL, LPCWSTR szFileName, DWORD dwReserved, LPBINDSTATUSCALLBACK lpfnCB)
Definition: download.c:427
#define E_ABORT
Definition: winerror.h:2366
#define IDCANCEL
Definition: winuser.h:831
BOOL WINAPI PostMessageW(_In_opt_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
#define WM_COMMAND
Definition: winuser.h:1740
int WINAPI MessageBoxW(_In_opt_ HWND hWnd, _In_opt_ LPCWSTR lpText, _In_opt_ LPCWSTR lpCaption, _In_ UINT uType)
#define MB_ICONERROR
Definition: winuser.h:787
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by installer_proc().

◆ install_addon()

BOOL install_addon ( addon_t  addon_type,
HWND  hwnd_parent 
)

Definition at line 450 of file addons.c.

451{
452
453 if(!*ARCH_STRING)
454 return FALSE;
455
456 addon = addons_info + addon_type;
457
459
460 /*
461 * Try to find addon .msi file in following order:
462 * - directory stored in $dir_config_key value of HKCU/Wine/Software/$config_key key
463 * - download the package
464 */
467
469
470 return TRUE;
471}
static INT_PTR CALLBACK installer_proc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
Definition: addons.c:400
#define ARCH_STRING
Definition: addons.c:35
static CRITICAL_SECTION csLock
Definition: addons.c:62
static enum install_res install_from_registered_dir(void)
Definition: addons.c:200
static const addon_info_t addons_info[]
Definition: addons.c:48
static const addon_info_t * addon
Definition: addons.c:59
static HWND hwnd_parent
Definition: dce.c:36
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
LPCWSTR dialog_template
Definition: addons.c:45
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
Definition: synch.c:751
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
#define DialogBoxW(i, t, p, f)
Definition: winuser.h:4399

Referenced by start_params().

◆ install_file()

static enum install_res install_file ( const WCHAR file_name)
static

Definition at line 137 of file addons.c.

138{
139 ULONG res;
140
142 if(res != ERROR_SUCCESS) {
143 ERR("MsiInstallProduct failed: %u\n", res);
144 return INSTALL_FAILED;
145 }
146
147 return INSTALL_OK;
148}
#define ERROR_SUCCESS
Definition: deptool.c:10
UINT WINAPI MsiInstallProductW(LPCWSTR szPackagePath, LPCWSTR szCommandLine)
Definition: msi.c:230
GLuint res
Definition: glext.h:9613
static LPCWSTR file_name
Definition: protocol.c:147

Referenced by download_proc(), and install_from_unix_file().

◆ install_from_registered_dir()

static enum install_res install_from_registered_dir ( void  )
static

Definition at line 200 of file addons.c.

201{
202 char *package_dir;
204 enum install_res ret;
205
206 package_dir = heap_alloc(size + sizeof(addon->file_name));
207
208 res = RegGetValueA(HKEY_CURRENT_USER, mshtml_keyA, "GeckoCabDir", RRF_RT_ANY, &type, (PBYTE)package_dir, &size);
209 if(res == ERROR_MORE_DATA) {
210 package_dir = heap_realloc(package_dir, size + sizeof(addon->file_name));
211 res = RegGetValueA(HKEY_CURRENT_USER, mshtml_keyA, "GeckoCabDir", RRF_RT_ANY, &type, (PBYTE)package_dir, &size);
212 }
213
214 if(res != ERROR_SUCCESS || (type != REG_SZ && type != REG_EXPAND_SZ)) {
215 heap_free(package_dir);
216 return INSTALL_FAILED;
217 }
218
219 if (type == REG_EXPAND_SZ)
220 {
221 size = ExpandEnvironmentStringsA(package_dir, NULL, 0);
222 if (size)
223 {
224 char* buf = heap_alloc(size + sizeof(addon->file_name));
225 ExpandEnvironmentStringsA(package_dir, buf, size);
226 heap_free(package_dir);
227 package_dir = buf;
228 }
229 }
230
231 TRACE("Trying %s/%s\n", debugstr_a(package_dir), debugstr_a(addon->file_name));
232
233 ret = install_from_unix_file(package_dir, "", addon->file_name);
234
235 heap_free(package_dir);
236 return ret;
237}
static enum install_res install_from_unix_file(const char *dir, const char *subdir, const char *file_name)
Definition: addons.c:150
static const CHAR mshtml_keyA[]
Definition: addons.c:195
install_res
Definition: addons.c:131
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:71
#define ERROR_MORE_DATA
Definition: dderror.h:13
LSTATUS WINAPI RegGetValueA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:2037
DWORD WINAPI ExpandEnvironmentStringsA(IN LPCSTR lpSrc, IN LPSTR lpDst, IN DWORD nSize)
Definition: environ.c:399
unsigned long DWORD
Definition: ntddk_ex.h:95
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLsizeiptr size
Definition: glext.h:5919
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define debugstr_a
Definition: kernel32.h:31
#define REG_SZ
Definition: layer.c:22
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
BYTE * PBYTE
Definition: pedump.c:66
const char * file_name
Definition: addons.c:41
int ret
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define RRF_RT_ANY
Definition: winreg.h:64

Referenced by install_addon().

◆ install_from_unix_file()

static enum install_res install_from_unix_file ( const char dir,
const char subdir,
const char file_name 
)
static

Definition at line 150 of file addons.c.

151{
152 LPWSTR dos_file_name;
153 char *file_path;
154 int fd, len;
155 enum install_res ret;
156 UINT res;
157
158 len = strlen(dir);
160 if(!file_path)
161 return INSTALL_FAILED;
162
164 if(len && file_path[len-1] != '/' && file_path[len-1] != '\\')
165 file_path[len++] = '/';
166 if(*subdir) {
167 strcpy(file_path+len, subdir);
168 len += strlen(subdir);
169 file_path[len++] = '/';
170 }
172
174 if(fd == -1) {
175 TRACE("%s not found\n", debugstr_a(file_path));
177 return INSTALL_NEXT;
178 }
179
180 _close(fd);
181
182 WARN("Could not get wine_get_dos_file_name function, calling install_cab directly.\n");
183 res = MultiByteToWideChar( CP_ACP, 0, file_path, -1, 0, 0);
184 dos_file_name = heap_alloc (res*sizeof(WCHAR));
185 MultiByteToWideChar( CP_ACP, 0, file_path, -1, dos_file_name, res);
186
188
189 ret = install_file(dos_file_name);
190
191 heap_free(dos_file_name);
192 return ret;
193}
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
#define O_RDONLY
Definition: acwin.h:108
unsigned int dir
Definition: maze.c:112
#define WARN(fmt,...)
Definition: debug.h:112
#define CP_ACP
Definition: compat.h:109
#define MultiByteToWideChar
Definition: compat.h:110
GLenum GLsizei len
Definition: glext.h:6722
unsigned int UINT
Definition: ndis.h:50
_Check_return_opt_ _CRTIMP int __cdecl _close(_In_ int _FileHandle)
_CRTIMP int __cdecl _open(const char *_Filename, int _OpenFlag,...)
Definition: file.c:2001
static int fd
Definition: io.c:51
TCHAR file_path[MAX_PATH]
Definition: sndrec32.cpp:57
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by install_from_registered_dir().

◆ InstallCallback_AddRef()

static ULONG WINAPI InstallCallback_AddRef ( IBindStatusCallback iface)
static

Definition at line 250 of file addons.c.

251{
252 return 2;
253}

◆ InstallCallback_GetBindInfo()

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

Definition at line 321 of file addons.c.

323{
324 return E_NOTIMPL;
325}
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InstallCallback_GetPriority()

static HRESULT WINAPI InstallCallback_GetPriority ( IBindStatusCallback iface,
LONG pnPriority 
)
static

Definition at line 274 of file addons.c.

276{
277 return E_NOTIMPL;
278}

◆ InstallCallback_OnDataAvailable()

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

Definition at line 327 of file addons.c.

329{
330 ERR("\n");
331 return E_NOTIMPL;
332}

◆ InstallCallback_OnLowResource()

static HRESULT WINAPI InstallCallback_OnLowResource ( IBindStatusCallback iface,
DWORD  dwReserved 
)
static

Definition at line 280 of file addons.c.

282{
283 return E_NOTIMPL;
284}

◆ InstallCallback_OnObjectAvailable()

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

Definition at line 334 of file addons.c.

336{
337 ERR("\n");
338 return E_NOTIMPL;
339}

◆ InstallCallback_OnProgress()

static HRESULT WINAPI InstallCallback_OnProgress ( IBindStatusCallback iface,
ULONG  ulProgress,
ULONG  ulProgressMax,
ULONG  ulStatusCode,
LPCWSTR  szStatusText 
)
static

Definition at line 286 of file addons.c.

288{
290
291 if(ulProgressMax)
292 SendMessageW(progress, PBM_SETRANGE32, 0, ulProgressMax);
293 if(ulProgress)
294 SendMessageW(progress, PBM_SETPOS, ulProgress, 0);
295
296 return S_OK;
297}
cd_progress_ptr progress
Definition: cdjpeg.h:152
#define ID_DWL_PROGRESS
Definition: resource.h:47
#define S_OK
Definition: intsafe.h:52
#define PBM_SETRANGE32
Definition: commctrl.h:2188
#define PBM_SETPOS
Definition: commctrl.h:2184
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

◆ InstallCallback_OnStartBinding()

static HRESULT WINAPI InstallCallback_OnStartBinding ( IBindStatusCallback iface,
DWORD  dwReserved,
IBinding pib 
)
static

Definition at line 260 of file addons.c.

262{
264
265 IBinding_AddRef(pib);
266
268 download_binding = pib;
270
271 return S_OK;
272}
static void set_status(DWORD id)
Definition: addons.c:122
static IBinding * download_binding
Definition: addons.c:63
#define IDS_DOWNLOADING
Definition: resource.h:34
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)

◆ InstallCallback_OnStopBinding()

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

Definition at line 299 of file addons.c.

301{
303 if(download_binding) {
304 IBinding_Release(download_binding);
306 }
308
309 if(FAILED(hresult)) {
310 if(hresult == E_ABORT)
311 TRACE("Binding aborted\n");
312 else
313 ERR("Binding failed %08x\n", hresult);
314 return S_OK;
315 }
316
318 return S_OK;
319}
#define IDS_INSTALLING
Definition: resource.h:35

◆ InstallCallback_QueryInterface()

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

Definition at line 239 of file addons.c.

241{
242 if(IsEqualGUID(&IID_IUnknown, riid) || IsEqualGUID(&IID_IBindStatusCallback, riid)) {
243 *ppv = iface;
244 return S_OK;
245 }
246
247 return E_INVALIDARG;
248}
const GUID IID_IUnknown
#define E_INVALIDARG
Definition: ddrawi.h:101
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define IsEqualGUID(rguid1, rguid2)
Definition: guiddef.h:147

◆ InstallCallback_Release()

static ULONG WINAPI InstallCallback_Release ( IBindStatusCallback iface)
static

Definition at line 255 of file addons.c.

256{
257 return 1;
258}

◆ installer_proc()

static INT_PTR CALLBACK installer_proc ( HWND  hwnd,
UINT  msg,
WPARAM  wParam,
LPARAM  lParam 
)
static

Definition at line 400 of file addons.c.

401{
402 HWND hwndProgress, hwndInstallButton;
403 switch(msg) {
404 case WM_INITDIALOG:
405 hwndProgress = GetDlgItem(hwnd, ID_DWL_PROGRESS);
406
407 /* CORE-5737: Move focus before SW_HIDE */
408 if (hwndProgress == GetFocus())
410
411 ShowWindow(hwndProgress, SW_HIDE);
413 return TRUE;
414
415 case WM_NOTIFY:
416 break;
417
418 case WM_COMMAND:
419 switch(wParam) {
420 case IDCANCEL:
422 if(download_binding) {
423 IBinding_Abort(download_binding);
424 }
425 else {
426 EndDialog(hwnd, 0);
427 }
429 return FALSE;
430
431 case ID_DWL_INSTALL:
433
434 /* CORE-17550: Never leave focus on a disabled control (Old/New/Thing p.228) */
435 hwndInstallButton = GetDlgItem(hwnd, ID_DWL_INSTALL);
436 if (hwndInstallButton == GetFocus())
437 {
439 }
440 EnableWindow(hwndInstallButton, FALSE);
441
443 return FALSE;
444 }
445 }
446
447 return FALSE;
448}
static DWORD WINAPI download_proc(PVOID arg)
Definition: addons.c:357
#define msg(x)
Definition: auth_time.c:54
WPARAM wParam
Definition: combotst.c:138
#define ID_DWL_INSTALL
Definition: resource.h:48
#define CloseHandle
Definition: compat.h:739
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:137
#define WM_NOTIFY
Definition: richedit.h:61
_In_ LONG _In_ HWND hwnd
Definition: winddi.h:4023
HWND WINAPI GetFocus(void)
Definition: window.c:1893
#define SW_HIDE
Definition: winuser.h:768
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
#define WM_INITDIALOG
Definition: winuser.h:1739
#define WM_NEXTDLGCTL
Definition: winuser.h:1643
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
#define SW_SHOW
Definition: winuser.h:775
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)

Referenced by install_addon().

◆ set_status()

static void set_status ( DWORD  id)
static

Definition at line 122 of file addons.c.

123{
125 WCHAR buf[64];
126
127 LoadStringW(hApplet, id, buf, sizeof(buf)/sizeof(WCHAR));
129}
#define ID_DWL_STATUS
Definition: resource.h:49
Definition: ps.c:97
LONG_PTR LPARAM
Definition: windef.h:208
#define WM_SETTEXT
Definition: winuser.h:1617

Referenced by InstallCallback_OnStartBinding(), and InstallCallback_OnStopBinding().

◆ sha_check()

static BOOL sha_check ( const WCHAR file_name)
static

Definition at line 80 of file addons.c.

81{
82 const unsigned char *file_map;
84 ULONG sha[5];
85 char buf[2*sizeof(sha)+1];
87 DWORD size, i;
88
91 return FALSE;
92
94
97 if(!map)
98 return FALSE;
99
100 file_map = MapViewOfFile(map, FILE_MAP_READ, 0, 0, 0);
102 if(!file_map)
103 return FALSE;
104
105 A_SHAInit(&ctx);
106 A_SHAUpdate(&ctx, file_map, size);
107 A_SHAFinal(&ctx, sha);
108
109 UnmapViewOfFile(file_map);
110
111 for(i=0; i < sizeof(sha); i++)
112 sprintf(buf + i*2, "%02x", *((unsigned char*)sha+i));
113
114 if(strcmp(buf, addon->sha)) {
115 WARN("Got %s, expected %s\n", buf, addon->sha);
116 return FALSE;
117 }
118
119 return TRUE;
120}
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
void WINAPI A_SHAInit(PSHA_CTX)
Definition: sha1.c:102
void WINAPI A_SHAUpdate(PSHA_CTX, const unsigned char *, UINT)
Definition: sha1.c:128
void WINAPI A_SHAFinal(PSHA_CTX, PULONG)
Definition: sha1.c:171
Definition: _map.h:48
static const WCHAR sha[]
Definition: oid.c:1218
#define PAGE_READONLY
Definition: compat.h:138
#define UnmapViewOfFile
Definition: compat.h:746
#define OPEN_EXISTING
Definition: compat.h:775
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
#define CreateFileMappingW(a, b, c, d, e, f)
Definition: compat.h:744
#define GENERIC_READ
Definition: compat.h:135
#define CreateFileW
Definition: compat.h:741
#define FILE_MAP_READ
Definition: compat.h:776
#define MapViewOfFile
Definition: compat.h:745
DWORD WINAPI GetFileSize(HANDLE hFile, LPDWORD lpFileSizeHigh)
Definition: fileinfo.c:331
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 sprintf(buf, format,...)
Definition: sprintf.c:55
#define FILE_ATTRIBUTE_READONLY
Definition: nt_native.h:702
Definition: addons.c:69
const char * sha
Definition: addons.c:42
Definition: fci.c:127

Referenced by download_proc().

Variable Documentation

◆ addon

const addon_info_t* addon
static

Definition at line 59 of file addons.c.

Referenced by do_read(), install_addon(), install_from_registered_dir(), and sha_check().

◆ addons_info

const addon_info_t addons_info[]
static
Initial value:
= {
{
"wine_gecko-" GECKO_VERSION "-" ARCH_STRING ".msi",
"MSHTML",
"GeckoCabDir",
}
}
#define GECKO_SHA
Definition: addons.c:36
#define GECKO_VERSION
Definition: nsiface.idl:28

Definition at line 48 of file addons.c.

Referenced by install_addon().

◆ csLock

◆ download_binding

IBinding* download_binding = NULL
static

◆ GeckoUrl

WCHAR GeckoUrl[] = L"https://svn.reactos.org/amine/wine_gecko-2.40-x86.msi"
static

Definition at line 65 of file addons.c.

Referenced by download_proc().

◆ install_dialog

HWND install_dialog = NULL
static

Definition at line 61 of file addons.c.

Referenced by download_proc(), InstallCallback_OnProgress(), installer_proc(), and set_status().

◆ InstallCallback

Definition at line 355 of file addons.c.

◆ InstallCallbackVtbl

const IBindStatusCallbackVtbl InstallCallbackVtbl
static
Initial value:
= {
}
static ULONG WINAPI InstallCallback_Release(IBindStatusCallback *iface)
Definition: addons.c:255
static HRESULT WINAPI InstallCallback_OnStartBinding(IBindStatusCallback *iface, DWORD dwReserved, IBinding *pib)
Definition: addons.c:260
static HRESULT WINAPI InstallCallback_OnLowResource(IBindStatusCallback *iface, DWORD dwReserved)
Definition: addons.c:280
static HRESULT WINAPI InstallCallback_GetBindInfo(IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
Definition: addons.c:321
static HRESULT WINAPI InstallCallback_OnDataAvailable(IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
Definition: addons.c:327
static HRESULT WINAPI InstallCallback_OnProgress(IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
Definition: addons.c:286
static HRESULT WINAPI InstallCallback_QueryInterface(IBindStatusCallback *iface, REFIID riid, void **ppv)
Definition: addons.c:239
static HRESULT WINAPI InstallCallback_GetPriority(IBindStatusCallback *iface, LONG *pnPriority)
Definition: addons.c:274
static ULONG WINAPI InstallCallback_AddRef(IBindStatusCallback *iface)
Definition: addons.c:250
static HRESULT WINAPI InstallCallback_OnObjectAvailable(IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
Definition: addons.c:334
static HRESULT WINAPI InstallCallback_OnStopBinding(IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
Definition: addons.c:299

Definition at line 341 of file addons.c.

◆ mshtml_keyA

const CHAR mshtml_keyA[]
static
Initial value:
=
{'S','o','f','t','w','a','r','e',
'\\','W','i','n','e',
'\\','M','S','H','T','M','L',0}

Definition at line 195 of file addons.c.

Referenced by install_from_registered_dir().