[REACTOS] Fix 64 bit issues

This commit is contained in:
Timo Kreuzer 2018-07-07 16:09:03 +02:00
parent 0f8439aa71
commit cf77354dce
11 changed files with 36 additions and 26 deletions

View file

@ -14,7 +14,7 @@
static BOOL
SendTime(SOCKET sock, CHAR *time)
{
DWORD stringSize = strlen(time) + 1;
SIZE_T stringSize = strlen(time) + 1;
if (send(sock, time, stringSize, 0) == SOCKET_ERROR)
{
LogEvent(L"DayTime: Error sending data", WSAGetLastError(), 0, LOG_ERROR);

View file

@ -70,20 +70,20 @@ LogToFile(LPCWSTR lpMsg,
UINT flags)
{
LPWSTR lpFullMsg = NULL;
DWORD msgLen;
SIZE_T msgLen;
msgLen = wcslen(lpMsg) + 1;
if (flags & LOG_ERROR)
{
LPVOID lpSysMsg;
LPWSTR lpSysMsg;
DWORD eMsgLen;
eMsgLen = FormatMessageW(FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
NULL,
errNum,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
(LPTSTR)&lpSysMsg,
(LPWSTR)&lpSysMsg,
0,
NULL);
@ -122,6 +122,13 @@ LogToFile(LPCWSTR lpMsg,
}
}
/* Make sure the length in bytes doesn't overflow a DWORD */
msgLen = wcslen(lpFullMsg);
if (msgLen > (MAXDWORD / sizeof(WCHAR)))
{
RaiseException(EXCEPTION_INT_OVERFLOW, 0, 0, NULL);
}
if (lpFullMsg)
{
DWORD bytesWritten;
@ -130,7 +137,7 @@ LogToFile(LPCWSTR lpMsg,
bRet = WriteFile(hLogFile,
lpFullMsg,
wcslen(lpFullMsg) * sizeof(WCHAR),
(DWORD)msgLen * sizeof(WCHAR),
&bytesWritten,
&olWrite);
if (!bRet)

View file

@ -182,7 +182,7 @@ public:
virtual HRESULT STDMETHODCALLTYPE
InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
{
UINT uiCmdId = (UINT)lpici->lpVerb;
UINT uiCmdId = PtrToUlong(lpici->lpVerb);
if (uiCmdId != 0)
{
if ((uiCmdId >= ID_SHELL_CMD_FIRST) && (uiCmdId <= ID_SHELL_CMD_LAST))

View file

@ -3322,7 +3322,7 @@ public:
virtual HRESULT STDMETHODCALLTYPE
InvokeCommand(LPCMINVOKECOMMANDINFO lpici)
{
UINT uiCmdId = (UINT) lpici->lpVerb;
UINT uiCmdId = PtrToUlong(lpici->lpVerb);
if (uiCmdId != 0)
{
if (uiCmdId >= m_idCmdCmFirst)

View file

@ -1536,9 +1536,9 @@ SmpInitializeKnownDllsInternal(IN PUNICODE_STRING Directory,
/* Checksum failed, so don't even try going further -- kill SMSS */
RtlInitUnicodeString(&ErrorResponse,
L"Verification of a KnownDLL failed.");
ErrorParameters[0] = (ULONG)&ErrorResponse;
ErrorParameters[0] = (ULONG_PTR)&ErrorResponse;
ErrorParameters[1] = Status;
ErrorParameters[2] = (ULONG)&RegEntry->Value;
ErrorParameters[2] = (ULONG_PTR)&RegEntry->Value;
SmpTerminate(ErrorParameters, 5, RTL_NUMBER_OF(ErrorParameters));
}
else if (!(ImageCharacteristics & IMAGE_FILE_DLL))
@ -1546,9 +1546,9 @@ SmpInitializeKnownDllsInternal(IN PUNICODE_STRING Directory,
/* An invalid known DLL entry will also kill SMSS */
RtlInitUnicodeString(&ErrorResponse,
L"Non-DLL file included in KnownDLL list.");
ErrorParameters[0] = (ULONG)&ErrorResponse;
ErrorParameters[0] = (ULONG_PTR)&ErrorResponse;
ErrorParameters[1] = STATUS_INVALID_IMPORT_OF_NON_DLL;
ErrorParameters[2] = (ULONG)&RegEntry->Value;
ErrorParameters[2] = (ULONG_PTR)&RegEntry->Value;
SmpTerminate(ErrorParameters, 5, RTL_NUMBER_OF(ErrorParameters));
}

View file

@ -152,8 +152,8 @@ HalpInitDma(VOID)
* Check if Extended DMA is available. We're just going to do a random
* read and write.
*/
WRITE_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2), 0x2A);
if (READ_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2)) == 0x2A)
WRITE_PORT_UCHAR(UlongToPtr(FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2)), 0x2A);
if (READ_PORT_UCHAR(UlongToPtr(FIELD_OFFSET(EISA_CONTROL, DmaController2Pages.Channel2))) == 0x2A)
{
DPRINT1("Machine supports EISA DMA. Bus type: %lu\n", HalpBusType);
HalpEisaDma = TRUE;
@ -479,11 +479,11 @@ HalpDmaInitializeEisaAdapter(IN PADAPTER_OBJECT AdapterObject,
if (Controller == 1)
{
AdapterBaseVa = (PVOID)FIELD_OFFSET(EISA_CONTROL, DmaController1);
AdapterBaseVa = UlongToPtr(FIELD_OFFSET(EISA_CONTROL, DmaController1));
}
else
{
AdapterBaseVa = (PVOID)FIELD_OFFSET(EISA_CONTROL, DmaController2);
AdapterBaseVa = UlongToPtr(FIELD_OFFSET(EISA_CONTROL, DmaController2));
}
AdapterObject->AdapterNumber = Controller;
@ -517,12 +517,12 @@ HalpDmaInitializeEisaAdapter(IN PADAPTER_OBJECT AdapterObject,
if (Controller == 1)
{
WRITE_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaExtendedMode1),
WRITE_PORT_UCHAR(UlongToPtr(FIELD_OFFSET(EISA_CONTROL, DmaExtendedMode1)),
ExtendedMode.Byte);
}
else
{
WRITE_PORT_UCHAR((PUCHAR)FIELD_OFFSET(EISA_CONTROL, DmaExtendedMode2),
WRITE_PORT_UCHAR(UlongToPtr(FIELD_OFFSET(EISA_CONTROL, DmaExtendedMode2)),
ExtendedMode.Byte);
}
}

View file

@ -231,12 +231,12 @@ HvpInitializeMemoryHive(
SIZE_T ChunkSize;
ChunkSize = ChunkBase->Length;
DPRINT("ChunkSize: %lx\n", ChunkSize);
DPRINT("ChunkSize: %zx\n", ChunkSize);
if (ChunkSize < sizeof(HBASE_BLOCK) ||
!HvpVerifyHiveHeader(ChunkBase))
{
DPRINT1("Registry is corrupt: ChunkSize %lu < sizeof(HBASE_BLOCK) %lu, "
DPRINT1("Registry is corrupt: ChunkSize 0x%zx < sizeof(HBASE_BLOCK) 0x%zx, "
"or HvpVerifyHiveHeader() failed\n", ChunkSize, sizeof(HBASE_BLOCK));
return STATUS_REGISTRY_CORRUPT;
}

View file

@ -166,9 +166,12 @@ KeBugCheckEx(
IN ULONG_PTR BugCheckParameter4)
{
char Buffer[70];
printf("*** STOP: 0x%08X (0x%08lX, 0x%08lX, 0x%08lX, 0x%08lX)",
BugCheckCode, BugCheckParameter1, BugCheckParameter2,
BugCheckParameter3, BugCheckParameter4);
printf("*** STOP: 0x%08X (0x%p,0x%p,0x%p,0x%p)",
BugCheckCode,
(PVOID)BugCheckParameter1,
(PVOID)BugCheckParameter2,
(PVOID)BugCheckParameter3,
(PVOID)BugCheckParameter4);
ASSERT(FALSE);
}

View file

@ -338,7 +338,7 @@ CsrSrvCreateSharedSection(IN PCHAR ParameterValue)
ULONG Size;
NTSTATUS Status;
LARGE_INTEGER SectionSize;
ULONG ViewSize = 0;
SIZE_T ViewSize = 0;
PPEB Peb = NtCurrentPeb();
/* If there's no parameter, fail */
@ -457,7 +457,7 @@ CsrSrvAttachSharedSection(IN PCSR_PROCESS CsrProcess OPTIONAL,
OUT PCSR_API_CONNECTINFO ConnectInfo)
{
NTSTATUS Status;
ULONG ViewSize = 0;
SIZE_T ViewSize = 0;
/* Check if we have a process */
if (CsrProcess)

View file

@ -456,7 +456,7 @@ DEVMODEW *pdm)
cOutputModes--;
pdm = (LPDEVMODEW) ( ((ULONG)pdm) + sizeof(DEVMODEW) +
pdm = (LPDEVMODEW) ( ((ULONG_PTR)pdm) + sizeof(DEVMODEW) +
DRIVER_EXTRA_SIZE);
cbOutputSize += (sizeof(DEVMODEW) + DRIVER_EXTRA_SIZE);

View file

@ -125,7 +125,7 @@ VmxFindAdapter(IN PVOID HwDeviceExtension,
}
/* Zero the frame buffer */
VideoPortZeroMemory((PVOID)DeviceExtension->FrameBuffer.LowPart,
VideoPortZeroMemory((PVOID)(ULONG_PTR)DeviceExtension->FrameBuffer.QuadPart,
DeviceExtension->VramSize.LowPart);
/* Initialize the video modes */