memset/memcpy/etc. with GDI driver



I'm having some linkage problems with building a GDI driver for XP after moving from DDK 3790.1830 to WDK 6000. The driver used memset() and memcpy(), and it built fine with the older DDK. With the newer one, I get errors like

foo.obj : error LNK2019: unresolved external symbol _memset referenced in function DrvEnableDriver@12

No problem, I'll write my own utility routines. This worked in the checked build, but unresolved references for memset/memcpy popped up again in the free build. It looks like the compiler is inserting its own calls to these functions when it recognizes certain loop idioms. As best as I can tell, the previous compiler did not insert these calls (and used intrinsics for explicit calls).

Now what? In spite of the warnings not to link GDI drivers against any other libraries, I tried adding ntoskrnl.lib. This lets me build the driver but it refuses to load.

Use of intrinsics is turned on. I can actually get away with calling memset() if the count is constant and not too large. The external call will still happen in other cases, though.

I see the same behavior in the 6001.18000RTM, so I figure I must be doing something wrong or it would have been fixed. What is the proper way of using memset/memcpy from a GDI driver? I guess I could write my own replacements in assembly, but it seems like it has to be easier than that.

Thanks,
Sue
.