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
8c34271a
Commit
8c34271a
authored
Aug 28, 2007
by
Juan Lang
Committed by
Alexandre Julliard
Aug 29, 2007
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wintrust: Test and implement pfnAddSgnr2Chain.
parent
150ddd6b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
93 additions
and
1 deletion
+93
-1
register.c
dlls/wintrust/register.c
+1
-1
softpub.c
dlls/wintrust/tests/softpub.c
+39
-0
wintrust_main.c
dlls/wintrust/wintrust_main.c
+51
-0
wintrust_priv.h
dlls/wintrust/wintrust_priv.h
+2
-0
No files found.
dlls/wintrust/register.c
View file @
8c34271a
...
@@ -837,7 +837,7 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
...
@@ -837,7 +837,7 @@ BOOL WINAPI WintrustLoadFunctionPointers( GUID* pgActionID,
pPfns
->
pfnAlloc
=
WINTRUST_Alloc
;
pPfns
->
pfnAlloc
=
WINTRUST_Alloc
;
pPfns
->
pfnFree
=
WINTRUST_Free
;
pPfns
->
pfnFree
=
WINTRUST_Free
;
pPfns
->
pfnAddStore2Chain
=
WINTRUST_AddStore
;
pPfns
->
pfnAddStore2Chain
=
WINTRUST_AddStore
;
pPfns
->
pfnAddSgnr2Chain
=
NULL
;
pPfns
->
pfnAddSgnr2Chain
=
WINTRUST_AddSgnr
;
pPfns
->
pfnAddCert2Chain
=
NULL
;
pPfns
->
pfnAddCert2Chain
=
NULL
;
pPfns
->
pfnAddPrivData2Chain
=
NULL
;
pPfns
->
pfnAddPrivData2Chain
=
NULL
;
pPfns
->
psUIpfns
=
NULL
;
pPfns
->
psUIpfns
=
NULL
;
...
...
dlls/wintrust/tests/softpub.c
View file @
8c34271a
...
@@ -91,6 +91,7 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
...
@@ -91,6 +91,7 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
{
{
CRYPT_PROVIDER_DATA
data
=
{
0
};
CRYPT_PROVIDER_DATA
data
=
{
0
};
HCERTSTORE
store
;
HCERTSTORE
store
;
CRYPT_PROVIDER_SGNR
sgnr
=
{
0
};
BOOL
ret
;
BOOL
ret
;
/* Crash
/* Crash
...
@@ -118,6 +119,44 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
...
@@ -118,6 +119,44 @@ static void test_utils(SAFE_PROVIDER_FUNCTIONS *funcs)
}
}
else
else
skip
(
"CertOpenStore failed: %08x
\n
"
,
GetLastError
());
skip
(
"CertOpenStore failed: %08x
\n
"
,
GetLastError
());
/* Crash
ret = funcs->pfnAddSgnr2Chain(NULL, FALSE, 0, NULL);
ret = funcs->pfnAddSgnr2Chain(&data, FALSE, 0, NULL);
*/
ret
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
0
,
&
sgnr
);
ok
(
ret
,
"pfnAddSgnr2Chain failed: %08x
\n
"
,
GetLastError
());
ok
(
data
.
csSigners
==
1
,
"Expected 1 signer, got %d
\n
"
,
data
.
csSigners
);
ok
(
data
.
pasSigners
!=
NULL
,
"Expected pasSigners to be allocated
\n
"
);
if
(
data
.
pasSigners
)
{
ok
(
!
memcmp
(
&
data
.
pasSigners
[
0
],
&
sgnr
,
sizeof
(
sgnr
)),
"Unexpected data in signer
\n
"
);
/* Adds into the location specified by the index */
sgnr
.
cbStruct
=
sizeof
(
CRYPT_PROVIDER_SGNR
);
sgnr
.
sftVerifyAsOf
.
dwLowDateTime
=
0xdeadbeef
;
ret
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
1
,
&
sgnr
);
ok
(
ret
,
"pfnAddSgnr2Chain failed: %08x
\n
"
,
GetLastError
());
ok
(
data
.
csSigners
==
2
,
"Expected 2 signers, got %d
\n
"
,
data
.
csSigners
);
ok
(
!
memcmp
(
&
data
.
pasSigners
[
1
],
&
sgnr
,
sizeof
(
sgnr
)),
"Unexpected data in signer
\n
"
);
/* This also adds, but the data aren't copied */
sgnr
.
cbStruct
=
sizeof
(
DWORD
);
ret
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
0
,
&
sgnr
);
ok
(
ret
,
"pfnAddSgnr2Chain failed: %08x
\n
"
,
GetLastError
());
ok
(
data
.
csSigners
==
3
,
"Expected 3 signers, got %d
\n
"
,
data
.
csSigners
);
ok
(
data
.
pasSigners
[
0
].
cbStruct
==
0
,
"Unexpected data size %d
\n
"
,
data
.
pasSigners
[
0
].
cbStruct
);
ok
(
data
.
pasSigners
[
0
].
sftVerifyAsOf
.
dwLowDateTime
==
0
,
"Unexpected verify time %d
\n
"
,
data
.
pasSigners
[
0
].
sftVerifyAsOf
.
dwLowDateTime
);
/* But too large a thing isn't added */
sgnr
.
cbStruct
=
sizeof
(
sgnr
)
+
sizeof
(
DWORD
);
SetLastError
(
0xdeadbeef
);
ret
=
funcs
->
pfnAddSgnr2Chain
(
&
data
,
FALSE
,
0
,
&
sgnr
);
ok
(
!
ret
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Expected ERROR_INVALID_PARAMETER, got %d
\n
"
,
GetLastError
());
}
}
}
static
void
testInitialize
(
SAFE_PROVIDER_FUNCTIONS
*
funcs
,
GUID
*
actionID
)
static
void
testInitialize
(
SAFE_PROVIDER_FUNCTIONS
*
funcs
,
GUID
*
actionID
)
...
...
dlls/wintrust/wintrust_main.c
View file @
8c34271a
...
@@ -252,3 +252,54 @@ BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store)
...
@@ -252,3 +252,54 @@ BOOL WINAPI WINTRUST_AddStore(CRYPT_PROVIDER_DATA *data, HCERTSTORE store)
SetLastError
(
ERROR_OUTOFMEMORY
);
SetLastError
(
ERROR_OUTOFMEMORY
);
return
ret
;
return
ret
;
}
}
BOOL
WINAPI
WINTRUST_AddSgnr
(
CRYPT_PROVIDER_DATA
*
data
,
BOOL
fCounterSigner
,
DWORD
idxSigner
,
CRYPT_PROVIDER_SGNR
*
sgnr
)
{
BOOL
ret
=
FALSE
;
if
(
sgnr
->
cbStruct
>
sizeof
(
CRYPT_PROVIDER_SGNR
))
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
fCounterSigner
)
{
FIXME
(
"unimplemented for counter signers
\n
"
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
FALSE
;
}
if
(
data
->
csSigners
)
data
->
pasSigners
=
WINTRUST_ReAlloc
(
data
->
pasSigners
,
(
data
->
csSigners
+
1
)
*
sizeof
(
CRYPT_PROVIDER_SGNR
));
else
{
data
->
pasSigners
=
WINTRUST_Alloc
(
sizeof
(
CRYPT_PROVIDER_SGNR
));
data
->
csSigners
=
0
;
}
if
(
data
->
pasSigners
)
{
if
(
idxSigner
<
data
->
csSigners
)
memmove
(
&
data
->
pasSigners
[
idxSigner
],
&
data
->
pasSigners
[
idxSigner
+
1
],
(
data
->
csSigners
-
idxSigner
)
*
sizeof
(
CRYPT_PROVIDER_SGNR
));
ret
=
TRUE
;
if
(
sgnr
->
cbStruct
==
sizeof
(
CRYPT_PROVIDER_SGNR
))
{
/* The PSDK says psSigner should be allocated using pfnAlloc, but
* it doesn't say anything about ownership. Since callers are
* internal, assume ownership is passed, and just store the
* pointer.
*/
memcpy
(
&
data
->
pasSigners
[
idxSigner
],
sgnr
,
sizeof
(
CRYPT_PROVIDER_SGNR
));
}
else
memset
(
&
data
->
pasSigners
[
idxSigner
],
0
,
sizeof
(
CRYPT_PROVIDER_SGNR
));
data
->
csSigners
++
;
}
else
SetLastError
(
ERROR_OUTOFMEMORY
);
return
ret
;
}
dlls/wintrust/wintrust_priv.h
View file @
8c34271a
...
@@ -22,5 +22,7 @@ void * WINAPI WINTRUST_Alloc(DWORD cb);
...
@@ -22,5 +22,7 @@ void * WINAPI WINTRUST_Alloc(DWORD cb);
void
*
WINAPI
WINTRUST_ReAlloc
(
void
*
ptr
,
DWORD
cb
);
void
*
WINAPI
WINTRUST_ReAlloc
(
void
*
ptr
,
DWORD
cb
);
void
WINAPI
WINTRUST_Free
(
void
*
p
);
void
WINAPI
WINTRUST_Free
(
void
*
p
);
BOOL
WINAPI
WINTRUST_AddStore
(
CRYPT_PROVIDER_DATA
*
data
,
HCERTSTORE
store
);
BOOL
WINAPI
WINTRUST_AddStore
(
CRYPT_PROVIDER_DATA
*
data
,
HCERTSTORE
store
);
BOOL
WINAPI
WINTRUST_AddSgnr
(
CRYPT_PROVIDER_DATA
*
data
,
BOOL
fCounterSigner
,
DWORD
idxSigner
,
CRYPT_PROVIDER_SGNR
*
sgnr
);
#endif
/* ndef __WINTRUST_PRIV_H__ */
#endif
/* ndef __WINTRUST_PRIV_H__ */
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