HippoMocks - How to mock user defined structures, specifically WinAPI structures

279 Views Asked by At

I'm in a situation where I have to mock WinAPI calls, and with some difficulty I was able to get C function mocking to work in HippoMocks.

1) I found that the HippoMocks repository on Assembla does not have C function mocking. I was able to find it on the repository from github.

2) I'm unable to mock functions that have user defined output parameters. As a for-instance,I tried a simple WinAPI function -- GetSystemTime, which does not return anything. Instead, it takes an output parameter of type LPSYSTEMTIME. When I try to mock this function, I see the following type of error:

error C2679: binary '=' : no operator found which takes a right-hand operand of type '_SYSTEMTIME *' (or there is no acceptable conversion)

The problem seems to be that the mocking framework complains about the fact that an object of type SYSTEMTIME does not have an assignment operator. How can this problem be resolved?

Note 1: I'm successfully able to mock WinAPI functions with simple parameters/return values.

1

There are 1 best solutions below

0
On

This should work now. I'm not entirely sure how you got that exact error; if the argument is a LPSYSTEMTIME it will never try to dereference it. Can you reproduce this error with the current version?