Unless I'm reading the code wrong, the only change made to make it work is that arg 4 has been changed from size to 24? According to MSDN, that argument is the number of bytes in the array used as arg 3 (pin) - which on that basis should be size. Confucius reigns!