diff --git a/base/applications/atactl/atactl.cpp b/base/applications/atactl/atactl.cpp index a315cac10d0..3eac17a1e9a 100644 --- a/base/applications/atactl/atactl.cpp +++ b/base/applications/atactl/atactl.cpp @@ -445,7 +445,7 @@ ata_str_to_mode( ) { int mode; - int len; + size_t len; if(!_stricmp(str, "SATA600")) return ATA_SA600; @@ -1688,7 +1688,8 @@ main ( ) { //ULONG Flags = 0; - int i, j; + int i; + uintptr_t j; char a; int bus_id = -1; int dev_id = -1; diff --git a/base/applications/notepad/dialog.c b/base/applications/notepad/dialog.c index a07a71d3f77..d3b5deeea8a 100644 --- a/base/applications/notepad/dialog.c +++ b/base/applications/notepad/dialog.c @@ -1095,7 +1095,7 @@ DIALOG_GoTo_DialogProc(HWND hwndDialog, UINT uMsg, WPARAM wParam, LPARAM lParam) switch(uMsg) { case WM_INITDIALOG: hTextBox = GetDlgItem(hwndDialog, ID_LINENUMBER); - _sntprintf(szText, ARRAY_SIZE(szText), _T("%ld"), lParam); + _sntprintf(szText, ARRAY_SIZE(szText), _T("%Id"), lParam); SetWindowText(hTextBox, szText); break; case WM_COMMAND: diff --git a/base/applications/notepad/main.h b/base/applications/notepad/main.h index a84162fbc05..65a8782f909 100644 --- a/base/applications/notepad/main.h +++ b/base/applications/notepad/main.h @@ -42,10 +42,6 @@ typedef enum ENCODING_UTF16BE = 2, ENCODING_UTF8 = 3 } ENCODING; -// #define ENCODING_ANSI 0 -#define ENCODING_UNICODE 1 -#define ENCODING_UNICODE_BE 2 -// #define ENCODING_UTF8 3 // #define MIN_ENCODING 0 // #define MAX_ENCODING 3 diff --git a/base/applications/notepad/text.c b/base/applications/notepad/text.c index 2c6ee8cd070..6e26a7ab474 100644 --- a/base/applications/notepad/text.c +++ b/base/applications/notepad/text.c @@ -85,12 +85,12 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, ENCODING *pencFile, /* Look for Byte Order Marks */ if ((dwSize >= 2) && (pBytes[0] == 0xFF) && (pBytes[1] == 0xFE)) { - encFile = ENCODING_UNICODE; + encFile = ENCODING_UTF16LE; dwPos += 2; } else if ((dwSize >= 2) && (pBytes[0] == 0xFE) && (pBytes[1] == 0xFF)) { - encFile = ENCODING_UNICODE_BE; + encFile = ENCODING_UTF16BE; dwPos += 2; } else if ((dwSize >= 3) && (pBytes[0] == 0xEF) && (pBytes[1] == 0xBB) && (pBytes[2] == 0xBF)) @@ -101,7 +101,7 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, ENCODING *pencFile, switch(encFile) { - case ENCODING_UNICODE_BE: + case ENCODING_UTF16BE: for (i = dwPos; i < dwSize-1; i += 2) { b = pBytes[i+0]; @@ -110,7 +110,7 @@ ReadText(HANDLE hFile, LPWSTR *ppszText, DWORD *pdwTextLen, ENCODING *pencFile, } /* fall through */ - case ENCODING_UNICODE: + case ENCODING_UTF16LE: pszText = (LPWSTR) &pBytes[dwPos]; dwCharCount = (dwSize - dwPos) / sizeof(WCHAR); break; @@ -239,13 +239,13 @@ static BOOL WriteEncodedText(HANDLE hFile, LPCWSTR pszText, DWORD dwTextLen, ENC { switch(encFile) { - case ENCODING_UNICODE: + case ENCODING_UTF16LE: pBytes = (LPBYTE) &pszText[dwPos]; dwByteCount = (dwTextLen - dwPos) * sizeof(WCHAR); dwPos = dwTextLen; break; - case ENCODING_UNICODE_BE: + case ENCODING_UTF16BE: dwByteCount = (dwTextLen - dwPos) * sizeof(WCHAR); if (dwByteCount > sizeof(buffer)) dwByteCount = sizeof(buffer); diff --git a/boot/freeldr/freeldr/include/arch/amd64/amd64.h b/boot/freeldr/freeldr/include/arch/amd64/amd64.h index 482015777b0..8a5ccddecca 100644 --- a/boot/freeldr/freeldr/include/arch/amd64/amd64.h +++ b/boot/freeldr/freeldr/include/arch/amd64/amd64.h @@ -31,10 +31,10 @@ #define PtrToPfn(p) \ ((((ULONGLONG)p) >> PAGE_SHIFT) & 0xfffffffULL) -#define VAtoPXI(va) ((((ULONG64)va) >> PXI_SHIFT) & 0x1FF) -#define VAtoPPI(va) ((((ULONG64)va) >> PPI_SHIFT) & 0x1FF) -#define VAtoPDI(va) ((((ULONG64)va) >> PDI_SHIFT) & 0x1FF) -#define VAtoPTI(va) ((((ULONG64)va) >> PTI_SHIFT) & 0x1FF) +#define VAtoPXI(va) ((((ULONG64)(va)) >> PXI_SHIFT) & 0x1FF) +#define VAtoPPI(va) ((((ULONG64)(va)) >> PPI_SHIFT) & 0x1FF) +#define VAtoPDI(va) ((((ULONG64)(va)) >> PDI_SHIFT) & 0x1FF) +#define VAtoPTI(va) ((((ULONG64)(va)) >> PTI_SHIFT) & 0x1FF) #ifndef ASM diff --git a/dll/shellext/stobject/volume.cpp b/dll/shellext/stobject/volume.cpp index 931cd2e2ae3..c30df9cae05 100644 --- a/dll/shellext/stobject/volume.cpp +++ b/dll/shellext/stobject/volume.cpp @@ -32,7 +32,7 @@ static HRESULT __stdcall Volume_FindMixerControl(CSysTray * pSysTray) TRACE("Volume_FindDefaultMixerID\n"); - result = waveOutMessage((HWAVEOUT)WAVE_MAPPER, DRVM_MAPPER_PREFERRED_GET, (DWORD_PTR)&waveOutId, (DWORD_PTR)¶m2); + result = waveOutMessage((HWAVEOUT)UlongToHandle(WAVE_MAPPER), DRVM_MAPPER_PREFERRED_GET, (DWORD_PTR)&waveOutId, (DWORD_PTR)¶m2); if (result) return E_FAIL; @@ -46,7 +46,7 @@ static HRESULT __stdcall Volume_FindMixerControl(CSysTray * pSysTray) { TRACE("waveOut default device is %d\n", waveOutId); - result = mixerGetID((HMIXEROBJ)waveOutId, &mixerId, MIXER_OBJECTF_WAVEOUT); + result = mixerGetID((HMIXEROBJ)UlongToHandle(waveOutId), &mixerId, MIXER_OBJECTF_WAVEOUT); if (result) return E_FAIL; @@ -77,7 +77,7 @@ static HRESULT __stdcall Volume_FindMixerControl(CSysTray * pSysTray) { mixerLine.cbStruct = sizeof(mixerLine); mixerLine.dwDestination = idx; - if (!mixerGetLineInfoW((HMIXEROBJ)g_mixerId, &mixerLine, 0)) + if (!mixerGetLineInfoW((HMIXEROBJ)UlongToHandle(g_mixerId), &mixerLine, 0)) { if (mixerLine.dwComponentType >= MIXERLINE_COMPONENTTYPE_DST_SPEAKERS && mixerLine.dwComponentType <= MIXERLINE_COMPONENTTYPE_DST_HEADPHONES) @@ -100,7 +100,7 @@ static HRESULT __stdcall Volume_FindMixerControl(CSysTray * pSysTray) mixerLineControls.pamxctrl = &mixerControl; mixerLineControls.cbmxctrl = sizeof(mixerControl); - if (mixerGetLineControlsW((HMIXEROBJ)g_mixerId, &mixerLineControls, MIXER_GETLINECONTROLSF_ONEBYTYPE)) + if (mixerGetLineControlsW((HMIXEROBJ)UlongToHandle(g_mixerId), &mixerLineControls, MIXER_GETLINECONTROLSF_ONEBYTYPE)) return E_FAIL; TRACE("Found control id %d for mute: %d\n", mixerControl.dwControlID); diff --git a/dll/win32/kernel32/client/file/rw.c b/dll/win32/kernel32/client/file/rw.c index da41eed5970..0c6905723e0 100644 --- a/dll/win32/kernel32/client/file/rw.c +++ b/dll/win32/kernel32/client/file/rw.c @@ -24,7 +24,7 @@ BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, - OUT LPDWORD lpNumberOfBytesWritten OPTIONAL, + OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL) { NTSTATUS Status; diff --git a/dll/win32/shell32/dialogs/view.cpp b/dll/win32/shell32/dialogs/view.cpp index 264ef5f8729..648915a0441 100644 --- a/dll/win32/shell32/dialogs/view.cpp +++ b/dll/win32/shell32/dialogs/view.cpp @@ -342,10 +342,10 @@ ViewTree_LoadTree(HKEY hKey, LPCWSTR pszKeyName, DWORD dwParentID) else { // HKeyRoot - Value = DWORD(HKEY_CURRENT_USER); - Size = sizeof(Value); - RegQueryValueExW(hKey, L"HKeyRoot", NULL, NULL, LPBYTE(&Value), &Size); - pEntry->hkeyRoot = HKEY(Value); + HKEY HKeyRoot = HKEY_CURRENT_USER; + Size = sizeof(HKeyRoot); + RegQueryValueExW(hKey, L"HKeyRoot", NULL, NULL, LPBYTE(&HKeyRoot), &Size); + pEntry->hkeyRoot = HKeyRoot; // RegPath pEntry->szRegPath[0] = 0; @@ -782,7 +782,7 @@ ViewDlg_RestoreDefaults(HWND hwndDlg) continue; } RegSetValueExW(hKey, pEntry->szValueName, 0, REG_DWORD, - LPBYTE(pEntry->dwDefaultValue), sizeof(DWORD)); + LPBYTE(&pEntry->dwDefaultValue), sizeof(DWORD)); RegCloseKey(hKey); // update check status diff --git a/dll/win32/ws2_32/src/rnr.c b/dll/win32/ws2_32/src/rnr.c index 34e8619df34..43ebea276cd 100644 --- a/dll/win32/ws2_32/src/rnr.c +++ b/dll/win32/ws2_32/src/rnr.c @@ -248,7 +248,7 @@ WSALookupServiceBeginA(IN LPWSAQUERYSETA lpqsRestrictions, { INT ErrorCode; LPWSAQUERYSETW UnicodeQuerySet = NULL; - DWORD UnicodeQuerySetSize = 0; + SIZE_T UnicodeQuerySetSize = 0; DPRINT("WSALookupServiceBeginA: %p\n", lpqsRestrictions); @@ -523,12 +523,25 @@ WSALookupServiceNextA(IN HANDLE hLookup, if (ErrorCode == ERROR_SUCCESS) { + SIZE_T SetSize = *lpdwBufferLength; + /* Now convert back to ANSI */ ErrorCode = MapUnicodeQuerySetToAnsi(UnicodeQuerySet, - lpdwBufferLength, + &SetSize, lpqsResults); if (ErrorCode != ERROR_SUCCESS) + { SetLastError(ErrorCode); + } + else if (SetSize > MAXDWORD) + { + ErrorCode = ERROR_ARITHMETIC_OVERFLOW; + SetLastError(ErrorCode); + } + else + { + *lpdwBufferLength = SetSize; + } } else { diff --git a/ntoskrnl/include/internal/ntoskrnl.h b/ntoskrnl/include/internal/ntoskrnl.h index c16a4b5ad2e..d0dfe4dbde1 100644 --- a/ntoskrnl/include/internal/ntoskrnl.h +++ b/ntoskrnl/include/internal/ntoskrnl.h @@ -136,7 +136,7 @@ typedef struct _INFORMATION_CLASS_INFO #endif -#ifdef _M_IX86 +#ifndef _WIN64 C_ASSERT(FIELD_OFFSET(KUSER_SHARED_DATA, SystemCall) == 0x300); C_ASSERT(FIELD_OFFSET(KTHREAD, InitialStack) == KTHREAD_INITIAL_STACK); diff --git a/sdk/include/psdk/windef.h b/sdk/include/psdk/windef.h index a456269b554..bd0278a2181 100644 --- a/sdk/include/psdk/windef.h +++ b/sdk/include/psdk/windef.h @@ -244,15 +244,10 @@ typedef HANDLE HGLOBAL; typedef HANDLE HLOCAL; typedef HANDLE GLOBALHANDLE; typedef HANDLE LOCALHANDLE; -#ifdef _WIN64 + typedef INT_PTR (WINAPI *FARPROC)(); typedef INT_PTR (WINAPI *NEARPROC)(); typedef INT_PTR (WINAPI *PROC)(); -#else -typedef int (WINAPI *FARPROC)(); -typedef int (WINAPI *NEARPROC)(); -typedef int (WINAPI *PROC)(); -#endif typedef void *HGDIOBJ; diff --git a/sdk/include/reactos/libs/fast486/fast486.h b/sdk/include/reactos/libs/fast486/fast486.h index 5f7e3ce1c44..db1cc7a1e09 100644 --- a/sdk/include/reactos/libs/fast486/fast486.h +++ b/sdk/include/reactos/libs/fast486/fast486.h @@ -113,7 +113,7 @@ * (by reading outside of the prefetch buffer). The prefetch cache must * also not cross a page boundary. */ -C_ASSERT((FAST486_CACHE_SIZE >= sizeof(DWORD)) +C_ASSERT((FAST486_CACHE_SIZE >= sizeof(ULONG)) && (FAST486_CACHE_SIZE <= FAST486_PAGE_SIZE)); struct _FAST486_STATE; diff --git a/sdk/lib/crt/stdlib/qsort.c b/sdk/lib/crt/stdlib/qsort.c index d6bca5f06cb..ed3d95acee5 100644 --- a/sdk/lib/crt/stdlib/qsort.c +++ b/sdk/lib/crt/stdlib/qsort.c @@ -30,6 +30,8 @@ #include #include +#define long intptr_t + #define min(a, b) (a) < (b) ? (a) : (b) /* @@ -50,7 +52,7 @@ es % sizeof(long) ? 2 : es == sizeof(long)? 0 : 1; static __inline void -swapfunc(char *a, char *b, int n, int swaptype) +swapfunc(char *a, char *b, intptr_t n, int swaptype) { if(swaptype <= 1) swapcode(long, a, b, n) @@ -91,7 +93,8 @@ __cdecl qsort(void *a, size_t n, size_t es, int (__cdecl *cmp)(const void*, const void*)) { char *pa, *pb, *pc, *pd, *pl, *pm, *pn; - int d, r, swaptype, swap_cnt; + int swaptype, swap_cnt; + intptr_t d, r; loop: SWAPINIT(a, es); swap_cnt = 0; diff --git a/sdk/lib/fast486/fast486.c b/sdk/lib/fast486/fast486.c index 8505bccbfb6..4ee2103a6a1 100644 --- a/sdk/lib/fast486/fast486.c +++ b/sdk/lib/fast486/fast486.c @@ -38,7 +38,7 @@ FASTCALL Fast486MemReadCallback(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size) { UNREFERENCED_PARAMETER(State); - RtlMoveMemory(Buffer, (PVOID)Address, Size); + RtlMoveMemory(Buffer, UlongToPtr(Address), Size); } static VOID @@ -46,7 +46,7 @@ FASTCALL Fast486MemWriteCallback(PFAST486_STATE State, ULONG Address, PVOID Buffer, ULONG Size) { UNREFERENCED_PARAMETER(State); - RtlMoveMemory((PVOID)Address, Buffer, Size); + RtlMoveMemory(UlongToPtr(Address), Buffer, Size); } static VOID diff --git a/win32ss/drivers/videoprt/int10.c b/win32ss/drivers/videoprt/int10.c index 0893db7ace1..b8eebfa49e8 100644 --- a/win32ss/drivers/videoprt/int10.c +++ b/win32ss/drivers/videoprt/int10.c @@ -40,7 +40,9 @@ IntInitializeVideoAddressSpace(VOID) PVOID BaseAddress; LARGE_INTEGER Offset; SIZE_T ViewSize; +#ifdef _M_IX86 CHAR IVTAndBda[1024+256]; +#endif // _M_IX86 /* Free the 1MB pre-reserved region. In reality, ReactOS should simply support us mapping the view into the reserved area, but it doesn't. */ BaseAddress = 0; @@ -124,6 +126,7 @@ IntInitializeVideoAddressSpace(VOID) return 0; } +#ifdef _M_IX86 /* Get the real mode IVT and BDA from the kernel */ Status = NtVdmControl(VdmInitialize, IVTAndBda); if (!NT_SUCCESS(Status)) @@ -131,6 +134,7 @@ IntInitializeVideoAddressSpace(VOID) DPRINT1("NtVdmControl failed (status %x)\n", Status); return Status; } +#endif // _M_IX86 /* Return success */ return STATUS_SUCCESS; diff --git a/win32ss/gdi/ntgdi/gdidbg.c b/win32ss/gdi/ntgdi/gdidbg.c index 27297fb0eca..b75bb01c986 100644 --- a/win32ss/gdi/ntgdi/gdidbg.c +++ b/win32ss/gdi/ntgdi/gdidbg.c @@ -365,7 +365,7 @@ DbgGdiHTIntegrityCheck(VOID) pEntry = &GdiHandleTable->Entries[i]; Type = pEntry->Type; - Handle = (HGDIOBJ)(((ULONG_PTR)Type << GDI_ENTRY_UPPER_SHIFT) + i); + Handle = (HGDIOBJ)(ULONG_PTR)((Type << GDI_ENTRY_UPPER_SHIFT) + i); if (Type & GDI_ENTRY_BASETYPE_MASK) {