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.

84 lines
1.6 KiB

  1. /*++
  2. Copyright (c) 1996 Microsoft Corporation
  3. Module Name:
  4. umfuncs.c
  5. Abstract:
  6. User-mode specific library functions
  7. Environment:
  8. Windows NT printer drivers
  9. Revision History:
  10. 08/13/96 -davidx-
  11. Created it.
  12. mm/dd/yy -author-
  13. description
  14. --*/
  15. #include "lib.h"
  16. BOOL
  17. IsMetricCountry(
  18. VOID
  19. )
  20. /*++
  21. Routine Description:
  22. Determine if the current country is using metric system.
  23. Arguments:
  24. NONE
  25. Return Value:
  26. TRUE if the current country uses metric system, FALSE otherwise
  27. --*/
  28. {
  29. INT iCharCount;
  30. PVOID pv = NULL;
  31. LONG lCountryCode = CTRY_UNITED_STATES;
  32. //
  33. // Determine the size of the buffer needed to retrieve locale information.
  34. // Allocate the necessary space.
  35. //
  36. //
  37. if ((iCharCount = GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY, NULL, 0)) > 0 &&
  38. (pv = MemAlloc(sizeof(TCHAR) * iCharCount)) &&
  39. (iCharCount == GetLocaleInfo(LOCALE_SYSTEM_DEFAULT, LOCALE_ICOUNTRY, pv, iCharCount)))
  40. {
  41. lCountryCode = _ttol(pv);
  42. }
  43. MemFree(pv);
  44. VERBOSE(("Default country code: %d\n", lCountryCode));
  45. //
  46. // This is the Win31 algorithm based on AT&T international dialing codes.
  47. //
  48. // Fix bug #31535: Brazil (country code 55) should use A4 as default paper size.
  49. //
  50. return ((lCountryCode == CTRY_UNITED_STATES) ||
  51. (lCountryCode == CTRY_CANADA) ||
  52. (lCountryCode >= 50 && lCountryCode < 60 && lCountryCode != CTRY_BRAZIL) ||
  53. (lCountryCode >= 500 && lCountryCode < 600)) ? FALSE : TRUE;
  54. }