schannel/tests: Use a more reliable method for detecting a wrong SECPKG_INTERFACE_VERSION.
Signed-off-by: Sven Baars <sven.wine@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
01de4d3399
commit
b6424ca5a4
|
@ -141,7 +141,7 @@ static void testInitialize(void)
|
||||||
static PSECPKG_FUNCTION_TABLE getNextSecPkgTable(PSECPKG_FUNCTION_TABLE pTable,
|
static PSECPKG_FUNCTION_TABLE getNextSecPkgTable(PSECPKG_FUNCTION_TABLE pTable,
|
||||||
ULONG Version)
|
ULONG Version)
|
||||||
{
|
{
|
||||||
size_t size;
|
int detectedVersion = 0, size;
|
||||||
PSECPKG_FUNCTION_TABLE pNextTable;
|
PSECPKG_FUNCTION_TABLE pNextTable;
|
||||||
|
|
||||||
if (Version == SECPKG_INTERFACE_VERSION)
|
if (Version == SECPKG_INTERFACE_VERSION)
|
||||||
|
@ -166,15 +166,41 @@ static PSECPKG_FUNCTION_TABLE getNextSecPkgTable(PSECPKG_FUNCTION_TABLE pTable,
|
||||||
}
|
}
|
||||||
|
|
||||||
pNextTable = (PSECPKG_FUNCTION_TABLE)((PBYTE)pTable + size);
|
pNextTable = (PSECPKG_FUNCTION_TABLE)((PBYTE)pTable + size);
|
||||||
/* Win7 function tables appear to be SECPKG_INTERFACE_VERSION_6 format,
|
|
||||||
but unfortunately SpLsaModeInitialize returns SECPKG_INTERFACE_VERSION_3.
|
/* For any version of Windows beyond Vista SpLsaModeInitialize returns
|
||||||
We detect that by comparing the "Initialize" pointer from the old table
|
SECPKG_INTERFACE_VERSION_3, so try detecting the actual version here
|
||||||
to the "FreeCredentialsHandle" pointer of the new table. These functions
|
by iterating until we find the Intitalize function */
|
||||||
have different numbers of arguments, so they can't possibly point to the
|
if (broken((void *) pTable->Initialize != (void *) pNextTable->Initialize &&
|
||||||
same implementation */
|
pTable->Initialize != NULL))
|
||||||
if (broken((void *) pTable->Initialize == (void *) pNextTable->FreeCredentialsHandle &&
|
|
||||||
pNextTable->FreeCredentialsHandle != NULL))
|
|
||||||
{
|
{
|
||||||
|
for (size = 1; size <= SECPKG_FUNCTION_TABLE_SIZE_8; size++)
|
||||||
|
{
|
||||||
|
pNextTable = (PSECPKG_FUNCTION_TABLE)((PBYTE)pTable + size);
|
||||||
|
if ((void *) pTable->Initialize == (void *) pNextTable->Initialize)
|
||||||
|
{
|
||||||
|
if (size == SECPKG_FUNCTION_TABLE_SIZE_1)
|
||||||
|
detectedVersion = 1;
|
||||||
|
else if (size == SECPKG_FUNCTION_TABLE_SIZE_2)
|
||||||
|
detectedVersion = 2;
|
||||||
|
else if (size == SECPKG_FUNCTION_TABLE_SIZE_3)
|
||||||
|
detectedVersion = 3;
|
||||||
|
else if (size == SECPKG_FUNCTION_TABLE_SIZE_4)
|
||||||
|
detectedVersion = 4;
|
||||||
|
else if (size == SECPKG_FUNCTION_TABLE_SIZE_5)
|
||||||
|
detectedVersion = 5;
|
||||||
|
else if (size == SECPKG_FUNCTION_TABLE_SIZE_6)
|
||||||
|
detectedVersion = 6;
|
||||||
|
else if (size == SECPKG_FUNCTION_TABLE_SIZE_7)
|
||||||
|
detectedVersion = 7;
|
||||||
|
else if (size == SECPKG_FUNCTION_TABLE_SIZE_8)
|
||||||
|
detectedVersion = 8;
|
||||||
|
else
|
||||||
|
trace("Unknown package version with size %u\n", size);
|
||||||
|
if (detectedVersion > 0)
|
||||||
|
trace("Detected SECPKG_INTERFACE_VERSION_%d\n", detectedVersion);
|
||||||
|
return pNextTable;
|
||||||
|
}
|
||||||
|
}
|
||||||
win_skip("Invalid function pointers for next package\n");
|
win_skip("Invalid function pointers for next package\n");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue