Commit 53d810c9 authored by Alexandre Julliard's avatar Alexandre Julliard

advapi32/tests: Make function pointers static and remove redundant typedefs.

parent 536fc570
...@@ -34,56 +34,44 @@ struct ustring { ...@@ -34,56 +34,44 @@ struct ustring {
unsigned char *Buffer; unsigned char *Buffer;
}; };
typedef NTSTATUS (WINAPI *fnSystemFunction001)(const BYTE *, const BYTE *, LPBYTE);
typedef NTSTATUS (WINAPI *fnSystemFunction002)(const BYTE *, const BYTE *, LPBYTE);
typedef NTSTATUS (WINAPI *fnSystemFunction003)(const BYTE *, LPBYTE);
typedef NTSTATUS (WINAPI *fnSystemFunction004)(const struct ustring *, const struct ustring *, struct ustring *);
typedef NTSTATUS (WINAPI *fnSystemFunction005)(const struct ustring *, const struct ustring *, struct ustring *);
typedef VOID (WINAPI *fnSystemFunction006)( PCSTR passwd, PSTR lmhash );
typedef NTSTATUS (WINAPI *fnSystemFunction008)(const BYTE *, const BYTE *, LPBYTE);
typedef NTSTATUS (WINAPI *fnSystemFunction009)(const BYTE *, const BYTE *, LPBYTE);
typedef int (WINAPI *descrypt)(unsigned char *, unsigned char *, unsigned char *); typedef int (WINAPI *descrypt)(unsigned char *, unsigned char *, unsigned char *);
typedef NTSTATUS (WINAPI *fnSystemFunction030)(const void*, const void*); static NTSTATUS (WINAPI *pSystemFunction001)(const BYTE *, const BYTE *, LPBYTE);
typedef NTSTATUS (WINAPI *fnSystemFunction032)(struct ustring *, const struct ustring *); static NTSTATUS (WINAPI *pSystemFunction002)(const BYTE *, const BYTE *, LPBYTE);
static NTSTATUS (WINAPI *pSystemFunction003)(const BYTE *, LPBYTE);
fnSystemFunction001 pSystemFunction001; static NTSTATUS (WINAPI *pSystemFunction004)(const struct ustring *, const struct ustring *, struct ustring *);
fnSystemFunction002 pSystemFunction002; static NTSTATUS (WINAPI *pSystemFunction005)(const struct ustring *, const struct ustring *, struct ustring *);
fnSystemFunction003 pSystemFunction003; static VOID (WINAPI *pSystemFunction006)( PCSTR passwd, PSTR lmhash );
fnSystemFunction004 pSystemFunction004; static NTSTATUS (WINAPI *pSystemFunction008)(const BYTE *, const BYTE *, LPBYTE);
fnSystemFunction004 pSystemFunction005; static NTSTATUS (WINAPI *pSystemFunction009)(const BYTE *, const BYTE *, LPBYTE);
fnSystemFunction006 pSystemFunction006; static NTSTATUS (WINAPI *pSystemFunction032)(struct ustring *, const struct ustring *);
fnSystemFunction008 pSystemFunction008;
fnSystemFunction008 pSystemFunction009;
/* encrypt two blocks */ /* encrypt two blocks */
descrypt pSystemFunction012; static descrypt pSystemFunction012;
descrypt pSystemFunction014; static descrypt pSystemFunction014;
descrypt pSystemFunction016; static descrypt pSystemFunction016;
descrypt pSystemFunction018; static descrypt pSystemFunction018;
descrypt pSystemFunction020; static descrypt pSystemFunction020;
descrypt pSystemFunction022; static descrypt pSystemFunction022;
/* decrypt two blocks */ /* decrypt two blocks */
descrypt pSystemFunction013; static descrypt pSystemFunction013;
descrypt pSystemFunction015; static descrypt pSystemFunction015;
descrypt pSystemFunction017; static descrypt pSystemFunction017;
descrypt pSystemFunction019; static descrypt pSystemFunction019;
descrypt pSystemFunction021; static descrypt pSystemFunction021;
descrypt pSystemFunction023; static descrypt pSystemFunction023;
/* encrypt two blocks with a 32bit key */ /* encrypt two blocks with a 32bit key */
descrypt pSystemFunction024; static descrypt pSystemFunction024;
descrypt pSystemFunction025; static descrypt pSystemFunction025;
/* decrypt two blocks with a 32bit key */ /* decrypt two blocks with a 32bit key */
descrypt pSystemFunction026; static descrypt pSystemFunction026;
descrypt pSystemFunction027; static descrypt pSystemFunction027;
typedef int (WINAPI *memcmpfunc)(unsigned char *, unsigned char *); typedef int (WINAPI *memcmpfunc)(unsigned char *, unsigned char *);
memcmpfunc pSystemFunction030; static memcmpfunc pSystemFunction030;
memcmpfunc pSystemFunction031; static memcmpfunc pSystemFunction031;
fnSystemFunction032 pSystemFunction032;
static void test_SystemFunction006(void) static void test_SystemFunction006(void)
{ {
...@@ -545,49 +533,49 @@ START_TEST(crypt_lmhash) ...@@ -545,49 +533,49 @@ START_TEST(crypt_lmhash)
{ {
HMODULE module = GetModuleHandleA("advapi32.dll"); HMODULE module = GetModuleHandleA("advapi32.dll");
pSystemFunction001 = (fnSystemFunction001)GetProcAddress( module, "SystemFunction001" ); pSystemFunction001 = (void *)GetProcAddress( module, "SystemFunction001" );
if (pSystemFunction001) if (pSystemFunction001)
test_SystemFunction001(); test_SystemFunction001();
else else
win_skip("SystemFunction001 is not available\n"); win_skip("SystemFunction001 is not available\n");
pSystemFunction002 = (fnSystemFunction002)GetProcAddress( module, "SystemFunction002" ); pSystemFunction002 = (void *)GetProcAddress( module, "SystemFunction002" );
if (pSystemFunction002) if (pSystemFunction002)
test_SystemFunction002(); test_SystemFunction002();
else else
win_skip("SystemFunction002 is not available\n"); win_skip("SystemFunction002 is not available\n");
pSystemFunction003 = (fnSystemFunction003)GetProcAddress( module, "SystemFunction003" ); pSystemFunction003 = (void *)GetProcAddress( module, "SystemFunction003" );
if (pSystemFunction003) if (pSystemFunction003)
test_SystemFunction003(); test_SystemFunction003();
else else
win_skip("SystemFunction002 is not available\n"); win_skip("SystemFunction002 is not available\n");
pSystemFunction004 = (fnSystemFunction004)GetProcAddress( module, "SystemFunction004" ); pSystemFunction004 = (void *)GetProcAddress( module, "SystemFunction004" );
if (pSystemFunction004) if (pSystemFunction004)
test_SystemFunction004(); test_SystemFunction004();
else else
win_skip("SystemFunction004 is not available\n"); win_skip("SystemFunction004 is not available\n");
pSystemFunction005 = (fnSystemFunction005)GetProcAddress( module, "SystemFunction005" ); pSystemFunction005 = (void *)GetProcAddress( module, "SystemFunction005" );
if (pSystemFunction005) if (pSystemFunction005)
test_SystemFunction005(); test_SystemFunction005();
else else
win_skip("SystemFunction005 is not available\n"); win_skip("SystemFunction005 is not available\n");
pSystemFunction006 = (fnSystemFunction006)GetProcAddress( module, "SystemFunction006" ); pSystemFunction006 = (void *)GetProcAddress( module, "SystemFunction006" );
if (pSystemFunction006) if (pSystemFunction006)
test_SystemFunction006(); test_SystemFunction006();
else else
win_skip("SystemFunction006 is not available\n"); win_skip("SystemFunction006 is not available\n");
pSystemFunction008 = (fnSystemFunction008)GetProcAddress( module, "SystemFunction008" ); pSystemFunction008 = (void *)GetProcAddress( module, "SystemFunction008" );
if (pSystemFunction008) if (pSystemFunction008)
test_SystemFunction008(); test_SystemFunction008();
else else
win_skip("SystemFunction008 is not available\n"); win_skip("SystemFunction008 is not available\n");
pSystemFunction009 = (fnSystemFunction009)GetProcAddress( module, "SystemFunction009" ); pSystemFunction009 = (void *)GetProcAddress( module, "SystemFunction009" );
if (pSystemFunction009) if (pSystemFunction009)
test_SystemFunction009(); test_SystemFunction009();
else else
...@@ -641,7 +629,7 @@ START_TEST(crypt_lmhash) ...@@ -641,7 +629,7 @@ START_TEST(crypt_lmhash)
test_memcmpfunc(pSystemFunction030); test_memcmpfunc(pSystemFunction030);
test_memcmpfunc(pSystemFunction031); test_memcmpfunc(pSystemFunction031);
pSystemFunction032 = (fnSystemFunction032)GetProcAddress( module, "SystemFunction032" ); pSystemFunction032 = (void *)GetProcAddress( module, "SystemFunction032" );
if (pSystemFunction032) if (pSystemFunction032)
test_SystemFunction032(); test_SystemFunction032();
else else
......
...@@ -36,18 +36,14 @@ typedef struct ...@@ -36,18 +36,14 @@ typedef struct
unsigned char digest[16]; unsigned char digest[16];
} MD4_CTX; } MD4_CTX;
typedef VOID (WINAPI *fnMD4Init)( MD4_CTX *ctx ); static VOID (WINAPI *pMD4Init)( MD4_CTX *ctx );
typedef VOID (WINAPI *fnMD4Update)( MD4_CTX *ctx, const unsigned char *src, const int len ); static VOID (WINAPI *pMD4Update)( MD4_CTX *ctx, const unsigned char *src, const int len );
typedef VOID (WINAPI *fnMD4Final)( MD4_CTX *ctx ); static VOID (WINAPI *pMD4Final)( MD4_CTX *ctx );
typedef int (WINAPI *fnSystemFunction007)(const UNICODE_STRING *, LPBYTE); static int (WINAPI *pSystemFunction007)(const UNICODE_STRING *, LPBYTE);
typedef int (WINAPI *md4hashfunc)(LPVOID, const LPBYTE, LPBYTE); typedef int (WINAPI *md4hashfunc)(LPVOID, const LPBYTE, LPBYTE);
fnMD4Init pMD4Init; static md4hashfunc pSystemFunction010;
fnMD4Update pMD4Update; static md4hashfunc pSystemFunction011;
fnMD4Final pMD4Final;
fnSystemFunction007 pSystemFunction007;
md4hashfunc pSystemFunction010;
md4hashfunc pSystemFunction011;
#define ctxcmp( a, b ) memcmp( a, b, FIELD_OFFSET( MD4_CTX, in ) ) #define ctxcmp( a, b ) memcmp( a, b, FIELD_OFFSET( MD4_CTX, in ) )
...@@ -149,16 +145,16 @@ START_TEST(crypt_md4) ...@@ -149,16 +145,16 @@ START_TEST(crypt_md4)
module = GetModuleHandleA( "advapi32.dll" ); module = GetModuleHandleA( "advapi32.dll" );
pMD4Init = (fnMD4Init)GetProcAddress( module, "MD4Init" ); pMD4Init = (void *)GetProcAddress( module, "MD4Init" );
pMD4Update = (fnMD4Update)GetProcAddress( module, "MD4Update" ); pMD4Update = (void *)GetProcAddress( module, "MD4Update" );
pMD4Final = (fnMD4Final)GetProcAddress( module, "MD4Final" ); pMD4Final = (void *)GetProcAddress( module, "MD4Final" );
if (pMD4Init && pMD4Update && pMD4Final) if (pMD4Init && pMD4Update && pMD4Final)
test_md4_ctx(); test_md4_ctx();
else else
win_skip("MD4Init and/or MD4Update and/or MD4Final are not available\n"); win_skip("MD4Init and/or MD4Update and/or MD4Final are not available\n");
pSystemFunction007 = (fnSystemFunction007)GetProcAddress( module, "SystemFunction007" ); pSystemFunction007 = (void *)GetProcAddress( module, "SystemFunction007" );
if (pSystemFunction007) if (pSystemFunction007)
test_SystemFunction007(); test_SystemFunction007();
else else
......
...@@ -33,13 +33,9 @@ typedef struct ...@@ -33,13 +33,9 @@ typedef struct
unsigned char digest[16]; unsigned char digest[16];
} MD5_CTX; } MD5_CTX;
typedef VOID (WINAPI *fnMD5Init)( MD5_CTX *ctx ); static VOID (WINAPI *pMD5Init)( MD5_CTX *ctx );
typedef VOID (WINAPI *fnMD5Update)( MD5_CTX *ctx, const unsigned char *src, const int len ); static VOID (WINAPI *pMD5Update)( MD5_CTX *ctx, const unsigned char *src, const int len );
typedef VOID (WINAPI *fnMD5Final)( MD5_CTX *ctx ); static VOID (WINAPI *pMD5Final)( MD5_CTX *ctx );
fnMD5Init pMD5Init;
fnMD5Update pMD5Update;
fnMD5Final pMD5Final;
#define ctxcmp( a, b ) memcmp( a, b, FIELD_OFFSET( MD5_CTX, in ) ) #define ctxcmp( a, b ) memcmp( a, b, FIELD_OFFSET( MD5_CTX, in ) )
...@@ -79,9 +75,9 @@ static void test_md5_ctx(void) ...@@ -79,9 +75,9 @@ static void test_md5_ctx(void)
module = GetModuleHandleA("advapi32.dll"); module = GetModuleHandleA("advapi32.dll");
pMD5Init = (fnMD5Init)GetProcAddress( module, "MD5Init" ); pMD5Init = (void *)GetProcAddress( module, "MD5Init" );
pMD5Update = (fnMD5Update)GetProcAddress( module, "MD5Update" ); pMD5Update = (void *)GetProcAddress( module, "MD5Update" );
pMD5Final = (fnMD5Final)GetProcAddress( module, "MD5Final" ); pMD5Final = (void *)GetProcAddress( module, "MD5Final" );
if (!pMD5Init || !pMD5Update || !pMD5Final) if (!pMD5Init || !pMD5Update || !pMD5Final)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment