Author: cmihail
Date: Wed Sep 7 23:21:02 2011
New Revision: 53633
URL:
http://svn.reactos.org/svn/reactos?rev=53633&view=rev
Log:
[shell32.dll]
- Initialize uninitialized variables.
- Add code to guard against potential NULL pointer dereferencing.
Thanks to Amine Khaldi for pointing out all these.
Modified:
branches/shell32_new-bringup/dll/win32/shell32/autocomplete.cpp
branches/shell32_new-bringup/dll/win32/shell32/classes.cpp
branches/shell32_new-bringup/dll/win32/shell32/debughlp.cpp
branches/shell32_new-bringup/dll/win32/shell32/dialogs.cpp
branches/shell32_new-bringup/dll/win32/shell32/enumidlist.cpp
branches/shell32_new-bringup/dll/win32/shell32/shfldr_mycomp.cpp
branches/shell32_new-bringup/dll/win32/shell32/shfldr_printers.cpp
branches/shell32_new-bringup/dll/win32/shell32/shlexec.cpp
branches/shell32_new-bringup/dll/win32/shell32/shv_def_cmenu.cpp
branches/shell32_new-bringup/dll/win32/shell32/shv_item_new.cpp
branches/shell32_new-bringup/dll/win32/shell32/shv_item_new.h
Modified: branches/shell32_new-bringup/dll/win32/shell32/autocomplete.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/autocomplete.cpp [iso-8859-1]
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/autocomplete.cpp [iso-8859-1] Wed Sep
7 23:21:02 2011
@@ -1,8 +1,8 @@
/*
- * AutoComplete interfaces implementation.
+ * AutoComplete interfaces implementation.
*
- * Copyright 2004 Maxime Bellengé <maxime.bellenge(a)laposte.net>
- * Copyright 2009 Andrew Hill
+ * Copyright 2004 Maxime Bellengé <maxime.bellenge(a)laposte.net>
+ * 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 @@
*/
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()
{
- 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 @@
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 @@
if (options & ACO_RTLREADING)
FIXME(" ACO_RTLREADING not supported\n");
- hwndEdit = hwndEdit;
-
- if (!SUCCEEDED (punkACL->QueryInterface(IID_IEnumString, (LPVOID *)&enumstr)))
- {
- TRACE("No IEnumString interface\n");
- return E_NOINTERFACE;
+ hwndEdit = hwndEdit;
+
+ if (!SUCCEEDED (punkACL->QueryInterface(IID_IEnumString, (LPVOID
*)&enumstr)))
+ {
+ TRACE("No IEnumString interface\n");
+ return E_NOINTERFACE;
}
wpOrigEditProc = (WNDPROC)SetWindowLongPtrW(hwndEdit, GWLP_WNDPROC, (LONG_PTR)
ACEditSubclassProc);
@@ -118,65 +118,88 @@
if (options & ACO_AUTOSUGGEST)
{
- HWND hwndParent;
-
- 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);
+ HWND hwndParent;
+
+ 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);
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;
-
- /* 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<WCHAR *>(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)
- {
- /* 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);
+ 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));
+
+ if (key)
+ {
+ wcscpy(key, pwzsRegKeyPath);
+ value = const_cast<WCHAR *>(strrchrW(key, '\\'));
+
+ if (value)
+ {
+ *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 @@
*/
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 @@
switch (uMsg)
{
- case CB_SHOWDROPDOWN:
- {
- ShowWindow(pThis->hwndListBox, SW_HIDE);
+ case CB_SHOWDROPDOWN:
+ {
+ ShowWindow(pThis->hwndListBox, SW_HIDE);
}; break;
- case WM_KILLFOCUS:
- {
- if ((pThis->options & ACO_AUTOSUGGEST) && ((HWND)wParam !=
pThis->hwndListBox))
- {
- ShowWindow(pThis->hwndListBox, SW_HIDE);
- }
+ case WM_KILLFOCUS:
+ {
+ 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:
- {
- GetWindowTextW(hwnd, (LPWSTR)hwndText, 255);
-
- switch(wParam)
- {
- case VK_RETURN:
- {
- /* 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);
- }
-
- ShowWindow(pThis->hwndListBox, SW_HIDE);
- return 0;
+ case WM_KEYUP:
+ {
+ GetWindowTextW(hwnd, (LPWSTR)hwndText, 255);
+
+ switch(wParam)
+ {
+ case VK_RETURN:
+ {
+ /* 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);
+ }
+
+ ShowWindow(pThis->hwndListBox, SW_HIDE);
+ return 0;
}; break;
case VK_LEFT:
- case VK_RIGHT:
- {
- return 0;
+ case VK_RIGHT:
+ {
+ return 0;
}; break;
- 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;
- }
+ 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;
+ }
else
{
- if (IsWindowVisible(pThis->hwndListBox))
+ if (IsWindowVisible(pThis->hwndListBox))
{
- 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;
-
+ 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;
+
SendMessageW(pThis->hwndListBox, LB_SETCURSEL, sel, 0);
-
+
if (sel != -1)
{
- 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);
- }
+ WCHAR *msg;
+ int len;
+
+ 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:
- {
- if ((! *hwndText) && (pThis->options & ACO_AUTOSUGGEST))
- {
- ShowWindow(pThis->hwndListBox, SW_HIDE);
- return CallWindowProcW(pThis->wpOrigEditProc, hwnd, uMsg, wParam,
lParam);
- }
-
+ case VK_DELETE:
+ {
+ if ((! *hwndText) && (pThis->options &
ACO_AUTOSUGGEST))
+ {
+ 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);
-
- HeapFree(GetProcessHeap(), 0, pThis->txtbackup);
- pThis->txtbackup = (WCHAR *)HeapAlloc(GetProcessHeap(),
- HEAP_ZERO_MEMORY, (wcslen(hwndText)+1)*sizeof(WCHAR));
- wcscpy(pThis->txtbackup, hwndText);
-
- /* 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;
-
+ ;
+ }
+
+ 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));
+
+ 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;
-
- if ((LPWSTR)strstrW(strs, hwndText) == strs)
- {
-
- if (pThis->options & ACO_AUTOAPPEND)
- {
- SetWindowTextW(hwnd, strs);
- SendMessageW(hwnd, EM_SETSEL, wcslen(hwndText), wcslen(strs));
- break;
- }
-
- if (pThis->options & ACO_AUTOSUGGEST)
- {
- SendMessageW(pThis->hwndListBox, LB_ADDSTRING, 0, (LPARAM)strs);
- filled = TRUE;
- cpt++;
- }
- }
- }
-
- if (pThis->options & ACO_AUTOSUGGEST)
- {
- 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 );
- }
+ hr = pThis->enumstr->Next(1, &strs, NULL);
+ if (hr != S_OK)
+ break;
+
+ if ((LPWSTR)strstrW(strs, hwndText) == strs)
+ {
+
+ if (pThis->options & ACO_AUTOAPPEND)
+ {
+ SetWindowTextW(hwnd, strs);
+ SendMessageW(hwnd, EM_SETSEL, wcslen(hwndText), wcslen(strs));
+ break;
+ }
+
+ if (pThis->options & ACO_AUTOSUGGEST)
+ {
+ SendMessageW(pThis->hwndListBox, LB_ADDSTRING, 0,
(LPARAM)strs);
+ filled = TRUE;
+ cpt++;
+ }
+ }
+ }
+
+ if (pThis->options & ACO_AUTOSUGGEST)
+ {
+ 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 );
+ }
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 @@
switch (uMsg)
{
- case WM_MOUSEMOVE:
- {
- sel = SendMessageW(hwnd, LB_ITEMFROMPOINT, 0, lParam);
- SendMessageW(hwnd, LB_SETCURSEL, (WPARAM)sel, (LPARAM)0);
+ case WM_MOUSEMOVE:
+ {
+ 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;
}
Modified: branches/shell32_new-bringup/dll/win32/shell32/classes.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/classes.cpp [iso-8859-1] (original)
+++ branches/shell32_new-bringup/dll/win32/shell32/classes.cpp [iso-8859-1] Wed Sep 7
23:21:02 2011
@@ -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 @@
BOOL HCR_MapTypeToValueW(LPCWSTR szExtension, LPWSTR szFileType, LONG len, BOOL
bPrependDot)
{
- HKEY hkey;
- WCHAR szTemp[MAX_EXTENSION_LENGTH + 2];
-
- TRACE("%s %p\n", debugstr_w(szExtension), debugstr_w(szFileType));
+ HKEY hkey;
+ WCHAR szTemp[MAX_EXTENSION_LENGTH + 2];
+
+ 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] = '.';
-
- lstrcpynW(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH);
-
- if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey))
- {
- return FALSE;
- }
-
- if (RegQueryValueW(hkey, NULL, szFileType, &len))
- {
- RegCloseKey(hkey);
- return FALSE;
- }
-
- RegCloseKey(hkey);
-
- TRACE("--UE;\n} %s\n", debugstr_w(szFileType));
-
- return TRUE;
+ if (bPrependDot)
+ szTemp[0] = '.';
+
+ lstrcpynW(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH);
+
+ if (RegOpenKeyExW(HKEY_CLASSES_ROOT, szTemp, 0, KEY_READ, &hkey))
+ {
+ return FALSE;
+ }
+
+ if (RegQueryValueW(hkey, NULL, szFileType, &len))
+ {
+ RegCloseKey(hkey);
+ return FALSE;
+ }
+
+ RegCloseKey(hkey);
+
+ TRACE("--UE;\n} %s\n", debugstr_w(szFileType));
+
+ return TRUE;
}
BOOL HCR_MapTypeToValueA(LPCSTR szExtension, LPSTR szFileType, LONG len, BOOL
bPrependDot)
{
- HKEY hkey;
- char szTemp[MAX_EXTENSION_LENGTH + 2];
-
- TRACE("%s %p\n", szExtension, szFileType);
+ HKEY hkey;
+ char szTemp[MAX_EXTENSION_LENGTH + 2];
+
+ 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] = '.';
-
- lstrcpynA(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH);
-
- 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 (RegQueryValueA(hkey, NULL, szFileType, &len))
- {
- RegCloseKey(hkey);
- return FALSE;
- }
-
- RegCloseKey(hkey);
-
- TRACE("--UE;\n} %s\n", szFileType);
-
- return TRUE;
+ if (bPrependDot)
+ szTemp[0] = '.';
+
+ lstrcpynA(szTemp + (bPrependDot?1:0), szExtension, MAX_EXTENSION_LENGTH);
+
+ 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 (RegQueryValueA(hkey, NULL, szFileType, &len))
+ {
+ RegCloseKey(hkey);
+ return FALSE;
+ }
+
+ RegCloseKey(hkey);
+
+ TRACE("--UE;\n} %s\n", szFileType);
+
+ return TRUE;
}
static const WCHAR swShell[] =
{'s','h','e','l','l','\\',0};
@@ -164,12 +164,12 @@
BOOL HCR_GetExecuteCommandW( HKEY hkeyClass, LPCWSTR szClass, LPCWSTR szVerb, LPWSTR
szDest, DWORD len )
{
- WCHAR sTempVerb[MAX_PATH];
- BOOL ret;
-
- TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb),
szDest);
-
- if (szClass)
+ WCHAR sTempVerb[MAX_PATH];
+ BOOL ret;
+
+ TRACE("%p %s %s %p\n", hkeyClass, debugstr_w(szClass), debugstr_w(szVerb),
szDest);
+
+ if (szClass)
RegOpenKeyExW(HKEY_CLASSES_ROOT, szClass, 0, KEY_READ, &hkeyClass);
if (!hkeyClass)
return FALSE;
@@ -186,26 +186,26 @@
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 );
-
- return !RegOpenKeyExW(HKEY_CLASSES_ROOT, xriid, 0, KEY_READ, hkey);
+ TRACE("%S\n",xriid );
+
+ 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_RegGetDefaultIconA(HKEY hkey, LPSTR szDest, DWORD len, int* picon_idx)
{
- DWORD dwType;
- char sTemp[MAX_PATH];
- char sNum[5];
-
- if (!RegQueryValueExA(hkey, NULL, 0, &dwType, (LPBYTE)szDest, &len))
- {
+ DWORD dwType;
+ char sTemp[MAX_PATH];
+ char sNum[5];
+
+ 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;
-
- TRACE("%s\n",debugstr_w(szClass) );
-
- 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);
- }
+ HKEY hkey;
+ WCHAR sTemp[MAX_PATH];
+ BOOL ret = FALSE;
+
+ TRACE("%s\n",debugstr_w(szClass) );
+
+ 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(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;
-
- TRACE("%s\n",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;
+ HKEY hkey;
+ char sTemp[MAX_PATH];
+ BOOL ret = FALSE;
+
+ TRACE("%s\n",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;
}
BOOL HCR_GetDefaultIconFromGUIDW(REFIID riid, LPWSTR szDest, DWORD len, int* picon_idx)
{
- 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;
+ 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;
}
/***************************************************************************************
-* HCR_GetClassName [internal]
+* HCR_GetClassName [internal]
*
* Gets the name of a registered class
*/
@@ -324,107 +324,107 @@
BOOL HCR_GetClassNameW(REFIID riid, LPWSTR szDest, DWORD len)
{
- HKEY hkey;
- BOOL ret = FALSE;
- DWORD buflen = len;
- WCHAR szName[100];
- LPOLESTR pStr;
-
- 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))
- {
+ HKEY hkey;
+ BOOL ret = FALSE;
+ DWORD buflen = len;
+ WCHAR szName[100];
+ LPOLESTR pStr;
+
+ 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))
+ {
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);
- }
-
- 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;
+ 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;
+ }
+
+ }
+ 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;
-
- szDest[0] = 0;
- if (HCR_RegOpenClassIDKey(riid, &hkey))
- {
+{ HKEY hkey;
+ BOOL ret = FALSE;
+ DWORD buflen = len;
+
+ 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);
- }
-
- 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);
-
- return ret;
+ 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;
+ }
+ }
+
+ TRACE("-- %s\n", szDest);
+
+ return ret;
}
/******************************************************************************
@@ -476,8 +476,8 @@
dwLen = sizeof(DWORD);
lResult = RegQueryValueExW(hSFKey, wszCallForAttributes, 0, NULL,
(LPBYTE)&dwTemp, &dwLen);
if ((lResult == ERROR_SUCCESS) && (dwTemp & *pdwAttributes)) {
- CComPtr<IShellFolder> psfDesktop;
- CComPtr<IShellFolder> psfFolder;
+ CComPtr<IShellFolder> psfDesktop;
+ CComPtr<IShellFolder> psfFolder;
HRESULT hr;
RegCloseKey(hSFKey);
Modified: branches/shell32_new-bringup/dll/win32/shell32/debughlp.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/debughlp.cpp [iso-8859-1] (original)
+++ branches/shell32_new-bringup/dll/win32/shell32/debughlp.cpp [iso-8859-1] Wed Sep 7
23:21:02 2011
@@ -25,221 +25,221 @@
static
LPITEMIDLIST _dbg_ILGetNext(LPCITEMIDLIST pidl)
{
- WORD len;
-
- if(pidl)
- {
- len = pidl->mkid.cb;
- if (len)
- {
- return (LPITEMIDLIST) (((LPBYTE)pidl)+len);
- }
- }
- return NULL;
+ WORD len;
+
+ 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);
-
- 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_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;
+ LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl);
+
+ 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_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;
}
static
LPWSTR _dbg_ILGetTextPointerW(LPCITEMIDLIST pidl)
{
- LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl);
-
- 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_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_VALUEW:
- return (LPWSTR)&(pdata->u.file.szNames);
- }
- }
- return NULL;
+ LPPIDLDATA pdata =_dbg_ILGetDataPointer(pidl);
+
+ 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_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_VALUEW:
+ return (LPWSTR)&(pdata->u.file.szNames);
+ }
+ }
+ return NULL;
}
static
LPSTR _dbg_ILGetSTextPointer(LPCITEMIDLIST 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);
-
- case PT_WORKGRP:
- return (LPSTR)(pdata->u.network.szNames + strlen (pdata->u.network.szNames)
+ 1);
- }
- }
- return NULL;
+ 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);
+
+ 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);
-
- 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_VALUEW:
- return (LPWSTR)(pdata->u.file.szNames + wcslen
((LPWSTR)pdata->u.file.szNames) + 1);
- }
- }
- return NULL;
+ 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;
+
+ 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;
}
static
IID* _dbg_ILGetGUIDPointer(LPCITEMIDLIST pidl)
{
- LPPIDLDATA pdata =_ILGetDataPointer(pidl);
-
- if (pdata)
- {
- switch (pdata->type)
- {
- case PT_SHELLEXT:
- case PT_GUID:
+ LPPIDLDATA pdata =_ILGetDataPointer(pidl);
+
+ 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;
-
- if (!pidl) return;
-
- 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)
+ LPSTR szSrc;
+ LPWSTR szSrcW;
+ GUID const * riid;
+
+ if (!pidl) return;
+
+ 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)
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 pdump (LPCITEMIDLIST pidl)
{
- LPCITEMIDLIST pidltemp = pidl;
-
- if (!TRACE_ON(pidl)) return;
-
- if (! pidltemp)
- {
- MESSAGE ("-------- pidl=NULL (Desktop)\n");
- }
- else
- {
- MESSAGE ("-------- pidl=%p\n", pidl);
- if (pidltemp->mkid.cb)
- {
- do
- {
+ LPCITEMIDLIST pidltemp = pidl;
+
+ if (!TRACE_ON(pidl)) return;
+
+ 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 @@
debugstr_a(szName), debugstr_a(szLongName),
debugstr_a(szShortName));
}
- pidltemp = _dbg_ILGetNext(pidltemp);
-
- } while (pidltemp && pidltemp->mkid.cb);
- }
- else
- {
- MESSAGE ("empty pidl (Desktop)\n");
- }
- pcheck(pidl);
- }
+ pidltemp = _dbg_ILGetNext(pidltemp);
+
+ } while (pidltemp && pidltemp->mkid.cb);
+ }
+ else
+ {
+ MESSAGE ("empty pidl (Desktop)\n");
+ }
+ pcheck(pidl);
+ }
}
static void dump_pidl_hex( LPCITEMIDLIST pidl )
@@ -340,83 +340,92 @@
while( pidltemp && pidltemp->mkid.cb )
{
- type = _dbg_ILGetDataPointer(pidltemp)->type;
- switch( type )
+ LPPIDLDATA pidlData = _dbg_ILGetDataPointer(pidltemp);
+
+ if (pidlData)
{
- 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 );
+ 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
+ {
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];
-
- 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;
- }
+ unsigned int i;
+ const char* name = NULL;
+ char clsidbuf[100];
+
+ 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;
+ }
return wine_dbg_sprintf(
"\n\t{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x} (%s)",
id->Data1, id->Data2, id->Data3,
Modified: branches/shell32_new-bringup/dll/win32/shell32/dialogs.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/dialogs.cpp [iso-8859-1] (original)
+++ branches/shell32_new-bringup/dll/win32/shell32/dialogs.cpp [iso-8859-1] Wed Sep 7
23:21:02 2011
@@ -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 @@
/*************************************************************************
- * PickIconDlg [SHELL32.62]
+ * PickIconDlg [SHELL32.62]
*
*/
@@ -261,17 +261,17 @@
}
/*************************************************************************
- * 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 @@
}
DialogBoxIndirectParamW(shell32_hInstance,
- (LPCDLGTEMPLATEW)tmplate, hwndOwner, RunDlgProc, (LPARAM)&rfdp);
+ (LPCDLGTEMPLATEW)tmplate, hwndOwner, RunDlgProc, (LPARAM)&rfdp);
}
@@ -308,6 +308,12 @@
static const WCHAR dotexeW[] = {'.','e','x','e',0};
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 @@
case WM_COMMAND :
switch (LOWORD (wParam))
+ {
+ case IDOK :
{
- 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 @@
/* 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 @@
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) ;
- }
+
+ 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 @@
MessageBoxA (hCb, "Unable to grab index", "Nix", MB_OK)
;
if (NULL != pszLatest)
+ {
+ if (!lstrcmpiA(pszCmd, pszLatest))
{
- if (!lstrcmpiA(pszCmd, pszLatest))
- {
/*
sprintf (szDbgMsg, "Found existing (%d).\n", Nix) ;
MessageBoxA (hCb, szDbgMsg, "Nix", MB_OK) ;
@@ -552,25 +570,24 @@
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 @@
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 @@
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 @@
/*************************************************************************
- * RestartDialogEx [SHELL32.730]
+ * RestartDialogEx [SHELL32.730]
*/
int WINAPI RestartDialogEx(HWND hWndOwner, LPCWSTR lpwstrReason, DWORD uFlags, DWORD
uReason)
@@ -675,7 +700,7 @@
/*************************************************************************
- * RestartDialog [SHELL32.59]
+ * RestartDialog [SHELL32.59]
*/
int WINAPI RestartDialog(HWND hWndOwner, LPCWSTR lpstrReason, DWORD uFlags)
@@ -685,7 +710,7 @@
/*************************************************************************
- * ExitWindowsDialog [SHELL32.60]
+ * ExitWindowsDialog [SHELL32.60]
*
* NOTES
* exported by ordinal
Modified: branches/shell32_new-bringup/dll/win32/shell32/enumidlist.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/enumidlist.cpp [iso-8859-1] (original)
+++ branches/shell32_new-bringup/dll/win32/shell32/enumidlist.cpp [iso-8859-1] Wed Sep 7
23:21:02 2011
@@ -1,7 +1,7 @@
/*
- * IEnumIDList
- *
- * Copyright 1998 Juergen Schmied <juergen.schmied(a)metronet.de>
+ * IEnumIDList
+ *
+ * Copyright 1998 Juergen Schmied <juergen.schmied(a)metronet.de>
*
* 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 @@
IEnumIDListImpl::IEnumIDListImpl()
{
- mpFirst = NULL;
- mpLast = NULL;
- mpCurrent = NULL;
+ mpFirst = NULL;
+ mpLast = NULL;
+ mpCurrent = NULL;
}
IEnumIDListImpl::~IEnumIDListImpl()
@@ -38,39 +38,39 @@
*/
BOOL IEnumIDListImpl::AddToEnumList(LPITEMIDLIST pidl)
{
- ENUMLIST *pNew;
-
- TRACE("(%p)->(pidl=%p)\n", this, pidl);
-
- if (!pidl)
- return FALSE;
-
- 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;
- }
-
- 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;
+ ENUMLIST *pNew;
+
+ TRACE("(%p)->(pidl=%p)\n", this, pidl);
+
+ if (!pidl)
+ return FALSE;
+
+ 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;
+ }
+
+ 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;
}
/**************************************************************************
@@ -78,21 +78,21 @@
*/
BOOL IEnumIDListImpl::DeleteList()
{
- ENUMLIST *pDelete;
-
- TRACE("(%p)->()\n", this);
-
- while (mpFirst)
- {
- pDelete = mpFirst;
- mpFirst = pDelete->pNext;
- SHFree(pDelete->pidl);
- SHFree(pDelete);
- }
- mpFirst = NULL;
- mpLast = NULL;
- mpCurrent = NULL;
- return TRUE;
+ ENUMLIST *pDelete;
+
+ TRACE("(%p)->()\n", this);
+
+ 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::HasItemWithCLSID(LPITEMIDLIST pidl)
{
- ENUMLIST *pCur;
- REFIID refid = *_ILGetGUIDPointer(pidl);
-
- pCur = mpFirst;
-
- while(pCur)
- {
- LPGUID curid = _ILGetGUIDPointer(pCur->pidl);
- if (curid && IsEqualGUID(*curid, refid))
+ ENUMLIST *pCur;
+ IID *ptr = _ILGetGUIDPointer(pidl);
+
+ if (ptr)
+ {
+ 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 @@
* CreateFolderEnumList()
*/
BOOL IEnumIDListImpl::CreateFolderEnumList(
- LPCWSTR lpszPath,
- DWORD dwFlags)
+ LPCWSTR lpszPath,
+ DWORD dwFlags)
{
LPITEMIDLIST pidl=NULL;
WIN32_FIND_DATAW stffile;
@@ -179,6 +184,7 @@
} while (succeeded && !findFinished);
FindClose(hFile);
}
+
return succeeded;
}
@@ -187,66 +193,66 @@
*/
HRESULT WINAPI IEnumIDListImpl::Next(
- ULONG celt,
- LPITEMIDLIST * rgelt,
- ULONG *pceltFetched)
-{
- ULONG i;
- HRESULT hr = S_OK;
- LPITEMIDLIST temp;
-
- TRACE("(%p)->(%d,%p, %p)\n", this, celt, rgelt, pceltFetched);
+ ULONG celt,
+ LPITEMIDLIST * rgelt,
+ ULONG *pceltFetched)
+{
+ ULONG i;
+ HRESULT hr = S_OK;
+ LPITEMIDLIST temp;
+
+ 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;
-
- *rgelt=0;
-
- if(celt > 1 && !pceltFetched)
- { return E_INVALIDARG;
- }
-
- if(celt > 0 && !mpCurrent)
- { return S_FALSE;
- }
-
- for(i = 0; i < celt; i++)
- { if(!mpCurrent)
- break;
-
- temp = ILClone(mpCurrent->pidl);
- rgelt[i] = temp;
- mpCurrent = mpCurrent->pNext;
- }
- if(pceltFetched)
- { *pceltFetched = i;
- }
-
- return hr;
+ if(pceltFetched)
+ *pceltFetched = 0;
+
+ *rgelt=0;
+
+ if(celt > 1 && !pceltFetched)
+ { return E_INVALIDARG;
+ }
+
+ if(celt > 0 && !mpCurrent)
+ { return S_FALSE;
+ }
+
+ for(i = 0; i < celt; i++)
+ { if(!mpCurrent)
+ break;
+
+ temp = ILClone(mpCurrent->pidl);
+ rgelt[i] = temp;
+ mpCurrent = mpCurrent->pNext;
+ }
+ if(pceltFetched)
+ { *pceltFetched = i;
+ }
+
+ return hr;
}
/**************************************************************************
* IEnumIDList_fnSkip
*/
HRESULT WINAPI IEnumIDListImpl::Skip(
- ULONG celt)
-{
- DWORD dwIndex;
- HRESULT hr = S_OK;
-
- TRACE("(%p)->(%u)\n", this, celt);
-
- for(dwIndex = 0; dwIndex < celt; dwIndex++)
- { if(!mpCurrent)
- { hr = S_FALSE;
- break;
- }
- mpCurrent = mpCurrent->pNext;
- }
- return hr;
+ ULONG celt)
+{
+ DWORD dwIndex;
+ HRESULT hr = S_OK;
+
+ TRACE("(%p)->(%u)\n", this, celt);
+
+ for(dwIndex = 0; dwIndex < celt; dwIndex++)
+ { if(!mpCurrent)
+ { hr = S_FALSE;
+ break;
+ }
+ mpCurrent = mpCurrent->pNext;
+ }
+ return hr;
}
/**************************************************************************
@@ -254,9 +260,9 @@
*/
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::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 IEnumIDList_Constructor(IEnumIDList **enumerator)
{
- CComObject<IEnumIDListImpl> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- if (enumerator == NULL)
- return E_POINTER;
- *enumerator = NULL;
- ATLTRY (theEnumerator = new CComObject<IEnumIDListImpl>);
- 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;
-}
+ CComObject<IEnumIDListImpl> *theEnumerator;
+ CComPtr<IEnumIDList> result;
+ HRESULT hResult;
+
+ if (enumerator == NULL)
+ return E_POINTER;
+ *enumerator = NULL;
+ ATLTRY (theEnumerator = new CComObject<IEnumIDListImpl>);
+ 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;
+}
Modified: branches/shell32_new-bringup/dll/win32/shell32/shfldr_mycomp.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/shfldr_mycomp.cpp [iso-8859-1]
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/shfldr_mycomp.cpp [iso-8859-1] Wed Sep
7 23:21:02 2011
@@ -77,6 +77,8 @@
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 @@
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 @@
}
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 @@
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<CDrivesFolderEnum>);
- 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 ();
Modified: branches/shell32_new-bringup/dll/win32/shell32/shfldr_printers.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/shfldr_printers.cpp [iso-8859-1]
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/shfldr_printers.cpp [iso-8859-1] Wed
Sep 7 23:21:02 2011
@@ -29,28 +29,28 @@
* Printers_IExtractIconW implementation
*/
class IExtractIconWImpl :
- public CComObjectRootEx<CComMultiThreadModelNoCS>,
- public IExtractIconW,
- public IExtractIconA
+ public CComObjectRootEx<CComMultiThreadModelNoCS>,
+ public IExtractIconW,
+ public IExtractIconA
{
private:
- LPITEMIDLIST pidl;
+ LPITEMIDLIST pidl;
public:
- IExtractIconWImpl();
- ~IExtractIconWImpl();
- HRESULT WINAPI Initialize(LPCITEMIDLIST pidl);
-
- // IExtractIconW
+ IExtractIconWImpl();
+ ~IExtractIconWImpl();
+ HRESULT WINAPI Initialize(LPCITEMIDLIST pidl);
+
+ // 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 @@
IExtractIconWImpl::IExtractIconWImpl()
{
- pidl = NULL;
+ pidl = NULL;
}
IExtractIconWImpl::~IExtractIconWImpl()
@@ -89,7 +89,7 @@
pidl = ILClone(pidl);
pdump(pidl);
- return S_OK;
+ return S_OK;
}
/**************************************************************************
@@ -97,11 +97,11 @@
*
* 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 @@
* 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 @@
*/
static HRESULT WINAPI IEI_Printers_Constructor(LPCITEMIDLIST pidl, REFIID riid, IUnknown
**ppv)
{
- CComObject<IExtractIconWImpl> *theExtractor;
- CComPtr<IUnknown> result;
- HRESULT hResult;
-
- if (ppv == NULL)
- return E_POINTER;
- *ppv = NULL;
- ATLTRY (theExtractor = new CComObject<IExtractIconWImpl>);
- 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;
+ CComObject<IExtractIconWImpl> *theExtractor;
+ CComPtr<IUnknown> result;
+ HRESULT hResult;
+
+ if (ppv == NULL)
+ return E_POINTER;
+ *ppv = NULL;
+ ATLTRY (theExtractor = new CComObject<IExtractIconWImpl>);
+ 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 @@
*/
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 @@
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 @@
{
pidlRoot = NULL;
dwAttributes = 0;
+ pclsid = NULL;
}
CPrinterFolder::~CPrinterFolder()
@@ -339,9 +340,9 @@
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 @@
*/
HRESULT WINAPI CPrinterFolder::EnumObjects(HWND hwndOwner, DWORD dwFlags, LPENUMIDLIST *
ppEnumIDList)
{
- CComObject<CPrintersEnum> *theEnumerator;
- CComPtr<IEnumIDList> result;
- HRESULT hResult;
-
- 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<CPrintersEnum>);
- 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 ();
+ CComObject<CPrintersEnum> *theEnumerator;
+ CComPtr<IEnumIDList> result;
+ HRESULT hResult;
+
+ 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<CPrintersEnum>);
+ 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;
}
/**************************************************************************
Modified: branches/shell32_new-bringup/dll/win32/shell32/shlexec.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/shlexec.cpp [iso-8859-1] (original)
+++ branches/shell32_new-bringup/dll/win32/shell32/shlexec.cpp [iso-8859-1] Wed Sep 7
23:21:02 2011
@@ -20,6 +20,7 @@
*/
#include <precomp.h>
+#include <windef.h>
WINE_DEFAULT_DEBUG_CHANNEL(exec);
Modified: branches/shell32_new-bringup/dll/win32/shell32/shv_def_cmenu.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/shv_def_cmenu.cpp [iso-8859-1]
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/shv_def_cmenu.cpp [iso-8859-1] Wed Sep
7 23:21:02 2011
@@ -660,7 +660,7 @@
}
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
Modified: branches/shell32_new-bringup/dll/win32/shell32/shv_item_new.cpp
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/shv_item_new.cpp [iso-8859-1]
(original)
+++ branches/shell32_new-bringup/dll/win32/shell32/shv_item_new.cpp [iso-8859-1] Wed Sep
7 23:21:02 2011
@@ -87,6 +87,21 @@
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)
{
Modified: branches/shell32_new-bringup/dll/win32/shell32/shv_item_new.h
URL:
http://svn.reactos.org/svn/reactos/branches/shell32_new-bringup/dll/win32/s…
==============================================================================
--- branches/shell32_new-bringup/dll/win32/shell32/shv_item_new.h [iso-8859-1] (original)
+++ branches/shell32_new-bringup/dll/win32/shell32/shv_item_new.h [iso-8859-1] Wed Sep 7
23:21:02 2011
@@ -56,6 +56,7 @@
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);