Author: fireball
Date: Sun Jun 29 04:39:06 2008
New Revision: 34180
URL: http://svn.reactos.org/svn/reactos?rev=34180&view=rev
Log:
- Revert 22081 by Magnus Olsen:
"fixing two hiden bug in reactos, null termante the string right at end, code tested in vs, but it seam no affact on wine test mscvrt printf test. What hell is the snprintf function call to ??".
Instead of fixing "hidden bugs", it introduced a real very well hidden bug, which was overwriting the target buffer and thus corrupting everything starting from the heap, and ending with pools. It's possible to install and run OO2 Writer now.
See issue #3311 for more details.
Modified:
trunk/reactos/lib/rtl/sprintf.c
trunk/reactos/lib/rtl/swprintf.c
Modified: trunk/reactos/lib/rtl/sprintf.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/sprintf.c?rev=3418…
==============================================================================
--- trunk/reactos/lib/rtl/sprintf.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/sprintf.c [iso-8859-1] Sun Jun 29 04:39:06 2008
@@ -691,20 +691,8 @@
if (str <= end)
*str = '\0';
else if (cnt > 0)
- {
/* don't write out a null byte if the buf size is zero */
- //*end = '\0';
- if (str-buf >cnt )
- {
- *end = '\0';
- }
- else
- {
- end++;
- *end = '\0';
- }
-
- }
+ *end = '\0';
return str-buf;
}
Modified: trunk/reactos/lib/rtl/swprintf.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/lib/rtl/swprintf.c?rev=341…
==============================================================================
--- trunk/reactos/lib/rtl/swprintf.c [iso-8859-1] (original)
+++ trunk/reactos/lib/rtl/swprintf.c [iso-8859-1] Sun Jun 29 04:39:06 2008
@@ -689,21 +689,9 @@
}
if (str <= end)
*str = L'\0';
- else if (cnt > 0)
- {
+ else if (cnt > 0)
/* don't write out a null byte if the buf size is zero */
- //*end = '\0';
- if (str-buf >cnt )
- {
- *end = L'\0';
- }
- else
- {
- end++;
- *end = L'\0';
- }
-
- }
+ *end = L'\0';
return str-buf;
}
Author: hpoussin
Date: Sun Jun 29 04:32:30 2008
New Revision: 34179
URL: http://svn.reactos.org/svn/reactos?rev=34179&view=rev
Log:
Use __REACTOS__ define instead of _ROS_ one
Modified:
trunk/reactos/base/shell/explorer/explorer.rbuild
trunk/reactos/base/shell/explorer/shell/mainframe.cpp
trunk/reactos/base/shell/explorer/taskbar/desktopbar.cpp
trunk/reactos/base/shell/explorer/taskbar/desktopbar.h
trunk/reactos/base/shell/explorer/taskbar/startmenu.cpp
trunk/reactos/base/shell/explorer/taskbar/taskbar.cpp
trunk/reactos/base/shell/explorer/utility/utility.cpp
Modified: trunk/reactos/base/shell/explorer/explorer.rbuild
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/explor…
==============================================================================
--- trunk/reactos/base/shell/explorer/explorer.rbuild [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/explorer.rbuild [iso-8859-1] Sun Jun 29 04:32:30 2008
@@ -7,7 +7,6 @@
<include base="explorer">.</include>
<define name="UNICODE" />
<define name="WIN32" />
- <define name="_ROS_" />
<define name="_WIN32_IE">0x0600</define>
<define name="_WIN32_WINNT">0x0501</define>
<define name="WINVER">0x0500</define>
Modified: trunk/reactos/base/shell/explorer/shell/mainframe.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/shell/…
==============================================================================
--- trunk/reactos/base/shell/explorer/shell/mainframe.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/shell/mainframe.cpp [iso-8859-1] Sun Jun 29 04:32:30 2008
@@ -300,7 +300,7 @@
break;
case WM_SIZE: {
-#ifdef _ROS_ ///@todo Work around to display rebar in ROS (with flickering) as long as the control isn't fixed
+#ifdef __REACTOS__ ///@todo Work around to display rebar in ROS (with flickering) as long as the control isn't fixed
int height = SendMessage(_hwndrebar, RB_GETBARHEIGHT, 0, 0);
MoveWindow(_hwndrebar, 0, 0, LOWORD(lparam), height, TRUE);
#else
@@ -788,7 +788,7 @@
extraBtns.iBitmap = 8;
SendMessage(_hextrabar, TB_INSERTBUTTON, INT_MAX, (LPARAM)&extraBtns);
}
-#ifndef _ROS_ // don't insert reg button for ROS. Regedit should be used.
+#ifndef __REACTOS__ // don't insert reg button for ROS. Regedit should be used.
// insert Registry button
extraBtns.iString = SendMessage(_hextrabar, TB_ADDSTRING, 0, (LPARAM)TEXT("Reg.\0"));
extraBtns.idCommand = ID_DRIVE_REGISTRY;
Modified: trunk/reactos/base/shell/explorer/taskbar/desktopbar.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskba…
==============================================================================
--- trunk/reactos/base/shell/explorer/taskbar/desktopbar.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/taskbar/desktopbar.cpp [iso-8859-1] Sun Jun 29 04:32:30 2008
@@ -41,7 +41,7 @@
DesktopBar::DesktopBar(HWND hwnd)
: super(hwnd),
-#ifdef _ROS_
+#ifdef __REACTOS__
_trayIcon(hwnd, ID_TRAY_VOLUME)
#else
WM_TASKBARCREATED(RegisterWindowMessage(WINMSG_TASKBARCREATED))
@@ -436,7 +436,7 @@
PostMessage(_hwndQuickLaunch, PM_UPDATE_DESKTOP, desktop_idx, 0);
break;}
-#ifdef _ROS_
+#ifdef __REACTOS__
case ID_TRAY_VOLUME:
launch_file(_hwnd, TEXT("sndvol32.exe"), SW_SHOWNORMAL); // launch volume control application
break;
@@ -525,7 +525,7 @@
}
-#ifdef _ROS_
+#ifdef __REACTOS__
void DesktopBar::AddTrayIcons()
{
Modified: trunk/reactos/base/shell/explorer/taskbar/desktopbar.h
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskba…
==============================================================================
--- trunk/reactos/base/shell/explorer/taskbar/desktopbar.h [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/taskbar/desktopbar.h [iso-8859-1] Sun Jun 29 04:32:30 2008
@@ -66,14 +66,14 @@
/// desktop bar window, also known as "system tray"
struct DesktopBar : public
-#ifdef _ROS_
+#ifdef __REACTOS__
TrayIconControllerTemplate<
OwnerDrawParent<Window> >
#else
OwnerDrawParent<Window>
#endif
{
-#ifdef _ROS_
+#ifdef __REACTOS__
typedef TrayIconControllerTemplate<
OwnerDrawParent<Window> > super;
#else
@@ -110,7 +110,7 @@
struct StartMenuRoot* _startMenuRoot;
-#ifdef _ROS_
+#ifdef __REACTOS__
TrayIcon _trayIcon;
void AddTrayIcons();
Modified: trunk/reactos/base/shell/explorer/taskbar/startmenu.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskba…
==============================================================================
--- trunk/reactos/base/shell/explorer/taskbar/startmenu.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/taskbar/startmenu.cpp [iso-8859-1] Sun Jun 29 04:32:30 2008
@@ -1766,7 +1766,7 @@
#endif
AddButton(ResString(IDS_LOGOFF), ICID_LOGOFF, false, IDC_LOGOFF);
-#ifdef _ROS_
+#ifdef __REACTOS__
AddButton(ResString(IDS_RESTART), ICID_RESTART, false, IDC_RESTART);
#endif
@@ -1777,7 +1777,7 @@
#endif
AddButton(ResString(IDS_SHUTDOWN), ICID_SHUTDOWN, false, IDC_SHUTDOWN);
-#ifndef _ROS_
+#ifndef __REACTOS__
AddButton(ResString(IDS_TERMINATE), ICID_LOGOFF, false, IDC_TERMINATE);
#endif
@@ -1942,7 +1942,7 @@
ShowLogoffDialog(g_Globals._hwndDesktopBar);
break;
-#ifndef _ROS_
+#ifndef __REACTOS__
case IDC_TERMINATE:
DestroyWindow(GetParent(_hwnd));
break;
@@ -2032,7 +2032,7 @@
case IDC_CONNECTIONS:
#ifndef ROSSHELL
-#ifdef _ROS_ // to be removed when RAS will be implemented
+#ifdef __REACTOS__ // to be removed when RAS will be implemented
MessageBox(0, TEXT("RAS folder not yet implemented in SHELL32"), ResString(IDS_TITLE), MB_OK);
#else
CreateSubmenu(id, CSIDL_CONNECTIONS, ResString(IDS_CONNECTIONS));
@@ -2048,7 +2048,7 @@
// browse menu
case IDC_NETWORK:
-#ifdef _ROS_ ///@todo to be removed when network browsing will be implemented in shell namespace
+#ifdef __REACTOS__ ///@todo to be removed when network browsing will be implemented in shell namespace
MessageBox(0, TEXT("network not yet implemented"), ResString(IDS_TITLE), MB_OK);
#else
CreateSubmenu(id, CSIDL_NETWORK, ResString(IDS_NETWORK));
@@ -2089,7 +2089,7 @@
void StartMenuHandler::ShowSearchDialog()
{
-#ifndef _ROS_ ///@todo to be removed when SHFindFiles() will be implemented in shell32.dll
+#ifndef __REACTOS__ ///@todo to be removed when SHFindFiles() will be implemented in shell32.dll
static DynamicFct<SHFINDFILES> SHFindFiles(TEXT("SHELL32"), 90);
if (SHFindFiles)
@@ -2101,7 +2101,7 @@
void StartMenuHandler::ShowSearchComputer()
{
-#ifndef _ROS_ ///@todo to be removed when SHFindComputer() will be implemented in shell32.dll
+#ifndef __REACTOS__ ///@todo to be removed when SHFindComputer() will be implemented in shell32.dll
static DynamicFct<SHFINDCOMPUTER> SHFindComputer(TEXT("SHELL32"), 91);
if (SHFindComputer)
@@ -2160,7 +2160,7 @@
{
super::AddEntries();
-#if defined(ROSSHELL) || defined(_ROS_) // _ROS_ to be removed when printer/network will be implemented
+#if defined(ROSSHELL) || defined(__REACTOS__) // __REACTOS__ to be removed when printer/network will be implemented
//TODO AddButton(ResString(IDS_PRINTERS), ICID_PRINTER, false, IDC_PRINTERS_MENU);
AddButton(ResString(IDS_CONNECTIONS), ICID_NETWORK, false, IDC_CONNECTIONS);
#else
@@ -2191,7 +2191,7 @@
#ifndef __MINGW32__ // SHRestricted() missing in MinGW (as of 29.10.2003)
if (!g_Globals._SHRestricted || !SHRestricted(REST_NONETHOOD)) // or REST_NOENTIRENETWORK ?
#endif
-#if defined(ROSSHELL) || defined(_ROS_) // _ROS_ to be removed when printer/network will be implemented
+#if defined(ROSSHELL) || defined(__REACTOS__) // __REACTOS__ to be removed when printer/network will be implemented
AddButton(ResString(IDS_NETWORK), ICID_NETWORK, false, IDC_NETWORK);
#else
AddButton(ResString(IDS_NETWORK), ICID_NETWORK, true, IDC_NETWORK);
Modified: trunk/reactos/base/shell/explorer/taskbar/taskbar.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/taskba…
==============================================================================
--- trunk/reactos/base/shell/explorer/taskbar/taskbar.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/taskbar/taskbar.cpp [iso-8859-1] Sun Jun 29 04:32:30 2008
@@ -469,7 +469,7 @@
entry._fsState = btn.fsState;
-#ifdef _ROS_ // now handled by activating the ARW_HIDE flag with SystemParametersInfo(SPI_SETMINIMIZEDMETRICS)
+#ifdef __REACTOS__ // now handled by activating the ARW_HIDE flag with SystemParametersInfo(SPI_SETMINIMIZEDMETRICS)
// move minimized windows out of sight
if (IsIconic(hwnd)) {
RECT rect;
Modified: trunk/reactos/base/shell/explorer/utility/utility.cpp
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/base/shell/explorer/utilit…
==============================================================================
--- trunk/reactos/base/shell/explorer/utility/utility.cpp [iso-8859-1] (original)
+++ trunk/reactos/base/shell/explorer/utility/utility.cpp [iso-8859-1] Sun Jun 29 04:32:30 2008
@@ -260,7 +260,7 @@
switch(osvi.dwPlatformId) {
case VER_PLATFORM_WIN32_NT:
-#ifdef _ROS_ // This work around can be removed if ReactOS gets a unique version number.
+#ifdef __REACTOS__ // This work around can be removed if ReactOS gets a unique version number.
str = TEXT("ReactOS");
#else
if (osvi.dwMajorVersion <= 4)