[winpr] fix NONAMELESSUNION handling
Fix code to compile with and without this set
This commit is contained in:
parent
13d46990b0
commit
5ed5cfe7db
@ -330,7 +330,12 @@ BOOL NamedPipeRead(PVOID Object, LPVOID lpBuffer, DWORD nNumberOfBytesToRead,
|
||||
/* synchronous behavior */
|
||||
lpOverlapped->Internal = 0;
|
||||
lpOverlapped->InternalHigh = (ULONG_PTR)nNumberOfBytesToRead;
|
||||
lpOverlapped->DUMMYUNIONNAME.Pointer = (PVOID)lpBuffer;
|
||||
#if defined(NONAMELESSUNION)
|
||||
lpOverlapped->DUMMYUNIONNAME.Pointer
|
||||
#else
|
||||
lpOverlapped->Pointer
|
||||
#endif
|
||||
= (PVOID)lpBuffer;
|
||||
(void)SetEvent(lpOverlapped->hEvent);
|
||||
#endif
|
||||
}
|
||||
@ -424,7 +429,12 @@ BOOL NamedPipeWrite(PVOID Object, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite,
|
||||
PVOID pv;
|
||||
} cnv;
|
||||
cnv.cpv = lpBuffer;
|
||||
lpOverlapped->DUMMYUNIONNAME.Pointer = cnv.pv;
|
||||
#if defined(NONAMELESSUNION)
|
||||
lpOverlapped->DUMMYUNIONNAME.Pointer
|
||||
#else
|
||||
lpOverlapped->Pointer
|
||||
#endif
|
||||
= cnv.pv;
|
||||
}
|
||||
(void)SetEvent(lpOverlapped->hEvent);
|
||||
#endif
|
||||
@ -780,7 +790,12 @@ BOOL ConnectNamedPipe(HANDLE hNamedPipe, LPOVERLAPPED lpOverlapped)
|
||||
/* synchronous behavior */
|
||||
lpOverlapped->Internal = 2;
|
||||
lpOverlapped->InternalHigh = (ULONG_PTR)0;
|
||||
lpOverlapped->DUMMYUNIONNAME.Pointer = (PVOID)NULL;
|
||||
#if defined(NONAMELESSUNION)
|
||||
lpOverlapped->DUMMYUNIONNAME.Pointer
|
||||
#else
|
||||
lpOverlapped->Pointer
|
||||
#endif
|
||||
= (PVOID)NULL;
|
||||
(void)SetEvent(lpOverlapped->hEvent);
|
||||
}
|
||||
|
||||
|
@ -231,7 +231,11 @@ void GetSystemInfo(LPSYSTEM_INFO lpSystemInfo)
|
||||
WINPR_ASSERT(lpSystemInfo);
|
||||
|
||||
*lpSystemInfo = empty;
|
||||
#if defined(NONAMELESSUNION)
|
||||
lpSystemInfo->DUMMYUNIONNAME.DUMMYSTRUCTNAME.wProcessorArchitecture =
|
||||
#else
|
||||
lpSystemInfo->wProcessorArchitecture =
|
||||
#endif
|
||||
GetProcessorArchitecture();
|
||||
lpSystemInfo->dwPageSize = GetSystemPageSize();
|
||||
lpSystemInfo->dwNumberOfProcessors = GetNumberOfProcessors();
|
||||
|
@ -11,10 +11,17 @@ int TestGetNativeSystemInfo(int argc, char* argv[])
|
||||
|
||||
GetNativeSystemInfo(&sysinfo);
|
||||
|
||||
#if defined(NONAMELESSUNION)
|
||||
const UINT16 wProcessorArchitecture =
|
||||
sysinfo.DUMMYUNIONNAME.DUMMYSTRUCTNAME.wProcessorArchitecture;
|
||||
const UINT16 wReserved = sysinfo.DUMMYUNIONNAME.DUMMYSTRUCTNAME.wReserved;
|
||||
#else
|
||||
const UINT16 wProcessorArchitecture = sysinfo.wProcessorArchitecture;
|
||||
const UINT16 wReserved = sysinfo.wReserved;
|
||||
#endif
|
||||
printf("SystemInfo:\n");
|
||||
printf("\twProcessorArchitecture: %" PRIu16 "\n",
|
||||
sysinfo.DUMMYUNIONNAME.DUMMYSTRUCTNAME.wProcessorArchitecture);
|
||||
printf("\twReserved: %" PRIu16 "\n", sysinfo.DUMMYUNIONNAME.DUMMYSTRUCTNAME.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);
|
||||
|
@ -663,7 +663,7 @@ BOOL Win32_WTSVirtualChannelPurge_Internal(HANDLE hChannelHandle, ULONG IoContro
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
const NTSTATUS ntstatus =
|
||||
NTSTATUS ntstatus =
|
||||
NtDeviceIoControlFile(pChannel->hFile, 0, 0, 0, &ioStatusBlock, IoControlCode, 0, 0, 0, 0);
|
||||
|
||||
if (ntstatus == STATUS_PENDING)
|
||||
@ -671,7 +671,13 @@ BOOL Win32_WTSVirtualChannelPurge_Internal(HANDLE hChannelHandle, ULONG IoContro
|
||||
ntstatus = NtWaitForSingleObject(pChannel->hFile, 0, 0);
|
||||
|
||||
if (ntstatus >= 0)
|
||||
{
|
||||
#if defined(NONAMELESSUNION)
|
||||
ntstatus = ioStatusBlock.DUMMYUNIONNAME.Status;
|
||||
#else
|
||||
ntstatus = ioStatusBlock.Status;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (ntstatus == STATUS_BUFFER_OVERFLOW)
|
||||
|
Loading…
Reference in New Issue
Block a user