Fix gcc 4.0 warnings.
[wine] / dlls / advapi32 / tests / crypt_lmhash.c
1 /*
2  * Unit tests for SystemFunction006 (LMHash?)
3  *
4  * Copyright 2004 Hans Leidekker
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #include <stdio.h>
22
23 #include "wine/test.h"
24 #include "windef.h"
25 #include "winbase.h"
26
27 typedef VOID (WINAPI *fnSystemFunction006)( PCSTR passwd, PSTR lmhash );
28 fnSystemFunction006 pSystemFunction006;
29
30 static void test_SystemFunction006(void)
31 {
32     char lmhash[16 + 1];
33
34     char passwd[] = { 's','e','c','r','e','t', 0, 0, 0, 0, 0, 0, 0, 0 };
35     unsigned char expect[] = 
36         { 0x85, 0xf5, 0x28, 0x9f, 0x09, 0xdc, 0xa7, 0xeb,
37           0xaa, 0xd3, 0xb4, 0x35, 0xb5, 0x14, 0x04, 0xee };
38
39     pSystemFunction006( passwd, lmhash );
40
41     ok( !memcmp( lmhash, expect, sizeof(expect) ),
42         "lmhash: %02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x%02x\n",
43         lmhash[0], lmhash[1], lmhash[2], lmhash[3], lmhash[4], lmhash[5],
44         lmhash[6], lmhash[7], lmhash[8], lmhash[9], lmhash[10], lmhash[11],
45         lmhash[12], lmhash[13], lmhash[14], lmhash[15] );
46 }
47
48 START_TEST(crypt_lmhash)
49 {
50     HMODULE module;
51
52     if (!(module = LoadLibrary("advapi32.dll"))) return;
53
54     pSystemFunction006 = (fnSystemFunction006)GetProcAddress( module, "SystemFunction006" );
55
56     if (!pSystemFunction006) goto out;
57
58     if (pSystemFunction006) 
59         test_SystemFunction006();
60
61 out:
62     FreeLibrary( module );
63 }