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.

76 lines
1.2 KiB

  1. /*++
  2. Copyright (c) 1991 Microsoft Corporation
  3. Module Name:
  4. parseini.c
  5. Abstract:
  6. This module implements functions to parse a .INI file
  7. Author:
  8. John Vert (jvert) 7-Oct-1993
  9. Revision History:
  10. John Vert (jvert) 7-Oct-1993 - largely lifted from splib\spinf.c
  11. --*/
  12. #include "parseini.h"
  13. #include <string.h>
  14. #include <ctype.h>
  15. #include <stdlib.h>
  16. PWCHAR
  17. SlCopyStringAW(
  18. IN PCHAR String
  19. )
  20. /*++
  21. Routine Description:
  22. Converts an ANSI string into UNICODE and copies it into the loader heap.
  23. Arguments:
  24. String - Supplies the string to be copied.
  25. Return Value:
  26. PWCHAR - pointer into the loader heap where the string was copied to.
  27. --*/
  28. {
  29. PWCHAR Buffer;
  30. ANSI_STRING aString;
  31. UNICODE_STRING uString;
  32. if (String==NULL) {
  33. SlNoMemoryError();
  34. }
  35. Buffer = BlAllocateHeap(sizeof(WCHAR)*(strlen(String)+1));
  36. if (Buffer==NULL) {
  37. SlNoMemoryError();
  38. } else {
  39. RtlInitAnsiString( &aString, String );
  40. uString.Buffer = Buffer;
  41. uString.MaximumLength = sizeof(WCHAR)*(strlen(String) + 1);
  42. RtlAnsiStringToUnicodeString( &uString, &aString, FALSE );
  43. Buffer[strlen(String)] = L'\0';
  44. }
  45. return(Buffer);
  46. }