ReactOS  0.4.13-dev-249-gcba1a2f
sysfunc.c File Reference
#include <advapi32.h>
#include <ntsecapi.h>
#include <ksecioctl.h>
#include <md4.h>
#include <md5.h>
#include <rc4.h>
Include dependency graph for sysfunc.c:

Go to the source code of this file.

Functions

NTSTATUS WINAPI SystemFunction001 (const BYTE *data, const BYTE *key, LPBYTE output)
 
NTSTATUS WINAPI SystemFunction002 (const BYTE *data, const BYTE *key, LPBYTE output)
 
NTSTATUS WINAPI SystemFunction003 (const BYTE *key, LPBYTE output)
 
NTSTATUS WINAPI SystemFunction004 (const struct ustring *in, const struct ustring *key, struct ustring *out)
 
NTSTATUS WINAPI SystemFunction005 (const struct ustring *in, const struct ustring *key, struct ustring *out)
 
NTSTATUS WINAPI SystemFunction007 (const UNICODE_STRING *string, LPBYTE hash)
 
NTSTATUS WINAPI SystemFunction008 (const BYTE *challenge, const BYTE *hash, LPBYTE response)
 
NTSTATUS WINAPI SystemFunction009 (const BYTE *challenge, const BYTE *hash, LPBYTE response)
 
NTSTATUS WINAPI SystemFunction010 (LPVOID unknown, const BYTE *data, LPBYTE hash)
 
NTSTATUS WINAPI SystemFunction012 (const BYTE *in, const BYTE *key, LPBYTE out)
 
NTSTATUS WINAPI SystemFunction013 (const BYTE *in, const BYTE *key, LPBYTE out)
 
NTSTATUS WINAPI SystemFunction024 (const BYTE *in, const BYTE *key, LPBYTE out)
 
NTSTATUS WINAPI SystemFunction025 (const BYTE *in, const BYTE *key, LPBYTE out)
 
NTSTATUS WINAPI SystemFunction028 (_In_ PVOID ContextHandle, _Out_ LPBYTE SessionKey)
 
INT WINAPI SystemFunction029 (INT a, INT b)
 
BOOL WINAPI SystemFunction030 (LPCVOID b1, LPCVOID b2)
 
NTSTATUS WINAPI SystemFunction032 (struct ustring *data, const struct ustring *key)
 
INT WINAPI SystemFunction033 (INT a, INT b)
 
INT WINAPI SystemFunction034 (INT a, INT b)
 
BOOL WINAPI SystemFunction035 (LPCSTR lpszDllFilePath)
 
BOOLEAN WINAPI SystemFunction036 (PVOID pbBuffer, ULONG dwLen)
 
static NTSTATUS KsecOpenDevice ()
 
VOID CloseKsecDdHandle (VOID)
 
static NTSTATUS KsecDeviceIoControl (ULONG IoControlCode, PVOID InputBuffer, SIZE_T InputBufferLength, PVOID OutputBuffer, SIZE_T OutputBufferLength)
 
NTSTATUS WINAPI SystemFunction040 (_Inout_ PVOID Memory, _In_ ULONG MemoryLength, _In_ ULONG OptionFlags)
 
NTSTATUS WINAPI SystemFunction041 (_Inout_ PVOID Memory, _In_ ULONG MemoryLength, _In_ ULONG OptionFlags)
 

Variables

static const unsigned char CRYPT_LMhash_Magic [8]
 
static const unsigned char DefaultSessionKey [16]
 
HANDLE KsecDeviceHandle
 

Function Documentation

◆ CloseKsecDdHandle()

VOID CloseKsecDdHandle ( VOID  )

Definition at line 682 of file sysfunc.c.

683 {
684  /* Check if we already opened a handle to ksecdd */
685  if (KsecDeviceHandle != NULL)
686  {
687  /* Close it */
690  }
691 }
#define CloseHandle
Definition: compat.h:398
HANDLE KsecDeviceHandle
Definition: sysfunc.c:645
smooth NULL
Definition: ftsmooth.c:416

