---
name: "SystemFunction040"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.4.1-4"
release: "Debian 7 (Wheezy)"
platforms: ["linux"]
url: "https://new.carta.tech/SystemFunction040"
---

# SystemFunction040(3w)

## NAME

**SystemFunction040** (ADVAPI32.@)

## SYNOPSIS

NTSTATUS SystemFunction040\
  (\
   PVOID *memory*,\
   ULONG *length*,\
   ULONG *flags*\
  )

## DESCRIPTION

**MSDN** documents this function as RtlEncryptMemory and declares it in ntsecapi.h.

## PARAMS

*memory* **\[In/Out\]**  Pointer to *memory* to encrypt.

*length* **\[In\]**  Length of region to encrypt in bytes.

*flags* **\[In\]**  Control whether other processes are able to decrypt the *memory*. **RTL\_ENCRYPT\_OPTION\_SAME\_PROCESS** RTL\_ENCRYPT\_OPTION\_CROSS\_PROCESS **RTL\_ENCRYPT\_OPTION\_SAME\_LOGON**.

## RETURNS

**Success:** **STATUS\_SUCCESS**

**Failure:** **NTSTATUS** error code.

## NOTES

*length* must be a multiple of **RTL\_ENCRYPT\_MEMORY\_SIZE**. If *flags* are specified when encrypting, the same flag value must be given when decrypting the *memory*.

## IMPLEMENTATION

Declared in **"ntsecapi.h"**.

Implemented in **"dlls/advapi32/crypt.c"**.

Debug channel **"crypt"**.
