[ADVAPI32] SystemFunction004 and SystemFunction005 must return the required output...
[reactos.git] / dll / win32 / advapi32 / misc / sysfunc.c
index 1e3c440..b6bee62 100644 (file)
@@ -1,14 +1,13 @@
 /*
- *
  * COPYRIGHT:       See COPYING in the top level directory
  * PROJECT:         ReactOS system libraries
- * FILE:            dll/win32/advapi32/misc/sysfun.c
+ * FILE:            dll/win32/advapi32/misc/sysfunc.c
  * PURPOSE:         advapi32.dll system functions (undocumented)
  * PROGRAMMER:      Emanuele Aliberti
  * UPDATE HISTORY:
- *     19990413 EA     created
- *     19990415 EA
- *     20080424 Ported from WINE
+ *  19990413 EA created
+ *  19990415 EA
+ *  20080424 Ported from WINE
  */
 
 #include <advapi32.h>
@@ -131,7 +130,10 @@ WINAPI SystemFunction004(const struct ustring *in,
 
     crypt_len = ((in->Length+7)&~7);
     if (out->MaximumLength < (crypt_len+8))
+    {
+        out->Length = crypt_len + 8;
         return STATUS_BUFFER_TOO_SMALL;
+    }
 
     data.ui[0] = in->Length;
     data.ui[1] = 1;
@@ -204,7 +206,10 @@ WINAPI SystemFunction005(const struct ustring *in,
 
     crypt_len = data.ui[0];
     if (crypt_len > out->MaximumLength)
+    {
+        out->Length = crypt_len;
         return STATUS_BUFFER_TOO_SMALL;
+    }
 
     for (ofs=0; (ofs+8)<crypt_len; ofs+=8)
         CRYPT_DESunhash(out->Buffer+ofs, deskey, in->Buffer+ofs+8);
@@ -450,8 +455,8 @@ SystemFunction028(INT a, INT b)
 {
     //NDRCContextBinding()
     //SystemFunction034()
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 28;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 28;
 }
 
 
@@ -464,8 +469,8 @@ WINAPI
 SystemFunction029(INT a, INT b)
 {
     //I_RpcBindingIsClientLocal()
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 29;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 29;
 }
 
 
@@ -484,7 +489,7 @@ SystemFunction029(INT a, INT b)
 BOOL
 WINAPI SystemFunction030(LPCVOID b1, LPCVOID b2)
 {
-       return !memcmp(b1, b2, 0x10);
+    return !memcmp(b1, b2, 0x10);
 }
 
 
@@ -524,8 +529,8 @@ INT
 WINAPI
 SystemFunction033(INT a, INT b)
 {
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 33;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 33;
 }
 
 /**********************************************************************
@@ -540,8 +545,8 @@ SystemFunction034(INT a, INT b)
     //I_RpcMapWin32Status
     //RpcStringBindingParseW
     //RpcStringFreeW
-       SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-       return 34;
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return 34;
 }
 
 
@@ -579,7 +584,7 @@ SystemFunction036(PVOID pbBuffer, ULONG dwLen)
     ////////////////////////////////////////////////////////////////
     //////////////////// B I G   W A R N I N G  !!! ////////////////
     // This function will output numbers based on the tick count. //
-    // It will NOT OUPUT CRYPTOGRAPHIC-SAFE RANDOM NUMBERS !!!    //
+    // It will NOT OUTPUT CRYPTOGRAPHIC-SAFE RANDOM NUMBERS !!!    //
     ////////////////////////////////////////////////////////////////
 
     DWORD dwSeed;
@@ -757,7 +762,7 @@ SystemFunction040(
         return STATUS_INVALID_PARAMETER;
     }
 
-       return KsecDeviceIoControl(IoControlCode, Memory, MemoryLength, Memory, MemoryLength);
+    return KsecDeviceIoControl(IoControlCode, Memory, MemoryLength, Memory, MemoryLength);
 }
 
 /******************************************************************************
@@ -808,7 +813,7 @@ SystemFunction041(
         return STATUS_INVALID_PARAMETER;
     }
 
-       return KsecDeviceIoControl(IoControlCode, Memory, MemoryLength, Memory, MemoryLength);
+    return KsecDeviceIoControl(IoControlCode, Memory, MemoryLength, Memory, MemoryLength);
 }
 
 /* EOF */