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
5bcc37a9
Commit
5bcc37a9
authored
Dec 04, 2009
by
Owen Rudge
Committed by
Alexandre Julliard
Dec 07, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
imagehlp: Implement ImageRemoveCertificate.
parent
74e5e0b3
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
79 additions
and
5 deletions
+79
-5
integrity.c
dlls/imagehlp/integrity.c
+77
-3
integrity.c
dlls/imagehlp/tests/integrity.c
+2
-2
No files found.
dlls/imagehlp/integrity.c
View file @
5bcc37a9
...
@@ -564,7 +564,81 @@ BOOL WINAPI ImageGetDigestStream(
...
@@ -564,7 +564,81 @@ BOOL WINAPI ImageGetDigestStream(
*/
*/
BOOL
WINAPI
ImageRemoveCertificate
(
HANDLE
FileHandle
,
DWORD
Index
)
BOOL
WINAPI
ImageRemoveCertificate
(
HANDLE
FileHandle
,
DWORD
Index
)
{
{
FIXME
(
"(%p, %d): stub
\n
"
,
FileHandle
,
Index
);
DWORD
size
=
0
,
count
=
0
,
sd_VirtualAddr
=
0
,
offset
=
0
;
SetLastError
(
ERROR_CALL_NOT_IMPLEMENTED
);
DWORD
data_size
=
0
,
cert_size
=
0
,
cert_size_padded
=
0
,
ret
=
0
;
return
FALSE
;
LPVOID
cert_data
;
BOOL
r
;
TRACE
(
"(%p, %d)
\n
"
,
FileHandle
,
Index
);
r
=
ImageEnumerateCertificates
(
FileHandle
,
CERT_SECTION_TYPE_ANY
,
&
count
,
NULL
,
0
);
if
((
!
r
)
||
(
count
==
0
))
return
FALSE
;
if
((
!
IMAGEHLP_GetSecurityDirOffset
(
FileHandle
,
&
sd_VirtualAddr
,
&
size
))
||
(
!
IMAGEHLP_GetCertificateOffset
(
FileHandle
,
Index
,
&
offset
,
&
cert_size
)))
return
FALSE
;
/* Ignore any padding we have, too */
if
(
cert_size
%
8
)
cert_size_padded
=
cert_size
+
(
8
-
(
cert_size
%
8
));
else
cert_size_padded
=
cert_size
;
data_size
=
size
-
(
offset
-
sd_VirtualAddr
)
-
cert_size_padded
;
if
(
data_size
==
0
)
{
ret
=
SetFilePointer
(
FileHandle
,
sd_VirtualAddr
,
NULL
,
FILE_BEGIN
);
if
(
ret
==
INVALID_SET_FILE_POINTER
)
return
FALSE
;
}
else
{
cert_data
=
HeapAlloc
(
GetProcessHeap
(),
HEAP_ZERO_MEMORY
,
data_size
);
if
(
!
cert_data
)
return
FALSE
;
ret
=
SetFilePointer
(
FileHandle
,
offset
+
cert_size_padded
,
NULL
,
FILE_BEGIN
);
if
(
ret
==
INVALID_SET_FILE_POINTER
)
goto
error
;
/* Read any subsequent certificates */
r
=
ReadFile
(
FileHandle
,
cert_data
,
data_size
,
&
count
,
NULL
);
if
((
!
r
)
||
(
count
!=
data_size
))
goto
error
;
SetFilePointer
(
FileHandle
,
offset
,
NULL
,
FILE_BEGIN
);
/* Write them one index back */
r
=
WriteFile
(
FileHandle
,
cert_data
,
data_size
,
&
count
,
NULL
);
if
((
!
r
)
||
(
count
!=
data_size
))
goto
error
;
HeapFree
(
GetProcessHeap
(),
0
,
cert_data
);
}
/* If security directory is at end of file, trim the file */
if
(
GetFileSize
(
FileHandle
,
NULL
)
==
sd_VirtualAddr
+
size
)
SetEndOfFile
(
FileHandle
);
if
(
count
==
1
)
r
=
IMAGEHLP_SetSecurityDirOffset
(
FileHandle
,
0
,
0
);
else
r
=
IMAGEHLP_SetSecurityDirOffset
(
FileHandle
,
sd_VirtualAddr
,
size
-
cert_size_padded
);
if
(
!
r
)
return
FALSE
;
return
TRUE
;
error:
HeapFree
(
GetProcessHeap
(),
0
,
cert_data
);
return
FALSE
;
}
}
dlls/imagehlp/tests/integrity.c
View file @
5bcc37a9
...
@@ -201,10 +201,10 @@ static void test_remove_certificate(void)
...
@@ -201,10 +201,10 @@ static void test_remove_certificate(void)
return
;
return
;
}
}
todo_wine
ok
(
pImageRemoveCertificate
(
hFile
,
0
),
"Unable to remove certificate from file; err=%x
\n
"
,
GetLastError
());
ok
(
pImageRemoveCertificate
(
hFile
,
0
),
"Unable to remove certificate from file; err=%x
\n
"
,
GetLastError
());
/* Test to see if the certificate has actually been removed */
/* Test to see if the certificate has actually been removed */
todo_wine
ok
(
pImageGetCertificateHeader
(
hFile
,
0
,
&
cert
)
==
FALSE
,
"Certificate header retrieval succeeded when it should have failed
\n
"
);
ok
(
pImageGetCertificateHeader
(
hFile
,
0
,
&
cert
)
==
FALSE
,
"Certificate header retrieval succeeded when it should have failed
\n
"
);
CloseHandle
(
hFile
);
CloseHandle
(
hFile
);
}
}
...
...
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