GetGeoInfoEx function

Retrieves information about a geographic location that you specify by using a two-letter International Organization for Standardization (ISO) 3166-1 code or numeric United Nations (UN) Series M, Number 49 (M.49) code.


int GetGeoInfoEx(
  PWSTR   location,
  GEOTYPE geoType,
  PWSTR   geoData,
  int     geoDataCount



The two-letter ISO 3166-1 or numeric UN M.49 code for the geographic location for which to get information. To get the codes that are available on the operating system, call EnumSystemGeoNames.


The type of information you want to retrieve. Possible values are defined by the SYSGEOTYPE enumeration. The following values of the SYSGEOTYPE enumeration should not be used with GetGeoInfoEx:

  • GEO_ID

    This value is provided for backward compatibility. Do not use this value in new applications, but use GEO_NAME instead.


    This value is not supported for the GetGeoInfoEx function.


    This value is not supported for the GetGeoInfoEx function.

  • GEO_RFC1766

    This value is not supported for the GetGeoInfoEx function.


A pointer to the buffer in which GetGeoInfoEx should write the requested information.


The size of the buffer to which the GeoData parameter points, in characters. Set this parameter to 0 to specify that the function should only return the size of the buffer required to store the requested information without writing the requested information to the buffer.

Return Value

The number of bytes of geographical location information that the function wrote the output buffer. If geoDataCount is 0, the function returns the size of the buffer required to hold the information without writing the information to the buffer.

0 indicates that the function did not succeed. To get extended error information, call GetLastError, which can return one of the following error codes:

Return code Description
The supplied buffer size was not large enough, or it was incorrectly set to NULL.
A parameter value was not valid.
The values supplied for flags were not valid.


For information about two-letter ISO 3166-1 codes, see Country Codes - ISO 3166. For information about numeric UN M.49 codes, see Standard country or area codes for statistical use (M49).


Minimum supported client Windows 10, version 1709 [desktop apps only]
Minimum supported server Windows Server 2016 [desktop apps only]
Target Platform Windows
Header winnls.h
Library Kernel32.lib
DLL Kernel32.dll

See Also



National Language Support

National Language Support Functions