Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
38483f1e
Commit
38483f1e
authored
May 09, 2014
by
Huw Davies
Committed by
Alexandre Julliard
May 09, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imagehlp/tests: Don't assume the certificate chain is originally empty.
parent
f5aaaf21
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
14 deletions
+18
-14
integrity.c
dlls/imagehlp/tests/integrity.c
+18
-14
No files found.
dlls/imagehlp/tests/integrity.c
View file @
38483f1e
...
@@ -135,7 +135,7 @@ static DWORD get_file_size(void)
...
@@ -135,7 +135,7 @@ static DWORD get_file_size(void)
return
filesize
;
return
filesize
;
}
}
static
void
test_add_certificate
(
const
char
*
cert_data
,
int
len
)
static
DWORD
test_add_certificate
(
const
char
*
cert_data
,
int
len
)
{
{
HANDLE
hFile
;
HANDLE
hFile
;
LPWIN_CERTIFICATE
cert
;
LPWIN_CERTIFICATE
cert
;
...
@@ -148,7 +148,7 @@ static void test_add_certificate(const char *cert_data, int len)
...
@@ -148,7 +148,7 @@ static void test_add_certificate(const char *cert_data, int len)
if
(
hFile
==
INVALID_HANDLE_VALUE
)
if
(
hFile
==
INVALID_HANDLE_VALUE
)
{
{
skip
(
"Unable to open %s, skipping test
\n
"
,
test_dll_path
);
skip
(
"Unable to open %s, skipping test
\n
"
,
test_dll_path
);
return
;
return
~
0
;
}
}
cert_len
=
sizeof
(
WIN_CERTIFICATE
)
+
len
;
cert_len
=
sizeof
(
WIN_CERTIFICATE
)
+
len
;
...
@@ -158,7 +158,7 @@ static void test_add_certificate(const char *cert_data, int len)
...
@@ -158,7 +158,7 @@ static void test_add_certificate(const char *cert_data, int len)
{
{
skip
(
"Unable to allocate memory, skipping test
\n
"
);
skip
(
"Unable to allocate memory, skipping test
\n
"
);
CloseHandle
(
hFile
);
CloseHandle
(
hFile
);
return
;
return
~
0
;
}
}
cert
->
dwLength
=
cert_len
;
cert
->
dwLength
=
cert_len
;
...
@@ -168,9 +168,11 @@ static void test_add_certificate(const char *cert_data, int len)
...
@@ -168,9 +168,11 @@ static void test_add_certificate(const char *cert_data, int len)
ret
=
pImageAddCertificate
(
hFile
,
cert
,
&
index
);
ret
=
pImageAddCertificate
(
hFile
,
cert
,
&
index
);
ok
(
ret
,
"Unable to add certificate to image, error %x
\n
"
,
GetLastError
());
ok
(
ret
,
"Unable to add certificate to image, error %x
\n
"
,
GetLastError
());
trace
(
"added cert index %d
\n
"
,
index
);
HeapFree
(
GetProcessHeap
(),
0
,
cert
);
HeapFree
(
GetProcessHeap
(),
0
,
cert
);
CloseHandle
(
hFile
);
CloseHandle
(
hFile
);
return
index
;
}
}
static
void
test_get_certificate
(
const
char
*
cert_data
,
int
index
)
static
void
test_get_certificate
(
const
char
*
cert_data
,
int
index
)
...
@@ -239,7 +241,7 @@ static void test_remove_certificate(int index)
...
@@ -239,7 +241,7 @@ static void test_remove_certificate(int index)
START_TEST
(
integrity
)
START_TEST
(
integrity
)
{
{
DWORD
file_size
,
file_size_orig
;
DWORD
file_size
,
file_size_orig
,
first
,
second
;
hImageHlp
=
LoadLibraryA
(
"imagehlp.dll"
);
hImageHlp
=
LoadLibraryA
(
"imagehlp.dll"
);
...
@@ -272,25 +274,27 @@ START_TEST(integrity)
...
@@ -272,25 +274,27 @@ START_TEST(integrity)
pImageGetCertificateHeader
=
(
void
*
)
GetProcAddress
(
hImageHlp
,
"ImageGetCertificateHeader"
);
pImageGetCertificateHeader
=
(
void
*
)
GetProcAddress
(
hImageHlp
,
"ImageGetCertificateHeader"
);
pImageRemoveCertificate
=
(
void
*
)
GetProcAddress
(
hImageHlp
,
"ImageRemoveCertificate"
);
pImageRemoveCertificate
=
(
void
*
)
GetProcAddress
(
hImageHlp
,
"ImageRemoveCertificate"
);
test_add_certificate
(
test_cert_data
,
sizeof
(
test_cert_data
));
first
=
test_add_certificate
(
test_cert_data
,
sizeof
(
test_cert_data
));
test_get_certificate
(
test_cert_data
,
0
);
test_get_certificate
(
test_cert_data
,
first
);
test_remove_certificate
(
0
);
test_remove_certificate
(
first
);
file_size
=
get_file_size
();
file_size
=
get_file_size
();
ok
(
file_size
==
file_size_orig
,
"File size different after add and remove (old: %d; new: %d)
\n
"
,
file_size_orig
,
file_size
);
ok
(
file_size
==
file_size_orig
,
"File size different after add and remove (old: %d; new: %d)
\n
"
,
file_size_orig
,
file_size
);
/* Try adding multiple certificates */
/* Try adding multiple certificates */
test_add_certificate
(
test_cert_data
,
sizeof
(
test_cert_data
));
first
=
test_add_certificate
(
test_cert_data
,
sizeof
(
test_cert_data
));
test_add_certificate
(
test_cert_data_2
,
sizeof
(
test_cert_data_2
));
second
=
test_add_certificate
(
test_cert_data_2
,
sizeof
(
test_cert_data_2
));
ok
(
second
==
first
+
1
,
"got %d %d
\n
"
,
first
,
second
);
test_get_certificate
(
test_cert_data
,
0
);
test_get_certificate
(
test_cert_data
,
first
);
test_get_certificate
(
test_cert_data_2
,
1
);
test_get_certificate
(
test_cert_data_2
,
second
);
/* Remove the first one and verify the second certificate is intact */
/* Remove the first one and verify the second certificate is intact */
test_remove_certificate
(
0
);
test_remove_certificate
(
first
);
test_get_certificate
(
test_cert_data_2
,
0
);
second
--
;
test_get_certificate
(
test_cert_data_2
,
second
);
test_remove_certificate
(
0
);
test_remove_certificate
(
second
);
file_size
=
get_file_size
();
file_size
=
get_file_size
();
ok
(
file_size
==
file_size_orig
,
"File size different after add and remove (old: %d; new: %d)
\n
"
,
file_size_orig
,
file_size
);
ok
(
file_size
==
file_size_orig
,
"File size different after add and remove (old: %d; new: %d)
\n
"
,
file_size_orig
,
file_size
);
...
...
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