Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

28 lines
747 B

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #include "atlconv.h"
  4. LPWSTR WINAPI AtlA2WHelper(LPWSTR lpw, LPCSTR lpa, int nChars)
  5. {
  6. _ASSERTE(lpa != NULL);
  7. _ASSERTE(lpw != NULL);
  8. // verify that no illegal character present
  9. // since lpw was allocated based on the size of lpa
  10. // don't worry about the number of chars
  11. lpw[0] = '\0';
  12. MultiByteToWideChar(CP_ACP, 0, lpa, -1, lpw, nChars);
  13. return lpw;
  14. }
  15. LPSTR WINAPI AtlW2AHelper(LPSTR lpa, LPCWSTR lpw, int nChars)
  16. {
  17. _ASSERTE(lpw != NULL);
  18. _ASSERTE(lpa != NULL);
  19. // verify that no illegal character present
  20. // since lpa was allocated based on the size of lpw
  21. // don't worry about the number of chars
  22. lpa[0] = '\0';
  23. WideCharToMultiByte(CP_ACP, 0, lpw, -1, lpa, nChars, NULL, NULL);
  24. return lpa;
  25. }
  26.