Hi I am working on windows platform on networking using mutli threading

I have a problem with the locking Mechanism, I am getting a exception which i am not able to fix it

My exception as as follows:-

Unhandled exception at 0x7c918af2 in xxx.exe:0xc0000005: Access violation writing location 0x00000010

I have used the locking mechanism using

EnterCriticalSection(&Lock);
LeaveCriticalSection(&Lock);


where Lock is a variable local to the class