Mike McCormack : advapi32: Implement and test SystemFunction010.

Alexandre Julliard julliard at wine.codeweavers.com
Mon May 22 05:19:23 CDT 2006


Module: wine
Branch: refs/heads/master
Commit: b4899f0712aba3e1eaae26abb7626cbe3cab8ea1
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=b4899f0712aba3e1eaae26abb7626cbe3cab8ea1

Author: Mike McCormack <mike at codeweavers.com>
Date:   Sun May 21 17:27:50 2006 +0900

advapi32: Implement and test SystemFunction010.

---

 dlls/advapi32/advapi32.spec     |    2 +-
 dlls/advapi32/crypt_md4.c       |   27 +++++++++++++++++++++++++++
 dlls/advapi32/tests/crypt_md4.c |   21 +++++++++++++++++++++
 3 files changed, 49 insertions(+), 1 deletions(-)

diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index 86a1b8d..becd80e 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -604,7 +604,7 @@ # @ stub StopTraceW
 @ stdcall SystemFunction007(ptr ptr)
 @ stdcall SystemFunction008(ptr ptr ptr)
 @ stdcall SystemFunction009(ptr ptr ptr)
-@ stub SystemFunction010
+@ stdcall SystemFunction010(ptr ptr ptr)
 @ stub SystemFunction011
 @ stub SystemFunction012
 @ stub SystemFunction013
diff --git a/dlls/advapi32/crypt_md4.c b/dlls/advapi32/crypt_md4.c
index 2c2318f..f782ca0 100644
--- a/dlls/advapi32/crypt_md4.c
+++ b/dlls/advapi32/crypt_md4.c
@@ -296,3 +296,30 @@ NTSTATUS WINAPI SystemFunction007(PUNICO
 
     return STATUS_SUCCESS;
 }
+
+/******************************************************************************
+ * SystemFunction010  [ADVAPI32.@]
+ *
+ * MD4 hashes 16 bytes of data
+ *
+ * PARAMS
+ *   unknown []  seems to have no effect on the output
+ *   data    [I] pointer to data to hash (16 bytes)
+ *   output  [O] the md4 hash of the data (16 bytes)
+ *
+ * RETURNS
+ *  Success: STATUS_SUCCESS
+ *  Failure: STATUS_UNSUCCESSFUL
+ *
+ */
+NTSTATUS WINAPI SystemFunction010(LPVOID unknown, LPBYTE data, LPBYTE hash)
+{
+    MD4_CTX ctx;
+
+    MD4Init( &ctx );
+    MD4Update( &ctx, data, 0x10 );
+    MD4Final( &ctx );
+    memcpy( hash, ctx.digest, 0x10 );
+
+    return STATUS_SUCCESS;
+}
diff --git a/dlls/advapi32/tests/crypt_md4.c b/dlls/advapi32/tests/crypt_md4.c
index 3dfa294..0c72d2b 100644
--- a/dlls/advapi32/tests/crypt_md4.c
+++ b/dlls/advapi32/tests/crypt_md4.c
@@ -40,11 +40,13 @@ typedef VOID (WINAPI *fnMD4Init)( MD4_CT
 typedef VOID (WINAPI *fnMD4Update)( MD4_CTX *ctx, const unsigned char *src, const int len );
 typedef VOID (WINAPI *fnMD4Final)( MD4_CTX *ctx );
 typedef int (WINAPI *fnSystemFunction007)(PUNICODE_STRING,LPBYTE);
+typedef int (WINAPI *fnSystemFunction010)(LPVOID, const LPBYTE, LPBYTE);
 
 fnMD4Init pMD4Init;
 fnMD4Update pMD4Update;
 fnMD4Final pMD4Final;
 fnSystemFunction007 pSystemFunction007;
+fnSystemFunction010 pSystemFunction010;
 
 #define ctxcmp( a, b ) memcmp( (char*)a, (char*)b, FIELD_OFFSET( MD4_CTX, in ) )
 
@@ -124,6 +126,21 @@ #endif
     ok(!memcmp(output, expected, sizeof expected), "response wrong\n");
 }
 
+static void test_SystemFunction010(void)
+{
+    unsigned char expected[0x10] = {
+        0x48, 0x7c, 0x3f, 0x5e, 0x2b, 0x0d, 0x6a, 0x79,
+        0x32, 0x4e, 0xcd, 0xbe, 0x9c, 0x15, 0x16, 0x6f };
+    unsigned char in[0x10], output[0x10];
+    int r;
+
+    memset(in, 0, sizeof in);
+    memset(output, 0, sizeof output);
+    r = pSystemFunction010(0, in, output);
+    ok( r == STATUS_SUCCESS, "wrong error code\n");
+    ok( !memcmp(expected, output, sizeof output), "output wrong\n");
+}
+
 START_TEST(crypt_md4)
 {
     HMODULE module;
@@ -141,5 +158,9 @@ START_TEST(crypt_md4)
     if (pSystemFunction007)
         test_SystemFunction007();
 
+    pSystemFunction010 = (fnSystemFunction010)GetProcAddress( module, "SystemFunction010" );
+    if (pSystemFunction010)
+        test_SystemFunction010();
+
     FreeLibrary( module );
 }




More information about the wine-cvs mailing list