[PATCH 7/8] [WinHlp32]: remove the lpszName field from the window structure, as it's given by the window info

Eric Pouech eric.pouech at orange.fr
Sat May 30 07:26:58 CDT 2009




A+
---

 programs/winhlp32/macro.c   |    6 +++---
 programs/winhlp32/winhelp.c |   13 ++++---------
 programs/winhlp32/winhelp.h |    2 --
 3 files changed, 7 insertions(+), 14 deletions(-)


diff --git a/programs/winhlp32/macro.c b/programs/winhlp32/macro.c
index 9a7f3fd..3383545 100644
--- a/programs/winhlp32/macro.c
+++ b/programs/winhlp32/macro.c
@@ -280,7 +280,7 @@ static void CALLBACK MACRO_CloseSecondarys(void)
 
     WINE_TRACE("()\n");
     for (win = Globals.win_list; win; win = win->next)
-        if (win->lpszName && lstrcmpi(win->lpszName, "main"))
+        if (lstrcmpi(win->info->name, "main"))
             DestroyWindow(win->hMainWnd);
 }
 
@@ -293,7 +293,7 @@ static void CALLBACK MACRO_CloseWindow(LPCSTR lpszWindow)
     if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
 
     for (win = Globals.win_list; win; win = win->next)
-        if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
+        if (!lstrcmpi(win->info->name, lpszWindow))
             DestroyWindow(win->hMainWnd);
 }
 
@@ -430,7 +430,7 @@ static void CALLBACK MACRO_FocusWindow(LPCSTR lpszWindow)
     if (!lpszWindow || !lpszWindow[0]) lpszWindow = "main";
 
     for (win = Globals.win_list; win; win = win->next)
-        if (win->lpszName && !lstrcmpi(win->lpszName, lpszWindow))
+        if (!lstrcmpi(win->info->name, lpszWindow))
             SetFocus(win->hMainWnd);
 }
 
diff --git a/programs/winhlp32/winhelp.c b/programs/winhlp32/winhelp.c
index e361335..8e6ba50 100644
--- a/programs/winhlp32/winhelp.c
+++ b/programs/winhlp32/winhelp.c
@@ -257,7 +257,7 @@ HLPFILE_WINDOWINFO*     WINHELP_GetWindowInfo(HLPFILE* hlpfile, LPCSTR name)
     unsigned int     i;
 
     if (!name || !name[0])
-        name = Globals.active_win->lpszName;
+        name = Globals.active_win->info->name;
 
     if (hlpfile)
         for (i = 0; i < hlpfile->numWindows; i++)
@@ -645,7 +645,6 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
 {
     WINHELP_WINDOW*     win = NULL;
     BOOL                bPrimary, bPopup, bReUsed = FALSE;
-    LPSTR               name;
     HICON               hIcon;
     HWND                hTextWnd = NULL;
 
@@ -656,7 +655,7 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
     {
         for (win = Globals.win_list; win; win = win->next)
         {
-            if (!lstrcmpi(win->lpszName, wpage->wininfo->name))
+            if (!lstrcmpi(win->info->name, wpage->wininfo->name))
             {
                 POINT   pt = {0, 0};
                 SIZE    sz = {0, 0};
@@ -699,15 +698,11 @@ BOOL WINHELP_CreateHelpWindow(WINHELP_WNDPAGE* wpage, int nCmdShow, BOOL remembe
     if (!win)
     {
         /* Initialize WINHELP_WINDOW struct */
-        win = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
-                        sizeof(WINHELP_WINDOW) + strlen(wpage->wininfo->name) + 1);
+        win = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINHELP_WINDOW));
         if (!win) return FALSE;
         win->next = Globals.win_list;
         Globals.win_list = win;
 
-        name = (char*)win + sizeof(WINHELP_WINDOW);
-        lstrcpy(name, wpage->wininfo->name);
-        win->lpszName = name;
         win->hHandCur = LoadCursorW(0, (LPWSTR)IDC_HAND);
         win->back.index = 0;
         win->font_scale = 1;
@@ -1496,7 +1491,7 @@ static LRESULT CALLBACK WINHELP_MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
         {
             BOOL bExit;
             win = (WINHELP_WINDOW*) GetWindowLongPtr(hWnd, 0);
-            bExit = (Globals.wVersion >= 4 && !lstrcmpi(win->lpszName, "main"));
+            bExit = (Globals.wVersion >= 4 && !lstrcmpi(win->info->name, "main"));
             WINHELP_DeleteWindow(win);
 
             if (bExit) MACRO_Exit();
diff --git a/programs/winhlp32/winhelp.h b/programs/winhlp32/winhelp.h
index 994547b..70e2dc2 100644
--- a/programs/winhlp32/winhelp.h
+++ b/programs/winhlp32/winhelp.h
@@ -71,8 +71,6 @@ typedef struct tagPageSet
 
 typedef struct tagWinHelp
 {
-    LPCSTR              lpszName;
-
     WINHELP_BUTTON*     first_button;
     HLPFILE_PAGE*       page;
 





More information about the wine-patches mailing list