Problem with ATL OLE DB Provider

I created a ATL OLE DB Provider using the wizard in Visual Studio 2005 (from the "Add class" menu).

The Provider created is supposed to return a "dir"-like rowset to a consumer.

The problem is that the test I wrote is getting only the first character of each filename sent by the provider.

I don't think there is a problem on the consumer side - it's a 3 liner vbscript.

On the other hand tracing thru the provider code doesn't reveal any problems - the filenames seem to be complete all the way.

Am I doing something dumb?

Many thanks in advance!

[614 byte] By [leorb] at [2007-12-22]
# 1

This may not be the ultimate solution, but have you tried changing to an _MBCS compilation (instead of UNICODE, _UNICODE)? All 2005 wizard generated projects default to UNICODE now.

Ted. at 2007-8-30 > top of Msdn Tech,Visual C++,Visual C++ General...
# 2

Changing to MBCS breaks compilation:

error C2664: 'StringCchCopyA' : cannot convert parameter 1 from 'WCHAR [129]' to 'STRSAFE_LPSTR'

leorb at 2007-8-30 > top of Msdn Tech,Visual C++,Visual C++ General...
# 3
I'd have to see the code you're calling - can you post a snippet where the compile error occurs?
Ted. at 2007-8-30 > top of Msdn Tech,Visual C++,Visual C++ General...
# 4

I fixed the compile error by changing the call to StringCchCopy() to wcscpy_s() which is functionally equivalent in addition to working correctly under _MBCS.

Thanks for the assistance!

~L.

leorb at 2007-8-30 > top of Msdn Tech,Visual C++,Visual C++ General...
# 5
But did it solve the problem? i.e. do you get more than just the first character of each file name?
Ted. at 2007-8-30 > top of Msdn Tech,Visual C++,Visual C++ General...
# 6

Yes it did. The entire file name is displayed.

Thanks again!

leorb at 2007-8-30 > top of Msdn Tech,Visual C++,Visual C++ General...