エラー処理は端折ってある。あと、freeを忘れるなよ :)
wchar_t *wcsmid( const wchar_t * str, int begin, int end )
{
 int length = end - begin;
 wchar_t *ret = malloc(( end - begin + 1 )*2);
 wcsncpy(ret, str+begin, length );
 ret[length] = L'\0';
 return ret;
}