---
name: "AllocSLCallback"
section: "3w"
platform: "linux"
package: "libwine-dev"
version: "1.0.1-3.1"
release: "Debian 6.0 (Squeeze)"
platforms: ["linux"]
url: "https://new.carta.tech/AllocSLCallback"
---

# AllocSLCallback(3w)

## NAME

**AllocSLCallback** (KERNEL32.@)

## SYNOPSIS

DWORD AllocSLCallback\
  (\
   DWORD *finalizer*,\
   DWORD *callback*\
  )

## PARAMS

*finalizer* **\[In\]**  Finalizer function.

**\[In\]**  Callback function.

## DESCRIPTION

Allocate a **16**-\>32 *callback*.

## NOTES

Win95 uses some structchains for callbacks. It allocates them in blocks of **100** entries, size **32** bytes each, layout:

**blockstart:** \
\
  	0:	PTR	nextblockstart\
\
 	4:	entry	\*first;\
\
 	8:	WORD	sel ( start points to blockstart)\
\
 	A:	WORD	unknown

100xentry: \
\
 	00\..17:		Code\
\
 	18:	PDB	\*owning\_process;\
\
 	1C:	PTR	blockstart.

We ignore this for now. (Just a note for further developers)

**FIXME:** use this method, so we don't waste selectors.**..**

Following code is then generated by AllocSLCallback. The code is **16** bit, so the 0x66 prefix switches from word*-\>long* registers. \
\
 	665A		pop	edx\
\
 	6668x arg2 x 	pushl	\<arg2\>\
\
 	6652		push	edx\
\
 	EAx arg1 x	jmpf	\<arg1\>.

returns the startaddress of this thunk.

Note, that they look very similar to the ones allocates by THUNK\_Alloc.

## RETURNS

A segmented pointer to the start of the thunk

## IMPLEMENTATION

Not defined in a Wine header. The function is either undocumented, or missing from Wine.

Implemented in **"dlls/kernel32/thunk.c"**.

Debug channel **"thunk"**.
