Huw Davies : shell32: ABM_GETAUTOHIDEBAR should return a HWND or NULL

Alexander Nicolaysen Sørnes : shell32: Use LocalFree in CommandLineToArgvW.
Rob Shearman : shell32: Memory allocated by CommandLineToArgvW should be that got from LocalAlloc/ LocalReAlloc, not from GlobalAlloc.

svn path=/trunk/; revision=32582
This commit is contained in:
Christoph von Wittich 2008-03-06 11:30:26 +00:00
parent ac8b86183a
commit 4e8e7ffccd
4 changed files with 14 additions and 15 deletions

View file

@ -507,7 +507,7 @@ static LRESULT APIENTRY ACEditSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
if ( (This->options & (ACO_AUTOSUGGEST | ACO_UPDOWNKEYDROPSLIST)) if ( (This->options & (ACO_AUTOSUGGEST | ACO_UPDOWNKEYDROPSLIST))
&& (!IsWindowVisible(This->hwndListBox) && (! *hwndText)) ) && (!IsWindowVisible(This->hwndListBox) && (! *hwndText)) )
{ {
/* We must dispays all the entries */ /* We must display all the entries */
displayall = TRUE; displayall = TRUE;
} else { } else {
if (IsWindowVisible(This->hwndListBox)) { if (IsWindowVisible(This->hwndListBox)) {

View file

@ -50,7 +50,7 @@ typedef struct tagbrowse_info
typedef struct tagTV_ITEMDATA typedef struct tagTV_ITEMDATA
{ {
LPSHELLFOLDER lpsfParent; /* IShellFolder of the parent */ LPSHELLFOLDER lpsfParent; /* IShellFolder of the parent */
LPITEMIDLIST lpi; /* PIDL relativ to parent */ LPITEMIDLIST lpi; /* PIDL relative to parent */
LPITEMIDLIST lpifq; /* Fully qualified PIDL */ LPITEMIDLIST lpifq; /* Fully qualified PIDL */
IEnumIDList* pEnumIL; /* Children iterator */ IEnumIDList* pEnumIL; /* Children iterator */
} TV_ITEMDATA, *LPTV_ITEMDATA; } TV_ITEMDATA, *LPTV_ITEMDATA;
@ -245,7 +245,7 @@ static BOOL GetName(LPSHELLFOLDER lpsf, LPCITEMIDLIST lpi, DWORD dwFlags, LPWSTR
* PARAMS * PARAMS
* info [I] data for the dialog * info [I] data for the dialog
* lpsf [I] IShellFolder interface of the item's parent shell folder * lpsf [I] IShellFolder interface of the item's parent shell folder
* pidl [I] ITEMIDLIST of the child to insert, relativ to parent * pidl [I] ITEMIDLIST of the child to insert, relative to parent
* pidlParent [I] ITEMIDLIST of the parent shell folder * pidlParent [I] ITEMIDLIST of the parent shell folder
* pEnumIL [I] Iterator for the children of the item to be inserted * pEnumIL [I] Iterator for the children of the item to be inserted
* hParent [I] The treeview-item that represents the parent shell folder * hParent [I] The treeview-item that represents the parent shell folder

View file

@ -85,7 +85,6 @@ extern const char * const SHELL_Authors[];
LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs) LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
{ {
DWORD argc; DWORD argc;
HGLOBAL hargv;
LPWSTR *argv; LPWSTR *argv;
LPCWSTR cs; LPCWSTR cs;
LPWSTR arg,s,d; LPWSTR arg,s,d;
@ -97,20 +96,18 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
/* Return the path to the executable */ /* Return the path to the executable */
DWORD len, size=16; DWORD len, size=16;
hargv=GlobalAlloc(GMEM_FIXED, size); argv=LocalAlloc(LMEM_FIXED, size);
argv=GlobalLock(hargv);
for (;;) for (;;)
{ {
len = GetModuleFileNameW(0, (LPWSTR)(argv+1), (size-sizeof(LPWSTR))/sizeof(WCHAR)); len = GetModuleFileNameW(0, (LPWSTR)(argv+1), (size-sizeof(LPWSTR))/sizeof(WCHAR));
if (!len) if (!len)
{ {
GlobalFree(hargv); LocalFree(argv);
return NULL; return NULL;
} }
if (len < size) break; if (len < size) break;
size*=2; size*=2;
hargv=GlobalReAlloc(hargv, size, 0); argv=LocalReAlloc(argv, size, 0);
argv=GlobalLock(hargv);
} }
argv[0]=(LPWSTR)(argv+1); argv[0]=(LPWSTR)(argv+1);
if (numargs) if (numargs)
@ -160,8 +157,7 @@ LPWSTR* WINAPI CommandLineToArgvW(LPCWSTR lpCmdline, int* numargs)
/* Allocate in a single lump, the string array, and the strings that go with it. /* Allocate in a single lump, the string array, and the strings that go with it.
* This way the caller can make a single GlobalFree call to free both, as per MSDN. * This way the caller can make a single GlobalFree call to free both, as per MSDN.
*/ */
hargv=GlobalAlloc(0, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR)); argv=LocalAlloc(LMEM_FIXED, argc*sizeof(LPWSTR)+(strlenW(lpCmdline)+1)*sizeof(WCHAR));
argv=GlobalLock(hargv);
if (!argv) if (!argv)
return NULL; return NULL;
cmdline=(LPWSTR)(argv+argc); cmdline=(LPWSTR)(argv+argc);
@ -860,12 +856,16 @@ typedef struct
/************************************************************************* /*************************************************************************
* SHAppBarMessage [SHELL32.@] * SHAppBarMessage [SHELL32.@]
*/ */
UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data) UINT_PTR WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
{ {
int width=data->rc.right - data->rc.left; int width=data->rc.right - data->rc.left;
int height=data->rc.bottom - data->rc.top; int height=data->rc.bottom - data->rc.top;
RECT rec=data->rc; RECT rec=data->rc;
TRACE("msg=%d, data={cb=%d, hwnd=%p, callback=%x, edge=%d, rc=%s, lparam=%lx}\n",
msg, data->cbSize, data->hWnd, data->uCallbackMessage, data->uEdge,
wine_dbgstr_rect(&data->rc), data->lParam);
switch (msg) switch (msg)
{ {
case ABM_GETSTATE: case ABM_GETSTATE:
@ -878,8 +878,7 @@ UINT WINAPI SHAppBarMessage(DWORD msg, PAPPBARDATA data)
SetActiveWindow(data->hWnd); SetActiveWindow(data->hWnd);
return TRUE; return TRUE;
case ABM_GETAUTOHIDEBAR: case ABM_GETAUTOHIDEBAR:
data->hWnd=GetActiveWindow(); return 0; /* pretend there is no autohide bar */
return TRUE;
case ABM_NEW: case ABM_NEW:
/* cbSize, hWnd, and uCallbackMessage are used. All other ignored */ /* cbSize, hWnd, and uCallbackMessage are used. All other ignored */
SetWindowPos(data->hWnd,HWND_TOP,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE); SetWindowPos(data->hWnd,HWND_TOP,0,0,0,0,SWP_SHOWWINDOW|SWP_NOMOVE|SWP_NOSIZE);

View file

@ -318,7 +318,7 @@ UINT WINAPI ExtractIconExA(LPCSTR,int,HICON*,HICON*,UINT);
UINT WINAPI ExtractIconExW(LPCWSTR,int,HICON*,HICON*,UINT); UINT WINAPI ExtractIconExW(LPCWSTR,int,HICON*,HICON*,UINT);
HINSTANCE WINAPI FindExecutableA(LPCSTR,LPCSTR,LPSTR); HINSTANCE WINAPI FindExecutableA(LPCSTR,LPCSTR,LPSTR);
HINSTANCE WINAPI FindExecutableW(LPCWSTR,LPCWSTR,LPWSTR); HINSTANCE WINAPI FindExecutableW(LPCWSTR,LPCWSTR,LPWSTR);
UINT WINAPI SHAppBarMessage(DWORD,PAPPBARDATA); UINT_PTR WINAPI SHAppBarMessage(DWORD,PAPPBARDATA);
BOOL WINAPI Shell_NotifyIconA(DWORD,PNOTIFYICONDATAA); BOOL WINAPI Shell_NotifyIconA(DWORD,PNOTIFYICONDATAA);
BOOL WINAPI Shell_NotifyIconW(DWORD,PNOTIFYICONDATAW); BOOL WINAPI Shell_NotifyIconW(DWORD,PNOTIFYICONDATAW);
int WINAPI ShellAboutA(HWND,LPCSTR,LPCSTR,HICON); int WINAPI ShellAboutA(HWND,LPCSTR,LPCSTR,HICON);