Referenced by DllMain().

◆ KsecDeviceIoControl()

static NTSTATUS KsecDeviceIoControl ( ULONG  IoControlCode,
PVOID  InputBuffer,
SIZE_T  InputBufferLength,
PVOID  OutputBuffer,
SIZE_T  OutputBufferLength 
)
static

Definition at line 695 of file sysfunc.c.

701 {
704 
705  /* Check if we already have a handle */
706  if (KsecDeviceHandle == NULL)
707  {
708  /* Try to open the device */
710  if (!NT_SUCCESS(Status))
711  {
712  //ERR("Failed to open handle to KsecDd driver!\n");
713  return Status;
714  }
715  }
716 
717  /* Call the driver */
719  NULL,
720  NULL,
721  NULL,
722  &IoStatusBlock,
724  InputBuffer,
726  OutputBuffer,
728 
729  return Status;
730 }
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
LONG NTSTATUS
Definition: precomp.h:26
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG _In_ ULONG OutputBufferLength
Definition: fltkernel.h:1374
NTSYSAPI NTSTATUS NTAPI NtDeviceIoControlFile(IN HANDLE hFile, IN HANDLE hEvent OPTIONAL, IN PIO_APC_ROUTINE IoApcRoutine OPTIONAL, IN PVOID IoApcContext OPTIONAL, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG DeviceIoControlCode, IN PVOID InBuffer OPTIONAL, IN ULONG InBufferLength, OUT PVOID OutBuffer OPTIONAL, IN ULONG OutBufferLength)
CHAR InputBuffer[80]
Definition: conmgr.c:33
HANDLE KsecDeviceHandle
Definition: sysfunc.c:645
smooth NULL
Definition: ftsmooth.c:416
_Must_inspect_result_ __drv_aliasesMem _In_ PDEVICE_OBJECT _In_opt_ PVOID _In_ ULONG _Out_opt_ PVOID OutputBuffer
Definition: iofuncs.h:713
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
static NTSTATUS KsecOpenDevice()
Definition: sysfunc.c:649
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG _In_ ULONG InputBufferLength
Definition: fltkernel.h:1372
Status
Definition: gdiplustypes.h:24
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75

Referenced by SystemFunction040(), and SystemFunction041().

◆ KsecOpenDevice()

static NTSTATUS KsecOpenDevice ( )
static

Definition at line 649 of file sysfunc.c.

650 {
651  UNICODE_STRING DeviceName = RTL_CONSTANT_STRING(L"\\Device\\KsecDD");
656 
658  &DeviceName,
660  NULL,
661  NULL);
665  &IoStatusBlock,
668  if (!NT_SUCCESS(Status))
669  {
670  return Status;
671  }
672 
674  {
676  }
677 
678  return STATUS_SUCCESS;
679 }
IN PUNICODE_STRING IN POBJECT_ATTRIBUTES ObjectAttributes
Definition: conport.c:35
_Inout_ PUSB_DEVICE_HANDLE DeviceHandle
Definition: hubbusif.h:121
LONG NTSTATUS
Definition: precomp.h:26
#define FILE_SHARE_WRITE
Definition: nt_native.h:681
WCHAR DeviceName[]
Definition: adapter.cpp:21
#define FILE_SHARE_READ
Definition: compat.h:125
#define FILE_READ_DATA
Definition: nt_native.h:628
#define InterlockedCompareExchangePointer
Definition: interlocked.h:129
HANDLE KsecDeviceHandle
Definition: sysfunc.c:645
smooth NULL
Definition: ftsmooth.c:416
NTSYSAPI NTSTATUS NTAPI NtOpenFile(OUT PHANDLE phFile, IN ACCESS_MASK DesiredAccess, IN POBJECT_ATTRIBUTES ObjectAttributes, OUT PIO_STATUS_BLOCK pIoStatusBlock, IN ULONG ShareMode, IN ULONG OpenMode)
Definition: file.c:3951
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
NTSTATUS NTAPI NtClose(IN HANDLE Handle)
Definition: obhandle.c:3399
#define OBJ_CASE_INSENSITIVE
Definition: winternl.h:228
#define FILE_SHARE_DELETE
Definition: nt_native.h:682
static const WCHAR L[]
Definition: oid.c:1250
#define SYNCHRONIZE
Definition: nt_native.h:61
Status
Definition: gdiplustypes.h:24
static OUT PIO_STATUS_BLOCK IoStatusBlock
Definition: pipe.c:75
#define FILE_SYNCHRONOUS_IO_NONALERT
Definition: from_kernel.h:31
#define InitializeObjectAttributes(p, n, a, r, s)
Definition: reg.c:106
return STATUS_SUCCESS
Definition: btrfs.c:2745
#define RTL_CONSTANT_STRING(s)
Definition: tunneltest.c:14

