SHAllocShared function (shlwapi.h)

[SHAllocShared is available for use in the operating systems specified in the Requirements section. It may be altered or unavailable in subsequent versions.]

Allocates a handle in a specified process to a copy of a specified memory block in the calling process.

Syntax

HANDLE SHAllocShared(
  [in, optional] const void *pvData,
  [in]           DWORD      dwSize,
  [in]           DWORD      dwProcessId
);

Parameters

[in, optional] pvData

Type: const void*

A pointer to the memory block in the calling process that is to be copied. You can set this parameter to NULL if you want to share a block of memory without copying any data to it.

[in] dwSize

Type: DWORD

The size, in bytes, of the memory block pointed to by pvData.

[in] dwProcessId

Type: DWORD

The process ID of the process that will share memory block specified by pvData.

Return value

Type: HANDLE

Returns a handle to the shared memory for the process specified by dwDestinationProcessId. Returns NULL if unsuccessful.

Remarks

Use SHFreeShared to free the handle when you are finished.

Requirements

Requirement Value
Minimum supported client Windows XP [desktop apps only]
Minimum supported server Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shlwapi.h
DLL Shlwapi.dll

See also

SHFreeShared

SHLockShared

SHUnlockShared