Common Data Types

The following data types are commonly used when transferring data across the wire. All multiple-byte numbers are transmitted by sending the least significant byte first, unless otherwise indicated.

Data Types

Value Meaning
BOOL A 32-bit field that is set to 1 to indicate TRUE, or 0 to indicate FALSE.
BOOLEAN An 8-bit field that is set to 1 to indicate TRUE, or 0 to indicate FALSE.
BYTE An 8-bit block of data.
CHAR An 8-bit block of data that typically contains a Windows (ANSI) character.
DWORD A 32-bit unsigned integer (range: 0 through 4294967295 decimal). Because a DWORD is unsigned, its first (most significant) bit is not reserved for signing.
GUID A globally unique identifier. This data type exposes the GUID structure (documented in the Platform SDK), which contains the following:

  • DWORD: Contains the first eight hexadecimal digits of the GUID identifier.
  • WORD: Contains the first group of four hexadecimal digits of the GUID identifier.
  • WORD: Contains the second group of four hexadecimal digits of the GUID identifier.
  • BYTE[]: An array whose first two bytes specify the third group of four hexadecimal digits, and whose remaining six bytes contain the final 12 hexadecimal digits of the GUID identifier.
HRESULT A 32-bit value that is used to describe an error or warning and contains the following:

  • A 1-bit code that indicates severity, where zero represents success and 1 represents failure.
  • A 4-bit reserved value.
  • An 11-bit code, also known as a facility code, that indicates responsibility for the error or warning.
  • A 16-bit code that describes the error or warning.
INT A 32-bit signed integer (range: -2147483648 through 2147483647 decimal).
LARGE_INTEGER A 64-bit signed integer (range: -2305843009213693952 through 2305843009213693952 decimal).
LONG A 32-bit signed integer (range: -2147483648 through 2147483647 decimal).
LONGLONG A 64-bit signed integer (range: -2305843009213693952 through 2305843009213693952 decimal).
LONG_PTR A 32-bit signed LONG for pointer precision. Use when casting a pointer to a LONG to perform pointer arithmetic.
LPBYTE A 32-bit pointer to a BYTE.
LPCSTR A 32-bit pointer to a null-terminated string of 8-bit Windows (ANSI) characters.
LPCWSTR A 32-bit pointer to a null-terminated string of 16-bit Unicode characters.
LPDWORD A 32-bit pointer to a DWORD.
LPSTR A 32-bit pointer to a null-terminated string of 8-bit Windows (ANSI) characters.
LPWSTR A 32-bit pointer to a null-terminated string of 16-bit Unicode characters.
OLD_LARGE_INTEGER A data type that exposes an OLD_LARGER_INTEGER structure, which contains the following:

  • ULONG: The lower four bytes.
  • LONG: The upper four bytes.
PWSTR A 32-bit pointer to a null-terminated string of 16-bit Unicode characters.
PUCHAR A 32-bit pointer to an unsigned CHAR.
PULONG A 32-bit pointer to a ULONG.
SHORT A 16-bit integer (range: -32768 through 32767 decimal). The first (most significant) bit is the signing bit.
TCHAR A character that is a WCHAR if Unicode is defined, or a CHAR otherwise.
TIME A 128-bit integer that represents an absolute time or a time interval. Times are specified in units of 100 milliseconds. This data type exposes the TIME structure, which contains the following:

  • ULONG: The lower four bytes.
  • LONG: The upper four bytes.

A positive value expresses an absolute time, where the base time is the beginning of the year 1601 A.D. in the Gregorian calendar. A negative value expresses a time interval relative to some base time, typically the current time.

UCHAR An 8-bit integer block of data (range: 0 through 255 decimal). Because a UCHAR is unsigned, its first (most significant) bit is not reserved for signing.
ULONG A 32-bit unsigned integer (range: 0 through 4294967296 decimal). Because a ULONG is unsigned, its first (most significant) bit is not reserved for signing.
ULONGLONG A 64-bit unsigned integer (range: 0 through to 18446744073709551616 decimal). Because a ULONGLONG is unsigned, its first (most significant) bit is not reserved for signing.
ULONG_PTR A 32-bit pointer to a ULONG.
UNICODE_STRING A complex data type (documented in the Platform SDK) that consists of the following:

  • USHORT: The length of the wide-character string in bytes.
  • USHORT: The total size, in bytes, of memory allocated for the wide-character string buffer.
  • PWSTR: Pointer to a wide-character string buffer.
USHORT A 16-bit unsigned integer (range: 0 through 65536 decimal). Because a USHORT is unsigned, its first (most significant) bit is not reserved for signing.
UTIME A 64-bit unsigned integer that represents the number of seconds since January 1, 1970, 00:00:00. For example, noon on January 1, 1970, is represented as 43200.
UUID A universally unique identifier. This data type exposes the UUID structure (documented in the Platform SDK), which contains the following:

  • LONG: Contains the first eight hexadecimal digits of the UUID.
  • SHORT: Contains the first group of four hexadecimal digits of the UUID.
  • SHORT: Contains the second group of four hexadecimal digits of the UUID.
  • CHAR[]: An array whose first two bytes specify the third group of four hexadecimal digits, and whose remaining six bytes contain the final 12 hexadecimal digits of the UUID.
VARIANT An Automation data type (documented in the Platform SDK) that contains any other automation data type.
WCHAR A 16-bit Unicode character.
wchar_t A 16-bit Unicode character for use with the MIDL compiler.
WORD A 16-bit unsigned integer (range: 0 through 65535 decimal). Because a WORD is unsigned, its first (most significant) bit is not reserved for signing.

See Also

Document Conventions