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
e7b0b35d
Commit
e7b0b35d
authored
Oct 04, 2021
by
Paul Gofman
Committed by
Alexandre Julliard
Oct 05, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Cache provider functions in WintrustLoadFunctionPointers().
Signed-off-by:
Paul Gofman
<
pgofman@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
165d1c0b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
52 additions
and
0 deletions
+52
-0
register.c
dlls/wintrust/register.c
+52
-0
No files found.
dlls/wintrust/register.c
View file @
e7b0b35d
...
@@ -835,6 +835,23 @@ error_close_key:
...
@@ -835,6 +835,23 @@ error_close_key:
return
Func
;
return
Func
;
}
}
static
CRITICAL_SECTION
cache_cs
;
static
CRITICAL_SECTION_DEBUG
cache_cs_debug
=
{
0
,
0
,
&
cache_cs
,
{
&
cache_cs_debug
.
ProcessLocksList
,
&
cache_cs_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": cache_cs"
)
}
};
static
CRITICAL_SECTION
cache_cs
=
{
&
cache_cs_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
struct
provider_cache_entry
{
GUID
guid
;
CRYPT_PROVIDER_FUNCTIONS
provider_functions
;
}
*
provider_cache
;
static
unsigned
int
provider_cache_size
;
/***********************************************************************
/***********************************************************************
* WintrustLoadFunctionPointers (WINTRUST.@)
* WintrustLoadFunctionPointers (WINTRUST.@)
*/
*/
...
@@ -842,6 +859,8 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
...
@@ -842,6 +859,8 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
CRYPT_PROVIDER_FUNCTIONS
*
pPfns
)
CRYPT_PROVIDER_FUNCTIONS
*
pPfns
)
{
{
WCHAR
GuidString
[
39
];
WCHAR
GuidString
[
39
];
BOOL
cached
=
FALSE
;
unsigned
int
i
;
TRACE
(
"(%s %p)
\n
"
,
debugstr_guid
(
pgActionID
),
pPfns
);
TRACE
(
"(%s %p)
\n
"
,
debugstr_guid
(
pgActionID
),
pPfns
);
...
@@ -853,6 +872,20 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
...
@@ -853,6 +872,20 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
}
}
if
(
pPfns
->
cbStruct
!=
sizeof
(
CRYPT_PROVIDER_FUNCTIONS
))
return
FALSE
;
if
(
pPfns
->
cbStruct
!=
sizeof
(
CRYPT_PROVIDER_FUNCTIONS
))
return
FALSE
;
EnterCriticalSection
(
&
cache_cs
);
for
(
i
=
0
;
i
<
provider_cache_size
;
++
i
)
{
if
(
IsEqualGUID
(
&
provider_cache
[
i
].
guid
,
pgActionID
))
{
TRACE
(
"Using cached data.
\n
"
);
*
pPfns
=
provider_cache
[
i
].
provider_functions
;
cached
=
TRUE
;
break
;
}
}
LeaveCriticalSection
(
&
cache_cs
);
if
(
cached
)
return
TRUE
;
/* Create this string only once, instead of in the helper function */
/* Create this string only once, instead of in the helper function */
WINTRUST_Guid2Wstr
(
pgActionID
,
GuidString
);
WINTRUST_Guid2Wstr
(
pgActionID
,
GuidString
);
...
@@ -873,6 +906,25 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
...
@@ -873,6 +906,25 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
pPfns
->
pfnTestFinalPolicy
=
(
PFN_PROVIDER_TESTFINALPOLICY_CALL
)
WINTRUST_ReadProviderFromReg
(
GuidString
,
DiagnosticPolicy
);
pPfns
->
pfnTestFinalPolicy
=
(
PFN_PROVIDER_TESTFINALPOLICY_CALL
)
WINTRUST_ReadProviderFromReg
(
GuidString
,
DiagnosticPolicy
);
pPfns
->
pfnCleanupPolicy
=
(
PFN_PROVIDER_CLEANUP_CALL
)
WINTRUST_ReadProviderFromReg
(
GuidString
,
Cleanup
);
pPfns
->
pfnCleanupPolicy
=
(
PFN_PROVIDER_CLEANUP_CALL
)
WINTRUST_ReadProviderFromReg
(
GuidString
,
Cleanup
);
EnterCriticalSection
(
&
cache_cs
);
for
(
i
=
0
;
i
<
provider_cache_size
;
++
i
)
if
(
IsEqualGUID
(
&
provider_cache
[
i
].
guid
,
pgActionID
))
break
;
if
(
i
==
provider_cache_size
)
{
struct
provider_cache_entry
*
new
;
new
=
realloc
(
provider_cache
,
(
provider_cache_size
+
1
)
*
sizeof
(
*
new
)
);
if
(
new
)
{
provider_cache
=
new
;
provider_cache
[
provider_cache_size
].
guid
=
*
pgActionID
;
provider_cache
[
provider_cache_size
].
provider_functions
=
*
pPfns
;
++
provider_cache_size
;
}
}
LeaveCriticalSection
(
&
cache_cs
);
return
TRUE
;
return
TRUE
;
}
}
...
...
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