Referenced by KsecDeviceIoControl().

◆ SystemFunction001()

NTSTATUS WINAPI SystemFunction001 ( const BYTE data,
const BYTE key,
LPBYTE  output 
)

Definition at line 41 of file sysfunc.c.

42 {
43  if (!data || !output)
44  return STATUS_UNSUCCESSFUL;
46  return STATUS_SUCCESS;
47 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
unsigned char * CRYPT_DEShash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:259
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: path.c:42

◆ SystemFunction002()

NTSTATUS WINAPI SystemFunction002 ( const BYTE data,
const BYTE key,
LPBYTE  output 
)

Definition at line 66 of file sysfunc.c.

67 {
68  if (!data || !output)
69  return STATUS_UNSUCCESSFUL;
71  return STATUS_SUCCESS;
72 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
unsigned char * CRYPT_DESunhash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:299
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: path.c:42

◆ SystemFunction003()

NTSTATUS WINAPI SystemFunction003 ( const BYTE key,
LPBYTE  output 
)

Definition at line 90 of file sysfunc.c.

91 {
92  if (!output)
93  return STATUS_UNSUCCESSFUL;
95  return STATUS_SUCCESS;
96 }
static UCHAR ULONG UCHAR ULONG UCHAR * output
Definition: bcrypt.c:29
static const unsigned char CRYPT_LMhash_Magic[8]
Definition: sysfunc.c:20
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
unsigned char * CRYPT_DEShash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:259
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: path.c:42

◆ SystemFunction004()

NTSTATUS WINAPI SystemFunction004 ( const struct ustring in,
const struct ustring key,
struct ustring out 
)

Definition at line 119 of file sysfunc.c.

122 {
123  union {
124  unsigned char uc[8];
125  unsigned int ui[2];
126  } data;
127  unsigned char deskey[7];
128  unsigned int crypt_len, ofs;
129 
130  if (key->Length<=0)
132 
133  crypt_len = ((in->Length+7)&~7);
134  if (out->MaximumLength < (crypt_len+8))
135  {
136  out->Length = crypt_len + 8;
138  }
139 
140  data.ui[0] = in->Length;
141  data.ui[1] = 1;
142 
143  if (key->Length<sizeof deskey)
144  {
145  memset(deskey, 0, sizeof deskey);
146  memcpy(deskey, key->Buffer, key->Length);
147  }
148  else
149  memcpy(deskey, key->Buffer, sizeof deskey);
150 
151  CRYPT_DEShash(out->Buffer, deskey, data.uc);
152 
153  for(ofs=0; ofs<(crypt_len-8); ofs+=8)
154  CRYPT_DEShash(out->Buffer+8+ofs, deskey, in->Buffer+ofs);
155 
156  memset(data.uc, 0, sizeof data.uc);
157  memcpy(data.uc, in->Buffer+ofs, in->Length +8-crypt_len);
158  CRYPT_DEShash(out->Buffer+8+ofs, deskey, data.uc);
159 
160  out->Length = crypt_len+8;
161 
162  return STATUS_SUCCESS;
163 }
static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
Definition: des.c:1285
UINT ui
Definition: oleauto.h:49
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:462
static FILE * out
Definition: regtests2xml.c:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLuint in
Definition: glext.h:9616
unsigned char * CRYPT_DEShash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:259
return STATUS_SUCCESS
Definition: btrfs.c:2745
#define memset(x, y, z)
Definition: compat.h:39
Definition: path.c:42

◆ SystemFunction005()

NTSTATUS WINAPI SystemFunction005 ( const struct ustring in,
const struct ustring key,
struct ustring out 
)

Definition at line 182 of file sysfunc.c.

185 {
186  union {
187  unsigned char uc[8];
188  unsigned int ui[2];
189  } data;
190  unsigned char deskey[7];
191  unsigned int ofs, crypt_len;
192 
193  if (key->Length<=0)
195 
196  if (key->Length<sizeof deskey)
197  {
198  memset(deskey, 0, sizeof deskey);
199  memcpy(deskey, key->Buffer, key->Length);
200  }
201  else
202  memcpy(deskey, key->Buffer, sizeof deskey);
203 
204  CRYPT_DESunhash(data.uc, deskey, in->Buffer);
205 
206  if (data.ui[1] != 1)
208 
209  crypt_len = data.ui[0];
210  if (crypt_len > out->MaximumLength)
211  {
212  out->Length = crypt_len;
214  }
215 
216  for (ofs=0; (ofs+8)<crypt_len; ofs+=8)
217  CRYPT_DESunhash(out->Buffer+ofs, deskey, in->Buffer+ofs+8);
218 
219  if (ofs<crypt_len)
220  {
221  CRYPT_DESunhash(data.uc, deskey, in->Buffer+ofs+8);
222  memcpy(out->Buffer+ofs, data.uc, crypt_len-ofs);
223  }
224 
225  out->Length = crypt_len;
226 
227  return STATUS_SUCCESS;
228 }
static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
Definition: des.c:1285
UINT ui
Definition: oleauto.h:49
#define STATUS_BUFFER_TOO_SMALL
Definition: shellext.h:64
#define STATUS_INVALID_PARAMETER_2
Definition: ntstatus.h:462
static FILE * out
Definition: regtests2xml.c:44
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char * CRYPT_DESunhash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:299
GLuint in
Definition: glext.h:9616
return STATUS_SUCCESS
Definition: btrfs.c:2745
#define memset(x, y, z)
Definition: compat.h:39
#define STATUS_UNKNOWN_REVISION
Definition: ntstatus.h:310
Definition: path.c:42

◆ SystemFunction007()

NTSTATUS WINAPI SystemFunction007 ( const UNICODE_STRING string,
LPBYTE  hash 
)

Definition at line 245 of file sysfunc.c.

246 {
247  MD4_CTX ctx;
248 
249  MD4Init( &ctx );
250  MD4Update( &ctx, (const BYTE *)string->Buffer, string->Length );
251  MD4Final( &ctx );
252  memcpy( hash, ctx.digest, 0x10 );
253 
254  return STATUS_SUCCESS;
255 }
unsigned char digest[16]
Definition: util.c:86
VOID WINAPI MD4Init(MD4_CTX *ctx)
Definition: md4.c:45
VOID WINAPI MD4Final(MD4_CTX *ctx)
Definition: md4.c:113
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
Definition: util.c:81
VOID WINAPI MD4Update(MD4_CTX *ctx, const unsigned char *buf, unsigned int len)
Definition: md4.c:59
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: _hash_fun.h:40

Referenced by MsvpChangePassword(), MsvpCheckPassword(), and SampInitHashes().

◆ SystemFunction008()

NTSTATUS WINAPI SystemFunction008 ( const BYTE challenge,
const BYTE hash,
LPBYTE  response 
)

Definition at line 276 of file sysfunc.c.

277 {
278  BYTE key[7*3];
279 
280  if (!challenge || !response)
281  return STATUS_UNSUCCESSFUL;
282 
283  memset(key, 0, sizeof key);
284  memcpy(key, hash, 0x10);
285 
286  CRYPT_DEShash(response, key, challenge);
287  CRYPT_DEShash(response+8, key+7, challenge);
288  CRYPT_DEShash(response+16, key+14, challenge);
289 
290  return STATUS_SUCCESS;
291 }
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
unsigned char * CRYPT_DEShash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:259
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: _hash_fun.h:40
#define memset(x, y, z)
Definition: compat.h:39
Definition: path.c:42

Referenced by SystemFunction009().

◆ SystemFunction009()

NTSTATUS WINAPI SystemFunction009 ( const BYTE challenge,
const BYTE hash,
LPBYTE  response 
)

Definition at line 299 of file sysfunc.c.

300 {
301  return SystemFunction008(challenge, hash, response);
302 }
NTSTATUS WINAPI SystemFunction008(const BYTE *challenge, const BYTE *hash, LPBYTE response)
Definition: sysfunc.c:276
Definition: _hash_fun.h:40

◆ SystemFunction010()

NTSTATUS WINAPI SystemFunction010 ( LPVOID  unknown,
const BYTE data,
LPBYTE  hash 
)

Definition at line 321 of file sysfunc.c.

322 {
323  MD4_CTX ctx;
324 
325  MD4Init( &ctx );
326  MD4Update( &ctx, data, 0x10 );
327  MD4Final( &ctx );
328  memcpy( hash, ctx.digest, 0x10 );
329 
330  return STATUS_SUCCESS;
331 }
unsigned char digest[16]
Definition: util.c:86
VOID WINAPI MD4Init(MD4_CTX *ctx)
Definition: md4.c:45
VOID WINAPI MD4Final(MD4_CTX *ctx)
Definition: md4.c:113
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
Definition: util.c:81
VOID WINAPI MD4Update(MD4_CTX *ctx, const unsigned char *buf, unsigned int len)
Definition: md4.c:59
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: _hash_fun.h:40

◆ SystemFunction012()

NTSTATUS WINAPI SystemFunction012 ( const BYTE in,
const BYTE key,
LPBYTE  out 
)

Definition at line 353 of file sysfunc.c.

354 {
355  if (!in || !out)
356  return STATUS_UNSUCCESSFUL;
357 
358  CRYPT_DEShash(out, key, in);
359  CRYPT_DEShash(out+8, key+7, in+8);
360  return STATUS_SUCCESS;
361 }
static FILE * out
Definition: regtests2xml.c:44
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
GLuint in
Definition: glext.h:9616
unsigned char * CRYPT_DEShash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:259
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: path.c:42

Referenced by MsvpChangePassword().

◆ SystemFunction013()

NTSTATUS WINAPI SystemFunction013 ( const BYTE in,
const BYTE key,
LPBYTE  out 
)

Definition at line 383 of file sysfunc.c.

384 {
385  if (!in || !out)
386  return STATUS_UNSUCCESSFUL;
388  CRYPT_DESunhash(out+8, key+7, in+8);
389  return STATUS_SUCCESS;
390 }
static FILE * out
Definition: regtests2xml.c:44
#define STATUS_UNSUCCESSFUL
Definition: udferr_usr.h:132
unsigned char * CRYPT_DESunhash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:299
GLuint in
Definition: glext.h:9616
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: path.c:42

Referenced by SamrChangePasswordUser().

◆ SystemFunction024()

NTSTATUS WINAPI SystemFunction024 ( const BYTE in,
const BYTE key,
LPBYTE  out 
)

Definition at line 406 of file sysfunc.c.

407 {
408  BYTE deskey[0x10];
409 
410  memcpy(deskey, key, 4);
411  memcpy(deskey+4, key, 4);
412  memcpy(deskey+8, key, 4);
413  memcpy(deskey+12, key, 4);
414 
416  CRYPT_DEShash(out+8, deskey+7, in+8);
417 
418  return STATUS_SUCCESS;
419 }
static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
Definition: des.c:1285
static FILE * out
Definition: regtests2xml.c:44
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
GLuint in
Definition: glext.h:9616
unsigned char * CRYPT_DEShash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:259
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: path.c:42

◆ SystemFunction025()

NTSTATUS WINAPI SystemFunction025 ( const BYTE in,
const BYTE key,
LPBYTE  out 
)

Definition at line 435 of file sysfunc.c.

436 {
437  BYTE deskey[0x10];
438 
439  memcpy(deskey, key, 4);
440  memcpy(deskey+4, key, 4);
441  memcpy(deskey+8, key, 4);
442  memcpy(deskey+12, key, 4);
443 
445  CRYPT_DESunhash(out+8, deskey+7, in+8);
446 
447  return STATUS_SUCCESS;
448 }
static void deskey(const unsigned char *key, short edf, ulong32 *keyout)
Definition: des.c:1285
static FILE * out
Definition: regtests2xml.c:44
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
unsigned char * CRYPT_DESunhash(unsigned char *dst, const unsigned char *key, const unsigned char *src) DECLSPEC_HIDDEN
Definition: crypt_des.c:299
GLuint in
Definition: glext.h:9616
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: path.c:42

◆ SystemFunction028()

NTSTATUS WINAPI SystemFunction028 ( _In_ PVOID  ContextHandle,
_Out_ LPBYTE  SessionKey 
)

Definition at line 466 of file sysfunc.c.

469 {
470  /* HACK: Always return the default key */
471  memcpy(SessionKey, DefaultSessionKey, sizeof(DefaultSessionKey));
473 
474 #if 0
475  //NDRCContextBinding();
476  //SystemFunction034()
478  return 28;
479 #endif
480 }
#define SetLastError(x)
Definition: compat.h:409
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92
static const unsigned char DefaultSessionKey[16]
Definition: sysfunc.c:22
#define STATUS_LOCAL_USER_SESSION_KEY
Definition: ntstatus.h:120

◆ SystemFunction029()

INT WINAPI SystemFunction029 ( INT  a,
INT  b 
)

Definition at line 489 of file sysfunc.c.

490 {
491  //I_RpcBindingIsClientLocal()
493  return 29;
494 }
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SystemFunction030()

BOOL WINAPI SystemFunction030 ( LPCVOID  b1,
LPCVOID  b2 
)

Definition at line 510 of file sysfunc.c.

511 {
512  return !memcmp(b1, b2, 0x10);
513 }
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
static CRYPT_DATA_BLOB b1[]
Definition: msg.c:573
static CRYPT_DATA_BLOB b2[]
Definition: msg.c:582

◆ SystemFunction032()

NTSTATUS WINAPI SystemFunction032 ( struct ustring data,
const struct ustring key 
)

Definition at line 533 of file sysfunc.c.

534 {
535  RC4_CONTEXT a4i;
536 
537  rc4_init(&a4i, key->Buffer, key->Length);
538  rc4_crypt(&a4i, data->Buffer, data->Length);
539 
540  return STATUS_SUCCESS;
541 }
void rc4_crypt(RC4_CONTEXT *a4i, unsigned char *inoutString, unsigned int length)
Definition: rc4.c:47
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
void rc4_init(RC4_CONTEXT *a4i, const unsigned char *key, unsigned int keyLen)
Definition: rc4.c:25
return STATUS_SUCCESS
Definition: btrfs.c:2745
Definition: path.c:42

Referenced by read_credential_blob(), and write_credential_blob().

◆ SystemFunction033()

INT WINAPI SystemFunction033 ( INT  a,
INT  b 
)

Definition at line 550 of file sysfunc.c.

551 {
553  return 33;
554 }
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SystemFunction034()

INT WINAPI SystemFunction034 ( INT  a,
INT  b 
)

Definition at line 562 of file sysfunc.c.

563 {
564  //RpcBindingToStringBindingW
565  //I_RpcMapWin32Status
566  //RpcStringBindingParseW
567  //RpcStringFreeW
569  return 34;
570 }
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SystemFunction035()

BOOL WINAPI SystemFunction035 ( LPCSTR  lpszDllFilePath)

Definition at line 582 of file sysfunc.c.

583 {
584  //FIXME("%s: stub\n", debugstr_a(lpszDllFilePath));
585  return TRUE;
586 }
#define TRUE
Definition: types.h:120

◆ SystemFunction036()

BOOLEAN WINAPI SystemFunction036 ( PVOID  pbBuffer,
ULONG  dwLen 
)

Definition at line 602 of file sysfunc.c.

603 {
606  // This function will output numbers based on the tick count. //
607  // It will NOT OUTPUT CRYPTOGRAPHIC-SAFE RANDOM NUMBERS !!! //
609 
610  DWORD dwSeed;
611  PBYTE pBuffer;
612  ULONG uPseudoRandom;
614  static ULONG uCounter = 17;
615 
616  if(!pbBuffer || !dwLen)
617  {
618  /* This function always returns TRUE, even if invalid parameters were passed. (verified under WinXP SP2) */
619  return TRUE;
620  }
621 
622  /* Get the first seed from the performance counter */
624  dwSeed = time.LowPart ^ time.HighPart ^ RtlUlongByteSwap(uCounter++);
625 
626  /* We will access the buffer bytewise */
627  pBuffer = (PBYTE)pbBuffer;
628 
629  do
630  {
631  /* Use the pseudo random number generator RtlRandom, which outputs a 4-byte value and a new seed */
632  uPseudoRandom = RtlRandom(&dwSeed);
633 
634  do
635  {
636  /* Get each byte from the pseudo random number and store it in the buffer */
637  *pBuffer = (BYTE)(uPseudoRandom >> 8 * (dwLen % 3) & 0xFF);
638  ++pBuffer;
639  } while(--dwLen % 3);
640  } while(dwLen);
641 
642  return TRUE;
643 }
NTSYSAPI ULONG NTAPI RtlRandom(_Inout_ PULONG Seed)
#define TRUE
Definition: types.h:120
__u16 time
Definition: mkdosfs.c:366
PVOID pBuffer
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI QueryPerformanceCounter(OUT PLARGE_INTEGER lpPerformanceCount)
Definition: perfcnt.c:23
unsigned char BYTE
Definition: mem.h:68
#define RtlUlongByteSwap(_x)
Definition: compat.h:465
unsigned int ULONG
Definition: retypes.h:1
BYTE * PBYTE
Definition: pedump.c:66

◆ SystemFunction040()

NTSTATUS WINAPI SystemFunction040 ( _Inout_ PVOID  Memory,
_In_ ULONG  MemoryLength,
_In_ ULONG  OptionFlags 
)

Definition at line 761 of file sysfunc.c.

765 {
767 
768  if (OptionFlags == RTL_ENCRYPT_OPTION_SAME_PROCESS)
769  {
771  }
772  else if (OptionFlags == RTL_ENCRYPT_OPTION_CROSS_PROCESS)
773  {
775  }
776  else if (OptionFlags == RTL_ENCRYPT_OPTION_SAME_LOGON)
777  {
779  }
780  else
781  {
783  }
784 
785  return KsecDeviceIoControl(IoControlCode, Memory, MemoryLength, Memory, MemoryLength);
786 }
static BYTE Memory[0x20]
Definition: ps2.c:54
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RTL_ENCRYPT_OPTION_CROSS_PROCESS
Definition: ksecdd.h:26
#define IOCTL_KSEC_ENCRYPT_SAME_LOGON
Definition: ksecioctl.h:34
#define RTL_ENCRYPT_OPTION_SAME_PROCESS
Definition: ksecdd.h:25
static NTSTATUS KsecDeviceIoControl(ULONG IoControlCode, PVOID InputBuffer, SIZE_T InputBufferLength, PVOID OutputBuffer, SIZE_T OutputBufferLength)
Definition: sysfunc.c:695
#define RTL_ENCRYPT_OPTION_SAME_LOGON
Definition: ksecdd.h:27
#define IOCTL_KSEC_ENCRYPT_SAME_PROCESS
Definition: ksecioctl.h:18
unsigned int ULONG
Definition: retypes.h:1
#define IOCTL_KSEC_ENCRYPT_CROSS_PROCESS
Definition: ksecioctl.h:26

◆ SystemFunction041()

NTSTATUS WINAPI SystemFunction041 ( _Inout_ PVOID  Memory,
_In_ ULONG  MemoryLength,
_In_ ULONG  OptionFlags 
)

Definition at line 812 of file sysfunc.c.

816 {
818 
819  if (OptionFlags == RTL_ENCRYPT_OPTION_SAME_PROCESS)
820  {
822  }
823  else if (OptionFlags == RTL_ENCRYPT_OPTION_CROSS_PROCESS)
824  {
826  }
827  else if (OptionFlags == RTL_ENCRYPT_OPTION_SAME_LOGON)
828  {
830  }
831  else
832  {
834  }
835 
836  return KsecDeviceIoControl(IoControlCode, Memory, MemoryLength, Memory, MemoryLength);
837 }
static BYTE Memory[0x20]
Definition: ps2.c:54
_Must_inspect_result_ _In_ PFILE_OBJECT _In_ ULONG IoControlCode
Definition: fltkernel.h:1383
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define RTL_ENCRYPT_OPTION_CROSS_PROCESS
Definition: ksecdd.h:26
#define IOCTL_KSEC_DECRYPT_CROSS_PROCESS
Definition: ksecioctl.h:30
#define IOCTL_KSEC_DECRYPT_SAME_PROCESS
Definition: ksecioctl.h:22
#define IOCTL_KSEC_DECRYPT_SAME_LOGON
Definition: ksecioctl.h:38
#define RTL_ENCRYPT_OPTION_SAME_PROCESS
Definition: ksecdd.h:25
static NTSTATUS KsecDeviceIoControl(ULONG IoControlCode, PVOID InputBuffer, SIZE_T InputBufferLength, PVOID OutputBuffer, SIZE_T OutputBufferLength)
Definition: sysfunc.c:695
#define RTL_ENCRYPT_OPTION_SAME_LOGON
Definition: ksecdd.h:27
unsigned int ULONG
Definition: retypes.h:1

Variable Documentation

◆ CRYPT_LMhash_Magic

const unsigned char CRYPT_LMhash_Magic[8]
static
Initial value:
=
{ 'K', 'G', 'S', '!', '@', '#', '$', '%' }

Definition at line 20 of file sysfunc.c.

Referenced by SystemFunction003().

◆ DefaultSessionKey

const unsigned char DefaultSessionKey[16]
static
Initial value:
=
{'D', 'e', 'f', 'S', 'e', 's', 's', 'i', 'o', 'n', 'K', 'e', 'y', '!', '@', '#'}

Definition at line 22 of file sysfunc.c.

Referenced by SystemFunction028().

◆ KsecDeviceHandle

HANDLE KsecDeviceHandle

Definition at line 645 of file sysfunc.c.

Referenced by CloseKsecDdHandle(), KsecDeviceIoControl(), and KsecOpenDevice().