Andrew Talbot wrote:
Changelog: shell32: Write-strings warning fix.
diff -urN a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c --- a/dlls/shell32/shlview.c 2006-05-23 17:24:50.000000000 +0100 +++ b/dlls/shell32/shlview.c 2006-06-07 19:37:41.000000000 +0100 @@ -779,7 +779,9 @@ */
static void ShellView_MergeViewMenu(IShellViewImpl * This, HMENU hSubMenu) -{ MENUITEMINFOA mii; +{
MENUITEMINFOA mii;
static CHAR mii_type_data[] = "View";
TRACE("(%p)->(submenu=%p)\n",This,hSubMenu);
@@ -791,7 +793,7 @@ mii.cbSize = sizeof(mii); mii.fMask = MIIM_SUBMENU | MIIM_TYPE | MIIM_DATA; mii.fType = MFT_STRING;
mii.dwTypeData = "View";
mii.hSubMenu = LoadMenuA(shell32_hInstance, "MENU_001"); InsertMenuItemA(hSubMenu, FCIDM_MENU_VIEW_SEP_OPTIONS, FALSE, &mii); }mii.dwTypeData = mii_type_data;
Sorry, this is wrong. If InsertMenuItemA writes to the string then it will be corrupted and will display the wrong thing for further uses in the process. It is therefore better to cast it from a "const char *" into a "char *" or to make it a non-static array at the top of the function.
I think the first choice of keeping it a "const char *" is the best choice in this case.