Mike McCormack : advapi32: Implement and test SystemFunction001.
Alexandre Julliard
julliard at wine.codeweavers.com
Wed May 10 12:56:59 CDT 2006
Module: wine
Branch: refs/heads/master
Commit: 6969cab5eeaa2d311ef8eb77f80bf4aed1fdd032
URL: http://source.winehq.org/git/?p=wine.git;a=commit;h=6969cab5eeaa2d311ef8eb77f80bf4aed1fdd032
Author: Mike McCormack <mike at codeweavers.com>
Date: Wed May 10 18:16:58 2006 +0900
advapi32: Implement and test SystemFunction001.
---
dlls/advapi32/advapi32.spec | 2 +-
dlls/advapi32/crypt_lmhash.c | 23 +++++++++++++++++++++++
dlls/advapi32/tests/crypt_lmhash.c | 27 ++++++++++++++++++++++++++-
3 files changed, 50 insertions(+), 2 deletions(-)
diff --git a/dlls/advapi32/advapi32.spec b/dlls/advapi32/advapi32.spec
index abec4e7..c729d3b 100644
--- a/dlls/advapi32/advapi32.spec
+++ b/dlls/advapi32/advapi32.spec
@@ -595,7 +595,7 @@ # @ stub StartTraceW
# @ stub StopTraceA
# @ stub StopTraceW
@ stdcall SynchronizeWindows31FilesAndWindowsNTRegistry(long long long long)
-@ stub SystemFunction001
+@ stdcall SystemFunction001(ptr ptr ptr)
@ stub SystemFunction002
@ stub SystemFunction003
@ stub SystemFunction004
diff --git a/dlls/advapi32/crypt_lmhash.c b/dlls/advapi32/crypt_lmhash.c
index dbe07ba..01f6049 100644
--- a/dlls/advapi32/crypt_lmhash.c
+++ b/dlls/advapi32/crypt_lmhash.c
@@ -89,3 +89,26 @@ NTSTATUS WINAPI SystemFunction008(const
return STATUS_SUCCESS;
}
+
+/******************************************************************************
+ * SystemFunction001 [ADVAPI32.@]
+ *
+ * Encrypts a single block of data using DES
+ *
+ * PARAMS
+ * data [I] data to encrypt (8 bytes)
+ * key [I] key data (7 bytes)
+ * output [O] the encrypted data (8 bytes)
+ *
+ * RETURNS
+ * Success: STATUS_SUCCESS
+ * Failure: STATUS_UNSUCCESSFUL
+ *
+ */
+NTSTATUS WINAPI SystemFunction001(const LPBYTE data, const LPBYTE key, LPBYTE output)
+{
+ if (!data || !output)
+ return STATUS_UNSUCCESSFUL;
+ CRYPT_DEShash(output, key, data);
+ return STATUS_SUCCESS;
+}
diff --git a/dlls/advapi32/tests/crypt_lmhash.c b/dlls/advapi32/tests/crypt_lmhash.c
index c389fb2..5c26633 100644
--- a/dlls/advapi32/tests/crypt_lmhash.c
+++ b/dlls/advapi32/tests/crypt_lmhash.c
@@ -29,10 +29,12 @@ #include "winbase.h"
#include "winternl.h"
typedef VOID (WINAPI *fnSystemFunction006)( PCSTR passwd, PSTR lmhash );
-typedef DWORD (WINAPI *fnSystemFunction008)(const LPBYTE, const LPBYTE, LPBYTE);
+typedef NTSTATUS (WINAPI *fnSystemFunction008)(const LPBYTE, const LPBYTE, LPBYTE);
+typedef NTSTATUS (WINAPI *fnSystemFunction001)(const LPBYTE, const LPBYTE, LPBYTE);
fnSystemFunction006 pSystemFunction006;
fnSystemFunction008 pSystemFunction008;
+fnSystemFunction001 pSystemFunction001;
static void test_SystemFunction006(void)
{
@@ -93,6 +95,25 @@ static void test_SystemFunction008(void)
ok( !memcmp(output, expected, sizeof expected), "response wrong\n");
}
+static void test_SystemFunction001(void)
+{
+ unsigned char key[8] = { 0xff, 0x37, 0x50, 0xbc, 0xc2, 0xb2, 0x24, 0 };
+ unsigned char data[8] = { 0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef };
+ unsigned char expected[8] = { 0xc3, 0x37, 0xcd, 0x5c, 0xbd, 0x44, 0xfc, 0x97 };
+ unsigned char output[16];
+ NTSTATUS r;
+
+ r = pSystemFunction001(0,0,0);
+ ok( r == STATUS_UNSUCCESSFUL, "wrong error code\n");
+
+ memset(output, 0, sizeof output);
+
+ r = pSystemFunction001(data,key,output);
+ ok( r == STATUS_SUCCESS, "wrong error code\n");
+
+ ok(!memcmp(output, expected, sizeof expected), "response wrong\n");
+}
+
START_TEST(crypt_lmhash)
{
HMODULE module;
@@ -107,5 +128,9 @@ START_TEST(crypt_lmhash)
if (pSystemFunction008)
test_SystemFunction008();
+ pSystemFunction001 = (fnSystemFunction001)GetProcAddress( module, "SystemFunction001" );
+ if (pSystemFunction001)
+ test_SystemFunction001();
+
FreeLibrary( module );
}
More information about the wine-cvs
mailing list