Mike McCormack : advapi32: Implement and test SystemFunction030.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 5 07:28:18 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 546b84c0c56b8168560aeadae229c8972c1aa509
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=546b84c0c56b8168560aeadae229c8972c1aa509
Author: Mike McCormack <mike at codeweavers.com>
Date: Sun Jun 4 19:40:54 2006 +0900
advapi32: Implement and test SystemFunction030.
---
dlls/advapi32/advapi32.spec | 2 +-
dlls/advapi32/crypt.c | 17 +++++++++++++
dlls/advapi32/tests/crypt_lmhash.c | 48 +++++++++++++++++++++++++++++++++---
3 files changed, 62 insertions(+), 5 deletions(-)
diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index f783c6d..3b1828a 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -624,7 +624,7 @@ # @ stub StopTraceW
@ stdcall SystemFunction027(ptr ptr ptr) SystemFunction025
@ stub SystemFunction028
@ stub SystemFunction029
-@ stub SystemFunction030
+@ stdcall SystemFunction030(ptr ptr)
@ stub SystemFunction031
@ stdcall SystemFunction032(ptr ptr)
@ stub SystemFunction033
diff --git a/dlls/advapi32/crypt.c b/dlls/advapi32/crypt.c
index dae2343..7a258c4 100644
--- a/dlls/advapi32/crypt.c
+++ b/dlls/advapi32/crypt.c
@@ -1969,6 +1969,23 @@ BOOL WINAPI CryptVerifySignatureA (HCRYP
/******************************************************************************
* SystemFunction036 (ADVAPI32.@)
*
+ * Tests if two blocks of 16 bytes are equal
+ *
+ * PARAMS
+ * b1,b2 [I] block of 16 bytes
+ *
+ * RETURNS
+ * TRUE if blocks are the same
+ * FALSE if blocks are different
+ */
+BOOL WINAPI SystemFunction030(PVOID b1, PVOID b2)
+{
+ return !memcmp(b1, b2, 0x10);
+}
+
+/******************************************************************************
+ * SystemFunction036 (ADVAPI32.@)
+ *
* MSDN documents this function as RtlGenRandom and declares it in ntsecapi.h
*
* PARAMS
diff --git a/dlls/advapi32/tests/crypt_lmhash.c b/dlls/advapi32/tests/crypt_lmhash.c
index 79d5542..1618cf8 100644
--- a/dlls/advapi32/tests/crypt_lmhash.c
+++ b/dlls/advapi32/tests/crypt_lmhash.c
@@ -43,6 +43,7 @@ typedef VOID (WINAPI *fnSystemFunction00
typedef NTSTATUS (WINAPI *fnSystemFunction008)(const LPBYTE, const LPBYTE, LPBYTE);
typedef NTSTATUS (WINAPI *fnSystemFunction009)(const LPBYTE, const LPBYTE, LPBYTE);
typedef int (WINAPI *descrypt)(unsigned char *, unsigned char *, unsigned char *);
+typedef NTSTATUS (WINAPI *fnSystemFunction030)(void*, void*);
typedef NTSTATUS (WINAPI *fnSystemFunction032)(struct ustring *, struct ustring *);
fnSystemFunction001 pSystemFunction001;
@@ -78,6 +79,7 @@ descrypt pSystemFunction025;
descrypt pSystemFunction026;
descrypt pSystemFunction027;
+fnSystemFunction030 pSystemFunction030;
fnSystemFunction032 pSystemFunction032;
static void test_SystemFunction006(void)
@@ -474,6 +476,40 @@ static void test_SystemFunction_dec32(de
ok( !memcmp( output, des_plaintext, sizeof des_plaintext), "plaintext wrong (%d)\n", num);
}
+static void test_SystemFunction030(void)
+{
+ unsigned char arg1[0x20], arg2[0x20];
+ int r;
+
+ /* r = pSystemFunction030(NULL, NULL); - crashes */
+
+ memset(arg1, 0, sizeof arg1);
+ memset(arg2, 0, sizeof arg2);
+ arg1[0x10] = 1;
+
+ r = pSystemFunction030(arg1, arg2);
+ ok( r == 1, "wrong error code\n");
+
+ memset(arg1, 1, sizeof arg1);
+ memset(arg2, 1, sizeof arg2);
+ arg1[0x10] = 0;
+
+ r = pSystemFunction030(arg1, arg2);
+ ok( r == 1, "wrong error code\n");
+
+ memset(arg1, 0, sizeof arg1);
+ memset(arg2, 1, sizeof arg2);
+
+ r = pSystemFunction030(arg1, arg2);
+ ok( r == 0, "wrong error code\n");
+
+ memset(arg1, 1, sizeof arg1);
+ memset(arg2, 0, sizeof arg2);
+
+ r = pSystemFunction030(arg1, arg2);
+ ok( r == 0, "wrong error code\n");
+}
+
START_TEST(crypt_lmhash)
{
HMODULE module;
@@ -512,10 +548,6 @@ START_TEST(crypt_lmhash)
if (pSystemFunction009)
test_SystemFunction009();
- pSystemFunction032 = (fnSystemFunction032)GetProcAddress( module, "SystemFunction032" );
- if (pSystemFunction032)
- test_SystemFunction032();
-
pSystemFunction012 = (descrypt) GetProcAddress( module, "SystemFunction012");
pSystemFunction013 = (descrypt) GetProcAddress( module, "SystemFunction013");
pSystemFunction014 = (descrypt) GetProcAddress( module, "SystemFunction014");
@@ -557,4 +589,12 @@ START_TEST(crypt_lmhash)
/* these descrypt two DES blocks with a short key */
test_SystemFunction_dec32(pSystemFunction025, 25);
test_SystemFunction_dec32(pSystemFunction027, 27);
+
+ pSystemFunction030 = (fnSystemFunction030)GetProcAddress( module, "SystemFunction030" );
+ if (pSystemFunction030)
+ test_SystemFunction030();
+
+ pSystemFunction032 = (fnSystemFunction032)GetProcAddress( module, "SystemFunction032" );
+ if (pSystemFunction032)
+ test_SystemFunction032();
}
More information about the wine-cvs
mailing list