James Hawkins wrote:
>      static const WCHAR create_fmt[] = {'C','R','E','A','T','E',' ','T','A','B','L','E',' ','`','%','s','`',' ','(',' ',0};
>  
> -    size = sizeof(create_fmt) + lstrlenW(table) - 2;
> +    size = lstrlenW(create_fmt) + lstrlenW(table) - 1;
Since the string is const, and we know it at compile time, using 
sizeof() is better as unlike lstrlenW() it has no runtime cost.  How 
about doing something like?
#define CONST_STRLENW(X) (sizeof (X)/ sizeof((X)[0]) - 1)
size = CONST_STRLENW(create_fmt) + strlenW(table) - 1;
Mike