diff --git a/dll/win32/shell32/autocomplete.cpp b/dll/win32/shell32/autocomplete.cpp index 3783f52d1f7..103f0a68cd3 100644 --- a/dll/win32/shell32/autocomplete.cpp +++ b/dll/win32/shell32/autocomplete.cpp @@ -1,8 +1,8 @@ /* - * AutoComplete interfaces implementation. + * AutoComplete interfaces implementation. * - * Copyright 2004 Maxime Bellengé - * Copyright 2009 Andrew Hill + * Copyright 2004 Maxime Bellengé + * Copyright 2009 Andrew Hill * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -44,12 +44,12 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); */ CAutoComplete::CAutoComplete() { - enabled = TRUE; - options = ACO_AUTOAPPEND; - wpOrigEditProc = NULL; - hwndListBox = NULL; - txtbackup = NULL; - quickComplete = NULL; + enabled = TRUE; + options = ACO_AUTOAPPEND; + wpOrigEditProc = NULL; + hwndListBox = NULL; + txtbackup = NULL; + quickComplete = NULL; hwndEdit = NULL; wpOrigLBoxProc = NULL; } @@ -59,11 +59,11 @@ CAutoComplete::CAutoComplete() */ CAutoComplete::~CAutoComplete() { - TRACE(" destroying IAutoComplete(%p)\n", this); - HeapFree(GetProcessHeap(), 0, quickComplete); - HeapFree(GetProcessHeap(), 0, txtbackup); - if (hwndListBox) - DestroyWindow(hwndListBox); + TRACE(" destroying IAutoComplete(%p)\n", this); + HeapFree(GetProcessHeap(), 0, quickComplete); + HeapFree(GetProcessHeap(), 0, txtbackup); + if (hwndListBox) + DestroyWindow(hwndListBox); } /****************************************************************************** @@ -88,7 +88,7 @@ HRESULT WINAPI CAutoComplete::Init(HWND hwndEdit, IUnknown *punkACL, LPCOLESTR p static const WCHAR lbName[] = {'L','i','s','t','B','o','x',0}; TRACE("(%p)->(0x%08lx, %p, %s, %s)\n", - this, hwndEdit, punkACL, debugstr_w(pwzsRegKeyPath), debugstr_w(pwszQuickComplete)); + this, hwndEdit, punkACL, debugstr_w(pwzsRegKeyPath), debugstr_w(pwszQuickComplete)); if (options & ACO_AUTOSUGGEST) TRACE(" ACO_AUTOSUGGEST\n"); @@ -105,12 +105,12 @@ HRESULT WINAPI CAutoComplete::Init(HWND hwndEdit, IUnknown *punkACL, LPCOLESTR p if (options & ACO_RTLREADING) FIXME(" ACO_RTLREADING not supported\n"); - hwndEdit = hwndEdit; + hwndEdit = hwndEdit; - if (!SUCCEEDED (punkACL->QueryInterface(IID_IEnumString, (LPVOID *)&enumstr))) + if (!SUCCEEDED (punkACL->QueryInterface(IID_IEnumString, (LPVOID *)&enumstr))) { - TRACE("No IEnumString interface\n"); - return E_NOINTERFACE; + TRACE("No IEnumString interface\n"); + return E_NOINTERFACE; } wpOrigEditProc = (WNDPROC)SetWindowLongPtrW(hwndEdit, GWLP_WNDPROC, (LONG_PTR) ACEditSubclassProc); @@ -118,65 +118,88 @@ HRESULT WINAPI CAutoComplete::Init(HWND hwndEdit, IUnknown *punkACL, LPCOLESTR p if (options & ACO_AUTOSUGGEST) { - HWND hwndParent; + HWND hwndParent; - hwndParent = GetParent(hwndEdit); + hwndParent = GetParent(hwndEdit); - /* FIXME : The listbox should be resizable with the mouse. WS_THICKFRAME looks ugly */ - hwndListBox = CreateWindowExW(0, lbName, NULL, - WS_BORDER | WS_CHILD | WS_VSCROLL | LBS_HASSTRINGS | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT, - CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, - hwndParent, NULL, - (HINSTANCE)GetWindowLongPtrW(hwndParent, GWLP_HINSTANCE), NULL); + /* FIXME : The listbox should be resizable with the mouse. WS_THICKFRAME looks ugly */ + hwndListBox = CreateWindowExW(0, lbName, NULL, + WS_BORDER | WS_CHILD | WS_VSCROLL | LBS_HASSTRINGS | LBS_NOTIFY | LBS_NOINTEGRALHEIGHT, + CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, CW_USEDEFAULT, + hwndParent, NULL, + (HINSTANCE)GetWindowLongPtrW(hwndParent, GWLP_HINSTANCE), NULL); if (hwndListBox) { - wpOrigLBoxProc = (WNDPROC)SetWindowLongPtrW(hwndListBox, GWLP_WNDPROC, (LONG_PTR)ACLBoxSubclassProc); - SetWindowLongPtrW(hwndListBox, GWLP_USERDATA, (LONG_PTR)this); - } - } + wpOrigLBoxProc = (WNDPROC)SetWindowLongPtrW(hwndListBox, GWLP_WNDPROC, (LONG_PTR)ACLBoxSubclassProc); + SetWindowLongPtrW(hwndListBox, GWLP_USERDATA, (LONG_PTR)this); + } + } if (pwzsRegKeyPath) { - WCHAR *key; - WCHAR result[MAX_PATH]; - WCHAR *value; - HKEY hKey = 0; - LONG res; - LONG len; + WCHAR *key; + WCHAR result[MAX_PATH]; + WCHAR *value; + HKEY hKey = 0; + LONG res; + LONG len; - /* pwszRegKeyPath contains the key as well as the value, so we split */ - key = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (wcslen(pwzsRegKeyPath) + 1) * sizeof(WCHAR)); - wcscpy(key, pwzsRegKeyPath); - value = const_cast(strrchrW(key, '\\')); - *value = 0; - value++; - /* Now value contains the value and buffer the key */ - res = RegOpenKeyExW(HKEY_CURRENT_USER, key, 0, KEY_READ, &hKey); - - if (res != ERROR_SUCCESS) + /* pwszRegKeyPath contains the key as well as the value, so we split */ + key = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (wcslen(pwzsRegKeyPath) + 1) * sizeof(WCHAR)); + + if (key) { - /* if the key is not found, MSDN states we must seek in HKEY_LOCAL_MACHINE */ - res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hKey); - } - - if (res == ERROR_SUCCESS) - { - res = RegQueryValueW(hKey, value, result, &len); - if (res == ERROR_SUCCESS) + wcscpy(key, pwzsRegKeyPath); + value = const_cast(strrchrW(key, '\\')); + + if (value) { - quickComplete = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR)); - wcscpy(quickComplete, result); - } - RegCloseKey(hKey); - } - HeapFree(GetProcessHeap(), 0, key); + *value = 0; + value++; + /* Now value contains the value and buffer the key */ + res = RegOpenKeyExW(HKEY_CURRENT_USER, key, 0, KEY_READ, &hKey); + + if (res != ERROR_SUCCESS) + { + /* if the key is not found, MSDN states we must seek in HKEY_LOCAL_MACHINE */ + res = RegOpenKeyExW(HKEY_LOCAL_MACHINE, key, 0, KEY_READ, &hKey); + } + + if (res == ERROR_SUCCESS) + { + res = RegQueryValueW(hKey, value, result, &len); + if (res == ERROR_SUCCESS) + { + quickComplete = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len * sizeof(WCHAR)); + wcscpy(quickComplete, result); + } + RegCloseKey(hKey); + } + } + + HeapFree(GetProcessHeap(), 0, key); + } + else + { + TRACE("HeapAlloc Failed when trying to alloca %d bytes\n", (wcslen(pwzsRegKeyPath) + 1) * sizeof(WCHAR)); + return S_FALSE; + } } if ((pwszQuickComplete) && (!quickComplete)) { - quickComplete = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (wcslen(pwszQuickComplete) + 1) * sizeof(WCHAR)); - wcscpy(quickComplete, pwszQuickComplete); + quickComplete = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (wcslen(pwszQuickComplete) + 1) * sizeof(WCHAR)); + + if (quickComplete) + { + wcscpy(quickComplete, pwszQuickComplete); + } + else + { + TRACE("HeapAlloc Failed when trying to alloca %d bytes\n", (wcslen(pwszQuickComplete) + 1) * sizeof(WCHAR)); + return S_FALSE; + } } return S_OK; @@ -215,7 +238,7 @@ HRESULT WINAPI CAutoComplete::SetOptions(DWORD dwFlag) */ LRESULT APIENTRY CAutoComplete::ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { - CAutoComplete *pThis = (CAutoComplete *)GetWindowLongPtrW(hwnd, GWLP_USERDATA); + CAutoComplete *pThis = (CAutoComplete *)GetWindowLongPtrW(hwnd, GWLP_USERDATA); LPOLESTR strs; HRESULT hr; WCHAR hwndText[255]; @@ -231,203 +254,218 @@ LRESULT APIENTRY CAutoComplete::ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM switch (uMsg) { - case CB_SHOWDROPDOWN: + case CB_SHOWDROPDOWN: { - ShowWindow(pThis->hwndListBox, SW_HIDE); + ShowWindow(pThis->hwndListBox, SW_HIDE); }; break; - case WM_KILLFOCUS: + case WM_KILLFOCUS: { - if ((pThis->options & ACO_AUTOSUGGEST) && ((HWND)wParam != pThis->hwndListBox)) - { - ShowWindow(pThis->hwndListBox, SW_HIDE); - } + if ((pThis->options & ACO_AUTOSUGGEST) && ((HWND)wParam != pThis->hwndListBox)) + { + ShowWindow(pThis->hwndListBox, SW_HIDE); + } return CallWindowProcW(pThis->wpOrigEditProc, hwnd, uMsg, wParam, lParam); }; break; - case WM_KEYUP: + case WM_KEYUP: { - GetWindowTextW(hwnd, (LPWSTR)hwndText, 255); + GetWindowTextW(hwnd, (LPWSTR)hwndText, 255); - switch(wParam) + switch(wParam) { - case VK_RETURN: + case VK_RETURN: { - /* If quickComplete is set and control is pressed, replace the string */ - control = GetKeyState(VK_CONTROL) & 0x8000; - if (control && pThis->quickComplete) + /* If quickComplete is set and control is pressed, replace the string */ + control = GetKeyState(VK_CONTROL) & 0x8000; + if (control && pThis->quickComplete) { - hwndQCText = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, - (wcslen(pThis->quickComplete)+wcslen(hwndText))*sizeof(WCHAR)); - sel = swprintf(hwndQCText, pThis->quickComplete, hwndText); - SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)hwndQCText); - SendMessageW(hwnd, EM_SETSEL, 0, sel); - HeapFree(GetProcessHeap(), 0, hwndQCText); - } + hwndQCText = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, + (wcslen(pThis->quickComplete)+wcslen(hwndText))*sizeof(WCHAR)); + sel = swprintf(hwndQCText, pThis->quickComplete, hwndText); + SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)hwndQCText); + SendMessageW(hwnd, EM_SETSEL, 0, sel); + HeapFree(GetProcessHeap(), 0, hwndQCText); + } - ShowWindow(pThis->hwndListBox, SW_HIDE); - return 0; + ShowWindow(pThis->hwndListBox, SW_HIDE); + return 0; }; break; case VK_LEFT: - case VK_RIGHT: + case VK_RIGHT: { - return 0; + return 0; }; break; - case VK_UP: - case VK_DOWN: + case VK_UP: + case VK_DOWN: { - /* Two cases here : - - if the listbox is not visible, displays it - with all the entries if the style ACO_UPDOWNKEYDROPSLIST - is present but does not select anything. - - if the listbox is visible, change the selection - */ - if ( (pThis->options & (ACO_AUTOSUGGEST | ACO_UPDOWNKEYDROPSLIST)) - && (!IsWindowVisible(pThis->hwndListBox) && (! *hwndText)) ) - { - /* We must display all the entries */ - displayall = TRUE; - } + /* Two cases here : + - if the listbox is not visible, displays it + with all the entries if the style ACO_UPDOWNKEYDROPSLIST + is present but does not select anything. + - if the listbox is visible, change the selection + */ + if ( (pThis->options & (ACO_AUTOSUGGEST | ACO_UPDOWNKEYDROPSLIST)) + && (!IsWindowVisible(pThis->hwndListBox) && (! *hwndText)) ) + { + /* We must display all the entries */ + displayall = TRUE; + } else { - if (IsWindowVisible(pThis->hwndListBox)) + if (IsWindowVisible(pThis->hwndListBox)) { - int count; + int count; - count = SendMessageW(pThis->hwndListBox, LB_GETCOUNT, 0, 0); - /* Change the selection */ - sel = SendMessageW(pThis->hwndListBox, LB_GETCURSEL, 0, 0); - if (wParam == VK_UP) - sel = ((sel-1)<0)?count-1:sel-1; - else - sel = ((sel+1)>= count)?-1:sel+1; - + count = SendMessageW(pThis->hwndListBox, LB_GETCOUNT, 0, 0); + /* Change the selection */ + sel = SendMessageW(pThis->hwndListBox, LB_GETCURSEL, 0, 0); + if (wParam == VK_UP) + sel = ((sel-1)<0)?count-1:sel-1; + else + sel = ((sel+1)>= count)?-1:sel+1; + SendMessageW(pThis->hwndListBox, LB_SETCURSEL, sel, 0); - + if (sel != -1) { - WCHAR *msg; - int len; + WCHAR *msg; + int len; - len = SendMessageW(pThis->hwndListBox, LB_GETTEXTLEN, sel, (LPARAM)NULL); - msg = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len + 1) * sizeof(WCHAR)); - - SendMessageW(pThis->hwndListBox, LB_GETTEXT, sel, (LPARAM)msg); - SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)msg); - SendMessageW(hwnd, EM_SETSEL, wcslen(msg), wcslen(msg)); - - HeapFree(GetProcessHeap(), 0, msg); - } + len = SendMessageW(pThis->hwndListBox, LB_GETTEXTLEN, sel, (LPARAM)NULL); + msg = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len + 1) * sizeof(WCHAR)); + + if (msg) + { + SendMessageW(pThis->hwndListBox, LB_GETTEXT, sel, (LPARAM)msg); + SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)msg); + SendMessageW(hwnd, EM_SETSEL, wcslen(msg), wcslen(msg)); + + HeapFree(GetProcessHeap(), 0, msg); + } + else + { + TRACE("HeapAlloc failed to allocate %d bytes\n", (len + 1) * sizeof(WCHAR)); + } + } else { - SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)pThis->txtbackup); - SendMessageW(hwnd, EM_SETSEL, wcslen(pThis->txtbackup), wcslen(pThis->txtbackup)); - } - } - return 0; - } + SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)pThis->txtbackup); + SendMessageW(hwnd, EM_SETSEL, wcslen(pThis->txtbackup), wcslen(pThis->txtbackup)); + } + } + return 0; + } }; break; - + case VK_BACK: - case VK_DELETE: + case VK_DELETE: { - if ((! *hwndText) && (pThis->options & ACO_AUTOSUGGEST)) + if ((! *hwndText) && (pThis->options & ACO_AUTOSUGGEST)) { - ShowWindow(pThis->hwndListBox, SW_HIDE); - return CallWindowProcW(pThis->wpOrigEditProc, hwnd, uMsg, wParam, lParam); - } - + ShowWindow(pThis->hwndListBox, SW_HIDE); + return CallWindowProcW(pThis->wpOrigEditProc, hwnd, uMsg, wParam, lParam); + } + if (pThis->options & ACO_AUTOAPPEND) { - DWORD b; - SendMessageW(hwnd, EM_GETSEL, (WPARAM)&b, (LPARAM)NULL); - if (b>1) + DWORD b; + SendMessageW(hwnd, EM_GETSEL, (WPARAM)&b, (LPARAM)NULL); + if (b>1) { - hwndText[b-1] = '\0'; - } + hwndText[b-1] = '\0'; + } else { - hwndText[0] = '\0'; - SetWindowTextW(hwnd, hwndText); - } - } + hwndText[0] = '\0'; + SetWindowTextW(hwnd, hwndText); + } + } }; break; - + default: - ; - } + ; + } - SendMessageW(pThis->hwndListBox, LB_RESETCONTENT, 0, 0); + SendMessageW(pThis->hwndListBox, LB_RESETCONTENT, 0, 0); - HeapFree(GetProcessHeap(), 0, pThis->txtbackup); - pThis->txtbackup = (WCHAR *)HeapAlloc(GetProcessHeap(), - HEAP_ZERO_MEMORY, (wcslen(hwndText)+1)*sizeof(WCHAR)); - wcscpy(pThis->txtbackup, hwndText); + HeapFree(GetProcessHeap(), 0, pThis->txtbackup); - /* Returns if there is no text to search and we doesn't want to display all the entries */ - if ((!displayall) && (! *hwndText) ) - break; + pThis->txtbackup = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (wcslen(hwndText)+1)*sizeof(WCHAR)); - pThis->enumstr->Reset(); - filled = FALSE; - + if (pThis->txtbackup) + { + wcscpy(pThis->txtbackup, hwndText); + } + else + { + TRACE("HeapAlloc failed to allocate %d bytes\n", (wcslen(hwndText)+1)*sizeof(WCHAR)); + } + + /* Returns if there is no text to search and we doesn't want to display all the entries */ + if ((!displayall) && (! *hwndText) ) + break; + + pThis->enumstr->Reset(); + filled = FALSE; + for(cpt = 0;;) { - hr = pThis->enumstr->Next(1, &strs, NULL); - if (hr != S_OK) - break; + hr = pThis->enumstr->Next(1, &strs, NULL); + if (hr != S_OK) + break; - if ((LPWSTR)strstrW(strs, hwndText) == strs) + if ((LPWSTR)strstrW(strs, hwndText) == strs) { - if (pThis->options & ACO_AUTOAPPEND) + if (pThis->options & ACO_AUTOAPPEND) { - SetWindowTextW(hwnd, strs); - SendMessageW(hwnd, EM_SETSEL, wcslen(hwndText), wcslen(strs)); - break; - } + SetWindowTextW(hwnd, strs); + SendMessageW(hwnd, EM_SETSEL, wcslen(hwndText), wcslen(strs)); + break; + } - if (pThis->options & ACO_AUTOSUGGEST) + if (pThis->options & ACO_AUTOSUGGEST) { - SendMessageW(pThis->hwndListBox, LB_ADDSTRING, 0, (LPARAM)strs); - filled = TRUE; - cpt++; - } - } - } + SendMessageW(pThis->hwndListBox, LB_ADDSTRING, 0, (LPARAM)strs); + filled = TRUE; + cpt++; + } + } + } - if (pThis->options & ACO_AUTOSUGGEST) + if (pThis->options & ACO_AUTOSUGGEST) { - if (filled) + if (filled) { - height = SendMessageW(pThis->hwndListBox, LB_GETITEMHEIGHT, 0, 0); - SendMessageW(pThis->hwndListBox, LB_CARETOFF, 0, 0); - GetWindowRect(hwnd, &r); - SetParent(pThis->hwndListBox, HWND_DESKTOP); - /* It seems that Windows XP displays 7 lines at most - and otherwise displays a vertical scroll bar */ - SetWindowPos(pThis->hwndListBox, HWND_TOP, - r.left, r.bottom + 1, r.right - r.left, min(height * 7, height * (cpt + 1)), - SWP_SHOWWINDOW ); - } + height = SendMessageW(pThis->hwndListBox, LB_GETITEMHEIGHT, 0, 0); + SendMessageW(pThis->hwndListBox, LB_CARETOFF, 0, 0); + GetWindowRect(hwnd, &r); + SetParent(pThis->hwndListBox, HWND_DESKTOP); + /* It seems that Windows XP displays 7 lines at most + and otherwise displays a vertical scroll bar */ + SetWindowPos(pThis->hwndListBox, HWND_TOP, + r.left, r.bottom + 1, r.right - r.left, min(height * 7, height * (cpt + 1)), + SWP_SHOWWINDOW ); + } else { - ShowWindow(pThis->hwndListBox, SW_HIDE); - } - } + ShowWindow(pThis->hwndListBox, SW_HIDE); + } + } }; break; - + default: { - return CallWindowProcW(pThis->wpOrigEditProc, hwnd, uMsg, wParam, lParam); + return CallWindowProcW(pThis->wpOrigEditProc, hwnd, uMsg, wParam, lParam); } - } + } - return 0; + return 0; } LRESULT APIENTRY CAutoComplete::ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) @@ -438,33 +476,40 @@ LRESULT APIENTRY CAutoComplete::ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM switch (uMsg) { - case WM_MOUSEMOVE: + case WM_MOUSEMOVE: { - sel = SendMessageW(hwnd, LB_ITEMFROMPOINT, 0, lParam); - SendMessageW(hwnd, LB_SETCURSEL, (WPARAM)sel, (LPARAM)0); + sel = SendMessageW(hwnd, LB_ITEMFROMPOINT, 0, lParam); + SendMessageW(hwnd, LB_SETCURSEL, (WPARAM)sel, (LPARAM)0); }; break; - + case WM_LBUTTONDOWN: { - sel = SendMessageW(hwnd, LB_GETCURSEL, 0, 0); - + sel = SendMessageW(hwnd, LB_GETCURSEL, 0, 0); + if (sel < 0) - break; - + break; + len = SendMessageW(pThis->hwndListBox, LB_GETTEXTLEN, sel, 0); - msg = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len + 1) * sizeof(WCHAR)); - - SendMessageW(hwnd, LB_GETTEXT, sel, (LPARAM)msg); - SendMessageW(pThis->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg); - SendMessageW(pThis->hwndEdit, EM_SETSEL, 0, wcslen(msg)); - ShowWindow(hwnd, SW_HIDE); - - HeapFree(GetProcessHeap(), 0, msg); - + msg = (WCHAR *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len + 1) * sizeof(WCHAR)); + + if (msg) + { + SendMessageW(hwnd, LB_GETTEXT, sel, (LPARAM)msg); + SendMessageW(pThis->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg); + SendMessageW(pThis->hwndEdit, EM_SETSEL, 0, wcslen(msg)); + ShowWindow(hwnd, SW_HIDE); + + HeapFree(GetProcessHeap(), 0, msg); + } + else + { + TRACE("HeapAlloc failed to allocate %d bytes\n", (len + 1) * sizeof(WCHAR)); + } + }; break; - + default: - return CallWindowProcW(pThis->wpOrigLBoxProc, hwnd, uMsg, wParam, lParam); + return CallWindowProcW(pThis->wpOrigLBoxProc, hwnd, uMsg, wParam, lParam); } return 0; } diff --git a/dll/win32/shell32/classes.cpp b/dll/win32/shell32/classes.cpp index f07d9af5a99..fe69656db94 100644 --- a/dll/win32/shell32/classes.cpp +++ b/dll/win32/shell32/classes.cpp @@ -1,6 +1,6 @@ /* - * file type mapping - * (HKEY_CLASSES_ROOT - Stuff) + * file type mapping + * (HKEY_CLASSES_ROOT - Stuff) * * Copyright 1998, 1999, 2000 Juergen Schmied * @@ -27,76 +27,76 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL bPrependDot) { - HKEY hkey; - WCHAR szTemp[MAX_EXTENSION_LENGTH + 2]; + HKEY hkey; + WCHAR szTemp[MAX_EXTENSION_LENGTH + 2]; - TRACE("%s %p\n", debugstr_w(szExtension), debugstr_w(szFileType)); + TRACE("%s %p\n", debugstr_w(szExtension), debugstr_w(szFileType)); /* added because we do not want to have double dots */ if (szExtension[0] == '.') bPrependDot = 0; - if (bPrependDot) - szTemp[0] = '.'; + if (bPrependDot) + szTemp[0] = '.'; - lstrcpynW(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH); + lstrcpynW(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH); - if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey)) - { - return FALSE; - } + if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey)) + { + return FALSE; + } - if (RegQueryValueW(hkey, NULL, szFileType, &len)) - { - RegCloseKey(hkey); - return FALSE; - } + if (RegQueryValueW(hkey, NULL, szFileType, &len)) + { + RegCloseKey(hkey); + return FALSE; + } - RegCloseKey(hkey); + RegCloseKey(hkey); - TRACE("--UE;\n} %s\n", debugstr_w(szFileType)); + TRACE("--UE;\n} %s\n", debugstr_w(szFileType)); - return TRUE; + return TRUE; } BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL bPrependDot) { - HKEY hkey; - char szTemp[MAX_EXTENSION_LENGTH + 2]; + HKEY hkey; + char szTemp[MAX_EXTENSION_LENGTH + 2]; - TRACE("%s %p\n", szExtension, szFileType); + TRACE("%s %p\n", szExtension, szFileType); /* added because we do not want to have double dots */ if (szExtension[0] == '.') bPrependDot = 0; - if (bPrependDot) - szTemp[0] = '.'; + if (bPrependDot) + szTemp[0] = '.'; - lstrcpynA(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH); + lstrcpynA(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH); - if (RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey)) - { - return FALSE; - } + if (RegOpenKeyExA(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey)) + { + return FALSE; + } - if (RegLoadMUIStringA(hkey, "FriendlyTypeName", szFileType, len, NULL, 0, NULL) == ERROR_SUCCESS) - { - RegCloseKey(hkey); - return TRUE; - } + if (RegLoadMUIStringA(hkey, "FriendlyTypeName", szFileType, len, NULL, 0, NULL) == ERROR_SUCCESS) + { + RegCloseKey(hkey); + return TRUE; + } - if (RegQueryValueA(hkey, NULL, szFileType, &len)) - { - RegCloseKey(hkey); - return FALSE; - } + if (RegQueryValueA(hkey, NULL, szFileType, &len)) + { + RegCloseKey(hkey); + return FALSE; + } - RegCloseKey(hkey); + RegCloseKey(hkey); - TRACE("--UE;\n} %s\n", szFileType); + TRACE("--UE;\n} %s\n", szFileType); - return TRUE; + return TRUE; } static const WCHAR swShell[] = {'s','h','e','l','l','\\',0}; @@ -164,12 +164,12 @@ BOOL HCR_GetDefaultVerbW( HKEY hkeyClass, LPCWSTR szVerb, LPWSTR szDest, DWORD l BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR szDest, DWORD len ) { - WCHAR sTempVerb[MAX_PATH]; - BOOL ret; + WCHAR sTempVerb[MAX_PATH]; + BOOL ret; - TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest); + TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb), szDest); - if (szClass) + if (szClass) RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, KEY_READ, &hkeyClass); if (!hkeyClass) return FALSE; @@ -186,26 +186,26 @@ BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LP if (szClass) RegCloseKey(hkeyClass); - TRACE("-- %s\n", debugstr_w(szDest) ); - return ret; + TRACE("-- %s\n", debugstr_w(szDest) ); + return ret; } /*************************************************************************************** -* HCR_GetDefaultIcon [internal] +* HCR_GetDefaultIcon [internal] * * Gets the icon for a filetype */ static BOOL HCR_RegOpenClassIDKey(REFIID riid, HKEY *hkey) { - WCHAR xriid[50]; + WCHAR xriid[50]; swprintf( xriid, L"CLSID\\{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", riid.Data1, riid.Data2, riid.Data3, riid.Data4[0], riid.Data4[1], riid.Data4[2], riid.Data4[3], riid.Data4[4], riid.Data4[5], riid.Data4[6], riid.Data4[7] ); - TRACE("%S\n",xriid ); + TRACE("%S\n",xriid ); - return !RegOpenKeyExW(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey); + return !RegOpenKeyExW(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey); } static BOOL HCR_RegGetDefaultIconW(HKEY hkey, LPWSTR szDest, DWORD len, int* picon_idx) @@ -234,89 +234,89 @@ static BOOL HCR_RegGetDefaultIconW(HKEY hkey, LPWSTR szDest, DWORD len, int* pic static BOOL HCR_RegGetDefaultIconA(HKEY hkey, LPSTR szDest, DWORD len, int* picon_idx) { - DWORD dwType; - char sTemp[MAX_PATH]; - char sNum[5]; + DWORD dwType; + char sTemp[MAX_PATH]; + char sNum[5]; - if (!RegQueryValueExA(hkey, NULL, 0, &dwType, (LPBYTE)szDest, &len)) - { + if (!RegQueryValueExA(hkey, NULL, 0, &dwType, (LPBYTE)szDest, &len)) + { if (dwType == REG_EXPAND_SZ) - { - ExpandEnvironmentStringsA(szDest, sTemp, MAX_PATH); - lstrcpynA(szDest, sTemp, len); - } - if (ParseFieldA (szDest, 2, sNum, 5)) + { + ExpandEnvironmentStringsA(szDest, sTemp, MAX_PATH); + lstrcpynA(szDest, sTemp, len); + } + if (ParseFieldA (szDest, 2, sNum, 5)) *picon_idx=atoi(sNum); else *picon_idx=0; /* sometimes the icon number is missing */ - ParseFieldA (szDest, 1, szDest, len); + ParseFieldA (szDest, 1, szDest, len); PathUnquoteSpacesA(szDest); - return TRUE; - } - return FALSE; + return TRUE; + } + return FALSE; } BOOL HCR_GetDefaultIconW(LPCWSTR szClass, LPWSTR szDest, DWORD len, int* picon_idx) { static const WCHAR swDefaultIcon[] = {'\\','D','e','f','a','u','l','t','I','c','o','n',0}; - HKEY hkey; - WCHAR sTemp[MAX_PATH]; - BOOL ret = FALSE; + HKEY hkey; + WCHAR sTemp[MAX_PATH]; + BOOL ret = FALSE; - TRACE("%s\n",debugstr_w(szClass) ); + TRACE("%s\n",debugstr_w(szClass) ); - lstrcpynW(sTemp, szClass, MAX_PATH); - wcscat(sTemp, swDefaultIcon); + lstrcpynW(sTemp, szClass, MAX_PATH); + wcscat(sTemp, swDefaultIcon); - if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey)) - { - ret = HCR_RegGetDefaultIconW(hkey, szDest, len, picon_idx); - RegCloseKey(hkey); - } + if (!RegOpenKeyExW(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey)) + { + ret = HCR_RegGetDefaultIconW(hkey, szDest, len, picon_idx); + RegCloseKey(hkey); + } if(ret) TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx); else TRACE("-- not found\n"); - return ret; + return ret; } BOOL HCR_GetDefaultIconA(LPCSTR szClass, LPSTR szDest, DWORD len, int* picon_idx) { - HKEY hkey; - char sTemp[MAX_PATH]; - BOOL ret = FALSE; + HKEY hkey; + char sTemp[MAX_PATH]; + BOOL ret = FALSE; - TRACE("%s\n",szClass ); + TRACE("%s\n",szClass ); - sprintf(sTemp, "%s\\DefaultIcon",szClass); + sprintf(sTemp, "%s\\DefaultIcon",szClass); - if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey)) - { - ret = HCR_RegGetDefaultIconA(hkey, szDest, len, picon_idx); - RegCloseKey(hkey); - } - TRACE("-- %s %i\n", szDest, *picon_idx); - return ret; + if (!RegOpenKeyExA(HKEY_CLASSES_ROOT, sTemp, 0, KEY_READ, &hkey)) + { + ret = HCR_RegGetDefaultIconA(hkey, szDest, len, picon_idx); + RegCloseKey(hkey); + } + TRACE("-- %s %i\n", szDest, *picon_idx); + return ret; } BOOL HCR_GetDefaultIconFromGUIDW(REFIID riid, LPWSTR szDest, DWORD len, int* picon_idx) { - HKEY hkey; - BOOL ret = FALSE; + HKEY hkey; + BOOL ret = FALSE; - if (HCR_RegOpenClassIDKey(riid, &hkey)) - { - ret = HCR_RegGetDefaultIconW(hkey, szDest, len, picon_idx); - RegCloseKey(hkey); - } - TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx); - return ret; + if (HCR_RegOpenClassIDKey(riid, &hkey)) + { + ret = HCR_RegGetDefaultIconW(hkey, szDest, len, picon_idx); + RegCloseKey(hkey); + } + TRACE("-- %s %i\n", debugstr_w(szDest), *picon_idx); + return ret; } /*************************************************************************************** -* HCR_GetClassName [internal] +* HCR_GetClassName [internal] * * Gets the name of a registered class */ @@ -324,107 +324,107 @@ static const WCHAR swEmpty[] = {0}; BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len) { - HKEY hkey; - BOOL ret = FALSE; - DWORD buflen = len; - WCHAR szName[100]; - LPOLESTR pStr; + HKEY hkey; + BOOL ret = FALSE; + DWORD buflen = len; + WCHAR szName[100]; + LPOLESTR pStr; - szDest[0] = 0; + szDest[0] = 0; - if (StringFromCLSID(riid, &pStr) == S_OK) - { - DWORD dwLen = buflen * sizeof(WCHAR); - swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr); - if (RegGetValueW(HKEY_CURRENT_USER, szName, NULL, RRF_RT_REG_SZ, NULL, (PVOID)szDest, &dwLen) == ERROR_SUCCESS) - { - ret = TRUE; - } - CoTaskMemFree(pStr); - } - if (!ret && HCR_RegOpenClassIDKey(riid, &hkey)) - { + if (StringFromCLSID(riid, &pStr) == S_OK) + { + DWORD dwLen = buflen * sizeof(WCHAR); + swprintf(szName, L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\CLSID\\%s", pStr); + if (RegGetValueW(HKEY_CURRENT_USER, szName, NULL, RRF_RT_REG_SZ, NULL, (PVOID)szDest, &dwLen) == ERROR_SUCCESS) + { + ret = TRUE; + } + CoTaskMemFree(pStr); + } + if (!ret && HCR_RegOpenClassIDKey(riid, &hkey)) + { static const WCHAR wszLocalizedString[] = { 'L','o','c','a','l','i','z','e','d','S','t','r','i','n','g', 0 }; if (!RegLoadMUIStringW(hkey, wszLocalizedString, szDest, len, NULL, 0, NULL) || !RegQueryValueExW(hkey, swEmpty, 0, NULL, (LPBYTE)szDest, &len)) { - ret = TRUE; - } - RegCloseKey(hkey); - } + ret = TRUE; + } + RegCloseKey(hkey); + } - if (!ret || !szDest[0]) - { - if(IsEqualIID(riid, CLSID_ShellDesktop)) - { - if (LoadStringW(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_MyComputer)) - { - if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_MyDocuments)) - { - if(LoadStringW(shell32_hInstance, IDS_PERSONAL, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_RecycleBin)) - { - if(LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_FOLDER_NAME, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_ControlPanel)) - { - if(LoadStringW(shell32_hInstance, IDS_CONTROLPANEL, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_AdminFolderShortcut)) - { - if(LoadStringW(shell32_hInstance, IDS_ADMINISTRATIVETOOLS, szDest, buflen)) - ret = TRUE; - } + if (!ret || !szDest[0]) + { + if(IsEqualIID(riid, CLSID_ShellDesktop)) + { + if (LoadStringW(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, CLSID_MyComputer)) + { + if(LoadStringW(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, CLSID_MyDocuments)) + { + if(LoadStringW(shell32_hInstance, IDS_PERSONAL, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, CLSID_RecycleBin)) + { + if(LoadStringW(shell32_hInstance, IDS_RECYCLEBIN_FOLDER_NAME, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, CLSID_ControlPanel)) + { + if(LoadStringW(shell32_hInstance, IDS_CONTROLPANEL, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, CLSID_AdminFolderShortcut)) + { + if(LoadStringW(shell32_hInstance, IDS_ADMINISTRATIVETOOLS, szDest, buflen)) + ret = TRUE; + } - } - TRACE("-- %s\n", debugstr_w(szDest)); - return ret; + } + TRACE("-- %s\n", debugstr_w(szDest)); + return ret; } BOOL HCR_GetClassNameA(REFIID riid, LPSTR szDest, DWORD len) -{ HKEY hkey; - BOOL ret = FALSE; - DWORD buflen = len; +{ HKEY hkey; + BOOL ret = FALSE; + DWORD buflen = len; - szDest[0] = 0; - if (HCR_RegOpenClassIDKey(riid, &hkey)) - { + szDest[0] = 0; + if (HCR_RegOpenClassIDKey(riid, &hkey)) + { if (!RegLoadMUIStringA(hkey,"LocalizedString",szDest,len,NULL,0,NULL) || !RegQueryValueExA(hkey,"",0,NULL,(LPBYTE)szDest,&len)) { - ret = TRUE; - } - RegCloseKey(hkey); - } + ret = TRUE; + } + RegCloseKey(hkey); + } - if (!ret || !szDest[0]) - { - if(IsEqualIID(riid, CLSID_ShellDesktop)) - { - if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) - ret = TRUE; - } - else if (IsEqualIID(riid, CLSID_MyComputer)) - { - if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) - ret = TRUE; - } - } + if (!ret || !szDest[0]) + { + if(IsEqualIID(riid, CLSID_ShellDesktop)) + { + if (LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen)) + ret = TRUE; + } + else if (IsEqualIID(riid, CLSID_MyComputer)) + { + if(LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen)) + ret = TRUE; + } + } - TRACE("-- %s\n", szDest); + TRACE("-- %s\n", szDest); - return ret; + return ret; } /****************************************************************************** @@ -476,8 +476,8 @@ BOOL HCR_GetFolderAttributes(LPCITEMIDLIST pidlFolder, LPDWORD pdwAttributes) dwLen = sizeof(DWORD); lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL, (LPBYTE)&dwTemp, &dwLen); if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) { - CComPtr psfDesktop; - CComPtr psfFolder; + CComPtr psfDesktop; + CComPtr psfFolder; HRESULT hr; RegCloseKey(hSFKey); diff --git a/dll/win32/shell32/debughlp.cpp b/dll/win32/shell32/debughlp.cpp index fde3b30f892..a64b6f7dfae 100644 --- a/dll/win32/shell32/debughlp.cpp +++ b/dll/win32/shell32/debughlp.cpp @@ -25,221 +25,221 @@ WINE_DEFAULT_DEBUG_CHANNEL(pidl); static LPITEMIDLIST _dbg_ILGetNext(LPCITEMIDLIST pidl) { - WORD len; + WORD len; - if(pidl) - { - len = pidl->mkid.cb; - if (len) - { - return (LPITEMIDLIST) (((LPBYTE)pidl)+len); - } - } - return NULL; + if(pidl) + { + len = pidl->mkid.cb; + if (len) + { + return (LPITEMIDLIST) (((LPBYTE)pidl)+len); + } + } + return NULL; } static BOOL _dbg_ILIsDesktop(LPCITEMIDLIST pidl) { - return ( !pidl || (pidl && pidl->mkid.cb == 0x00) ); + return ( !pidl || (pidl && pidl->mkid.cb == 0x00) ); } static LPPIDLDATA _dbg_ILGetDataPointer(LPCITEMIDLIST pidl) { - if(pidl && pidl->mkid.cb != 0x00) - return (LPPIDLDATA) &(pidl->mkid.abID); - return NULL; + if(pidl && pidl->mkid.cb != 0x00) + return (LPPIDLDATA) &(pidl->mkid.abID); + return NULL; } static LPSTR _dbg_ILGetTextPointer(LPCITEMIDLIST pidl) { - LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl); + LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl); - if (pdata) - { - switch (pdata->type) - { - case PT_GUID: - case PT_SHELLEXT: - case PT_YAGUID: - return NULL; + if (pdata) + { + switch (pdata->type) + { + case PT_GUID: + case PT_SHELLEXT: + case PT_YAGUID: + return NULL; - case PT_DRIVE: - case PT_DRIVE1: - case PT_DRIVE2: - case PT_DRIVE3: - return (LPSTR)&(pdata->u.drive.szDriveName); + case PT_DRIVE: + case PT_DRIVE1: + case PT_DRIVE2: + case PT_DRIVE3: + return (LPSTR)&(pdata->u.drive.szDriveName); - case PT_FOLDER: - case PT_FOLDER1: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - return (LPSTR)&(pdata->u.file.szNames); + case PT_FOLDER: + case PT_FOLDER1: + case PT_VALUE: + case PT_IESPECIAL1: + case PT_IESPECIAL2: + return (LPSTR)&(pdata->u.file.szNames); - case PT_WORKGRP: - case PT_COMP: - case PT_NETWORK: - case PT_NETPROVIDER: - case PT_SHARE: - return (LPSTR)&(pdata->u.network.szNames); - } - } - return NULL; + case PT_WORKGRP: + case PT_COMP: + case PT_NETWORK: + case PT_NETPROVIDER: + case PT_SHARE: + return (LPSTR)&(pdata->u.network.szNames); + } + } + return NULL; } static LPWSTR _dbg_ILGetTextPointerW(LPCITEMIDLIST pidl) { - LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl); + LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl); - if (pdata) - { - switch (pdata->type) - { - case PT_GUID: - case PT_SHELLEXT: - case PT_YAGUID: - return NULL; + if (pdata) + { + switch (pdata->type) + { + case PT_GUID: + case PT_SHELLEXT: + case PT_YAGUID: + return NULL; - case PT_DRIVE: - case PT_DRIVE1: - case PT_DRIVE2: - case PT_DRIVE3: - /* return (LPSTR)&(pdata->u.drive.szDriveName);*/ - return NULL; + case PT_DRIVE: + case PT_DRIVE1: + case PT_DRIVE2: + case PT_DRIVE3: + /* return (LPSTR)&(pdata->u.drive.szDriveName);*/ + return NULL; - case PT_FOLDER: - case PT_FOLDER1: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - /* return (LPSTR)&(pdata->u.file.szNames); */ - return NULL; + case PT_FOLDER: + case PT_FOLDER1: + case PT_VALUE: + case PT_IESPECIAL1: + case PT_IESPECIAL2: + /* return (LPSTR)&(pdata->u.file.szNames); */ + return NULL; - case PT_WORKGRP: - case PT_COMP: - case PT_NETWORK: - case PT_NETPROVIDER: - case PT_SHARE: - /* return (LPSTR)&(pdata->u.network.szNames); */ - return NULL; + case PT_WORKGRP: + case PT_COMP: + case PT_NETWORK: + case PT_NETPROVIDER: + case PT_SHARE: + /* return (LPSTR)&(pdata->u.network.szNames); */ + return NULL; - case PT_VALUEW: - return (LPWSTR)&(pdata->u.file.szNames); - } - } - return NULL; + case PT_VALUEW: + return (LPWSTR)&(pdata->u.file.szNames); + } + } + return NULL; } static LPSTR _dbg_ILGetSTextPointer(LPCITEMIDLIST pidl) { - LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl); + LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl); - if (pdata) - { - switch (pdata->type) - { - case PT_FOLDER: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1); + if (pdata) + { + switch (pdata->type) + { + case PT_FOLDER: + case PT_VALUE: + case PT_IESPECIAL1: + case PT_IESPECIAL2: + return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1); - case PT_WORKGRP: - return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1); - } - } - return NULL; + case PT_WORKGRP: + return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1); + } + } + return NULL; } static LPWSTR _dbg_ILGetSTextPointerW(LPCITEMIDLIST pidl) { - LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl); + LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl); - if (pdata) - { - switch (pdata->type) - { - case PT_FOLDER: - case PT_VALUE: - case PT_IESPECIAL1: - case PT_IESPECIAL2: - /*return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1); */ - return NULL; + if (pdata) + { + switch (pdata->type) + { + case PT_FOLDER: + case PT_VALUE: + case PT_IESPECIAL1: + case PT_IESPECIAL2: + /*return (LPSTR)(pdata->u.file.szNames + strlen (pdata->u.file.szNames) + 1); */ + return NULL; - case PT_WORKGRP: - /* return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1); */ - return NULL; + case PT_WORKGRP: + /* return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames) + 1); */ + return NULL; - case PT_VALUEW: - return (LPWSTR)(pdata->u.file.szNames + wcslen ((LPWSTR)pdata->u.file.szNames) + 1); - } - } - return NULL; + case PT_VALUEW: + return (LPWSTR)(pdata->u.file.szNames + wcslen ((LPWSTR)pdata->u.file.szNames) + 1); + } + } + return NULL; } static IID* _dbg_ILGetGUIDPointer(LPCITEMIDLIST pidl) { - LPPIDLDATA pdata =_ILGetDataPointer(pidl); + LPPIDLDATA pdata =_ILGetDataPointer(pidl); - if (pdata) - { - switch (pdata->type) - { - case PT_SHELLEXT: - case PT_GUID: + if (pdata) + { + switch (pdata->type) + { + case PT_SHELLEXT: + case PT_GUID: case PT_YAGUID: - return &(pdata->u.guid.guid); - } - } - return NULL; + return &(pdata->u.guid.guid); + } + } + return NULL; } static void _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) { - LPSTR szSrc; - LPWSTR szSrcW; - GUID const * riid; + LPSTR szSrc; + LPWSTR szSrcW; + GUID const * riid; - if (!pidl) return; + if (!pidl) return; - if (szOut) - *szOut = 0; + if (szOut) + *szOut = 0; - if (_dbg_ILIsDesktop(pidl)) - { - /* desktop */ - if (szOut) lstrcpynA(szOut, "Desktop", uOutSize); - } - else if (( szSrc = _dbg_ILGetTextPointer(pidl) )) - { - /* filesystem */ - if (szOut) lstrcpynA(szOut, szSrc, uOutSize); - } - else if (( szSrcW = _dbg_ILGetTextPointerW(pidl) )) - { - CHAR tmp[MAX_PATH]; - /* unicode filesystem */ - WideCharToMultiByte(CP_ACP,0,szSrcW, -1, tmp, MAX_PATH, NULL, NULL); - if (szOut) lstrcpynA(szOut, tmp, uOutSize); - } - else if (( riid = _dbg_ILGetGUIDPointer(pidl) )) - { - if (szOut) + if (_dbg_ILIsDesktop(pidl)) + { + /* desktop */ + if (szOut) lstrcpynA(szOut, "Desktop", uOutSize); + } + else if (( szSrc = _dbg_ILGetTextPointer(pidl) )) + { + /* filesystem */ + if (szOut) lstrcpynA(szOut, szSrc, uOutSize); + } + else if (( szSrcW = _dbg_ILGetTextPointerW(pidl) )) + { + CHAR tmp[MAX_PATH]; + /* unicode filesystem */ + WideCharToMultiByte(CP_ACP,0,szSrcW, -1, tmp, MAX_PATH, NULL, NULL); + if (szOut) lstrcpynA(szOut, tmp, uOutSize); + } + else if (( riid = _dbg_ILGetGUIDPointer(pidl) )) + { + if (szOut) sprintf( szOut, "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}", riid->Data1, riid->Data2, riid->Data3, riid->Data4[0], riid->Data4[1], riid->Data4[2], riid->Data4[3], riid->Data4[4], riid->Data4[5], riid->Data4[6], riid->Data4[7] ); - } + } } @@ -247,21 +247,21 @@ void _dbg_ILSimpleGetText (LPCITEMIDLIST pidl, LPSTR szOut, UINT uOutSize) void pdump (LPCITEMIDLIST pidl) { - LPCITEMIDLIST pidltemp = pidl; + LPCITEMIDLIST pidltemp = pidl; - if (!TRACE_ON(pidl)) return; + if (!TRACE_ON(pidl)) return; - if (! pidltemp) - { - MESSAGE ("-------- pidl=NULL (Desktop)\n"); - } - else - { - MESSAGE ("-------- pidl=%p\n", pidl); - if (pidltemp->mkid.cb) - { - do - { + if (! pidltemp) + { + MESSAGE ("-------- pidl=NULL (Desktop)\n"); + } + else + { + MESSAGE ("-------- pidl=%p\n", pidl); + if (pidltemp->mkid.cb) + { + do + { if (_ILIsUnicode(pidltemp)) { DWORD dwAttrib = 0; @@ -297,16 +297,16 @@ void pdump (LPCITEMIDLIST pidl) debugstr_a(szName), debugstr_a(szLongName), debugstr_a(szShortName)); } - pidltemp = _dbg_ILGetNext(pidltemp); + pidltemp = _dbg_ILGetNext(pidltemp); - } while (pidltemp && pidltemp->mkid.cb); - } - else - { - MESSAGE ("empty pidl (Desktop)\n"); - } - pcheck(pidl); - } + } while (pidltemp && pidltemp->mkid.cb); + } + else + { + MESSAGE ("empty pidl (Desktop)\n"); + } + pcheck(pidl); + } } static void dump_pidl_hex( LPCITEMIDLIST pidl ) @@ -340,83 +340,92 @@ BOOL pcheck( LPCITEMIDLIST pidl ) while( pidltemp && pidltemp->mkid.cb ) { - type = _dbg_ILGetDataPointer(pidltemp)->type; - switch( type ) + LPPIDLDATA pidlData = _dbg_ILGetDataPointer(pidltemp); + + if (pidlData) + { + type = pidlData->type; + switch( type ) + { + case PT_CPLAPPLET: + case PT_GUID: + case PT_SHELLEXT: + case PT_DRIVE: + case PT_DRIVE1: + case PT_DRIVE2: + case PT_DRIVE3: + case PT_FOLDER: + case PT_VALUE: + case PT_VALUEW: + case PT_FOLDER1: + case PT_WORKGRP: + case PT_COMP: + case PT_NETPROVIDER: + case PT_NETWORK: + case PT_IESPECIAL1: + case PT_YAGUID: + case PT_IESPECIAL2: + case PT_SHARE: + break; + default: + ERR("unknown IDLIST %p [%p] size=%u type=%x\n", + pidl, pidltemp, pidltemp->mkid.cb,type ); + dump_pidl_hex( pidltemp ); + return FALSE; + } + pidltemp = _dbg_ILGetNext(pidltemp); + } + else { - case PT_CPLAPPLET: - case PT_GUID: - case PT_SHELLEXT: - case PT_DRIVE: - case PT_DRIVE1: - case PT_DRIVE2: - case PT_DRIVE3: - case PT_FOLDER: - case PT_VALUE: - case PT_VALUEW: - case PT_FOLDER1: - case PT_WORKGRP: - case PT_COMP: - case PT_NETPROVIDER: - case PT_NETWORK: - case PT_IESPECIAL1: - case PT_YAGUID: - case PT_IESPECIAL2: - case PT_SHARE: - break; - default: - ERR("unknown IDLIST %p [%p] size=%u type=%x\n", - pidl, pidltemp, pidltemp->mkid.cb,type ); - dump_pidl_hex( pidltemp ); return FALSE; } - pidltemp = _dbg_ILGetNext(pidltemp); } return TRUE; } static const struct { - REFIID riid; - const char *name; + REFIID riid; + const char *name; } InterfaceDesc[] = { - {IID_IUnknown, "IID_IUnknown"}, - {IID_IClassFactory, "IID_IClassFactory"}, - {IID_IShellView, "IID_IShellView"}, - {IID_IOleCommandTarget, "IID_IOleCommandTarget"}, - {IID_IDropTarget, "IID_IDropTarget"}, - {IID_IDropSource, "IID_IDropSource"}, - {IID_IViewObject, "IID_IViewObject"}, - {IID_IContextMenu, "IID_IContextMenu"}, - {IID_IShellExtInit, "IID_IShellExtInit"}, - {IID_IShellFolder, "IID_IShellFolder"}, - {IID_IShellFolder2, "IID_IShellFolder2"}, - {IID_IPersist, "IID_IPersist"}, - {IID_IPersistFolder, "IID_IPersistFolder"}, - {IID_IPersistFolder2, "IID_IPersistFolder2"}, - {IID_IPersistFolder3, "IID_IPersistFolder3"}, - {IID_IExtractIconA, "IID_IExtractIconA"}, - {IID_IExtractIconW, "IID_IExtractIconW"}, - {IID_IDataObject, "IID_IDataObject"}, - {IID_IAutoComplete, "IID_IAutoComplete"}, - {IID_IAutoComplete2, "IID_IAutoComplete2"}, + {IID_IUnknown, "IID_IUnknown"}, + {IID_IClassFactory, "IID_IClassFactory"}, + {IID_IShellView, "IID_IShellView"}, + {IID_IOleCommandTarget, "IID_IOleCommandTarget"}, + {IID_IDropTarget, "IID_IDropTarget"}, + {IID_IDropSource, "IID_IDropSource"}, + {IID_IViewObject, "IID_IViewObject"}, + {IID_IContextMenu, "IID_IContextMenu"}, + {IID_IShellExtInit, "IID_IShellExtInit"}, + {IID_IShellFolder, "IID_IShellFolder"}, + {IID_IShellFolder2, "IID_IShellFolder2"}, + {IID_IPersist, "IID_IPersist"}, + {IID_IPersistFolder, "IID_IPersistFolder"}, + {IID_IPersistFolder2, "IID_IPersistFolder2"}, + {IID_IPersistFolder3, "IID_IPersistFolder3"}, + {IID_IExtractIconA, "IID_IExtractIconA"}, + {IID_IExtractIconW, "IID_IExtractIconW"}, + {IID_IDataObject, "IID_IDataObject"}, + {IID_IAutoComplete, "IID_IAutoComplete"}, + {IID_IAutoComplete2, "IID_IAutoComplete2"}, {IID_IShellLinkA, "IID_IShellLinkA"}, {IID_IShellLinkW, "IID_IShellLinkW"}, - }; + }; const char * shdebugstr_guid( const struct _GUID *id ) { - unsigned int i; - const char* name = NULL; - char clsidbuf[100]; + unsigned int i; + const char* name = NULL; + char clsidbuf[100]; - if (!id) return "(null)"; + if (!id) return "(null)"; - for (i=0; i < sizeof(InterfaceDesc) / sizeof(InterfaceDesc[0]); i++) { - if (IsEqualIID(InterfaceDesc[i].riid, *id)) name = InterfaceDesc[i].name; - } - if (!name) { - if (HCR_GetClassNameA(*id, clsidbuf, 100)) - name = clsidbuf; - } + for (i=0; i < sizeof(InterfaceDesc) / sizeof(InterfaceDesc[0]); i++) { + if (IsEqualIID(InterfaceDesc[i].riid, *id)) name = InterfaceDesc[i].name; + } + if (!name) { + if (HCR_GetClassNameA(*id, clsidbuf, 100)) + name = clsidbuf; + } return wine_dbg_sprintf( "\n\t{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x} (%s)", id->Data1, id->Data2, id->Data3, diff --git a/dll/win32/shell32/dialogs.cpp b/dll/win32/shell32/dialogs.cpp index 36ea5bf1a25..89e40644998 100644 --- a/dll/win32/shell32/dialogs.cpp +++ b/dll/win32/shell32/dialogs.cpp @@ -1,5 +1,5 @@ /* - * common shell dialogs + * common shell dialogs * * Copyright 2000 Juergen Schmied * @@ -22,14 +22,14 @@ typedef struct - { - HWND hwndOwner ; - HICON hIcon ; - LPCWSTR lpstrDirectory ; - LPCWSTR lpstrTitle ; - LPCWSTR lpstrDescription ; - UINT uFlags ; - } RUNFILEDLGPARAMS ; +{ + HWND hwndOwner ; + HICON hIcon ; + LPCWSTR lpstrDirectory ; + LPCWSTR lpstrTitle ; + LPCWSTR lpstrDescription ; + UINT uFlags ; +} RUNFILEDLGPARAMS ; typedef BOOL (WINAPI * LPFNOFN) (OPENFILENAMEW *) ; @@ -39,7 +39,7 @@ static void FillList (HWND, char *, BOOL) ; /************************************************************************* - * PickIconDlg [SHELL32.62] + * PickIconDlg [SHELL32.62] * */ @@ -261,17 +261,17 @@ BOOL WINAPI PickIconDlg( } /************************************************************************* - * RunFileDlg [internal] + * RunFileDlg [internal] * * The Unicode function that is available as ordinal 61 on Windows NT/2000/XP/... */ void WINAPI RunFileDlg( - HWND hwndOwner, - HICON hIcon, - LPCWSTR lpstrDirectory, - LPCWSTR lpstrTitle, - LPCWSTR lpstrDescription, - UINT uFlags) + HWND hwndOwner, + HICON hIcon, + LPCWSTR lpstrDirectory, + LPCWSTR lpstrTitle, + LPCWSTR lpstrDescription, + UINT uFlags) { static const WCHAR resnameW[] = {'S','H','E','L','L','_','R','U','N','_','D','L','G',0}; RUNFILEDLGPARAMS rfdp; @@ -295,7 +295,7 @@ void WINAPI RunFileDlg( } DialogBoxIndirectParamW(shell32_hInstance, - (LPCDLGTEMPLATEW)tmplate, hwndOwner, RunDlgProc, (LPARAM)&rfdp); + (LPCDLGTEMPLATEW)tmplate, hwndOwner, RunDlgProc, (LPARAM)&rfdp); } @@ -309,6 +309,12 @@ static LPWSTR RunDlg_GetParentDir(LPCWSTR cmdline) result = (WCHAR *)HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR)*(strlenW(cmdline)+5)); + if (NULL == result) + { + TRACE("HeapAlloc couldn't allocate %d bytes\n", sizeof(WCHAR)*(strlenW(cmdline)+5)); + return NULL; + } + src = cmdline; dest = result; @@ -391,50 +397,54 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR case WM_COMMAND : switch (LOWORD (wParam)) - { + { case IDOK : - { + { int ic ; HWND htxt = GetDlgItem (hwnd, IDC_RUNDLG_EDITPATH); if ((ic = GetWindowTextLengthW (htxt))) - { + { WCHAR *psz, *parent=NULL ; SHELLEXECUTEINFOW sei ; ZeroMemory (&sei, sizeof(sei)) ; sei.cbSize = sizeof(sei) ; psz = (WCHAR *)HeapAlloc( GetProcessHeap(), 0, (ic + 1)*sizeof(WCHAR) ); - GetWindowTextW (htxt, psz, ic + 1) ; - /* according to http://www.codeproject.com/KB/shell/runfiledlg.aspx we should send a - * WM_NOTIFY before execution */ - - sei.hwnd = hwnd; - sei.nShow = SW_SHOWNORMAL; - sei.lpFile = psz; - - if (prfdp->lpstrDirectory) - sei.lpDirectory = prfdp->lpstrDirectory; - else - sei.lpDirectory = parent = RunDlg_GetParentDir(sei.lpFile); - - if (!ShellExecuteExW( &sei )) + if (psz) { + GetWindowTextW (htxt, psz, ic + 1) ; + + /* according to http://www.codeproject.com/KB/shell/runfiledlg.aspx we should send a + * WM_NOTIFY before execution */ + + sei.hwnd = hwnd; + sei.nShow = SW_SHOWNORMAL; + sei.lpFile = psz; + + if (prfdp->lpstrDirectory) + sei.lpDirectory = prfdp->lpstrDirectory; + else + sei.lpDirectory = parent = RunDlg_GetParentDir(sei.lpFile); + + if (!ShellExecuteExW( &sei )) + { + HeapFree(GetProcessHeap(), 0, psz); + HeapFree(GetProcessHeap(), 0, parent); + SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; + return TRUE ; + } + + /* FillList is still ANSI */ + GetWindowTextA (htxt, (LPSTR)psz, ic + 1) ; + FillList (htxt, (LPSTR)psz, FALSE) ; + HeapFree(GetProcessHeap(), 0, psz); HeapFree(GetProcessHeap(), 0, parent); - SendMessageA (htxt, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; - return TRUE ; - } - - /* FillList is still ANSI */ - GetWindowTextA (htxt, (LPSTR)psz, ic + 1) ; - FillList (htxt, (LPSTR)psz, FALSE) ; - - HeapFree(GetProcessHeap(), 0, psz); - HeapFree(GetProcessHeap(), 0, parent); - EndDialog (hwnd, 0); + EndDialog (hwnd, 0); } } + } case IDCANCEL : EndDialog (hwnd, 0) ; @@ -491,7 +501,7 @@ static INT_PTR CALLBACK RunDlgProc (HWND hwnd, UINT message, WPARAM wParam, LPAR /* This grabs the MRU list from the registry and fills the combo for the "Run" dialog above */ /* fShowDefault ignored if pszLatest != NULL */ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault) - { +{ HKEY hkey ; /* char szDbgMsg[256] = "" ; */ char *pszList = NULL, *pszCmd = NULL, cMatch = 0, cMax = 0x60, szIndex[2] = "-" ; @@ -508,20 +518,28 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault) RegQueryValueExA (hkey, "MRUList", NULL, NULL, NULL, &icList) ; if (icList > 0) - { + { pszList = (char *)HeapAlloc( GetProcessHeap(), 0, icList) ; - if (ERROR_SUCCESS != RegQueryValueExA (hkey, "MRUList", NULL, NULL, (LPBYTE)pszList, &icList)) - MessageBoxA (hCb, "Unable to grab MRUList !", "Nix", MB_OK) ; - } - else + + if (pszList) { + if (ERROR_SUCCESS != RegQueryValueExA (hkey, "MRUList", NULL, NULL, (LPBYTE)pszList, &icList)) + MessageBoxA (hCb, "Unable to grab MRUList !", "Nix", MB_OK); + } + else + { + TRACE("HeapAlloc failed to allocate %d bytes\n", icList); + } + } + else + { icList = 1 ; pszList = (char *)HeapAlloc( GetProcessHeap(), 0, icList) ; pszList[0] = 0 ; - } + } for (Nix = 0 ; Nix < icList - 1 ; Nix++) - { + { if (pszList[Nix] > cMax) cMax = pszList[Nix] ; @@ -537,9 +555,9 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault) MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK) ; if (NULL != pszLatest) - { + { if (!lstrcmpiA(pszCmd, pszLatest)) - { + { /* sprintf (szDbgMsg, "Found existing (%d).\n", Nix) ; MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ; @@ -552,25 +570,24 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault) memmove (&pszList[1], pszList, Nix) ; pszList[0] = cMatch ; continue ; - } } + } if (26 != icList - 1 || icList - 2 != Nix || cMatch || NULL == pszLatest) - { + { /* sprintf (szDbgMsg, "Happily appending (%d).\n", Nix) ; MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ; */ SendMessageA (hCb, CB_ADDSTRING, 0, (LPARAM)pszCmd) ; if (!Nix && fShowDefault) - { + { SetWindowTextA (hCb, pszCmd) ; SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; - } - } + } else - { + { /* sprintf (szDbgMsg, "Doing loop thing.\n") ; MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ; @@ -584,11 +601,11 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault) pszList[0] = cMatch ; szIndex[0] = cMatch ; RegSetValueExA (hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, strlen (pszLatest) + 1) ; - } } + } if (!cMatch && NULL != pszLatest) - { + { /* sprintf (szDbgMsg, "Simply inserting (increasing list).\n") ; MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ; @@ -598,25 +615,33 @@ static void FillList (HWND hCb, char *pszLatest, BOOL fShowDefault) SendMessageA (hCb, CB_SETEDITSEL, 0, MAKELPARAM (0, -1)) ; cMatch = ++cMax ; - if( pszList ) + if (pszList) pszList = (char *)HeapReAlloc(GetProcessHeap(), 0, pszList, ++icList) ; else pszList = (char *)HeapAlloc(GetProcessHeap(), 0, ++icList) ; - memmove (&pszList[1], pszList, icList - 1) ; - pszList[0] = cMatch ; - szIndex[0] = cMatch ; - RegSetValueExA (hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, strlen (pszLatest) + 1) ; + + if (pszList) + { + memmove (&pszList[1], pszList, icList - 1) ; + pszList[0] = cMatch ; + szIndex[0] = cMatch ; + RegSetValueExA (hkey, szIndex, 0, REG_SZ, (LPBYTE)pszLatest, strlen (pszLatest) + 1) ; } + else + { + TRACE("HeapAlloc or HeapReAlloc failed to allocate enough bytes\n"); + } + } RegSetValueExA (hkey, "MRUList", 0, REG_SZ, (LPBYTE)pszList, strlen (pszList) + 1) ; HeapFree( GetProcessHeap(), 0, pszCmd) ; HeapFree( GetProcessHeap(), 0, pszList) ; - } +} /************************************************************************* - * ConfirmDialog [internal] + * ConfirmDialog [internal] * * Put up a confirm box, return TRUE if the user confirmed */ @@ -632,7 +657,7 @@ static BOOL ConfirmDialog(HWND hWndOwner, UINT PromptId, UINT TitleId) /************************************************************************* - * RestartDialogEx [SHELL32.730] + * RestartDialogEx [SHELL32.730] */ int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD uReason) @@ -675,7 +700,7 @@ EXTERN_C int WINAPI LogoffWindowsDialog(HWND hWndOwner) /************************************************************************* - * RestartDialog [SHELL32.59] + * RestartDialog [SHELL32.59] */ int WINAPI RestartDialog(HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags) @@ -685,7 +710,7 @@ int WINAPI RestartDialog(HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags) /************************************************************************* - * ExitWindowsDialog [SHELL32.60] + * ExitWindowsDialog [SHELL32.60] * * NOTES * exported by ordinal diff --git a/dll/win32/shell32/enumidlist.cpp b/dll/win32/shell32/enumidlist.cpp index 916d7562353..e44d0b22b6e 100644 --- a/dll/win32/shell32/enumidlist.cpp +++ b/dll/win32/shell32/enumidlist.cpp @@ -1,7 +1,7 @@ /* - * IEnumIDList + * IEnumIDList * - * Copyright 1998 Juergen Schmied + * Copyright 1998 Juergen Schmied * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -24,9 +24,9 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); IEnumIDListImpl::IEnumIDListImpl() { - mpFirst = NULL; - mpLast = NULL; - mpCurrent = NULL; + mpFirst = NULL; + mpLast = NULL; + mpCurrent = NULL; } IEnumIDListImpl::~IEnumIDListImpl() @@ -38,39 +38,39 @@ IEnumIDListImpl::~IEnumIDListImpl() */ BOOL IEnumIDListImpl::AddToEnumList(LPITEMIDLIST pidl) { - ENUMLIST *pNew; + ENUMLIST *pNew; - TRACE("(%p)->(pidl=%p)\n", this, pidl); + TRACE("(%p)->(pidl=%p)\n", this, pidl); - if (!pidl) - return FALSE; + if (!pidl) + return FALSE; - pNew = (ENUMLIST *)SHAlloc(sizeof(ENUMLIST)); - if (pNew) - { - /*set the next pointer */ - pNew->pNext = NULL; - pNew->pidl = pidl; + pNew = (ENUMLIST *)SHAlloc(sizeof(ENUMLIST)); + if (pNew) + { + /*set the next pointer */ + pNew->pNext = NULL; + pNew->pidl = pidl; - /*is This the first item in the list? */ - if (!mpFirst) - { - mpFirst = pNew; - mpCurrent = pNew; - } + /*is This the first item in the list? */ + if (!mpFirst) + { + mpFirst = pNew; + mpCurrent = pNew; + } - if (mpLast) - { - /*add the new item to the end of the list */ - mpLast->pNext = pNew; - } + if (mpLast) + { + /*add the new item to the end of the list */ + mpLast->pNext = pNew; + } - /*update the last item pointer */ - mpLast = pNew; - TRACE("-- (%p)->(first=%p, last=%p)\n", this, mpFirst, mpLast); - return TRUE; - } - return FALSE; + /*update the last item pointer */ + mpLast = pNew; + TRACE("-- (%p)->(first=%p, last=%p)\n", this, mpFirst, mpLast); + return TRUE; + } + return FALSE; } /************************************************************************** @@ -78,21 +78,21 @@ BOOL IEnumIDListImpl::AddToEnumList(LPITEMIDLIST pidl) */ BOOL IEnumIDListImpl::DeleteList() { - ENUMLIST *pDelete; + ENUMLIST *pDelete; - TRACE("(%p)->()\n", this); + TRACE("(%p)->()\n", this); - while (mpFirst) - { - pDelete = mpFirst; - mpFirst = pDelete->pNext; - SHFree(pDelete->pidl); - SHFree(pDelete); - } - mpFirst = NULL; - mpLast = NULL; - mpCurrent = NULL; - return TRUE; + while (mpFirst) + { + pDelete = mpFirst; + mpFirst = pDelete->pNext; + SHFree(pDelete->pidl); + SHFree(pDelete); + } + mpFirst = NULL; + mpLast = NULL; + mpCurrent = NULL; + return TRUE; } /************************************************************************** @@ -100,20 +100,25 @@ BOOL IEnumIDListImpl::DeleteList() */ BOOL IEnumIDListImpl::HasItemWithCLSID(LPITEMIDLIST pidl) { - ENUMLIST *pCur; - REFIID refid = *_ILGetGUIDPointer(pidl); + ENUMLIST *pCur; + IID *ptr = _ILGetGUIDPointer(pidl); - pCur = mpFirst; - - while(pCur) + if (ptr) { - LPGUID curid = _ILGetGUIDPointer(pCur->pidl); - if (curid && IsEqualGUID(*curid, refid)) + REFIID refid = *ptr; + pCur = mpFirst; + + while(pCur) { - return TRUE; + LPGUID curid = _ILGetGUIDPointer(pCur->pidl); + if (curid && IsEqualGUID(*curid, refid)) + { + return TRUE; + } + pCur = pCur->pNext; } - pCur = pCur->pNext; } + return FALSE; } @@ -122,8 +127,8 @@ BOOL IEnumIDListImpl::HasItemWithCLSID(LPITEMIDLIST pidl) * CreateFolderEnumList() */ BOOL IEnumIDListImpl::CreateFolderEnumList( - LPCWSTR lpszPath, - DWORD dwFlags) + LPCWSTR lpszPath, + DWORD dwFlags) { LPITEMIDLIST pidl=NULL; WIN32_FIND_DATAW stffile; @@ -179,6 +184,7 @@ BOOL IEnumIDListImpl::CreateFolderEnumList( } while (succeeded && !findFinished); FindClose(hFile); } + return succeeded; } @@ -187,66 +193,66 @@ BOOL IEnumIDListImpl::CreateFolderEnumList( */ HRESULT WINAPI IEnumIDListImpl::Next( - ULONG celt, - LPITEMIDLIST * rgelt, - ULONG *pceltFetched) + ULONG celt, + LPITEMIDLIST * rgelt, + ULONG *pceltFetched) { - ULONG i; - HRESULT hr = S_OK; - LPITEMIDLIST temp; + ULONG i; + HRESULT hr = S_OK; + LPITEMIDLIST temp; - TRACE("(%p)->(%d,%p, %p)\n", this, celt, rgelt, pceltFetched); + TRACE("(%p)->(%d,%p, %p)\n", this, celt, rgelt, pceltFetched); /* It is valid to leave pceltFetched NULL when celt is 1. Some of explorer's * subsystems actually use it (and so may a third party browser) */ - if(pceltFetched) - *pceltFetched = 0; + if(pceltFetched) + *pceltFetched = 0; - *rgelt=0; + *rgelt=0; - if(celt > 1 && !pceltFetched) - { return E_INVALIDARG; - } + if(celt > 1 && !pceltFetched) + { return E_INVALIDARG; + } - if(celt > 0 && !mpCurrent) - { return S_FALSE; - } + if(celt > 0 && !mpCurrent) + { return S_FALSE; + } - for(i = 0; i < celt; i++) - { if(!mpCurrent) - break; + for(i = 0; i < celt; i++) + { if(!mpCurrent) + break; - temp = ILClone(mpCurrent->pidl); - rgelt[i] = temp; - mpCurrent = mpCurrent->pNext; - } - if(pceltFetched) - { *pceltFetched = i; - } + temp = ILClone(mpCurrent->pidl); + rgelt[i] = temp; + mpCurrent = mpCurrent->pNext; + } + if(pceltFetched) + { *pceltFetched = i; + } - return hr; + return hr; } /************************************************************************** * IEnumIDList_fnSkip */ HRESULT WINAPI IEnumIDListImpl::Skip( - ULONG celt) + ULONG celt) { - DWORD dwIndex; - HRESULT hr = S_OK; + DWORD dwIndex; + HRESULT hr = S_OK; - TRACE("(%p)->(%u)\n", this, celt); + TRACE("(%p)->(%u)\n", this, celt); - for(dwIndex = 0; dwIndex < celt; dwIndex++) - { if(!mpCurrent) - { hr = S_FALSE; - break; - } - mpCurrent = mpCurrent->pNext; - } - return hr; + for(dwIndex = 0; dwIndex < celt; dwIndex++) + { if(!mpCurrent) + { hr = S_FALSE; + break; + } + mpCurrent = mpCurrent->pNext; + } + return hr; } /************************************************************************** @@ -254,9 +260,9 @@ HRESULT WINAPI IEnumIDListImpl::Skip( */ HRESULT WINAPI IEnumIDListImpl::Reset() { - TRACE("(%p)\n", this); - mpCurrent = mpFirst; - return S_OK; + TRACE("(%p)\n", this); + mpCurrent = mpFirst; + return S_OK; } /************************************************************************** @@ -264,8 +270,8 @@ HRESULT WINAPI IEnumIDListImpl::Reset() */ HRESULT WINAPI IEnumIDListImpl::Clone(LPENUMIDLIST *ppenum) { - TRACE("(%p)->() to (%p)->() E_NOTIMPL\n", this, ppenum); - return E_NOTIMPL; + TRACE("(%p)->() to (%p)->() E_NOTIMPL\n", this, ppenum); + return E_NOTIMPL; } /************************************************************************** @@ -274,22 +280,22 @@ HRESULT WINAPI IEnumIDListImpl::Clone(LPENUMIDLIST *ppenum) */ HRESULT IEnumIDList_Constructor(IEnumIDList **enumerator) { - CComObject *theEnumerator; - CComPtr result; - HRESULT hResult; + CComObject *theEnumerator; + CComPtr result; + HRESULT hResult; - if (enumerator == NULL) - return E_POINTER; - *enumerator = NULL; - ATLTRY (theEnumerator = new CComObject); - if (theEnumerator == NULL) - return E_OUTOFMEMORY; - hResult = theEnumerator->QueryInterface (IID_IEnumIDList, (void **)&result); - if (FAILED (hResult)) - { - delete theEnumerator; - return hResult; - } - *enumerator = result.Detach (); - return S_OK; + if (enumerator == NULL) + return E_POINTER; + *enumerator = NULL; + ATLTRY (theEnumerator = new CComObject); + if (theEnumerator == NULL) + return E_OUTOFMEMORY; + hResult = theEnumerator->QueryInterface (IID_IEnumIDList, (void **)&result); + if (FAILED (hResult)) + { + delete theEnumerator; + return hResult; + } + *enumerator = result.Detach (); + return S_OK; } diff --git a/dll/win32/shell32/shfldr_mycomp.cpp b/dll/win32/shell32/shfldr_mycomp.cpp index a294f2ccd16..b2f58798006 100644 --- a/dll/win32/shell32/shfldr_mycomp.cpp +++ b/dll/win32/shell32/shfldr_mycomp.cpp @@ -77,6 +77,8 @@ CDrivesFolderEnum::~CDrivesFolderEnum() HRESULT WINAPI CDrivesFolderEnum::Initialize(HWND hwndOwner, DWORD dwFlags) { + DbgPrint("[shell32, CDrivesFolderEnum::Initialize] Called with flags = %d\n", dwFlags); + if (CreateMyCompEnumList(dwFlags) == FALSE) return E_FAIL; return S_OK; @@ -97,6 +99,8 @@ BOOL CDrivesFolderEnum::CreateMyCompEnumList(DWORD dwFlags) TRACE("(%p)->(flags=0x%08x)\n", this, dwFlags); + DbgPrint("[shell32, CDrivesFolderEnum::CreateMyCompEnumList] Called with flags = %d\n", dwFlags); + /* enumerate the folders */ if (dwFlags & SHCONTF_FOLDERS) { @@ -114,7 +118,8 @@ BOOL CDrivesFolderEnum::CreateMyCompEnumList(DWORD dwFlags) } TRACE("-- (%p)-> enumerate (mycomputer shell extensions)\n", this); - for (i=0; i<2; i++) { + for (i=0; i<2; i++) + { if (ret && !RegOpenKeyExW(i == 0 ? HKEY_LOCAL_MACHINE : HKEY_CURRENT_USER, MyComputer_NameSpaceW, 0, KEY_READ, &hkey)) { @@ -255,19 +260,27 @@ HRESULT WINAPI CDrivesFolder::EnumObjects (HWND hwndOwner, DWORD dwFlags, LPENUM TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner, dwFlags, ppEnumIDList); + DbgPrint("[shell32, CDrivesFolder::EnumObjects] Called with flags = %d\n", dwFlags); + if (ppEnumIDList == NULL) return E_POINTER; - *ppEnumIDList = NULL; + + *ppEnumIDList = NULL; ATLTRY (theEnumerator = new CComObject); - if (theEnumerator == NULL) + + if (theEnumerator == NULL) return E_OUTOFMEMORY; - hResult = theEnumerator->QueryInterface (IID_IEnumIDList, (void **)&result); + + hResult = theEnumerator->QueryInterface (IID_IEnumIDList, (void **)&result); if (FAILED (hResult)) { delete theEnumerator; return hResult; } - hResult = theEnumerator->Initialize (hwndOwner, dwFlags); + + DbgPrint("[shell32, CDrivesFolder::EnumObjects] Calling theEnumerator->Initialize\n"); + + hResult = theEnumerator->Initialize (hwndOwner, dwFlags); if (FAILED (hResult)) return hResult; *ppEnumIDList = result.Detach (); diff --git a/dll/win32/shell32/shfldr_printers.cpp b/dll/win32/shell32/shfldr_printers.cpp index f846c72ec82..05650aa716f 100644 --- a/dll/win32/shell32/shfldr_printers.cpp +++ b/dll/win32/shell32/shfldr_printers.cpp @@ -29,28 +29,28 @@ WINE_DEFAULT_DEBUG_CHANNEL (shell); * Printers_IExtractIconW implementation */ class IExtractIconWImpl : - public CComObjectRootEx, - public IExtractIconW, - public IExtractIconA + public CComObjectRootEx, + public IExtractIconW, + public IExtractIconA { private: - LPITEMIDLIST pidl; + LPITEMIDLIST pidl; public: - IExtractIconWImpl(); - ~IExtractIconWImpl(); - HRESULT WINAPI Initialize(LPCITEMIDLIST pidl); + IExtractIconWImpl(); + ~IExtractIconWImpl(); + HRESULT WINAPI Initialize(LPCITEMIDLIST pidl); - // IExtractIconW + // IExtractIconW virtual HRESULT STDMETHODCALLTYPE GetIconLocation(UINT uFlags, LPWSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags); virtual HRESULT STDMETHODCALLTYPE Extract(LPCWSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize); - // IExtractIconA + // IExtractIconA virtual HRESULT STDMETHODCALLTYPE GetIconLocation(UINT uFlags, LPSTR szIconFile, UINT cchMax, int *piIndex, UINT *pwFlags); virtual HRESULT STDMETHODCALLTYPE Extract(LPCSTR pszFile, UINT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIconSize); BEGIN_COM_MAP(IExtractIconWImpl) - COM_INTERFACE_ENTRY_IID(IID_IExtractIconW, IExtractIconW) - COM_INTERFACE_ENTRY_IID(IID_IExtractIconA, IExtractIconA) + COM_INTERFACE_ENTRY_IID(IID_IExtractIconW, IExtractIconW) + COM_INTERFACE_ENTRY_IID(IID_IExtractIconA, IExtractIconA) END_COM_MAP() }; @@ -75,7 +75,7 @@ static shvheader PrinterSFHeader[] = { IExtractIconWImpl::IExtractIconWImpl() { - pidl = NULL; + pidl = NULL; } IExtractIconWImpl::~IExtractIconWImpl() @@ -89,7 +89,7 @@ HRESULT WINAPI IExtractIconWImpl::Initialize(LPCITEMIDLIST pidl) pidl = ILClone(pidl); pdump(pidl); - return S_OK; + return S_OK; } /************************************************************************** @@ -97,11 +97,11 @@ HRESULT WINAPI IExtractIconWImpl::Initialize(LPCITEMIDLIST pidl) * * mapping filetype to icon */ -HRESULT WINAPI IExtractIconWImpl::GetIconLocation(UINT uFlags, /* GIL_ flags */ +HRESULT WINAPI IExtractIconWImpl::GetIconLocation(UINT uFlags, /* GIL_ flags */ LPWSTR szIconFile, UINT cchMax, int *piIndex, - UINT *pwFlags) /* returned GIL_ flags */ + UINT *pwFlags) /* returned GIL_ flags */ { TRACE("(%p) (flags=%u %p %u %p %p)\n", this, uFlags, szIconFile, cchMax, piIndex, pwFlags); @@ -142,10 +142,10 @@ HRESULT WINAPI IExtractIconWImpl::Extract(LPCWSTR pszFile, * IExtractIconA_GetIconLocation */ HRESULT WINAPI IExtractIconWImpl::GetIconLocation(UINT uFlags, - LPSTR szIconFile, - UINT cchMax, - int * piIndex, - UINT * pwFlags) + LPSTR szIconFile, + UINT cchMax, + int * piIndex, + UINT * pwFlags) { HRESULT ret; LPWSTR lpwstrFile = (LPWSTR)HeapAlloc(GetProcessHeap(), 0, cchMax * sizeof(WCHAR)); @@ -183,27 +183,27 @@ HRESULT WINAPI IExtractIconWImpl::Extract(LPCSTR pszFile, */ static HRESULT WINAPI IEI_Printers_Constructor(LPCITEMIDLIST pidl, REFIID riid, IUnknown **ppv) { - CComObject *theExtractor; - CComPtr result; - HRESULT hResult; + CComObject *theExtractor; + CComPtr result; + HRESULT hResult; - if (ppv == NULL) - return E_POINTER; - *ppv = NULL; - ATLTRY (theExtractor = new CComObject); - if (theExtractor == NULL) - return E_OUTOFMEMORY; - hResult = theExtractor->QueryInterface (riid, (void **)&result); - if (FAILED (hResult)) - { - delete theExtractor; - return hResult; - } - hResult = theExtractor->Initialize (pidl); - if (FAILED (hResult)) - return hResult; - *ppv = result.Detach (); - return S_OK; + if (ppv == NULL) + return E_POINTER; + *ppv = NULL; + ATLTRY (theExtractor = new CComObject); + if (theExtractor == NULL) + return E_OUTOFMEMORY; + hResult = theExtractor->QueryInterface (riid, (void **)&result); + if (FAILED (hResult)) + { + delete theExtractor; + return hResult; + } + hResult = theExtractor->Initialize (pidl); + if (FAILED (hResult)) + return hResult; + *ppv = result.Detach (); + return S_OK; } /*********************************************************************** @@ -211,17 +211,17 @@ static HRESULT WINAPI IEI_Printers_Constructor(LPCITEMIDLIST pidl, REFIID riid, */ class CPrintersEnum : - public IEnumIDListImpl + public IEnumIDListImpl { private: public: - CPrintersEnum(); - ~CPrintersEnum(); - HRESULT WINAPI Initialize(HWND hwndOwner, DWORD dwFlags); - BOOL CreatePrintersEnumList(DWORD dwFlags); + CPrintersEnum(); + ~CPrintersEnum(); + HRESULT WINAPI Initialize(HWND hwndOwner, DWORD dwFlags); + BOOL CreatePrintersEnumList(DWORD dwFlags); BEGIN_COM_MAP(CPrintersEnum) - COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList) + COM_INTERFACE_ENTRY_IID(IID_IEnumIDList, IEnumIDList) END_COM_MAP() }; @@ -235,9 +235,9 @@ CPrintersEnum::~CPrintersEnum() HRESULT WINAPI CPrintersEnum::Initialize(HWND hwndOwner, DWORD dwFlags) { - if (CreatePrintersEnumList(dwFlags) == FALSE) - return E_FAIL; - return S_OK; + if (CreatePrintersEnumList(dwFlags) == FALSE) + return E_FAIL; + return S_OK; } static LPITEMIDLIST _ILCreatePrinterItem(PRINTER_INFO_4W *pi) @@ -327,6 +327,7 @@ CPrinterFolder::CPrinterFolder() { pidlRoot = NULL; dwAttributes = 0; + pclsid = NULL; } CPrinterFolder::~CPrinterFolder() @@ -339,9 +340,9 @@ CPrinterFolder::~CPrinterFolder() HRESULT WINAPI CPrinterFolder::FinalConstruct() { pidlRoot = _ILCreatePrinters(); /* my qualified pidl */ - if (pidlRoot == NULL) - return E_OUTOFMEMORY; - return S_OK; + if (pidlRoot == NULL) + return E_OUTOFMEMORY; + return S_OK; } /************************************************************************** @@ -378,32 +379,32 @@ static PIDLPrinterStruct * _ILGetPrinterStruct(LPCITEMIDLIST pidl) */ HRESULT WINAPI CPrinterFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST * ppEnumIDList) { - CComObject *theEnumerator; - CComPtr result; - HRESULT hResult; + CComObject *theEnumerator; + CComPtr result; + HRESULT hResult; - TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner, dwFlags, ppEnumIDList); + TRACE ("(%p)->(HWND=%p flags=0x%08x pplist=%p)\n", this, hwndOwner, dwFlags, ppEnumIDList); - if (ppEnumIDList == NULL) - return E_POINTER; - *ppEnumIDList = NULL; - ATLTRY (theEnumerator = new CComObject); - if (theEnumerator == NULL) - return E_OUTOFMEMORY; - hResult = theEnumerator->QueryInterface (IID_IEnumIDList, (void **)&result); - if (FAILED (hResult)) - { - delete theEnumerator; - return hResult; - } - hResult = theEnumerator->Initialize (hwndOwner, dwFlags); - if (FAILED (hResult)) - return hResult; - *ppEnumIDList = result.Detach (); + if (ppEnumIDList == NULL) + return E_POINTER; + *ppEnumIDList = NULL; + ATLTRY (theEnumerator = new CComObject); + if (theEnumerator == NULL) + return E_OUTOFMEMORY; + hResult = theEnumerator->QueryInterface (IID_IEnumIDList, (void **)&result); + if (FAILED (hResult)) + { + delete theEnumerator; + return hResult; + } + hResult = theEnumerator->Initialize (hwndOwner, dwFlags); + if (FAILED (hResult)) + return hResult; + *ppEnumIDList = result.Detach (); TRACE ("-- (%p)->(new ID List: %p)\n", this, *ppEnumIDList); - return S_OK; + return S_OK; } /************************************************************************** diff --git a/dll/win32/shell32/shlexec.cpp b/dll/win32/shell32/shlexec.cpp index 8d07adddfdc..4bf8164dfbf 100644 --- a/dll/win32/shell32/shlexec.cpp +++ b/dll/win32/shell32/shlexec.cpp @@ -20,6 +20,7 @@ */ #include +#include WINE_DEFAULT_DEBUG_CHANNEL(exec); diff --git a/dll/win32/shell32/shv_def_cmenu.cpp b/dll/win32/shell32/shv_def_cmenu.cpp index bf63742e8fc..3237f04d3a7 100644 --- a/dll/win32/shell32/shv_def_cmenu.cpp +++ b/dll/win32/shell32/shv_def_cmenu.cpp @@ -660,7 +660,7 @@ IDefaultContextMenuImpl::AddStaticContextMenusToMenu( } else { - TRACE("Failed to laod string, defaulting to default (NULL) value for mii.dwTypeData\n"); + TRACE("Failed to load string, defaulting to NULL value for mii.dwTypeData\n"); } } else diff --git a/dll/win32/shell32/shv_item_new.cpp b/dll/win32/shell32/shv_item_new.cpp index 39ebb770107..a6d82efb5a4 100644 --- a/dll/win32/shell32/shv_item_new.cpp +++ b/dll/win32/shell32/shv_item_new.cpp @@ -87,6 +87,21 @@ GetKeyDescription(LPWSTR szKeyName, LPWSTR szResult) return TRUE; } +void CNewMenu::UnloadItem(SHELLNEW_ITEM *item) +{ + // bail if the item is clearly invalid + if (NULL == item) + return; + + if (NULL != item->szTarget) + free(item->szTarget); + + free(item->szDesc); + free(item->szIcon); + free(item->szExt); + + HeapFree(GetProcessHeap(), 0, item); +} CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPWSTR szKeyName) { diff --git a/dll/win32/shell32/shv_item_new.h b/dll/win32/shell32/shv_item_new.h index 2bedc5bd60b..a8168419fd8 100644 --- a/dll/win32/shell32/shv_item_new.h +++ b/dll/win32/shell32/shv_item_new.h @@ -56,6 +56,7 @@ public: CNewMenu(); ~CNewMenu(); SHELLNEW_ITEM *LoadItem(LPWSTR szKeyName); + void UnloadItem(SHELLNEW_ITEM *item); BOOL LoadShellNewItems(); UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu); HRESULT DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi);