Merge pull request #10773 from akallabeth/wtypes.h

[winpr,wtypes] simplify by basing on stdint.h
This commit is contained in:
akallabeth
2024-12-03 17:50:09 +01:00
committed by GitHub
16 changed files with 688 additions and 825 deletions

View File

@@ -140,6 +140,9 @@ endif()
message(STATUS "Git Revision ${GIT_REVISION}")
# MSVC compatibility with system headers
add_definitions(-DNONAMELESSUNION)
# Make the detected version available as default version for all subprojects
set(FREERDP_DEFAULT_PROJECT_VERSION ${FREERDP_VERSION} CACHE STRING INTERNAL)

View File

@@ -150,8 +150,8 @@ static UINT cliprdr_send_data_request(wfClipboard* clipboard, UINT32 format);
static UINT cliprdr_send_lock(wfClipboard* clipboard);
static UINT cliprdr_send_unlock(wfClipboard* clipboard);
static UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, const void* streamid,
ULONG index, UINT32 flag, DWORD positionhigh,
DWORD positionlow, ULONG request);
ULONG index, UINT32 flag, UINT64 position,
ULONG request);
static void CliprdrDataObject_Delete(CliprdrDataObject* instance);
@@ -239,8 +239,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrStream_Read(IStream* This, void* pv, ULO
return S_FALSE;
ret = cliprdr_send_request_filecontents(clipboard, (void*)This, instance->m_lIndex,
FILECONTENTS_RANGE, instance->m_lOffset.HighPart,
instance->m_lOffset.LowPart, cb);
FILECONTENTS_RANGE, instance->m_lOffset.QuadPart, cb);
if (ret < 0)
return E_FAIL;
@@ -451,7 +450,7 @@ static CliprdrStream* CliprdrStream_New(ULONG index, void* pData, const FILEDESC
{
/* get content size of this stream */
if (cliprdr_send_request_filecontents(clipboard, (void*)instance,
instance->m_lIndex, FILECONTENTS_SIZE, 0, 0,
instance->m_lIndex, FILECONTENTS_SIZE, 0,
8) == CHANNEL_RC_OK)
{
success = TRUE;
@@ -462,8 +461,8 @@ static CliprdrStream* CliprdrStream_New(ULONG index, void* pData, const FILEDESC
}
else
{
instance->m_lSize.LowPart = instance->m_Dsc.nFileSizeLow;
instance->m_lSize.HighPart = instance->m_Dsc.nFileSizeHigh;
instance->m_lSize.QuadPart =
((UINT64)instance->m_Dsc.nFileSizeHigh << 32) | instance->m_Dsc.nFileSizeLow;
success = TRUE;
}
}
@@ -588,7 +587,8 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FO
if (cliprdr_send_data_request(clipboard, remote) != 0)
return E_UNEXPECTED;
pMedium->hGlobal = clipboard->hmem; /* points to a FILEGROUPDESCRIPTOR structure */
pMedium->u.hGlobal = clipboard->hmem;
/* points to a FILEGROUPDESCRIPTOR structure */
/* GlobalLock returns a pointer to the first byte of the memory block,
* in which is a FILEGROUPDESCRIPTOR structure, whose first UINT member
* is the number of FILEDESCRIPTOR's */
@@ -624,7 +624,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FO
clipboard->hmem = NULL;
}
pMedium->hGlobal = NULL;
pMedium->u.hGlobal = NULL;
return E_OUTOFMEMORY;
}
}
@@ -632,7 +632,7 @@ static HRESULT STDMETHODCALLTYPE CliprdrDataObject_GetData(IDataObject* This, FO
{
if ((pFormatEtc->lindex >= 0) && ((ULONG)pFormatEtc->lindex < instance->m_nStreams))
{
pMedium->pstm = instance->m_pStream[pFormatEtc->lindex];
pMedium->u.pstm = instance->m_pStream[pFormatEtc->lindex];
IDataObject_AddRef(instance->m_pStream[pFormatEtc->lindex]);
}
else
@@ -821,28 +821,24 @@ void CliprdrDataObject_Delete(CliprdrDataObject* instance)
static BOOL wf_create_file_obj(wfClipboard* clipboard, IDataObject** ppDataObject)
{
FORMATETC fmtetc[2];
STGMEDIUM stgmeds[2];
FORMATETC fmtetc[2] = { 0 };
STGMEDIUM stgmeds[2] = { 0 };
if (!ppDataObject)
return FALSE;
fmtetc[0].cfFormat = RegisterClipboardFormat(CFSTR_FILEDESCRIPTORW);
fmtetc[0].dwAspect = DVASPECT_CONTENT;
fmtetc[0].lindex = 0;
fmtetc[0].ptd = NULL;
fmtetc[0].tymed = TYMED_HGLOBAL;
stgmeds[0].tymed = TYMED_HGLOBAL;
stgmeds[0].hGlobal = NULL;
stgmeds[0].pUnkForRelease = NULL;
fmtetc[1].cfFormat = RegisterClipboardFormat(CFSTR_FILECONTENTS);
fmtetc[1].dwAspect = DVASPECT_CONTENT;
fmtetc[1].lindex = 0;
fmtetc[1].ptd = NULL;
fmtetc[1].tymed = TYMED_ISTREAM;
stgmeds[1].tymed = TYMED_ISTREAM;
stgmeds[1].pstm = NULL;
stgmeds[1].pUnkForRelease = NULL;
*ppDataObject = (IDataObject*)CliprdrDataObject_New(fmtetc, stgmeds, 2, clipboard);
return (*ppDataObject) ? TRUE : FALSE;
}
@@ -1305,8 +1301,7 @@ static UINT cliprdr_send_data_request(wfClipboard* clipboard, UINT32 formatId)
}
UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, const void* streamid, ULONG index,
UINT32 flag, DWORD positionhigh, DWORD positionlow,
ULONG nreq)
UINT32 flag, UINT64 position, ULONG nreq)
{
UINT rc;
CLIPRDR_FILE_CONTENTS_REQUEST fileContentsRequest;
@@ -1317,8 +1312,8 @@ UINT cliprdr_send_request_filecontents(wfClipboard* clipboard, const void* strea
fileContentsRequest.streamId = (UINT32)(ULONG_PTR)streamid;
fileContentsRequest.listIndex = index;
fileContentsRequest.dwFlags = flag;
fileContentsRequest.nPositionLow = positionlow;
fileContentsRequest.nPositionHigh = positionhigh;
fileContentsRequest.nPositionLow = position & 0xFFFFFFFF;
fileContentsRequest.nPositionHigh = (position >> 32) & 0xFFFFFFFF;
fileContentsRequest.cbRequested = nreq;
fileContentsRequest.clipDataId = 0;
fileContentsRequest.common.msgFlags = 0;
@@ -2073,7 +2068,8 @@ static SSIZE_T wf_cliprdr_get_filedescriptor(wfClipboard* clipboard, BYTE** pDat
goto exit;
}
DROPFILES* dropFiles = (DROPFILES*)GlobalLock(stg_medium.hGlobal);
HGLOBAL hdl = stg_medium.u.hGlobal;
DROPFILES* dropFiles = (DROPFILES*)GlobalLock(hdl);
if (!dropFiles)
{
@@ -2108,7 +2104,7 @@ static SSIZE_T wf_cliprdr_get_filedescriptor(wfClipboard* clipboard, BYTE** pDat
}
}
GlobalUnlock(stg_medium.hGlobal);
GlobalUnlock(hdl);
ReleaseStgMedium(&stg_medium);
exit:
{
@@ -2319,7 +2315,7 @@ wf_cliprdr_server_file_contents_request(CliprdrClientContext* context,
if (hRet == S_OK)
{
pStreamStc = vStgMedium.pstm;
pStreamStc = vStgMedium.u.pstm;
uStreamIdStc = fileContentsRequest->streamId;
bIsStreamFile = TRUE;
}
@@ -2340,8 +2336,8 @@ wf_cliprdr_server_file_contents_request(CliprdrClientContext* context,
if (hRet == S_OK)
{
*((UINT32*)&pData[0]) = vStatStg.cbSize.LowPart;
*((UINT32*)&pData[4]) = vStatStg.cbSize.HighPart;
*((UINT32*)&pData[0]) = vStatStg.cbSize.QuadPart & 0xFFFFFFFF;
*((UINT32*)&pData[4]) = (vStatStg.cbSize.QuadPart >> 32) & 0xFFFFFFFF;
uSize = cbRequested;
}
}
@@ -2349,8 +2345,8 @@ wf_cliprdr_server_file_contents_request(CliprdrClientContext* context,
{
LARGE_INTEGER dlibMove;
ULARGE_INTEGER dlibNewPosition;
dlibMove.HighPart = fileContentsRequest->nPositionHigh;
dlibMove.LowPart = fileContentsRequest->nPositionLow;
dlibMove.QuadPart = (INT64)(((UINT64)fileContentsRequest->nPositionHigh << 32) |
fileContentsRequest->nPositionLow);
hRet = IStream_Seek(pStreamStc, dlibMove, STREAM_SEEK_SET, &dlibNewPosition);
if (SUCCEEDED(hRet))

View File

@@ -1,22 +0,0 @@
/*===---- stdbool.h - Standard header for booleans -------------------------===
*
* Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
* See https://llvm.org/LICENSE.txt for license information.
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*
*===-----------------------------------------------------------------------===
*/
#ifndef __STDBOOL_H
#define __STDBOOL_H
/* Don't define bool, true, and false in C++, except as a GNU extension. */
#ifndef __cplusplus
typedef int bool;
#define true 1
#define false 0
#endif
#define __bool_true_false_are_defined 1
#endif /* __STDBOOL_H */

View File

@@ -61,6 +61,9 @@ if(NOT FREERDP_UNIFIED_BUILD)
else()
set(DEFAULT_DEBUG_OPTION "OFF" CACHE INTERNAL "debug default")
endif()
# MSVC compatibility with system headers
add_definitions(-DNONAMELESSUNION)
endif()
if(WIN32 AND NOT UWP)
@@ -189,42 +192,38 @@ else()
endif()
include(CheckTypeSize)
set(CMAKE_EXTRA_INCLUDE_FILES "sys/types.h")
check_type_size(ssize_t SSIZE_T)
set(CMAKE_EXTRA_INCLUDE_FILES "BaseTsd.h")
check_type_size(SSIZE_T WIN_SSIZE_T)
set(WINPR_HAVE_SSIZE_T ${HAVE_SSIZE_T})
set(WINPR_HAVE_WIN_SSIZE_T ${HAVE_WIN_SSIZE_T})
if(NOT IOS)
check_symbol_exists(strndup string.h WINPR_HAVE_STRNDUP)
check_include_files(unistd.h WINPR_HAVE_UNISTD_H)
check_include_files(execinfo.h WINPR_HAVE_EXECINFO_HEADER)
if(WINPR_HAVE_EXECINFO_HEADER)
check_symbol_exists(backtrace execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE)
check_symbol_exists(backtrace_symbols execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS)
check_symbol_exists(backtrace_symbols_fd execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD)
check_symbol_exists(strndup string.h WINPR_HAVE_STRNDUP)
check_include_files(unistd.h WINPR_HAVE_UNISTD_H)
check_include_files(execinfo.h WINPR_HAVE_EXECINFO_HEADER)
if(WINPR_HAVE_EXECINFO_HEADER)
check_symbol_exists(backtrace execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE)
check_symbol_exists(backtrace_symbols execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS)
check_symbol_exists(backtrace_symbols_fd execinfo.h WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD)
# Some implementations (e.g. Android NDK API < 33) provide execinfo.h but do not define
# the backtrace functions. Disable detection for these cases
if(WINPR_HAVE_EXECINFO_BACKTRACE AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS
AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD
)
set(WINPR_HAVE_EXECINFO_H ON)
endif()
# Some implementations (e.g. Android NDK API < 33) provide execinfo.h but do not define
# the backtrace functions. Disable detection for these cases
if(WINPR_HAVE_EXECINFO_BACKTRACE AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS
AND WINPR_HAVE_EXECINFO_BACKTRACE_SYMBOLS_FD
)
set(WINPR_HAVE_EXECINFO_H ON)
endif()
check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H)
check_include_files(stdint.h WINPR_HAVE_STDINT_H)
check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H)
else(NOT IOS)
set(WINPR_HAVE_STDINT_H 1)
set(WINPR_HAVE_STRNDUP 1)
set(WINPR_HAVE_INTTYPES_H 1)
endif(NOT IOS)
endif()
if(NOT IOS)
check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H)
if(NOT WINPR_HAVE_STDBOOL_H)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../compat/stdbool)
endif()
else()
set(WINPR_HAVE_STDBOOL_H 1)
check_include_files(stdint.h WINPR_HAVE_STDINT_H)
check_include_files(inttypes.h WINPR_HAVE_INTTYPES_H)
check_include_files(stdbool.h WINPR_HAVE_STDBOOL_H)
if(NOT WINPR_HAVE_INTTYPES_H OR NOT WINPR_HAVE_STDINT_H OR NOT WINPR_HAVE_STDBOOL_H)
message(FATAL_ERROR "c11 headers stdint.h, stdbool.h and inttypes.h are required, giving up")
endif()
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)

View File

@@ -19,7 +19,6 @@ include(CFlagsToVar)
cflagstovar(C_FLAGS)
cleaning_configure_file(config/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/version.h)
cleaning_configure_file(config/wtypes.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/wtypes.h)
cleaning_configure_file(config/build-config.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/build-config.h)
cleaning_configure_file(config/buildflags.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/buildflags.h)
cleaning_configure_file(config/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/winpr/config.h)

View File

@@ -24,6 +24,7 @@
#cmakedefine WINPR_HAVE_STRNDUP
#cmakedefine WINPR_HAVE_UNWIND_H
#cmakedefine WINPR_HAVE_SSIZE_T
#cmakedefine WINPR_HAVE_WIN_SSIZE_T
#cmakedefine WINPR_WITH_PNG
#cmakedefine WINPR_HAVE_STRERROR_R /** @since version 3.3.0 */

View File

@@ -1,676 +0,0 @@
/**
* WinPR: Windows Portable Runtime
* Windows Data Types
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_WTYPES_H
#define WINPR_WTYPES_H
#include <winpr/platform.h>
/* Set by CMake during configuration */
#cmakedefine WINPR_HAVE_STDINT_H
#cmakedefine WINPR_HAVE_STDBOOL_H
#if !defined(_MSC_VER) || _MSC_VER >= 1900
/* Microsoft's inttypes.h is broken before MSVC 2015 */
#cmakedefine WINPR_HAVE_INTTYPES_H
#endif
/* MSDN: Windows Data Types - http://msdn.microsoft.com/en-us/library/aa383751/ */
/* [MS-DTYP]: Windows Data Types - http://msdn.microsoft.com/en-us/library/cc230273/ */
#include <wchar.h>
#include <winpr/windows.h>
#include <winpr/spec.h>
#ifdef WINPR_HAVE_STDBOOL_H
#include <stdbool.h>
#endif
#ifdef WINPR_HAVE_STDINT_H
#include <stdint.h>
#endif
#ifdef WINPR_HAVE_INTTYPES_H
#include <inttypes.h>
#endif
#include <limits.h>
#if defined(_WIN32) || defined(__MINGW32__)
#include <wtypes.h>
/* Handle missing ssize_t on Windows */
#ifdef _WIN64
typedef long long LONG_PTR;
#else
typedef long LONG_PTR;
#endif
#if ssize_t
typedef ssize_t SSIZE_T
#else
typedef LONG_PTR SSIZE_T;
#endif
#endif
#if defined(__OBJC__) && defined(__APPLE__)
#include <objc/objc.h>
#endif
#ifndef CONST
#define CONST const
#endif
#ifndef VOID
#define VOID void
#endif
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
WINPR_PRAGMA_DIAG_IGNORED_RESERVED_IDENTIFIER
#if !defined(_WIN32) && !defined(__MINGW32__)
#define CALLBACK
#define WINAPI
#define CDECL
#ifndef FAR
#define FAR
#endif
#ifndef NEAR
#define NEAR
#endif
#ifdef WINPR_HAVE_STDINT_H
typedef int8_t __int8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef uint8_t __uint8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef int16_t __int16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef uint16_t __uint16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef int32_t __int32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef uint32_t __uint32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef int64_t __int64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef uint64_t __uint64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#if UCHAR_MAX == 0xFF
typedef signed char __int8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned char __uint8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#error "8-bit type not configured"
#endif
#if USHRT_MAX == 0xFFFF
typedef short __int16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned short __uint16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#elif UINT_MAX == 0xFFFF
typedef int __int16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned int __uint16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#error "16-bit type not configured"
#endif
#if UINT_MAX == 0xFFFFFFFF
typedef int __int32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned int __uint32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#elif ULONG_MAX == 0xFFFFFFFF
typedef long __int32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned long __uint32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#error "32-bit type not configured"
#endif
#if ULONG_MAX == 0xFFFFFFFFFFFFFFFF
typedef long __int64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned long __uint64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#elif ULLONG_MAX == 0xFFFFFFFFFFFFFFFF
typedef long long __int64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef unsigned long long
__uint64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#error "64-bit type not configured"
#endif
#endif /* WINPR_HAVE_STDINT_H */
#ifdef WINPR_HAVE_STDINT_H
#if defined(__ILP64__) || defined(__LP64__)
#define __int3264 int64_t // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define __uint3264 uint64_t // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#define __int3264 int32_t // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define __uint3264 uint32_t // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
#else
#if defined(__ILP64__) || defined(__LP64__)
#define __int3264 __int64 // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define __uint3264 __uint64 // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#define __int3264 __int32 // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define __uint3264 __uint32 // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
#endif /* WINPR_HAVE_STDINT_H */
typedef void *PVOID, *LPVOID, *PVOID64, *LPVOID64;
#ifndef XMD_H /* X11/Xmd.h typedef collision with BOOL */
#ifndef __OBJC__ /* objc.h typedef collision with BOOL */
#ifndef __APPLE__
typedef __int32 BOOL; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else /* __APPLE__ */
#include <TargetConditionals.h>
/* ensure compatibility with objc libraries */
#if (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0) && defined(__LP64__)) || \
(defined(TARGET_OS_WATCH) && (TARGET_OS_WATCH != 0))
typedef bool BOOL;
#else
typedef signed char BOOL;
#endif
#endif /* __APPLE__ */
#endif /* __OBJC__ */
#endif /* XMD_H */
typedef BOOL *PBOOL, *LPBOOL;
#ifndef FALSE
#define FALSE 0
#endif
#ifndef TRUE
#define TRUE 1
#endif
#ifndef XMD_H /* X11/Xmd.h typedef collision with BYTE */
typedef __uint8 BYTE; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif /* XMD_H */
typedef BYTE byte, *PBYTE, *LPBYTE;
typedef BYTE BOOLEAN, PBOOLEAN;
#if CHAR_BIT == 8
typedef char CHAR;
typedef unsigned char UCHAR;
#else
typedef __int8 CHAR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint8 UCHAR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
typedef CHAR CCHAR, *PCHAR, *LPCH, *PCH, *PSTR, *LPSTR;
typedef const CHAR *LPCCH, *PCCH, *LPCSTR, *PCSTR;
typedef UCHAR* PUCHAR;
typedef __uint16 WCHAR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef WCHAR UNICODE, *PWCHAR, *LPWCH, *PWCH, *BSTR, *LMSTR, *LPWSTR, *PWSTR;
typedef const WCHAR *LPCWCH, *PCWCH, *LMCSTR, *LPCWSTR, *PCWSTR;
typedef __int16 SHORT, *PSHORT; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int32 INT, *PINT,
*LPINT; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int32 LONG, *PLONG,
*LPLONG; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int64 LONGLONG,
*PLONGLONG; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint32 UINT, *PUINT,
*LPUINT; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint16 USHORT,
*PUSHORT; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint32 ULONG, *PULONG; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint64 ULONGLONG,
*PULONGLONG; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#ifndef XMD_H /* X11/Xmd.h typedef collisions */
typedef __int8 INT8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int16 INT16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int32 INT32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int64 INT64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
typedef INT8* PINT8;
typedef INT16* PINT16;
typedef INT32* PINT32;
typedef INT64* PINT64;
typedef __int32 LONG32,
*PLONG32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#ifndef LONG64 /* X11/Xmd.h uses/defines LONG64 */
typedef __int64 LONG64,
*PLONG64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
typedef __uint8 UINT8, *PUINT8; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint16 UINT16,
*PUINT16; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint32 UINT32,
*PUINT32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint64 UINT64,
*PUINT64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint64 ULONG64,
*PULONG64; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint16 WORD, *PWORD,
*LPWORD; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint32 DWORD, DWORD32, *PDWORD, *LPDWORD,
*PDWORD32; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint64 DWORD64, DWORDLONG, QWORD, *PDWORD64, *PDWORDLONG,
*PQWORD; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int3264 INT_PTR,
*PINT_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint3264 UINT_PTR,
*PUINT_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __int3264 LONG_PTR,
*PLONG_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint3264 ULONG_PTR,
*PULONG_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef __uint3264 DWORD_PTR,
*PDWORD_PTR; // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef ULONG_PTR SIZE_T, *PSIZE_T; /** deprecated */
#if defined(WINPR_HAVE_SSIZE_T)
#include <sys/types.h>
typedef ssize_t SSIZE_T, *PSSIZE_T;
#else
typedef LONG_PTR SSIZE_T, *PSSIZE_T;
#endif
typedef float FLOAT;
typedef double DOUBLE;
typedef void *HANDLE, *PHANDLE, *LPHANDLE;
typedef HANDLE HINSTANCE;
typedef HANDLE HMODULE;
typedef HANDLE HWND;
typedef HANDLE HBITMAP;
typedef HANDLE HICON;
typedef HANDLE HCURSOR;
typedef HANDLE HBRUSH;
typedef HANDLE HMENU;
typedef DWORD HCALL;
typedef ULONG error_status_t;
typedef LONG HRESULT;
typedef LONG SCODE;
typedef SCODE* PSCODE;
typedef struct s_POINTL /* ptl */
{
LONG x;
LONG y;
} POINTL, *PPOINTL;
typedef struct tagSIZE
{
LONG cx;
LONG cy;
} SIZE, *PSIZE, *LPSIZE;
typedef SIZE SIZEL;
typedef struct s_GUID
{
UINT32 Data1;
UINT16 Data2;
UINT16 Data3;
BYTE Data4[8];
} GUID, UUID, *PGUID, *LPGUID, *LPCGUID;
typedef GUID CLSID;
typedef struct s_LUID
{
DWORD LowPart;
LONG HighPart;
} LUID, *PLUID;
typedef GUID IID;
typedef IID* REFIID;
#ifdef UNICODE
#define _T(x) L##x // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#define _T(x) x // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
#ifdef UNICODE
typedef LPWSTR PTSTR;
typedef LPWSTR LPTCH;
typedef LPWSTR LPTSTR;
typedef LPCWSTR LPCTSTR;
#else
typedef LPSTR PTSTR;
typedef LPSTR LPTCH;
typedef LPSTR LPTSTR;
typedef LPCSTR LPCTSTR;
#endif
typedef union u_ULARGE_INTEGER
{
struct
{
DWORD LowPart;
DWORD HighPart;
} DUMMYSTRUCTNAME;
struct
{
DWORD LowPart;
DWORD HighPart;
} u;
ULONGLONG QuadPart;
} ULARGE_INTEGER, *PULARGE_INTEGER;
typedef union u_LARGE_INTEGER
{
struct
{
DWORD LowPart;
LONG HighPart;
} DUMMYSTRUCTNAME;
struct
{
DWORD LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
typedef struct s_FILETIME
{
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME, *PFILETIME, *LPFILETIME;
typedef struct s_SYSTEMTIME
{
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
typedef struct s_RPC_SID_IDENTIFIER_AUTHORITY
{
BYTE Value[6];
} RPC_SID_IDENTIFIER_AUTHORITY;
typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
typedef struct s_RPC_SID
{
UCHAR Revision;
UCHAR SubAuthorityCount;
RPC_SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
ULONG SubAuthority[1];
} RPC_SID, *PRPC_SID, *PSID;
typedef struct s_ACL
{
UCHAR AclRevision;
UCHAR Sbz1;
USHORT AclSize;
USHORT AceCount;
USHORT Sbz2;
} ACL, *PACL;
typedef struct s_SECURITY_DESCRIPTOR
{
UCHAR Revision;
UCHAR Sbz1;
USHORT Control;
PSID Owner;
PSID Group;
PACL Sacl;
PACL Dacl;
} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
typedef struct s_SECURITY_ATTRIBUTES
{
DWORD nLength;
LPVOID lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
typedef struct s_PROCESS_INFORMATION
{
HANDLE hProcess;
HANDLE hThread;
DWORD dwProcessId;
DWORD dwThreadId;
} PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION;
typedef DWORD (*PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter);
typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
typedef void* FARPROC;
typedef struct tagDEC
{
USHORT wReserved;
union
{
struct
{
BYTE scale;
BYTE sign;
} DUMMYSTRUCTNAME;
USHORT signscale;
} DUMMYUNIONNAME;
ULONG Hi32;
union
{
struct
{
ULONG Lo32;
ULONG Mid32;
} DUMMYSTRUCTNAME2;
ULONGLONG Lo64;
} DUMMYUNIONNAME2;
} DECIMAL;
typedef DECIMAL* LPDECIMAL;
#define DECIMAL_NEG ((BYTE)0x80)
#define DECIMAL_SETZERO(dec) \
{ \
(dec).Lo64 = 0; \
(dec).Hi32 = 0; \
(dec).signscale = 0; \
}
typedef DWORD LCID;
typedef PDWORD PLCID;
typedef WORD LANGID;
#endif /* _WIN32 not defined */
typedef void* PCONTEXT_HANDLE;
typedef PCONTEXT_HANDLE* PPCONTEXT_HANDLE;
#ifndef _NTDEF
typedef LONG NTSTATUS;
typedef NTSTATUS* PNTSTATUS;
#endif
#ifndef _LPCVOID_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define _LPCVOID_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef const VOID* LPCVOID;
#endif
#ifndef _LPCBYTE_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define _LPCBYTE_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef const BYTE* LPCBYTE;
#endif
/* integer format specifiers */
#ifndef WINPR_HAVE_INTTYPES_H
#define PRId8 "hhd"
#define PRIi8 "hhi"
#define PRIu8 "hhu"
#define PRIo8 "hho"
#define PRIx8 "hhx"
#define PRIX8 "hhX"
#define PRId16 "hd"
#define PRIi16 "hi"
#define PRIu16 "hu"
#define PRIo16 "ho"
#define PRIx16 "hx"
#define PRIX16 "hX"
#if defined(_MSC_VER)
#define PRId32 "I32d"
#define PRIi32 "I32i"
#define PRIu32 "I32u"
#define PRIo32 "I32o"
#define PRIx32 "I32x"
#define PRIX32 "I32X"
#define PRId64 "I64d"
#define PRIi64 "I64i"
#define PRIu64 "I64u"
#define PRIo64 "I64o"
#define PRIx64 "I64x"
#define PRIX64 "I64X"
#else
#define PRId32 "d"
#define PRIi32 "i"
#define PRIu32 "u"
#define PRIo32 "o"
#define PRIx32 "x"
#define PRIX32 "X"
#if ULONG_MAX == 0xFFFFFFFFFFFFFFFF
#define PRId64 "ld"
#define PRIi64 "li"
#define PRIu64 "lu"
#define PRIo64 "lo"
#define PRIx64 "lx"
#define PRIX64 "lX"
#else
#define PRId64 "lld"
#define PRIi64 "lli"
#define PRIu64 "llu"
#define PRIo64 "llo"
#define PRIx64 "llx"
#define PRIX64 "llX"
#endif
#endif /* _MSC_VER */
#endif /* WINPR_HAVE_INTTYPES_H not defined*/
#ifndef SSIZE_MAX
#if defined(_POSIX_SSIZE_MAX)
#define SSIZE_MAX _POSIX_SSIZE_MAX
#elif defined(_WIN64)
#define SSIZE_MAX _I64_MAX
#elif defined(_WIN32)
#define SSIZE_MAX LONG_MAX
#else
#define SSIZE_MAX LONG_MAX
#endif
#endif
#if defined(_MSC_VER) && _MSC_VER < 1900
/* %z not supported before MSVC 2015 */
#define PRIdz "Id"
#define PRIiz "Ii"
#define PRIuz "Iu"
#define PRIoz "Io"
#define PRIxz "Ix"
#define PRIXz "IX"
#else
#define PRIdz "zd"
#define PRIiz "zi"
#define PRIuz "zu"
#define PRIoz "zo"
#define PRIxz "zx"
#define PRIXz "zX"
#endif
#include <winpr/user.h>
#ifndef _WIN32
#define _fseeki64(fp, offset, origin) fseeko(fp, offset, origin)
#define _ftelli64(fp) ftello(fp)
#endif
WINPR_PRAGMA_DIAG_POP
#endif /* WINPR_WTYPES_H */

View File

@@ -45,9 +45,9 @@ typedef struct
{
DWORD Offset;
DWORD OffsetHigh;
};
} DUMMYSTRUCTNAME;
PVOID Pointer;
};
} DUMMYUNIONNAME;
HANDLE hEvent;
} OVERLAPPED, *LPOVERLAPPED;

View File

@@ -35,6 +35,7 @@ WINPR_PRAGMA_DIAG_IGNORED_RESERVED_IDENTIFIER
#else
#if defined(NONAMELESSUNION)
#define DUMMYUNIONNAME u
#define DUMMYUNIONNAME1 u1
#define DUMMYUNIONNAME2 u2
@@ -51,6 +52,24 @@ WINPR_PRAGMA_DIAG_IGNORED_RESERVED_IDENTIFIER
#define DUMMYSTRUCTNAME3 s3
#define DUMMYSTRUCTNAME4 s4
#define DUMMYSTRUCTNAME5 s5
#else
#define DUMMYUNIONNAME
#define DUMMYUNIONNAME1
#define DUMMYUNIONNAME2
#define DUMMYUNIONNAME3
#define DUMMYUNIONNAME4
#define DUMMYUNIONNAME5
#define DUMMYUNIONNAME6
#define DUMMYUNIONNAME7
#define DUMMYUNIONNAME8
#define DUMMYSTRUCTNAME
#define DUMMYSTRUCTNAME1
#define DUMMYSTRUCTNAME2
#define DUMMYSTRUCTNAME3
#define DUMMYSTRUCTNAME4
#define DUMMYSTRUCTNAME5
#endif
#if (defined(_M_AMD64) || defined(_M_ARM)) && !defined(_WIN32)
#define _UNALIGNED __unaligned

View File

@@ -84,8 +84,8 @@ extern "C"
{
WORD wProcessorArchitecture;
WORD wReserved;
};
};
} DUMMYSTRUCTNAME;
} DUMMYUNIONNAME;
DWORD dwPageSize;
LPVOID lpMinimumApplicationAddress;

View File

@@ -0,0 +1,499 @@
/**
* WinPR: Windows Portable Runtime
* Windows Data Types
*
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
* Copyright 2024 Armin Novak <anovak@thincast.com>
* Copyright 2024 Thincast Technologies GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef WINPR_WTYPES_H
#define WINPR_WTYPES_H
#include <assert.h>
#include <winpr/config.h>
#include <winpr/platform.h>
/* MSDN: Windows Data Types - http://msdn.microsoft.com/en-us/library/aa383751/ */
/* [MS-DTYP]: Windows Data Types - http://msdn.microsoft.com/en-us/library/cc230273/ */
#include <wchar.h>
#include <winpr/windows.h>
#include <winpr/spec.h>
#include <stdbool.h>
#include <stdint.h>
#include <inttypes.h>
#include <limits.h>
#if defined(_WIN32) || defined(__MINGW32__)
#include <wtypes.h>
/* Handle missing ssize_t on Windows */
#if defined(WINPR_HAVE_SSIZE_T)
typedef ssize_t SSIZE_T;
#elif !defined(WINPR_HAVE_WIN_SSIZE_T)
typedef intptr_t SSIZE_T;
#endif
#endif
#if defined(__OBJC__) && defined(__APPLE__)
#include <objc/objc.h>
#endif
#ifndef CONST
#define CONST const
#endif
#ifndef VOID
#define VOID void
#endif
WINPR_PRAGMA_DIAG_PUSH WINPR_PRAGMA_DIAG_IGNORED_RESERVED_ID_MACRO
WINPR_PRAGMA_DIAG_IGNORED_RESERVED_IDENTIFIER
#if !defined(_WIN32) && !defined(__MINGW32__)
#define CALLBACK
#define WINAPI
#define CDECL
#ifndef FAR
#define FAR
#endif
#ifndef NEAR
#define NEAR
#endif
typedef void *PVOID,
*LPVOID, *PVOID64, *LPVOID64;
#ifndef XMD_H /* X11/Xmd.h typedef collision with BOOL */
#ifndef __OBJC__ /* objc.h typedef collision with BOOL */
#ifndef __APPLE__
typedef int32_t BOOL;
#else /* __APPLE__ */
#include <TargetConditionals.h>
/* ensure compatibility with objc libraries */
#if (defined(TARGET_OS_IPHONE) && (TARGET_OS_IPHONE != 0) && defined(__LP64__)) || \
(defined(TARGET_OS_WATCH) && (TARGET_OS_WATCH != 0))
typedef bool BOOL;
#else
typedef signed char BOOL;
#endif
#endif /* __APPLE__ */
#endif /* __OBJC__ */
#endif /* XMD_H */
typedef BOOL *PBOOL, *LPBOOL;
#ifndef FALSE
#define FALSE false
#endif
#ifndef TRUE
#define TRUE true
#endif
#ifndef XMD_H /* X11/Xmd.h typedef collision with BYTE */
typedef uint8_t BYTE;
#endif /* XMD_H */
typedef BYTE byte, *PBYTE, *LPBYTE;
typedef BYTE BOOLEAN, PBOOLEAN;
#if CHAR_BIT == 8
typedef char CHAR;
typedef unsigned char UCHAR;
#else
typedef int8_t CHAR;
typedef uint8_t UCHAR;
#endif
typedef CHAR CCHAR, *PCHAR, *LPCH, *PCH, *PSTR, *LPSTR;
typedef const CHAR *LPCCH, *PCCH, *LPCSTR, *PCSTR;
typedef UCHAR* PUCHAR;
typedef uint16_t WCHAR;
typedef WCHAR UNICODE, *PWCHAR, *LPWCH, *PWCH, *BSTR, *LMSTR, *LPWSTR, *PWSTR;
typedef const WCHAR *LPCWCH, *PCWCH, *LMCSTR, *LPCWSTR, *PCWSTR;
typedef int16_t SHORT, *PSHORT;
typedef int32_t INT, *PINT, *LPINT;
typedef int32_t LONG, *PLONG, *LPLONG;
typedef int64_t LONGLONG, *PLONGLONG;
typedef uint32_t UINT, *PUINT, *LPUINT;
typedef uint16_t USHORT, *PUSHORT;
typedef uint32_t ULONG, *PULONG;
typedef uint64_t ULONGLONG, *PULONGLONG;
#ifndef XMD_H /* X11/Xmd.h typedef collisions */
typedef int8_t INT8;
typedef int16_t INT16;
typedef int32_t INT32;
typedef int64_t INT64;
#endif
typedef INT8* PINT8;
typedef INT16* PINT16;
typedef INT32* PINT32;
typedef INT64* PINT64;
typedef int32_t LONG32, *PLONG32;
#ifndef LONG64 /* X11/Xmd.h uses/defines LONG64 */
typedef int64_t LONG64, *PLONG64;
#endif
typedef uint8_t UINT8, *PUINT8;
typedef uint16_t UINT16, *PUINT16;
typedef uint32_t UINT32, *PUINT32;
typedef uint64_t UINT64, *PUINT64;
typedef uint64_t ULONG64, *PULONG64;
typedef uint16_t WORD, *PWORD, *LPWORD;
typedef uint32_t DWORD, DWORD32, *PDWORD, *LPDWORD, *PDWORD32;
typedef uint64_t DWORD64, DWORDLONG, QWORD, *PDWORD64, *PDWORDLONG, *PQWORD;
typedef intptr_t INT_PTR, *PINT_PTR;
typedef uintptr_t UINT_PTR, *PUINT_PTR;
typedef intptr_t LONG_PTR, *PLONG_PTR;
typedef uintptr_t ULONG_PTR, *PULONG_PTR;
typedef uintptr_t DWORD_PTR, *PDWORD_PTR;
typedef ULONG_PTR SIZE_T, *PSIZE_T; /** deprecated */
#if defined(WINPR_HAVE_SSIZE_T)
#include <sys/types.h>
typedef ssize_t SSIZE_T;
#elif !defined(WINPR_HAVE_WIN_SSIZE_T)
typedef LONG_PTR SSIZE_T;
#endif
typedef float FLOAT;
typedef double DOUBLE;
typedef void* HANDLE;
typedef HANDLE *PHANDLE, *LPHANDLE;
typedef HANDLE HINSTANCE;
typedef HANDLE HMODULE;
typedef HANDLE HWND;
typedef HANDLE HBITMAP;
typedef HANDLE HICON;
typedef HANDLE HCURSOR;
typedef HANDLE HBRUSH;
typedef HANDLE HMENU;
typedef DWORD HCALL;
typedef ULONG error_status_t;
typedef LONG HRESULT;
typedef LONG SCODE;
typedef SCODE* PSCODE;
typedef struct s_POINTL /* ptl */
{
LONG x;
LONG y;
} POINTL, *PPOINTL;
typedef struct tagSIZE
{
LONG cx;
LONG cy;
} SIZE, *PSIZE, *LPSIZE;
typedef SIZE SIZEL;
typedef struct s_GUID
{
UINT32 Data1;
UINT16 Data2;
UINT16 Data3;
BYTE Data4[8];
} GUID, UUID, *PGUID, *LPGUID, *LPCGUID;
typedef GUID CLSID;
typedef struct s_LUID
{
DWORD LowPart;
LONG HighPart;
} LUID, *PLUID;
typedef GUID IID;
typedef IID* REFIID;
#ifdef UNICODE
#define _T(x) u##x // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#else
#define _T(x) x // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#endif
#ifdef UNICODE
typedef LPWSTR PTSTR;
typedef LPWSTR LPTCH;
typedef LPWSTR LPTSTR;
typedef LPCWSTR LPCTSTR;
#else
typedef LPSTR PTSTR;
typedef LPSTR LPTCH;
typedef LPSTR LPTSTR;
typedef LPCSTR LPCTSTR;
#endif
typedef union u_ULARGE_INTEGER
{
struct
{
DWORD LowPart;
DWORD HighPart;
} DUMMYSTRUCTNAME;
struct
{
DWORD LowPart;
DWORD HighPart;
} u;
ULONGLONG QuadPart;
} ULARGE_INTEGER, *PULARGE_INTEGER;
typedef union u_LARGE_INTEGER
{
struct
{
DWORD LowPart;
LONG HighPart;
} DUMMYSTRUCTNAME;
struct
{
DWORD LowPart;
LONG HighPart;
} u;
LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;
typedef struct s_FILETIME
{
DWORD dwLowDateTime;
DWORD dwHighDateTime;
} FILETIME, *PFILETIME, *LPFILETIME;
typedef struct s_SYSTEMTIME
{
WORD wYear;
WORD wMonth;
WORD wDayOfWeek;
WORD wDay;
WORD wHour;
WORD wMinute;
WORD wSecond;
WORD wMilliseconds;
} SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
typedef struct s_RPC_SID_IDENTIFIER_AUTHORITY
{
BYTE Value[6];
} RPC_SID_IDENTIFIER_AUTHORITY;
typedef DWORD SECURITY_INFORMATION, *PSECURITY_INFORMATION;
typedef struct s_RPC_SID
{
UCHAR Revision;
UCHAR SubAuthorityCount;
RPC_SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
ULONG SubAuthority[1];
} RPC_SID, *PRPC_SID, *PSID;
typedef struct s_ACL
{
UCHAR AclRevision;
UCHAR Sbz1;
USHORT AclSize;
USHORT AceCount;
USHORT Sbz2;
} ACL, *PACL;
typedef struct s_SECURITY_DESCRIPTOR
{
UCHAR Revision;
UCHAR Sbz1;
USHORT Control;
PSID Owner;
PSID Group;
PACL Sacl;
PACL Dacl;
} SECURITY_DESCRIPTOR, *PSECURITY_DESCRIPTOR;
typedef WORD SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
typedef struct s_SECURITY_ATTRIBUTES
{
DWORD nLength;
LPVOID lpSecurityDescriptor;
BOOL bInheritHandle;
} SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
typedef struct s_PROCESS_INFORMATION
{
HANDLE hProcess;
HANDLE hThread;
DWORD dwProcessId;
DWORD dwThreadId;
} PROCESS_INFORMATION, *PPROCESS_INFORMATION, *LPPROCESS_INFORMATION;
typedef DWORD (*PTHREAD_START_ROUTINE)(LPVOID lpThreadParameter);
typedef PTHREAD_START_ROUTINE LPTHREAD_START_ROUTINE;
typedef void* FARPROC;
typedef struct tagDEC
{
USHORT wReserved;
union
{
struct
{
BYTE scale;
BYTE sign;
} DUMMYSTRUCTNAME;
USHORT signscale;
} DUMMYUNIONNAME;
ULONG Hi32;
union
{
struct
{
ULONG Lo32;
ULONG Mid32;
} DUMMYSTRUCTNAME2;
ULONGLONG Lo64;
} DUMMYUNIONNAME2;
} DECIMAL;
typedef DECIMAL* LPDECIMAL;
#define DECIMAL_NEG ((BYTE)0x80)
#define DECIMAL_SETZERO(dec) \
{ \
(dec).Lo64 = 0; \
(dec).Hi32 = 0; \
(dec).signscale = 0; \
}
typedef DWORD LCID;
typedef PDWORD PLCID;
typedef WORD LANGID;
#endif /* _WIN32 not defined */
typedef void* PCONTEXT_HANDLE;
typedef PCONTEXT_HANDLE* PPCONTEXT_HANDLE;
#ifndef _NTDEF
typedef LONG NTSTATUS;
typedef NTSTATUS* PNTSTATUS;
#endif
#ifndef _LPCVOID_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define _LPCVOID_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef const VOID* LPCVOID;
#endif
#ifndef _LPCBYTE_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
#define _LPCBYTE_DEFINED // NOLINT(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
typedef const BYTE* LPCBYTE;
#endif
#ifndef SSIZE_MAX
#if defined(_POSIX_SSIZE_MAX)
#define SSIZE_MAX _POSIX_SSIZE_MAX
#elif defined(_WIN64)
#define SSIZE_MAX _I64_MAX
#elif defined(_WIN32)
#define SSIZE_MAX LONG_MAX
#else
#define SSIZE_MAX INTPTR_MAX
#endif
#endif
#define PRIdz "zd"
#define PRIiz "zi"
#define PRIuz "zu"
#define PRIoz "zo"
#define PRIxz "zx"
#define PRIXz "zX"
#include <winpr/user.h>
#ifndef _WIN32
#include <stdio.h>
// NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
static inline int _fseeki64(FILE* fp, INT64 offset, int origin)
{
return fseeko(fp, offset, origin);
}
// NOLINTNEXTLINE(bugprone-reserved-identifier,cert-dcl37-c,cert-dcl51-cpp)
static inline INT64 _ftelli64(FILE* fp)
{
return ftello(fp);
}
#endif
WINPR_PRAGMA_DIAG_POP
#endif /* WINPR_WTYPES_H */

View File

@@ -19,6 +19,7 @@
#include <winpr/config.h>
#include <winpr/assert.h>
#include <winpr/platform.h>
#include <winpr/synch.h>
#include <winpr/handle.h>
@@ -34,6 +35,7 @@
VOID InitializeSListHead(WINPR_PSLIST_HEADER ListHead)
{
WINPR_ASSERT(ListHead);
#ifdef _WIN64
ListHead->s.Alignment = 0;
ListHead->s.Region = 0;
@@ -46,9 +48,11 @@ VOID InitializeSListHead(WINPR_PSLIST_HEADER ListHead)
WINPR_PSLIST_ENTRY InterlockedPushEntrySList(WINPR_PSLIST_HEADER ListHead,
WINPR_PSLIST_ENTRY ListEntry)
{
WINPR_SLIST_HEADER old;
WINPR_SLIST_HEADER newHeader;
WINPR_SLIST_HEADER old = { 0 };
WINPR_SLIST_HEADER newHeader = { 0 };
WINPR_ASSERT(ListHead);
WINPR_ASSERT(ListEntry);
#ifdef _WIN64
newHeader.HeaderX64.NextEntry = (((ULONG_PTR)ListEntry) >> 4);
@@ -61,11 +65,10 @@ WINPR_PSLIST_ENTRY InterlockedPushEntrySList(WINPR_PSLIST_HEADER ListHead,
newHeader.HeaderX64.Depth = old.HeaderX64.Depth + 1;
newHeader.HeaderX64.Sequence = old.HeaderX64.Sequence + 1;
if (InterlockedCompareExchange64((LONGLONG*)ListHead, newHeader.s.Alignment,
old.s.Alignment))
if (InterlockedCompareExchange64((LONGLONG*)ListHead, newHeader).Alignment, old).Alignment))
{
InterlockedCompareExchange64(&((LONGLONG*)ListHead)[1], newHeader.s.Region,
old.s.Region);
InterlockedCompareExchange64(&((LONGLONG*)ListHead)[1], newHeader).Region,
old).Region);
break;
}
}
@@ -97,6 +100,10 @@ WINPR_PSLIST_ENTRY InterlockedPushEntrySList(WINPR_PSLIST_HEADER ListHead,
WINPR_PSLIST_ENTRY InterlockedPushListSListEx(WINPR_PSLIST_HEADER ListHead, WINPR_PSLIST_ENTRY List,
WINPR_PSLIST_ENTRY ListEnd, ULONG Count)
{
WINPR_ASSERT(ListHead);
WINPR_ASSERT(List);
WINPR_ASSERT(ListEnd);
#ifdef _WIN64
#else
@@ -107,10 +114,12 @@ WINPR_PSLIST_ENTRY InterlockedPushListSListEx(WINPR_PSLIST_HEADER ListHead, WINP
WINPR_PSLIST_ENTRY InterlockedPopEntrySList(WINPR_PSLIST_HEADER ListHead)
{
WINPR_SLIST_HEADER old;
WINPR_SLIST_HEADER newHeader;
WINPR_SLIST_HEADER old = { 0 };
WINPR_SLIST_HEADER newHeader = { 0 };
WINPR_PSLIST_ENTRY entry = NULL;
WINPR_ASSERT(ListHead);
#ifdef _WIN64
while (1)
{
@@ -125,11 +134,10 @@ WINPR_PSLIST_ENTRY InterlockedPopEntrySList(WINPR_PSLIST_HEADER ListHead)
newHeader.HeaderX64.Depth = old.HeaderX64.Depth - 1;
newHeader.HeaderX64.Sequence = old.HeaderX64.Sequence - 1;
if (InterlockedCompareExchange64((LONGLONG*)ListHead, newHeader.s.Alignment,
old.s.Alignment))
if (InterlockedCompareExchange64((LONGLONG*)ListHead, newHeader).Alignment, old).Alignment))
{
InterlockedCompareExchange64(&((LONGLONG*)ListHead)[1], newHeader.s.Region,
old.s.Region);
InterlockedCompareExchange64(&((LONGLONG*)ListHead)[1], newHeader).Region,
old).Region);
break;
}
}
@@ -162,15 +170,16 @@ WINPR_PSLIST_ENTRY InterlockedPopEntrySList(WINPR_PSLIST_HEADER ListHead)
WINPR_PSLIST_ENTRY InterlockedFlushSList(WINPR_PSLIST_HEADER ListHead)
{
WINPR_SLIST_HEADER old;
WINPR_SLIST_HEADER newHeader;
WINPR_SLIST_HEADER old = { 0 };
WINPR_SLIST_HEADER newHeader = { 0 };
WINPR_ASSERT(ListHead);
if (!QueryDepthSList(ListHead))
return NULL;
#ifdef _WIN64
newHeader.s.Alignment = 0;
newHeader.s.Region = 0;
newHeader).Alignment = 0;
newHeader).Region = 0;
newHeader.HeaderX64.HeaderType = 1;
while (1)
@@ -178,11 +187,10 @@ WINPR_PSLIST_ENTRY InterlockedFlushSList(WINPR_PSLIST_HEADER ListHead)
old = *ListHead;
newHeader.HeaderX64.Sequence = old.HeaderX64.Sequence + 1;
if (InterlockedCompareExchange64((LONGLONG*)ListHead, newHeader.s.Alignment,
old.s.Alignment))
if (InterlockedCompareExchange64((LONGLONG*)ListHead, newHeader).Alignment, old).Alignment))
{
InterlockedCompareExchange64(&((LONGLONG*)ListHead)[1], newHeader.s.Region,
old.s.Region);
InterlockedCompareExchange64(&((LONGLONG*)ListHead)[1], newHeader).Region,
old).Region);
break;
}
}
@@ -212,6 +220,8 @@ WINPR_PSLIST_ENTRY InterlockedFlushSList(WINPR_PSLIST_HEADER ListHead)
USHORT QueryDepthSList(WINPR_PSLIST_HEADER ListHead)
{
WINPR_ASSERT(ListHead);
#ifdef _WIN64
return ListHead->HeaderX64.Depth;
#else
@@ -221,6 +231,8 @@ USHORT QueryDepthSList(WINPR_PSLIST_HEADER ListHead)
LONG InterlockedIncrement(LONG volatile* Addend)
{
WINPR_ASSERT(Addend);
#if defined(__GNUC__) || defined(__clang__)
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST
@@ -233,6 +245,8 @@ LONG InterlockedIncrement(LONG volatile* Addend)
LONG InterlockedDecrement(LONG volatile* Addend)
{
WINPR_ASSERT(Addend);
#if defined(__GNUC__) || defined(__clang__)
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST
@@ -245,6 +259,8 @@ LONG InterlockedDecrement(LONG volatile* Addend)
LONG InterlockedExchange(LONG volatile* Target, LONG Value)
{
WINPR_ASSERT(Target);
#if defined(__GNUC__) || defined(__clang__)
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST
@@ -257,6 +273,8 @@ LONG InterlockedExchange(LONG volatile* Target, LONG Value)
LONG InterlockedExchangeAdd(LONG volatile* Addend, LONG Value)
{
WINPR_ASSERT(Addend);
#if defined(__GNUC__) || defined(__clang__)
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST
@@ -269,6 +287,8 @@ LONG InterlockedExchangeAdd(LONG volatile* Addend, LONG Value)
LONG InterlockedCompareExchange(LONG volatile* Destination, LONG Exchange, LONG Comperand)
{
WINPR_ASSERT(Destination);
#if defined(__GNUC__) || defined(__clang__)
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST
@@ -282,6 +302,8 @@ LONG InterlockedCompareExchange(LONG volatile* Destination, LONG Exchange, LONG
PVOID InterlockedCompareExchangePointer(PVOID volatile* Destination, PVOID Exchange,
PVOID Comperand)
{
WINPR_ASSERT(Destination);
#if defined(__GNUC__) || defined(__clang__)
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST
@@ -367,6 +389,8 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile* Destination, LONGLONG E
LONGLONG InterlockedCompareExchange64(LONGLONG volatile* Destination, LONGLONG Exchange,
LONGLONG Comperand)
{
WINPR_ASSERT(Destination);
#if defined(__GNUC__) || defined(__clang__)
WINPR_PRAGMA_DIAG_PUSH
WINPR_PRAGMA_DIAG_IGNORED_ATOMIC_SEQ_CST
@@ -391,21 +415,25 @@ LONGLONG InterlockedCompareExchange64(LONGLONG volatile* Destination, LONGLONG E
VOID InitializeListHead(WINPR_PLIST_ENTRY ListHead)
{
WINPR_ASSERT(ListHead);
ListHead->Flink = ListHead->Blink = ListHead;
}
BOOL IsListEmpty(const WINPR_LIST_ENTRY* ListHead)
{
WINPR_ASSERT(ListHead);
return (BOOL)(ListHead->Flink == ListHead);
}
BOOL RemoveEntryList(WINPR_PLIST_ENTRY Entry)
{
WINPR_PLIST_ENTRY OldFlink = NULL;
WINPR_PLIST_ENTRY OldBlink = NULL;
WINPR_ASSERT(Entry);
WINPR_PLIST_ENTRY OldFlink = Entry->Flink;
WINPR_ASSERT(OldFlink);
WINPR_PLIST_ENTRY OldBlink = Entry->Blink;
WINPR_ASSERT(OldBlink);
OldFlink = Entry->Flink;
OldBlink = Entry->Blink;
OldFlink->Blink = OldBlink;
OldBlink->Flink = OldFlink;
@@ -414,9 +442,12 @@ BOOL RemoveEntryList(WINPR_PLIST_ENTRY Entry)
VOID InsertHeadList(WINPR_PLIST_ENTRY ListHead, WINPR_PLIST_ENTRY Entry)
{
WINPR_PLIST_ENTRY OldFlink = NULL;
WINPR_ASSERT(ListHead);
WINPR_ASSERT(Entry);
WINPR_PLIST_ENTRY OldFlink = ListHead->Flink;
WINPR_ASSERT(OldFlink);
OldFlink = ListHead->Flink;
Entry->Flink = OldFlink;
Entry->Blink = ListHead;
OldFlink->Blink = Entry;
@@ -425,11 +456,14 @@ VOID InsertHeadList(WINPR_PLIST_ENTRY ListHead, WINPR_PLIST_ENTRY Entry)
WINPR_PLIST_ENTRY RemoveHeadList(WINPR_PLIST_ENTRY ListHead)
{
WINPR_PLIST_ENTRY Flink = NULL;
WINPR_PLIST_ENTRY Entry = NULL;
WINPR_ASSERT(ListHead);
WINPR_PLIST_ENTRY Entry = ListHead->Flink;
WINPR_ASSERT(Entry);
WINPR_PLIST_ENTRY Flink = Entry->Flink;
WINPR_ASSERT(Flink);
Entry = ListHead->Flink;
Flink = Entry->Flink;
ListHead->Flink = Flink;
Flink->Blink = ListHead;
@@ -438,9 +472,12 @@ WINPR_PLIST_ENTRY RemoveHeadList(WINPR_PLIST_ENTRY ListHead)
VOID InsertTailList(WINPR_PLIST_ENTRY ListHead, WINPR_PLIST_ENTRY Entry)
{
WINPR_PLIST_ENTRY OldBlink = NULL;
WINPR_ASSERT(ListHead);
WINPR_ASSERT(Entry);
WINPR_PLIST_ENTRY OldBlink = ListHead->Blink;
WINPR_ASSERT(OldBlink);
OldBlink = ListHead->Blink;
Entry->Flink = ListHead;
Entry->Blink = OldBlink;
OldBlink->Flink = Entry;
@@ -449,11 +486,14 @@ VOID InsertTailList(WINPR_PLIST_ENTRY ListHead, WINPR_PLIST_ENTRY Entry)
WINPR_PLIST_ENTRY RemoveTailList(WINPR_PLIST_ENTRY ListHead)
{
WINPR_PLIST_ENTRY Blink = NULL;
WINPR_PLIST_ENTRY Entry = NULL;
WINPR_ASSERT(ListHead);
WINPR_PLIST_ENTRY Entry = ListHead->Blink;
WINPR_ASSERT(Entry);
WINPR_PLIST_ENTRY Blink = Entry->Blink;
WINPR_ASSERT(Blink);
Entry = ListHead->Blink;
Blink = Entry->Blink;
ListHead->Blink = Blink;
Blink->Flink = ListHead;
@@ -462,6 +502,9 @@ WINPR_PLIST_ENTRY RemoveTailList(WINPR_PLIST_ENTRY ListHead)
VOID AppendTailList(WINPR_PLIST_ENTRY ListHead, WINPR_PLIST_ENTRY ListToAppend)
{
WINPR_ASSERT(ListHead);
WINPR_ASSERT(ListToAppend);
WINPR_PLIST_ENTRY ListEnd = ListHead->Blink;
ListHead->Blink->Flink = ListToAppend;
@@ -472,15 +515,17 @@ VOID AppendTailList(WINPR_PLIST_ENTRY ListHead, WINPR_PLIST_ENTRY ListToAppend)
VOID PushEntryList(WINPR_PSINGLE_LIST_ENTRY ListHead, WINPR_PSINGLE_LIST_ENTRY Entry)
{
WINPR_ASSERT(ListHead);
WINPR_ASSERT(Entry);
Entry->Next = ListHead->Next;
ListHead->Next = Entry;
}
WINPR_PSINGLE_LIST_ENTRY PopEntryList(WINPR_PSINGLE_LIST_ENTRY ListHead)
{
WINPR_PSINGLE_LIST_ENTRY FirstEntry = NULL;
FirstEntry = ListHead->Next;
WINPR_ASSERT(ListHead);
WINPR_PSINGLE_LIST_ENTRY FirstEntry = ListHead->Next;
if (FirstEntry != NULL)
ListHead->Next = FirstEntry->Next;

View File

@@ -332,7 +332,7 @@ BOOL NamedPipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
/* synchronous behavior */
lpOverlapped->Internal = 0;
lpOverlapped->InternalHigh = (ULONG_PTR)nNumberOfBytesToRead;
lpOverlapped->Pointer = (PVOID)lpBuffer;
lpOverlapped->DUMMYUNIONNAME.Pointer = (PVOID)lpBuffer;
(void)SetEvent(lpOverlapped->hEvent);
#endif
}
@@ -426,7 +426,7 @@ BOOL NamedPipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
PVOID pv;
} cnv;
cnv.cpv = lpBuffer;
lpOverlapped->Pointer = cnv.pv;
lpOverlapped->DUMMYUNIONNAME.Pointer = cnv.pv;
}
(void)SetEvent(lpOverlapped->hEvent);
#endif
@@ -782,7 +782,7 @@ BOOL ConnectNamedPipe(HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped)
/* synchronous behavior */
lpOverlapped->Internal = 2;
lpOverlapped->InternalHigh = (ULONG_PTR)0;
lpOverlapped->Pointer = (PVOID)NULL;
lpOverlapped->DUMMYUNIONNAME.Pointer = (PVOID)NULL;
(void)SetEvent(lpOverlapped->hEvent);
}

View File

@@ -20,6 +20,7 @@
#include <winpr/config.h>
#include <winpr/assert.h>
#include <winpr/sysinfo.h>
#include <winpr/platform.h>
@@ -226,17 +227,14 @@ static DWORD GetSystemPageSize(void)
void GetSystemInfo(LPSYSTEM_INFO lpSystemInfo)
{
lpSystemInfo->wProcessorArchitecture = GetProcessorArchitecture();
lpSystemInfo->wReserved = 0;
const SYSTEM_INFO empty = { 0 };
WINPR_ASSERT(lpSystemInfo);
*lpSystemInfo = empty;
lpSystemInfo->DUMMYUNIONNAME.DUMMYSTRUCTNAME.wProcessorArchitecture =
GetProcessorArchitecture();
lpSystemInfo->dwPageSize = GetSystemPageSize();
lpSystemInfo->lpMinimumApplicationAddress = NULL;
lpSystemInfo->lpMaximumApplicationAddress = NULL;
lpSystemInfo->dwActiveProcessorMask = 0;
lpSystemInfo->dwNumberOfProcessors = GetNumberOfProcessors();
lpSystemInfo->dwProcessorType = 0;
lpSystemInfo->dwAllocationGranularity = 0;
lpSystemInfo->wProcessorLevel = 0;
lpSystemInfo->wProcessorRevision = 0;
}
void GetNativeSystemInfo(LPSYSTEM_INFO lpSystemInfo)

View File

@@ -4,16 +4,20 @@
int TestGetNativeSystemInfo(int argc, char* argv[])
{
SYSTEM_INFO sysinfo;
SYSTEM_INFO sysinfo = { 0 };
WINPR_UNUSED(argc);
WINPR_UNUSED(argv);
GetNativeSystemInfo(&sysinfo);
const UINT16 wProcessorArchitecture =
sysinfo.DUMMYUNIONNAME.DUMMYSTRUCTNAME.wProcessorArchitecture;
const UINT16 wReserved = sysinfo.DUMMYUNIONNAME.DUMMYSTRUCTNAME.wReserved;
printf("SystemInfo:\n");
printf("\twProcessorArchitecture: %" PRIu16 "\n", sysinfo.wProcessorArchitecture);
printf("\twReserved: %" PRIu16 "\n", sysinfo.wReserved);
printf("\twProcessorArchitecture: %" PRIu16 "\n", wProcessorArchitecture);
printf("\twReserved: %" PRIu16 "\n", wReserved);
printf("\tdwPageSize: 0x%08" PRIX32 "\n", sysinfo.dwPageSize);
printf("\tlpMinimumApplicationAddress: %p\n", sysinfo.lpMinimumApplicationAddress);
printf("\tlpMaximumApplicationAddress: %p\n", sysinfo.lpMaximumApplicationAddress);

View File

@@ -654,9 +654,7 @@ BOOL WINAPI Win32_WTSVirtualChannelWrite(HANDLE hChannel, LPCVOID lpBuffer,
BOOL Win32_WTSVirtualChannelPurge_Internal(HANDLE hChannelHandle, ULONG IoControlCode)
{
DWORD error;
NTSTATUS ntstatus;
IO_STATUS_BLOCK ioStatusBlock;
IO_STATUS_BLOCK ioStatusBlock = { 0 };
WTSAPI_CHANNEL* pChannel = (WTSAPI_CHANNEL*)hChannelHandle;
if (!pChannel || (pChannel->magic != WTSAPI_CHANNEL_MAGIC))
@@ -665,7 +663,7 @@ BOOL Win32_WTSVirtualChannelPurge_Internal(HANDLE hChannelHandle, ULONG IoContro
return FALSE;
}
ntstatus =
NTSTATUS ntstatus =
NtDeviceIoControlFile(pChannel->hFile, 0, 0, 0, &ioStatusBlock, IoControlCode, 0, 0, 0, 0);
if (ntstatus == STATUS_PENDING)
@@ -673,20 +671,20 @@ BOOL Win32_WTSVirtualChannelPurge_Internal(HANDLE hChannelHandle, ULONG IoContro
ntstatus = NtWaitForSingleObject(pChannel->hFile, 0, 0);
if (ntstatus >= 0)
ntstatus = ioStatusBlock.Status;
ntstatus = ioStatusBlock.DUMMYUNIONNAME.Status;
}
if (ntstatus == STATUS_BUFFER_OVERFLOW)
{
ntstatus = STATUS_BUFFER_TOO_SMALL;
error = RtlNtStatusToDosError(ntstatus);
const DWORD error = RtlNtStatusToDosError(ntstatus);
SetLastError(error);
return FALSE;
}
if (ntstatus < 0)
{
error = RtlNtStatusToDosError(ntstatus);
const DWORD error = RtlNtStatusToDosError(ntstatus);
SetLastError(error);
return FALSE;
}