GetGeoInfoEx function (winnls.h)

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.

Syntax

int GetGeoInfoEx(
  [in]            PWSTR   location,
  [in]            GEOTYPE geoType,
  [out, optional] PWSTR   geoData,
  [in]            int     geoDataCount
);

Parameters

[in] location

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.

[in] geoType

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.

  • GEO_LCID

    This value is not supported for the GetGeoInfoEx function.

  • GEO_NATION

    This value is not supported for the GetGeoInfoEx function.

  • GEO_RFC1766

    This value is not supported for the GetGeoInfoEx function.

[out, optional] geoData

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

[in] geoDataCount

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
ERROR_INSUFFICIENT_BUFFER
The supplied buffer size was not large enough, or it was incorrectly set to NULL.
ERROR_INVALID_PARAMETER
A parameter value was not valid.
ERROR_INVALID_FLAGS
The values supplied for flags were not valid.

Remarks

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).

Requirements

Requirement Value
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

EnumSystemGeoNames

GetGeoInfo

National Language Support

National Language Support Functions

SYSGEOTYPE