From: Alex Henrie alexhenrie24@gmail.com
--- dlls/hhctrl.ocx/chm.c | 37 ++++++++++--------------------- dlls/hhctrl.ocx/help.c | 48 ++++++++++++---------------------------- dlls/hhctrl.ocx/hhctrl.c | 10 +++------ dlls/hhctrl.ocx/search.c | 3 +-- 4 files changed, 30 insertions(+), 68 deletions(-)
diff --git a/dlls/hhctrl.ocx/chm.c b/dlls/hhctrl.ocx/chm.c index 4be86bd165a..9a7095eb622 100644 --- a/dlls/hhctrl.ocx/chm.c +++ b/dlls/hhctrl.ocx/chm.c @@ -90,9 +90,7 @@ static BOOL ReadChmSystem(CHMInfo *chm) WORD len; } entry;
- static const WCHAR wszSYSTEM[] = {'#','S','Y','S','T','E','M',0}; - - hres = IStorage_OpenStream(chm->pStorage, wszSYSTEM, NULL, STGM_READ, 0, &stream); + hres = IStorage_OpenStream(chm->pStorage, L"#SYSTEM", NULL, STGM_READ, 0, &stream); if(FAILED(hres)) { WARN("Could not open #SYSTEM stream: %08lx\n", hres); return FALSE; @@ -190,9 +188,7 @@ LPWSTR FindContextAlias(CHMInfo *chm, DWORD index) LPCSTR ret = NULL; HRESULT hres;
- static const WCHAR wszIVB[] = {'#','I','V','B',0}; - - hres = IStorage_OpenStream(chm->pStorage, wszIVB, NULL, STGM_READ, 0, &ivb_stream); + hres = IStorage_OpenStream(chm->pStorage, L"#IVB", NULL, STGM_READ, 0, &ivb_stream); if(FAILED(hres)) { WARN("Could not open #IVB stream: %08lx\n", hres); return NULL; @@ -361,11 +357,6 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) DWORD cbRead; BOOL ret = FALSE;
- static const WCHAR empty[] = {0}; - static const WCHAR toc_extW[] = {'h','h','c',0}; - static const WCHAR index_extW[] = {'h','h','k',0}; - static const WCHAR windowsW[] = {'#','W','I','N','D','O','W','S',0}; - /* HH_WINTYPE as stored on disk. It's identical to HH_WINTYPE except that the pointer fields have been changed to DWORDs, so that the layout on 64-bit remains unchanged. */ struct file_wintype @@ -412,7 +403,7 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) wintype.cbStruct = sizeof(wintype); wintype.fUniCodeStrings = TRUE;
- hr = IStorage_OpenStream(pStorage, windowsW, NULL, STGM_READ, 0, &pStream); + hr = IStorage_OpenStream(pStorage, L"#WINDOWS", NULL, STGM_READ, 0, &pStream); if (SUCCEEDED(hr)) { /* jump past the #WINDOWS header */ @@ -457,10 +448,9 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) else { /* no defined window types so use (hopefully) sane defaults */ - static const WCHAR defaultwinW[] = {'d','e','f','a','u','l','t','w','i','n','\0'}; - wintype.pszType = wcsdup(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : defaultwinW); - wintype.pszToc = wcsdup(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : empty); - wintype.pszIndex = wcsdup(empty); + wintype.pszType = wcsdup(info->pCHMInfo->defWindow ? info->pCHMInfo->defWindow : L"defaultwin"); + wintype.pszToc = wcsdup(info->pCHMInfo->defToc ? info->pCHMInfo->defToc : L""); + wintype.pszIndex = wcsdup(L""); wintype.fsValidMembers = 0; wintype.fsWinProperties = HHWIN_PROP_TRI_PANE; wintype.dwStyles = WS_POPUP; @@ -472,13 +462,13 @@ BOOL LoadWinTypeFromCHM(HHInfo *info) /* merge the new data with any pre-existing HH_WINTYPE structure */ MergeChmProperties(&wintype, info, FALSE); if (!info->WinType.pszCaption) - info->WinType.pszCaption = info->stringsW.pszCaption = wcsdup(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : empty); + info->WinType.pszCaption = info->stringsW.pszCaption = wcsdup(info->pCHMInfo->defTitle ? info->pCHMInfo->defTitle : L""); if (!info->WinType.pszFile) - info->WinType.pszFile = info->stringsW.pszFile = wcsdup(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : empty); + info->WinType.pszFile = info->stringsW.pszFile = wcsdup(info->pCHMInfo->defTopic ? info->pCHMInfo->defTopic : L""); if (!info->WinType.pszToc) - info->WinType.pszToc = info->stringsW.pszToc = FindHTMLHelpSetting(info, toc_extW); + info->WinType.pszToc = info->stringsW.pszToc = FindHTMLHelpSetting(info, L"hhc"); if (!info->WinType.pszIndex) - info->WinType.pszIndex = info->stringsW.pszIndex = FindHTMLHelpSetting(info, index_extW); + info->WinType.pszIndex = info->stringsW.pszIndex = FindHTMLHelpSetting(info, L"hhk");
wintype_free(&wintype); ret = TRUE; @@ -509,11 +499,10 @@ LPCWSTR skip_schema(LPCWSTR url) void SetChmPath(ChmPath *file, LPCWSTR base_file, LPCWSTR path) { LPCWSTR ptr; - static const WCHAR separatorW[] = {':',':',0};
path = skip_schema(path);
- ptr = wcsstr(path, separatorW); + ptr = wcsstr(path, L"::"); if(ptr) { WCHAR chm_file[MAX_PATH]; WCHAR rel_path[MAX_PATH]; @@ -634,8 +623,6 @@ CHMInfo *OpenCHM(LPCWSTR szFile) HRESULT hres; CHMInfo *ret;
- static const WCHAR wszSTRINGS[] = {'#','S','T','R','I','N','G','S',0}; - if (!(ret = calloc(1, sizeof(CHMInfo)))) return NULL; ret->codePage = CP_ACP; @@ -658,7 +645,7 @@ CHMInfo *OpenCHM(LPCWSTR szFile) WARN("Could not open storage: %08lx\n", hres); return CloseCHM(ret); } - hres = IStorage_OpenStream(ret->pStorage, wszSTRINGS, NULL, STGM_READ, 0, + hres = IStorage_OpenStream(ret->pStorage, L"#STRINGS", NULL, STGM_READ, 0, &ret->strings_stream); if(FAILED(hres)) { WARN("Could not open #STRINGS stream: %08lx\n", hres); diff --git a/dlls/hhctrl.ocx/help.c b/dlls/hhctrl.ocx/help.c index 947787ceb7e..4e67cf4ecf3 100644 --- a/dlls/hhctrl.ocx/help.c +++ b/dlls/hhctrl.ocx/help.c @@ -233,10 +233,6 @@ BOOL NavigateToUrl(HHInfo *info, LPCWSTR surl)
static BOOL AppendFullPathURL(LPCWSTR file, LPWSTR buf, LPCWSTR index) { - static const WCHAR url_format[] = - {'m','k',':','@','M','S','I','T','S','t','o','r','e',':','%','s',':',':','%','s','%','s',0}; - static const WCHAR slash[] = {'/',0}; - static const WCHAR empty[] = {0}; WCHAR full_path[MAX_PATH];
TRACE("%s %p %s\n", debugstr_w(file), buf, debugstr_w(index)); @@ -246,7 +242,7 @@ static BOOL AppendFullPathURL(LPCWSTR file, LPWSTR buf, LPCWSTR index) return FALSE; }
- wsprintfW(buf, url_format, full_path, (!index || index[0] == '/') ? empty : slash, index); + wsprintfW(buf, L"mk:@MSITStore:%s::%s%s", full_path, (!index || index[0] == '/') ? L"" : L"/", index); return TRUE; }
@@ -285,10 +281,9 @@ static void DoSync(HHInfo *info)
if (lstrcmpiW(buf, url) > 0) { - static const WCHAR delimW[] = {':',':','/',0}; const WCHAR *index;
- index = wcsstr(url, delimW); + index = wcsstr(url, L"::/");
if (index) ActivateContentTopic(info->tabs[TAB_CONTENTS].hwnd, index + 3, info->content); /* skip over ::/ */ @@ -301,10 +296,6 @@ static void DoSync(HHInfo *info)
#define SIZEBAR_WIDTH 4
-static const WCHAR szSizeBarClass[] = { - 'H','H',' ','S','i','z','e','B','a','r',0 -}; - /* Draw the SizeBar */ static void SB_OnPaint(HWND hWnd) { @@ -398,7 +389,7 @@ static void HH_RegisterSizeBarClass(HHInfo *pHHInfo) wcex.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_SIZEWE); wcex.hbrBackground = (HBRUSH)(COLOR_MENU + 1); wcex.lpszMenuName = NULL; - wcex.lpszClassName = szSizeBarClass; + wcex.lpszClassName = L"HH SizeBar"; wcex.hIconSm = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION);
RegisterClassExW(&wcex); @@ -428,7 +419,7 @@ static BOOL HH_AddSizeBar(HHInfo *pHHInfo)
SB_GetSizeBarRect(pHHInfo, &rc);
- hWnd = CreateWindowExW(dwExStyles, szSizeBarClass, szEmpty, dwStyles, + hWnd = CreateWindowExW(dwExStyles, L"HH SizeBar", L"", dwStyles, rc.left, rc.top, rc.right, rc.bottom, hwndParent, NULL, hhctrl_hinstance, NULL); if (!hWnd) @@ -443,10 +434,6 @@ static BOOL HH_AddSizeBar(HHInfo *pHHInfo)
/* Child Window */
-static const WCHAR szChildClass[] = { - 'H','H',' ','C','h','i','l','d',0 -}; - static LRESULT Child_OnPaint(HWND hWnd) { PAINTSTRUCT ps; @@ -806,7 +793,7 @@ static void HH_RegisterChildWndClass(HHInfo *pHHInfo) wcex.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wcex.lpszMenuName = NULL; - wcex.lpszClassName = szChildClass; + wcex.lpszClassName = L"HH Child"; wcex.hIconSm = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION);
RegisterClassExW(&wcex); @@ -1092,7 +1079,7 @@ static BOOL HH_AddNavigationPane(HHInfo *info)
NP_GetNavigationRect(info, &rc);
- hWnd = CreateWindowExW(dwExStyles, szChildClass, szEmpty, dwStyles, + hWnd = CreateWindowExW(dwExStyles, L"HH Child", szEmpty, dwStyles, rc.left, rc.top, rc.right, rc.bottom, hwndParent, NULL, hhctrl_hinstance, NULL); if (!hWnd) @@ -1162,7 +1149,7 @@ static BOOL HH_AddHTMLPane(HHInfo *pHHInfo)
HP_GetHTMLRect(pHHInfo, &rc);
- hWnd = CreateWindowExW(dwExStyles, szChildClass, szEmpty, dwStyles, + hWnd = CreateWindowExW(dwExStyles, L"HH Child", szEmpty, dwStyles, rc.left, rc.top, rc.right, rc.bottom, hwndParent, NULL, hhctrl_hinstance, NULL); if (!hWnd) @@ -1248,7 +1235,7 @@ static BOOL AddSearchTab(HHInfo *info)
if(info->tabs[TAB_SEARCH].id == -1) return TRUE; /* No "Search" tab */ - hwndContainer = CreateWindowExW(WS_EX_CONTROLPARENT, szChildClass, szEmpty, + hwndContainer = CreateWindowExW(WS_EX_CONTROLPARENT, L"HH Child", szEmpty, WS_CHILD, 0, 0, 0, 0, info->WinType.hwndNavigation, NULL, hhctrl_hinstance, NULL); if(!hwndContainer) { @@ -1405,9 +1392,6 @@ static LRESULT CALLBACK PopupChild_WndProc(HWND hWnd, UINT message, WPARAM wPara
static BOOL AddIndexPopup(HHInfo *info) { - static const WCHAR szPopupChildClass[] = {'H','H',' ','P','o','p','u','p',' ','C','h','i','l','d',0}; - static const WCHAR windowCaptionW[] = {'S','e','l','e','c','t',' ','T','o','p','i','c',':',0}; - static const WCHAR windowClassW[] = {'H','H',' ','P','o','p','u','p',0}; HWND hwndList, hwndPopup, hwndCallback; char hidden_column[] = "Column"; WNDCLASSEXW wcex; @@ -1426,7 +1410,7 @@ static BOOL AddIndexPopup(HHInfo *info) wcex.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_MENU + 1); wcex.lpszMenuName = NULL; - wcex.lpszClassName = windowClassW; + wcex.lpszClassName = L"HH Popup"; wcex.hIconSm = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION); RegisterClassExW(&wcex);
@@ -1440,13 +1424,13 @@ static BOOL AddIndexPopup(HHInfo *info) wcex.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); wcex.lpszMenuName = NULL; - wcex.lpszClassName = szPopupChildClass; + wcex.lpszClassName = L"HH Popup Child"; wcex.hIconSm = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION); RegisterClassExW(&wcex);
hwndPopup = CreateWindowExW(WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_APPWINDOW | WS_EX_WINDOWEDGE | WS_EX_RIGHTSCROLLBAR, - windowClassW, windowCaptionW, WS_POPUPWINDOW + L"HH Popup", L"Select Topic:", WS_POPUPWINDOW | WS_OVERLAPPEDWINDOW | WS_VISIBLE | WS_CLIPSIBLINGS | WS_CLIPCHILDREN, CW_USEDEFAULT, CW_USEDEFAULT, 300, 200, info->WinType.hwndHelp, @@ -1455,7 +1439,7 @@ static BOOL AddIndexPopup(HHInfo *info) return FALSE;
hwndCallback = CreateWindowExW(WS_EX_LEFT | WS_EX_LTRREADING | WS_EX_RIGHTSCROLLBAR, - szPopupChildClass, szEmpty, WS_CHILDWINDOW | WS_VISIBLE, + L"HH Popup Child", szEmpty, WS_CHILDWINDOW | WS_VISIBLE, 0, 0, 0, 0, hwndPopup, NULL, hhctrl_hinstance, NULL); if (!hwndCallback) @@ -1610,10 +1594,6 @@ static BOOL HH_CreateHelpWindow(HHInfo *info) DWORD x, y, width = 0, height = 0; LPCWSTR caption;
- static const WCHAR windowClassW[] = { - 'H','H',' ', 'P','a','r','e','n','t',0 - }; - wcex.cbSize = sizeof(WNDCLASSEXW); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = Help_WndProc; @@ -1624,7 +1604,7 @@ static BOOL HH_CreateHelpWindow(HHInfo *info) wcex.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_MENU + 1); wcex.lpszMenuName = NULL; - wcex.lpszClassName = windowClassW; + wcex.lpszClassName = L"HH Parent"; wcex.hIconSm = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION);
RegisterClassExW(&wcex); @@ -1677,7 +1657,7 @@ static BOOL HH_CreateHelpWindow(HHInfo *info) caption = info->WinType.pszCaption; if (!*caption) caption = info->pCHMInfo->defTitle;
- hWnd = CreateWindowExW(dwExStyles, windowClassW, caption, dwStyles, x, y, width, height, + hWnd = CreateWindowExW(dwExStyles, L"HH Popup", caption, dwStyles, x, y, width, height, info->WinType.hwndCaller, NULL, hhctrl_hinstance, NULL); if (!hWnd) return FALSE; diff --git a/dlls/hhctrl.ocx/hhctrl.c b/dlls/hhctrl.ocx/hhctrl.c index 3de9a741422..14e18bbaf98 100644 --- a/dlls/hhctrl.ocx/hhctrl.c +++ b/dlls/hhctrl.ocx/hhctrl.c @@ -99,10 +99,6 @@ static const char *command_to_string(UINT command)
static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD buflen, WCHAR **index, WCHAR **window) { - static const WCHAR helpW[] = {'\','h','e','l','p','\',0}; - static const WCHAR delimW[] = {':',':',0}; - static const WCHAR delim2W[] = {'>',0}; - DWORD env_len; WCHAR *filename, *extra;
@@ -122,7 +118,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b
ExpandEnvironmentStringsW(env_filename, filename, env_len);
- extra = wcsstr(filename, delim2W); + extra = wcschr(filename, '>'); if (extra) { *extra = 0; @@ -130,7 +126,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b *window = wcsdup(extra + 1); }
- extra = wcsstr(filename, delimW); + extra = wcsstr(filename, L"::"); if (extra) { *extra = 0; @@ -142,7 +138,7 @@ static BOOL resolve_filename(const WCHAR *env_filename, WCHAR *fullname, DWORD b if (GetFileAttributesW(fullname) == INVALID_FILE_ATTRIBUTES) { GetWindowsDirectoryW(fullname, buflen); - lstrcatW(fullname, helpW); + lstrcatW(fullname, L"\help\"); lstrcatW(fullname, filename); }
diff --git a/dlls/hhctrl.ocx/search.c b/dlls/hhctrl.ocx/search.c index 64b71e87ac7..cbd78345f99 100644 --- a/dlls/hhctrl.ocx/search.c +++ b/dlls/hhctrl.ocx/search.c @@ -154,7 +154,6 @@ cleanup: static SearchItem *SearchCHM_Storage(SearchItem *item, IStorage *pStorage, const char *needle) { - static const WCHAR szHTMext[] = {'.','h','t','m',0}; IEnumSTATSTG *elem = NULL; WCHAR *filename = NULL; STATSTG entries; @@ -177,7 +176,7 @@ static SearchItem *SearchCHM_Storage(SearchItem *item, IStorage *pStorage, item = SearchCHM_Folder(item, pStorage, filename, needle); break; case STGTY_STREAM: - if(wcsstr(filename, szHTMext)) + if(wcsstr(filename, L".htm")) { WCHAR *title = SearchCHM_File(pStorage, filename, needle);