directX and heap coruption

going nuts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
struct TRI
{
	WORD v0, v1, v2;
	TRI(WORD w0, WORD w1, WORD w2)
	{
		v0 = w0;
		v1 = w1;
		v2 = w2;
	};
};

BorderIndexCount = 48; //if i put 49 here it works 
i = mX::_D3DDevice->CreateIndexBuffer(BorderIndexCount, 0, D3DFMT_INDEX16, D3DPOOL_DEFAULT,  _IB, 0);	if(D3D_OK != i) throw;
new mExtern(_IB, this, O_D3DINDEXBUFER);
TRI* pIndexes;
_IB->Lock(0, 0, (void**)&pIndexes, D3DLOCK_DISCARD);
*pIndexes++ = TRI( 0,  1,  3);
...
..
.
16 times TRI( 0,  1...
if i put 49 instead of 48 (i have 48 indexes) i can put a hole lot more 
then 48 whit out geting a corupted heap using the corect amount creats a heap
coruption

where i am wrong ?
Topic archived. No new replies allowed.