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

# SysAllocStringByteLen(3w)

## NAME

**SysAllocStringByteLen** (OLEAUT32.150)

## SYNOPSIS

BSTR SysAllocStringByteLen\
  (\
   LPCSTR *str*,\
   UINT   *len*\
  )

## DESCRIPTION

Create a **BSTR** from an **OLESTR** of a given byte length.

## PARAMS

*str* **\[In\]**  Source to create **BSTR** from.

*len* **\[In\]**  Length of oleStr in bytes.

## RETURNS

**Success:** A newly allocated **BSTR**

**Failure:** **NULL**, if *len* is \>= 0x80000000, or memory allocation fails.

## NOTES

**-**If *len* is **0** or oleStr is **NULL** the resulting string is empty ("").

**-**This function always **NUL** terminates the resulting **BSTR**.

**-**oleStr may be either an **LPCSTR** or **LPCOLESTR**, since it is copied without checking for a terminating **NUL**. See **[BSTR(3w)](/BSTR/3w.md)**.

## IMPLEMENTATION

Declared in **"oleauto.h"**.

Implemented in **"dlls/oleaut32/oleaut.c"**.

Debug channel **"ole"**.
