Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between the `A` and `W` functions in the Win32 API?

What is the difference in calling the Win32 API function that have an A character appended to the end as opposed to the W character.

I know it means ASCII and WIDE CHARACTER or Unicode, but what is the difference in the output or the input?

For example, If I call GetDefaultCommConfigA, will it fill my COMMCONFIG structure with ASCII strings instead of WCHAR strings? (Or vice-versa for GetDefaultCommConfigW)

In other words, how do I know what Encoding the string is in, ASCII or UNICODE, it must be by the version of the function I call A or W? Correct?

I have found this question, but I don't think it answers my question.

like image 559
Questionaire Avatar asked Sep 14 '11 23:09

Questionaire


People also ask

What does Win32 API do?

Alternatively referred to as the Windows API and WinAPI, Win32 is the main set of Microsoft Windows APIs used for developing 32-bit applications. These APIs are responsible for functions in the following categories: Administration and Management - Install, configure, and service applications or systems.

What is Win32 API C++?

The Windows 32 API. Win32 API is a set of functions defined in the Windows OS, in other words it is the Windows API, this is the name given by Microsoft to the core set of application programming interfaces available in the Microsoft Windows operating systems.

What is Winuser H?

Winuser. h is part of the Microsoft Visual C++ (VC++) development environment. The tool defines several elements that developers use when they write programs to run on Windows platforms.

What is WinAPI in C?

WinAPI (also known as Win32; officially called the Microsoft Windows API) is an application programming interface written in C by Microsoft to allow access to Windows features. The main components of the WinAPI are: WinBase: The kernel functions, CreateFile, CreateProcess, etc.


1 Answers

The A functions use Ansi (not ASCII) strings as input and output, and the W functions use Unicode string instead (UCS-2 on NT4 and earlier, UTF-16 on W2K and later). Refer to MSDN for more details.

like image 189
Remy Lebeau Avatar answered Oct 12 '22 09:10

Remy Lebeau