ported ConvertDefaultLocale() from wine
authorThomas Bluemel <thomas@reactsoft.com>
Sun, 21 Sep 2003 01:47:02 +0000 (01:47 +0000)
committerThomas Bluemel <thomas@reactsoft.com>
Sun, 21 Sep 2003 01:47:02 +0000 (01:47 +0000)
svn path=/trunk/; revision=6107

reactos/include/base.h
reactos/lib/kernel32/misc/lang.c

index b9255c7..97fffb2 100644 (file)
@@ -260,6 +260,35 @@ typedef unsigned int WPARAM;
 /*
   Enumerations
 */
+
+
+#define GEOID_NOT_AVAILABLE (-1)
+/*
+  GEO information types for clients to query
+*/
+
+enum SYSGEOTYPE {
+    GEO_NATION            = 0x01,
+    GEO_LATITUDE          = 0x02,
+    GEO_LONGITUDE         = 0x03,
+    GEO_ISO2              = 0x04,
+    GEO_ISO3              = 0x05,
+    GEO_RFC1766           = 0x06,
+    GEO_LCID              = 0x07,
+    GEO_FRIENDLYNAME      = 0x08,
+    GEO_OFFICIALNAME      = 0x09,
+    GEO_TIMEZONES         = 0x0A,
+    GEO_OFFICIALLANGUAGES = 0x0B,
+};
+
+/*
+  More GEOCLASS defines will be listed here
+*/
+
+enum SYSGEOCLASS {
+    GEOCLASS_NATION       = 16,
+    GEOCLASS_REGION       = 14,
+};
  
  
 #define RASCS_DONE 0x2000
index 50e6808..3c7ed04 100644 (file)
@@ -1,4 +1,4 @@
-/* $Id: lang.c,v 1.1 2003/09/20 23:37:56 weiden Exp $
+/* $Id: lang.c,v 1.2 2003/09/21 01:47:02 weiden Exp $
  *
  * COPYRIGHT: See COPYING in the top level directory
  * PROJECT  : ReactOS user mode libraries
 #define NDEBUG
 #include <kernel32/kernel32.h>
 
+
+static LCID SystemLocale = MAKELCID(LANG_ENGLISH, SORT_DEFAULT);
+
 //#define _OLE2NLS_IN_BUILD_
 
 /*
- * @unimplemented
+ * @implemented
  */
 LCID
 STDCALL
@@ -23,8 +26,20 @@ ConvertDefaultLocale (
     LCID    Locale
     )
 {
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
+  switch(Locale)
+  {
+    case LOCALE_SYSTEM_DEFAULT:
+      return GetSystemDefaultLCID();
+    
+    case LOCALE_USER_DEFAULT:
+      return GetUserDefaultLCID();
+    
+    /*case LOCALE_NEUTRAL:
+      return MAKELCID(LANG_NEUTRAL, SUBLANG_NEUTRAL);*/
+  }
+  
+  /* ported from wine, is that right? */
+  return MAKELANGID(PRIMARYLANGID(Locale), SUBLANG_NEUTRAL);
 }
 
 
@@ -228,8 +243,30 @@ EnumSystemGeoID(
     GEOID           ParentGeoId,
     GEO_ENUMPROC    lpGeoEnumProc)
 {
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return 0;
+  if(!lpGeoEnumProc)
+  {
+    SetLastError(ERROR_INVALID_PARAMETER);
+    return FALSE;
+  }
+  
+  switch(GeoClass)
+  {
+    case GEOCLASS_NATION:
+      /*RtlEnterCriticalSection(&DllLock);
+      
+        FIXME - Get GEO IDs calling Csr
+      
+      RtlLeaveCriticalSection(&DllLock);*/
+      
+      SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+      break;
+    
+    default:
+      SetLastError(ERROR_INVALID_FLAGS);
+      return FALSE;
+  }
+  return FALSE;
 }
 
 
@@ -676,18 +713,13 @@ GetSystemDefaultLangID (VOID)
 
 
 /*
- * @unimplemented
+ * @implemented
  */
 LCID
 STDCALL
 GetSystemDefaultLCID (VOID)
 {
-    /* FIXME: ??? */
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return MAKELCID(
-        LANG_ENGLISH,
-        SORT_DEFAULT
-        );
+  return SystemLocale;
 }
 
 #endif