I see no reason why memsetting a DX struct would crash.
Only thing I can think of is that your 'this' pointer is bad.
Open a watch window and look at this. Is it something wonky like 0xcdcdcdcd?
EDIT:
To elaborate further... your 'this' pointer can be bad if you do not call the InitializeD3D function with a valid object. So if you're doing something like this:
1 2
DirectX* ptr; // <- uninitialized pointer
ptr->InitializeD3D( /*... */ ); // <- your 'this' pointer will be bad.
Still crashing :/ this time it's highlighting the buffercount line. I fixed it highlighting the ZeroMemory by making the variable sd local to the scope.
I fixed it highlighting the ZeroMemory by making the variable sd local to the scope
That does not really fix the problem, it just dodges it. The problem is your 'this' pointer is bad because you're calling this function with a bad pointer. That is what you need to fix.
The bug is not in the InitializeD3D function. It's before it. Post the code that's calling this function.