Leaked source code of windows server 2003
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.

78 lines
1.9 KiB

  1. //
  2. // uniwrap.cpp
  3. //
  4. // Unicode wrappers
  5. //
  6. // Copyright(C) Microsoft Corporation 2000
  7. // Author: Nadim Abdo (nadima)
  8. //
  9. // Public interface to the wrappers
  10. //
  11. #include "stdafx.h"
  12. BOOL g_bRunningOnNT = FALSE;
  13. BOOL g_fUnicodeWrapsInitialized = FALSE;
  14. //
  15. // The policy behind the wrappers is:
  16. // we run unicode internally for everything.
  17. //
  18. // The wrappers either thunk directly to the unicode system API's
  19. // if they are available or convert to ansi and call the ANSI versions.
  20. //
  21. // If we need 'W' function that is not available on win9x then
  22. // it has to be dynamically bound.
  23. // We can statically bind to the 'A' versions.
  24. //
  25. //
  26. CUnicodeWrapper::CUnicodeWrapper()
  27. {
  28. //do nada
  29. }
  30. CUnicodeWrapper::~CUnicodeWrapper()
  31. {
  32. //do nada
  33. }
  34. // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  35. // DO NOT USE ANY TRC FUNCTIONS UNTIL THE WRAPPERS ARE INITIALIZED
  36. //
  37. // This means no DC_BEGIN_FN calls until we wrappers are ready.
  38. BOOL CUnicodeWrapper::InitializeWrappers()
  39. {
  40. //
  41. // Determine if we're running on a unicode platform
  42. // (call A api as that is always present, we can't use
  43. // a wrapper function before knowing how to wrap)
  44. OSVERSIONINFOA osVersionInfo;
  45. osVersionInfo.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA);
  46. if (GetVersionExA(&osVersionInfo))
  47. {
  48. //NT is unicode, everything else is NOT.
  49. //If the CE folks do a port of the shell to their
  50. //platform they will need to look into this
  51. g_bRunningOnNT = (osVersionInfo.dwPlatformId !=
  52. VER_PLATFORM_WIN32_WINDOWS);
  53. }
  54. else
  55. {
  56. //Treat as non-fatal, just use ANSI thunks they are slower
  57. //but always present
  58. g_bRunningOnNT = FALSE;
  59. }
  60. g_fUnicodeWrapsInitialized = TRUE;
  61. return TRUE;
  62. }
  63. BOOL CUnicodeWrapper::CleanupWrappers()
  64. {
  65. return TRUE;
  66. }