diff --git a/reactos/cmake/msvc.cmake b/reactos/cmake/msvc.cmake index 4bd9b985f7a..e6a0b0d57ed 100644 --- a/reactos/cmake/msvc.cmake +++ b/reactos/cmake/msvc.cmake @@ -21,6 +21,9 @@ add_definitions(/Dinline=__inline /D__STDC__=1) add_compile_flags("/X /GR- /GS- /Zl /W3") +# C4700 is almost always likely to result in broken code, so mark it as an error +add_compile_flags("/we4700") + # Debugging if(${CMAKE_BUILD_TYPE} MATCHES Debug) if(NOT _PREFAST_) diff --git a/reactos/dll/ntdll/ldr/ldrutils.c b/reactos/dll/ntdll/ldr/ldrutils.c index 4bc12c0705a..e553e5fe672 100644 --- a/reactos/dll/ntdll/ldr/ldrutils.c +++ b/reactos/dll/ntdll/ldr/ldrutils.c @@ -1860,7 +1860,9 @@ LdrpSearchPath(IN PWCHAR *SearchPath, /* Sanity check */ TestName.Length = (USHORT)ALIGN_DOWN((BufEnd - Buffer), WCHAR); +#if 0 ASSERT(TestName.Length < TestName.MaximumLength); +#endif /* Check if the file exists */ #if 0 diff --git a/reactos/dll/win32/browseui/bandsite.cpp b/reactos/dll/win32/browseui/bandsite.cpp index aa80e1796f7..15293a84200 100644 --- a/reactos/dll/win32/browseui/bandsite.cpp +++ b/reactos/dll/win32/browseui/bandsite.cpp @@ -409,6 +409,7 @@ HRESULT STDMETHODCALLTYPE CBandSiteBase::AddBand(IUnknown *punk) WARN("IBandSite::AddBand(): Call to IDeskBand::SetSite() failed: %x\n", hRet); /* Remove the band from the ReBar control */ + BuildRebarBandInfo(NewBand, &rbi); uBand = (UINT)SendMessageW(fRebarWindow, RB_IDTOINDEX, (WPARAM)rbi.wID, 0); if (uBand != (UINT)-1) { diff --git a/reactos/drivers/bus/pcix/pci/id.c b/reactos/drivers/bus/pcix/pci/id.c index 9db7d703fb0..205265d7802 100644 --- a/reactos/drivers/bus/pcix/pci/id.c +++ b/reactos/drivers/bus/pcix/pci/id.c @@ -51,7 +51,7 @@ PciGetDescriptionMessage(IN ULONG Identifier, /* Validate valid message length, ending with a newline character */ ASSERT(TextLength > 1); - ASSERT(Description[TextLength / sizeof(WCHAR) == L'\n']); + ASSERT(Description[TextLength / sizeof(WCHAR)] == L'\n'); /* Allocate the buffer to hold the message string */ Buffer = ExAllocatePoolWithTag(PagedPool, TextLength, 'BicP'); @@ -61,8 +61,8 @@ PciGetDescriptionMessage(IN ULONG Identifier, RtlCopyMemory(Buffer, Entry->Text, TextLength - 1); Buffer[TextLength / sizeof(WCHAR)] = UNICODE_NULL; - /* Return the length to the caller */ - if (Length) *Length = UnicodeString.Length; + /* Return the length to the caller, minus the terminating NULL */ + if (Length) *Length = TextLength - 1; } else { diff --git a/reactos/include/ddk/ndis.h b/reactos/include/ddk/ndis.h index ba7fa0d30f5..bacae3a3f4b 100644 --- a/reactos/include/ddk/ndis.h +++ b/reactos/include/ddk/ndis.h @@ -3101,19 +3101,19 @@ NdisGetFirstBufferFromPacket( #define NdisChainBufferAtBack(Packet, \ Buffer) \ { \ - PNDIS_BUFFER NdisBuffer = (Buffer); \ + PNDIS_BUFFER _NdisBuffer = (Buffer); \ \ - while (NdisBuffer->Next != NULL) \ - NdisBuffer = NdisBuffer->Next; \ + while (_NdisBuffer->Next != NULL) \ + _NdisBuffer = _NdisBuffer->Next; \ \ - NdisBuffer->Next = NULL; \ + _NdisBuffer->Next = NULL; \ \ if ((Packet)->Private.Head != NULL) \ (Packet)->Private.Tail->Next = (Buffer); \ else \ (Packet)->Private.Head = (Buffer); \ \ - (Packet)->Private.Tail = NdisBuffer; \ + (Packet)->Private.Tail = _NdisBuffer; \ (Packet)->Private.ValidCounts = FALSE; \ } diff --git a/reactos/subsystems/win32/win32k/ntuser/winpos.c b/reactos/subsystems/win32/win32k/ntuser/winpos.c index 32b811faff3..1cb43ba0ced 100644 --- a/reactos/subsystems/win32/win32k/ntuser/winpos.c +++ b/reactos/subsystems/win32/win32k/ntuser/winpos.c @@ -134,7 +134,7 @@ WinPosShowIconTitle( PWND pWnd, BOOL bShow ) { HICON hIcon; if (!pWnd->pcls || pWnd->fnid == FNID_DESKTOP) return FALSE; - if (!hIcon) hIcon = pWnd->pcls->hIconSm; + hIcon = pWnd->pcls->hIconSm; if (!hIcon) hIcon = pWnd->pcls->hIcon; if (!hIcon) return FALSE;