Hey
I'm stuck with the following code. I need to pass a few variables address to new thread to got a shared access to them but the way I choose seems doesn't work. I got in new thread a good pointer to params class but bool and intereger variable addresses are not proper. Where can be the problem??

Thanks!

#include"threads.h"

class params
{
public:
bool* bl;
int* i;
HANDLE* h;

};


DWORD WINAPI ThreadProc(
__in LPVOID lpParameter
)
{
bool* p_b;
int* p_i;
HANDLE h;

params* ptr=(params*)lpParameter;

p_b=ptr->bl; //that's the first problem (often even 0 value for pointer)
p_i=ptr->i; //that's the second problem
h=(*ptr->h);

return 0;

}

void initThread()
{
bool a=true;
int b=1;
HANDLE h=CreateMutex(NULL,TRUE,L"TEST");


params prm;
prm.bl=&a;
prm.h=&h;
prm.i=&b;

CreateThread(0,0,ThreadProc,&prm,0,0);

}