mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
[winpr] fix OVERLAPPED and SYSTEM_INFO definitions
rename them to conform to windows versions
This commit is contained in:
@@ -45,9 +45,9 @@ typedef struct
|
||||
{
|
||||
DWORD Offset;
|
||||
DWORD OffsetHigh;
|
||||
};
|
||||
} DUMMYSTRUCTNAME;
|
||||
PVOID Pointer;
|
||||
};
|
||||
} DUMMYUNIONNAME;
|
||||
HANDLE hEvent;
|
||||
} OVERLAPPED, *LPOVERLAPPED;
|
||||
|
||||
|
||||
@@ -84,8 +84,8 @@ extern "C"
|
||||
{
|
||||
WORD wProcessorArchitecture;
|
||||
WORD wReserved;
|
||||
};
|
||||
};
|
||||
} DUMMYSTRUCTNAME;
|
||||
} DUMMYUNIONNAME;
|
||||
|
||||
DWORD dwPageSize;
|
||||
LPVOID lpMinimumApplicationAddress;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -4,16 +4,22 @@
|
||||
|
||||
int TestGetNativeSystemInfo(int argc, char* argv[])
|
||||
{
|
||||
SYSTEM_INFO sysinfo;
|
||||
SYSTEM_INFO sysinfo = { 0 };
|
||||
|
||||
WINPR_UNUSED(argc);
|
||||
WINPR_UNUSED(argv);
|
||||
|
||||
GetNativeSystemInfo(&sysinfo);
|
||||
|
||||
#if defined(DUMMYUNIONNAME) && defined(DUMMYSTRUCTNAME)
|
||||
#define DUMMYXPTR(x) x.DUMMYUNIONNAME.DUMMYSTRUCTNAME
|
||||
#else
|
||||
#define DUMMYXPTR(x) x
|
||||
#endif
|
||||
|
||||
printf("SystemInfo:\n");
|
||||
printf("\twProcessorArchitecture: %" PRIu16 "\n", sysinfo.wProcessorArchitecture);
|
||||
printf("\twReserved: %" PRIu16 "\n", sysinfo.wReserved);
|
||||
printf("\twProcessorArchitecture: %" PRIu16 "\n", DUMMYXPTR(sysinfo).wProcessorArchitecture);
|
||||
printf("\twReserved: %" PRIu16 "\n", DUMMYXPTR(sysinfo).wReserved);
|
||||
printf("\tdwPageSize: 0x%08" PRIX32 "\n", sysinfo.dwPageSize);
|
||||
printf("\tlpMinimumApplicationAddress: %p\n", sysinfo.lpMinimumApplicationAddress);
|
||||
printf("\tlpMaximumApplicationAddress: %p\n", sysinfo.lpMaximumApplicationAddress);
|
||||
|
||||
Reference in New Issue
Block a user