Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
b00117d4
Commit
b00117d4
authored
Dec 29, 2010
by
Jacek Caban
Committed by
Alexandre Julliard
Dec 29, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
appwiz.cpl: Added checksum validation of downloaded file.
parent
2eb2f71c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
69 additions
and
1 deletion
+69
-1
En.rc
dlls/appwiz.cpl/En.rc
+1
-0
addons.c
dlls/appwiz.cpl/addons.c
+67
-1
res.h
dlls/appwiz.cpl/res.h
+1
-0
No files found.
dlls/appwiz.cpl/En.rc
View file @
b00117d4
...
...
@@ -46,6 +46,7 @@ STRINGTABLE
{
IDS_DOWNLOADING "Downloading..."
IDS_INSTALLING "Installing..."
IDS_INVALID_SHA "Unexpected checksum of downloaded file. Aborting installation of corrupted file."
}
IDD_MAIN DIALOG 0, 0, 320, 220
...
...
dlls/appwiz.cpl/addons.c
View file @
b00117d4
...
...
@@ -20,6 +20,7 @@
#include <stdarg.h>
#include <fcntl.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
...
...
@@ -53,10 +54,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(appwizcpl);
#ifdef __i386__
#define ARCH_STRING "x86"
#define GECKO_SHA "1b6c637207b6f032ae8a52841db9659433482714"
#elif defined(__x86_64__)
#define ARCH_STRING "x86_64"
#define GECKO_SHA "55b4b60cd2a48631d6236fb411c3a94d806d9906"
#else
#define ARCH_STRING ""
#define GECKO_SHA "???"
#endif
#define GECKO_FILE_NAME "wine_gecko-" GECKO_VERSION "-" ARCH_STRING ".cab"
...
...
@@ -82,6 +86,67 @@ static inline char *heap_strdupWtoA(LPCWSTR str)
return
ret
;
}
/* SHA definitions are copied from advapi32. They aren't available in headers. */
typedef
struct
{
ULONG
Unknown
[
6
];
ULONG
State
[
5
];
ULONG
Count
[
2
];
UCHAR
Buffer
[
64
];
}
SHA_CTX
,
*
PSHA_CTX
;
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
)
{
const
unsigned
char
*
file_map
;
HANDLE
file
,
map
;
ULONG
sha
[
5
];
char
buf
[
2
*
sizeof
(
sha
)
+
1
];
SHA_CTX
ctx
;
DWORD
size
,
i
;
file
=
CreateFileW
(
file_name
,
GENERIC_READ
,
0
,
NULL
,
OPEN_EXISTING
,
FILE_ATTRIBUTE_READONLY
,
NULL
);
if
(
file
==
INVALID_HANDLE_VALUE
)
return
FALSE
;
size
=
GetFileSize
(
file
,
NULL
);
map
=
CreateFileMappingW
(
file
,
NULL
,
PAGE_READONLY
,
0
,
0
,
NULL
);
CloseHandle
(
file
);
if
(
!
map
)
return
FALSE
;
file_map
=
MapViewOfFile
(
map
,
FILE_MAP_READ
,
0
,
0
,
0
);
CloseHandle
(
map
);
if
(
!
file_map
)
return
FALSE
;
A_SHAInit
(
&
ctx
);
A_SHAUpdate
(
&
ctx
,
file_map
,
size
);
A_SHAFinal
(
&
ctx
,
sha
);
UnmapViewOfFile
(
file_map
);
for
(
i
=
0
;
i
<
sizeof
(
sha
);
i
++
)
sprintf
(
buf
+
i
*
2
,
"%02x"
,
*
((
unsigned
char
*
)
sha
+
i
));
if
(
strcmp
(
buf
,
GECKO_SHA
))
{
WCHAR
message
[
256
];
WARN
(
"Got %s, expected %s
\n
"
,
buf
,
GECKO_SHA
);
if
(
LoadStringW
(
hInst
,
IDS_INVALID_SHA
,
message
,
sizeof
(
message
)
/
sizeof
(
WCHAR
)))
MessageBoxW
(
NULL
,
message
,
NULL
,
MB_ICONERROR
);
return
FALSE
;
}
return
TRUE
;
}
static
void
set_status
(
DWORD
id
)
{
HWND
status
=
GetDlgItem
(
install_dialog
,
ID_DWL_STATUS
);
...
...
@@ -447,7 +512,8 @@ static DWORD WINAPI download_proc(PVOID arg)
return
0
;
}
install_cab
(
tmp_file
);
if
(
sha_check
(
tmp_file
))
install_cab
(
tmp_file
);
DeleteFileW
(
tmp_file
);
EndDialog
(
install_dialog
,
0
);
return
0
;
...
...
dlls/appwiz.cpl/res.h
View file @
b00117d4
...
...
@@ -68,3 +68,4 @@
#define IDS_MODIFY_REMOVE 11
#define IDS_DOWNLOADING 12
#define IDS_INSTALLING 13
#define IDS_INVALID_SHA 14
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment