ReactOS 0.4.16-dev-311-g9382aa2
comctl32undoc.c File Reference
#include <stdarg.h>
#include <string.h>
#include <ctype.h>
#include <limits.h>
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winnls.h"
#include "winreg.h"
#include "commctrl.h"
#include "objbase.h"
#include "winerror.h"
#include "comctl32.h"
#include "wine/debug.h"
Include dependency graph for comctl32undoc.c:

Go to the source code of this file.

Classes

struct  tagMRUINFOA
 
struct  tagMRUINFOW
 
struct  tagWINEMRUITEM
 
struct  tagWINEMRULIST
 
struct  tagNOTIFYDATA
 

Macros

#define COBJMACROS
 
#define NONAMELESSUNION
 
#define MRU_STRING   0 /* list will contain strings */
 
#define MRU_BINARY   1 /* list will contain binary data */
 
#define MRU_CACHEWRITE   2 /* only save list order to reg. is FreeMRUList */
 
#define WMRUIF_CHANGED   0x0001 /* this dataitem changed */
 
#define WMRUF_CHANGED   0x0001 /* MRU list has changed */
 

Typedefs

typedef INT(CALLBACKMRUStringCmpFnA) (LPCSTR lhs, LPCSTR rhs)
 
typedef INT(CALLBACKMRUStringCmpFnW) (LPCWSTR lhs, LPCWSTR rhs)
 
typedef INT(CALLBACKMRUBinaryCmpFn) (LPCVOID lhs, LPCVOID rhs, DWORD length)
 
typedef struct tagMRUINFOA MRUINFOA
 
typedef struct tagMRUINFOALPMRUINFOA
 
typedef struct tagMRUINFOW MRUINFOW
 
typedef struct tagMRUINFOWLPMRUINFOW
 
typedef struct tagWINEMRUITEM WINEMRUITEM
 
typedef struct tagWINEMRUITEMLPWINEMRUITEM
 
typedef struct tagWINEMRULIST WINEMRULIST
 
typedef struct tagWINEMRULISTLPWINEMRULIST
 
typedef struct tagNOTIFYDATA NOTIFYDATA
 
typedef struct tagNOTIFYDATALPNOTIFYDATA
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (commctrl)
 
LPVOID WINAPI Alloc (DWORD dwSize)
 
LPVOID WINAPI ReAlloc (LPVOID lpSrc, DWORD dwSize)
 
BOOL WINAPI Free (LPVOID lpMem)
 
DWORD WINAPI GetSize (LPVOID lpMem)
 
static void MRU_SaveChanged (LPWINEMRULIST mp)
 
void WINAPI FreeMRUList (HANDLE hMRUList)
 
INT WINAPI FindMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum)
 
INT WINAPI AddMRUData (HANDLE hList, LPCVOID lpData, DWORD cbData)
 
INT WINAPI AddMRUStringW (HANDLE hList, LPCWSTR lpszString)
 
INT WINAPI AddMRUStringA (HANDLE hList, LPCSTR lpszString)
 
BOOL WINAPI DelMRUString (HANDLE hList, INT nItemPos)
 
INT WINAPI FindMRUStringW (HANDLE hList, LPCWSTR lpszString, LPINT lpRegNum)
 
INT WINAPI FindMRUStringA (HANDLE hList, LPCSTR lpszString, LPINT lpRegNum)
 
static HANDLE create_mru_list (LPWINEMRULIST mp)
 
HANDLE WINAPI CreateMRUListLazyW (const MRUINFOW *infoW, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4)
 
HANDLE WINAPI CreateMRUListLazyA (const MRUINFOA *lpcml, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4)
 
HANDLE WINAPI CreateMRUListW (const MRUINFOW *infoW)
 
HANDLE WINAPI CreateMRUListA (const MRUINFOA *lpcml)
 
INT WINAPI EnumMRUListW (HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize)
 
INT WINAPI EnumMRUListA (HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize)
 
INT Str_GetPtrWtoA (LPCWSTR lpSrc, LPSTR lpDest, INT nMaxLen)
 
INT Str_GetPtrAtoW (LPCSTR lpSrc, LPWSTR lpDest, INT nMaxLen)
 
BOOL Str_SetPtrAtoW (LPWSTR *lppDest, LPCSTR lpSrc)
 
BOOL Str_SetPtrWtoA (LPSTR *lppDest, LPCWSTR lpSrc)
 
static LRESULT DoNotify (const NOTIFYDATA *lpNotify, UINT uCode, LPNMHDR lpHdr)
 
LRESULT WINAPI SendNotify (HWND hwndTo, HWND hwndFrom, UINT uCode, LPNMHDR lpHdr)
 
LRESULT WINAPI SendNotifyEx (HWND hwndTo, HWND hwndFrom, UINT uCode, LPNMHDR lpHdr, DWORD dwParam5)
 

Variables

static const WCHAR strMRUList [] = { 'M','R','U','L','i','s','t',0 }
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 35 of file comctl32undoc.c.

◆ MRU_BINARY

#define MRU_BINARY   1 /* list will contain binary data */

Definition at line 239 of file comctl32undoc.c.

◆ MRU_CACHEWRITE

#define MRU_CACHEWRITE   2 /* only save list order to reg. is FreeMRUList */

Definition at line 240 of file comctl32undoc.c.

◆ MRU_STRING

#define MRU_STRING   0 /* list will contain strings */

Definition at line 238 of file comctl32undoc.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 36 of file comctl32undoc.c.

◆ WMRUF_CHANGED

#define WMRUF_CHANGED   0x0001 /* MRU list has changed */

Definition at line 272 of file comctl32undoc.c.

◆ WMRUIF_CHANGED

#define WMRUIF_CHANGED   0x0001 /* this dataitem changed */

Definition at line 258 of file comctl32undoc.c.

Typedef Documentation

◆ LPMRUINFOA

◆ LPMRUINFOW

◆ LPNOTIFYDATA

◆ LPWINEMRUITEM

◆ LPWINEMRULIST

◆ MRUBinaryCmpFn

typedef INT(CALLBACK * MRUBinaryCmpFn) (LPCVOID lhs, LPCVOID rhs, DWORD length)

Definition at line 207 of file comctl32undoc.c.

◆ MRUINFOA

◆ MRUINFOW

◆ MRUStringCmpFnA

typedef INT(CALLBACK * MRUStringCmpFnA) (LPCSTR lhs, LPCSTR rhs)

Definition at line 205 of file comctl32undoc.c.

◆ MRUStringCmpFnW

typedef INT(CALLBACK * MRUStringCmpFnW) (LPCWSTR lhs, LPCWSTR rhs)

Definition at line 206 of file comctl32undoc.c.

◆ NOTIFYDATA

◆ WINEMRUITEM

◆ WINEMRULIST

Function Documentation

◆ AddMRUData()

INT WINAPI AddMRUData ( HANDLE  hList,
LPCVOID  lpData,
DWORD  cbData 
)

Definition at line 462 of file comctl32undoc.c.

463{
464 LPWINEMRULIST mp = hList;
465 LPWINEMRUITEM witem;
466 INT i, replace;
467
468 if ((replace = FindMRUData (hList, lpData, cbData, NULL)) >= 0) {
469 /* Item exists, just move it to the front */
470 LPWSTR pos = wcschr(mp->realMRU, replace + 'a');
471 while (pos > mp->realMRU)
472 {
473 pos[0] = pos[-1];
474 pos--;
475 }
476 }
477 else {
478 /* either add a new entry or replace oldest */
479 if (mp->cursize < mp->extview.uMax) {
480 /* Add in a new item */
481 replace = mp->cursize;
482 mp->cursize++;
483 }
484 else {
485 /* get the oldest entry and replace data */
486 replace = mp->realMRU[mp->cursize - 1] - 'a';
487 Free(mp->array[replace]);
488 }
489
490 /* Allocate space for new item and move in the data */
491 mp->array[replace] = witem = Alloc(cbData + sizeof(WINEMRUITEM));
492 witem->itemFlag |= WMRUIF_CHANGED;
493 witem->size = cbData;
494 memcpy( &witem->datastart, lpData, cbData);
495
496 /* now rotate MRU list */
497 for(i=mp->cursize-1; i>=1; i--)
498 mp->realMRU[i] = mp->realMRU[i-1];
499 }
500
501 /* The new item gets the front spot */
503 mp->realMRU[0] = replace + 'a';
504
505 TRACE("(%p, %p, %d) adding data, /%c/ now most current\n",
506 hList, lpData, cbData, replace+'a');
507
508 if (!(mp->extview.fFlags & MRU_CACHEWRITE)) {
509 /* save changed stuff right now */
510 MRU_SaveChanged( mp );
511 }
512
513 return replace;
514}
#define WMRUIF_CHANGED
INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum)
LPVOID WINAPI Alloc(DWORD dwSize)
Definition: comctl32undoc.c:68
static void MRU_SaveChanged(LPWINEMRULIST mp)
#define WMRUF_CHANGED
#define MRU_CACHEWRITE
#define NULL
Definition: types.h:112
#define wcschr
Definition: compat.h:17
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
HWND hList
Definition: livecd.c:10
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *doMore)
Definition: replace.c:38
#define TRACE(s)
Definition: solgame.cpp:4
LPWINEMRUITEM * array
MRUINFOW extview
int32_t INT
Definition: typedefs.h:58
_In_opt_ PALLOCATE_FUNCTION _In_opt_ PFREE_FUNCTION Free
Definition: exfuncs.h:815
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by AddMRUStringA(), AddMRUStringW(), init_functions(), SHADD_create_add_mru_data(), and SHAddToRecentDocs().

◆ AddMRUStringA()

INT WINAPI AddMRUStringA ( HANDLE  hList,
LPCSTR  lpszString 
)

Definition at line 563 of file comctl32undoc.c.

564{
565 DWORD len;
567 INT ret;
568
569 TRACE("(%p,%s)\n", hList, debugstr_a(lpszString));
570
571 if (!hList)
572 return -1;
573
574 if (IsBadStringPtrA(lpszString, -1))
575 {
577 return 0;
578 }
579
580 len = MultiByteToWideChar(CP_ACP, 0, lpszString, -1, NULL, 0) * sizeof(WCHAR);
581 stringW = Alloc(len);
582 if (!stringW)
583 return -1;
584
585 MultiByteToWideChar(CP_ACP, 0, lpszString, -1, stringW, len/sizeof(WCHAR));
587 Free(stringW);
588 return ret;
589}
INT WINAPI AddMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData)
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:109
#define SetLastError(x)
Definition: compat.h:752
#define MultiByteToWideChar
Definition: compat.h:110
BOOL NTAPI IsBadStringPtrA(IN LPCSTR lpsz, IN UINT_PTR ucchMax)
Definition: except.c:989
static const WCHAR stringW[]
Definition: engine.c:38
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
#define debugstr_a
Definition: kernel32.h:31
int ret
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by init_functions().

◆ AddMRUStringW()

INT WINAPI AddMRUStringW ( HANDLE  hList,
LPCWSTR  lpszString 
)

Definition at line 541 of file comctl32undoc.c.

542{
543 TRACE("(%p,%s)\n", hList, debugstr_w(lpszString));
544
545 if (!hList)
546 return -1;
547
548 if (!lpszString || IsBadStringPtrW(lpszString, -1))
549 {
551 return 0;
552 }
553
554 return AddMRUData(hList, lpszString,
555 (lstrlenW(lpszString) + 1) * sizeof(WCHAR));
556}
#define lstrlenW
Definition: compat.h:750
BOOL NTAPI IsBadStringPtrW(IN LPCWSTR lpsz, IN UINT_PTR ucchMax)
Definition: except.c:950
#define debugstr_w
Definition: kernel32.h:32

Referenced by COpenWithList::AddAppToMRUList().

◆ Alloc()

LPVOID WINAPI Alloc ( DWORD  dwSize)

Definition at line 68 of file comctl32undoc.c.

69{
71}
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1390
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define LMEM_ZEROINIT
Definition: winbase.h:401

Referenced by AddMRUData(), AddMRUStringA(), create_mru_list(), CreateMRUListLazyA(), CreateMRUListLazyW(), FindMRUData(), and FindMRUStringA().

◆ create_mru_list()

static HANDLE create_mru_list ( LPWINEMRULIST  mp)
static

Definition at line 650 of file comctl32undoc.c.

651{
652 UINT i, err;
653 HKEY newkey;
654 DWORD datasize, dwdisp;
655 WCHAR realname[2];
656 LPWINEMRUITEM witem;
657 DWORD type;
658
659 /* get space to save indices that will turn into names
660 * but in order of most to least recently used
661 */
662 mp->realMRU = Alloc((mp->extview.uMax + 2) * sizeof(WCHAR));
663
664 /* get space to save pointers to actual data in order of
665 * 'a' to 'z' (0 to n).
666 */
667 mp->array = Alloc(mp->extview.uMax * sizeof(LPVOID));
668
669 /* open the sub key */
671 0,
672 NULL,
675 0,
676 &newkey,
677 &dwdisp))) {
678 /* error - what to do ??? */
679 ERR("(%u %u %x %p %s %p): Could not open key, error=%d\n",
680 mp->extview.cbSize, mp->extview.uMax, mp->extview.fFlags,
683 return 0;
684 }
685
686 /* get values from key 'MRUList' */
687 if (newkey) {
688 datasize = (mp->extview.uMax + 1) * sizeof(WCHAR);
689 if (RegQueryValueExW( newkey, strMRUList, 0, &type,
690 (LPBYTE)mp->realMRU, &datasize)) {
691 /* not present - set size to 1 (will become 0 later) */
692 datasize = 1;
693 *mp->realMRU = 0;
694 }
695 else
696 datasize /= sizeof(WCHAR);
697
698 TRACE("MRU list = %s, datasize = %d\n", debugstr_w(mp->realMRU), datasize);
699
700 mp->cursize = datasize - 1;
701 /* datasize now has number of items in the MRUList */
702
703 /* get actual values for each entry */
704 realname[1] = 0;
705 for(i=0; i<mp->cursize; i++) {
706 realname[0] = 'a' + i;
707 if(RegQueryValueExW( newkey, realname, 0, &type, 0, &datasize)) {
708 /* not present - what to do ??? */
709 ERR("Key %s not found 1\n", debugstr_w(realname));
710 }
711 mp->array[i] = witem = Alloc(datasize + sizeof(WINEMRUITEM));
712 witem->size = datasize;
713 if(RegQueryValueExW( newkey, realname, 0, &type,
714 &witem->datastart, &datasize)) {
715 /* not present - what to do ??? */
716 ERR("Key %s not found 2\n", debugstr_w(realname));
717 }
718 }
719 RegCloseKey( newkey );
720 }
721 else
722 mp->cursize = 0;
723
724 TRACE("(%u %u %x %p %s %p): Current Size = %d\n",
725 mp->extview.cbSize, mp->extview.uMax, mp->extview.fFlags,
727 mp->extview.u.string_cmpfn, mp->cursize);
728 return mp;
729}
#define ERR(fmt,...)
Definition: precomp.h:57
#define RegCloseKey(hKey)
Definition: registry.h:49
static const WCHAR strMRUList[]
Definition: comctl32undoc.c:54
static SIZE_T datasize
Definition: asm.c:30
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4103
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
unsigned int UINT
Definition: ndis.h:50
#define KEY_READ
Definition: nt_native.h:1023
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
#define err(...)
union tagMRUINFOW::@335 u
MRUStringCmpFnW string_cmpfn
LPWSTR lpszSubKey
unsigned char * LPBYTE
Definition: typedefs.h:53

Referenced by CreateMRUListLazyA(), and CreateMRUListLazyW().

◆ CreateMRUListA()

HANDLE WINAPI CreateMRUListA ( const MRUINFOA lpcml)

Definition at line 810 of file comctl32undoc.c.

811{
812 return CreateMRUListLazyA (lpcml, 0, 0, 0);
813}
HANDLE WINAPI CreateMRUListLazyA(const MRUINFOA *lpcml, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4)

Referenced by init_functions().

◆ CreateMRUListLazyA()

HANDLE WINAPI CreateMRUListLazyA ( const MRUINFOA lpcml,
DWORD  dwParam2,
DWORD  dwParam3,
DWORD  dwParam4 
)

Definition at line 768 of file comctl32undoc.c.

770{
771 LPWINEMRULIST mp;
772 DWORD len;
773
774 /* Native does not check for a NULL lpcml */
775
776 if (!lpcml->hKey || IsBadStringPtrA(lpcml->lpszSubKey, -1))
777 return 0;
778
779 mp = Alloc(sizeof(WINEMRULIST));
780 memcpy(&mp->extview, lpcml, sizeof(MRUINFOA));
781 len = MultiByteToWideChar(CP_ACP, 0, lpcml->lpszSubKey, -1, NULL, 0);
782 mp->extview.lpszSubKey = Alloc(len * sizeof(WCHAR));
784 mp->extview.lpszSubKey, len);
785 mp->isUnicode = FALSE;
786 return create_mru_list(mp);
787}
static HANDLE create_mru_list(LPWINEMRULIST mp)
#define FALSE
Definition: types.h:117
LPSTR lpszSubKey

Referenced by CreateMRUListA(), and init_functions().

◆ CreateMRUListLazyW()

HANDLE WINAPI CreateMRUListLazyW ( const MRUINFOW infoW,
DWORD  dwParam2,
DWORD  dwParam3,
DWORD  dwParam4 
)

Definition at line 736 of file comctl32undoc.c.

738{
739 LPWINEMRULIST mp;
740
741 /* Native does not check for a NULL lpcml */
742 if (!infoW->hKey || IsBadStringPtrW(infoW->lpszSubKey, -1))
743 return NULL;
744
745 mp = Alloc(sizeof(WINEMRULIST));
746 memcpy(&mp->extview, infoW, sizeof(MRUINFOW));
747 mp->extview.lpszSubKey = Alloc((lstrlenW(infoW->lpszSubKey) + 1) * sizeof(WCHAR));
748 lstrcpyW(mp->extview.lpszSubKey, infoW->lpszSubKey);
749 mp->isUnicode = TRUE;
750
751 return create_mru_list(mp);
752}
#define TRUE
Definition: types.h:120
#define lstrcpyW
Definition: compat.h:749
static const SecPkgInfoW infoW
Definition: kerberos.c:293

Referenced by CreateMRUListW(), and init_functions().

◆ CreateMRUListW()

HANDLE WINAPI CreateMRUListW ( const MRUINFOW infoW)

Definition at line 794 of file comctl32undoc.c.

795{
796 return CreateMRUListLazyW(infoW, 0, 0, 0);
797}
HANDLE WINAPI CreateMRUListLazyW(const MRUINFOW *infoW, DWORD dwParam2, DWORD dwParam3, DWORD dwParam4)

Referenced by init_functions(), COpenWithList::OpenMRUList(), and SHAddToRecentDocs().

◆ DelMRUString()

BOOL WINAPI DelMRUString ( HANDLE  hList,
INT  nItemPos 
)

Definition at line 603 of file comctl32undoc.c.

604{
605 FIXME("(%p, %d): stub\n", hList, nItemPos);
606 return TRUE;
607}
#define FIXME(fmt,...)
Definition: precomp.h:53

◆ DoNotify()

static LRESULT DoNotify ( const NOTIFYDATA lpNotify,
UINT  uCode,
LPNMHDR  lpHdr 
)
static

Definition at line 1071 of file comctl32undoc.c.

1072{
1073 NMHDR nmhdr;
1074 LPNMHDR lpNmh = NULL;
1075 UINT idFrom = 0;
1076
1077 TRACE("(%p %p %d %p 0x%08x)\n",
1078 lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr,
1079 lpNotify->dwParam5);
1080
1081 if (!lpNotify->hwndTo)
1082 return 0;
1083
1084 if (lpNotify->hwndFrom == (HWND)-1) {
1085 lpNmh = lpHdr;
1086 idFrom = lpHdr->idFrom;
1087 }
1088 else {
1089 if (lpNotify->hwndFrom)
1090 idFrom = GetDlgCtrlID (lpNotify->hwndFrom);
1091
1092 lpNmh = (lpHdr) ? lpHdr : &nmhdr;
1093
1094 lpNmh->hwndFrom = lpNotify->hwndFrom;
1095 lpNmh->idFrom = idFrom;
1096 lpNmh->code = uCode;
1097 }
1098
1099 return SendMessageW (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh);
1100}
#define WM_NOTIFY
Definition: richedit.h:61
UINT_PTR idFrom
Definition: winuser.h:3161
UINT code
Definition: winuser.h:3162
HWND hwndFrom
Definition: winuser.h:3160
LONG_PTR LPARAM
Definition: windef.h:208
int WINAPI GetDlgCtrlID(_In_ HWND)
LRESULT WINAPI SendMessageW(_In_ HWND, _In_ UINT, _In_ WPARAM, _In_ LPARAM)

Referenced by SendNotify(), and SendNotifyEx().

◆ EnumMRUListA()

INT WINAPI EnumMRUListA ( HANDLE  hList,
INT  nItemPos,
LPVOID  lpBuffer,
DWORD  nBufferSize 
)

Definition at line 860 of file comctl32undoc.c.

862{
863 const WINEMRULIST *mp = hList;
864 LPWINEMRUITEM witem;
866 DWORD lenA;
867
868 if (!mp) return -1;
869 if ((nItemPos < 0) || !lpBuffer) return mp->cursize;
870 if (nItemPos >= mp->cursize) return -1;
871 desired = mp->realMRU[nItemPos];
872 desired -= 'a';
873 TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired);
874 witem = mp->array[desired];
875 if(mp->extview.fFlags & MRU_BINARY) {
876 datasize = min( witem->size, nBufferSize );
877 memcpy( lpBuffer, &witem->datastart, datasize);
878 } else {
879 lenA = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&witem->datastart, -1,
880 NULL, 0, NULL, NULL);
881 datasize = min( lenA, nBufferSize );
884 ((char *)lpBuffer)[ datasize - 1 ] = '\0';
885 datasize = lenA - 1;
886 }
887 TRACE("(%p, %d, %p, %d): returning len=%d\n",
888 hList, nItemPos, lpBuffer, nBufferSize, datasize);
889 return datasize;
890}
#define MRU_BINARY
static TAGREF LPCWSTR LPDWORD LPVOID lpBuffer
Definition: db.cpp:175
#define WideCharToMultiByte
Definition: compat.h:111
int desired
Definition: jpeglib.h:1119
#define min(a, b)
Definition: monoChain.cc:55

Referenced by init_functions(), and SHAddToRecentDocs().

◆ EnumMRUListW()

INT WINAPI EnumMRUListW ( HANDLE  hList,
INT  nItemPos,
LPVOID  lpBuffer,
DWORD  nBufferSize 
)

Definition at line 834 of file comctl32undoc.c.

836{
837 const WINEMRULIST *mp = hList;
838 const WINEMRUITEM *witem;
840
841 if (!mp) return -1;
842 if ((nItemPos < 0) || !lpBuffer) return mp->cursize;
843 if (nItemPos >= mp->cursize) return -1;
844 desired = mp->realMRU[nItemPos];
845 desired -= 'a';
846 TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired);
847 witem = mp->array[desired];
848 datasize = min( witem->size, nBufferSize );
849 memcpy( lpBuffer, &witem->datastart, datasize);
850 TRACE("(%p, %d, %p, %d): returning len=%d\n",
851 hList, nItemPos, lpBuffer, nBufferSize, datasize);
852 return datasize;
853}

Referenced by init_functions(), and COpenWithList::LoadMRUList().

◆ FindMRUData()

INT WINAPI FindMRUData ( HANDLE  hList,
LPCVOID  lpData,
DWORD  cbData,
LPINT  lpRegNum 
)

Definition at line 388 of file comctl32undoc.c.

390{
391 const WINEMRULIST *mp = hList;
392 INT ret;
393 UINT i;
394 LPSTR dataA = NULL;
395
396 if (!mp || !mp->extview.u.string_cmpfn)
397 return -1;
398
399 if(!(mp->extview.fFlags & MRU_BINARY) && !mp->isUnicode) {
400 DWORD len = WideCharToMultiByte(CP_ACP, 0, lpData, -1,
401 NULL, 0, NULL, NULL);
402 dataA = Alloc(len);
403 WideCharToMultiByte(CP_ACP, 0, lpData, -1, dataA, len, NULL, NULL);
404 }
405
406 for(i=0; i<mp->cursize; i++) {
407 if (mp->extview.fFlags & MRU_BINARY) {
408 if (!mp->extview.u.binary_cmpfn(lpData, &mp->array[i]->datastart, cbData))
409 break;
410 }
411 else {
412 if(mp->isUnicode) {
413 if (!mp->extview.u.string_cmpfn(lpData, (LPWSTR)&mp->array[i]->datastart))
414 break;
415 } else {
417 (LPWSTR)&mp->array[i]->datastart, -1,
418 NULL, 0, NULL, NULL);
419 LPSTR itemA = Alloc(len);
420 INT cmp;
422 itemA, len, NULL, NULL);
423
424 cmp = mp->extview.u.string_cmpfn((LPWSTR)dataA, (LPWSTR)itemA);
425 Free(itemA);
426 if(!cmp)
427 break;
428 }
429 }
430 }
431 Free(dataA);
432 if (i < mp->cursize)
433 ret = i;
434 else
435 ret = -1;
436 if (lpRegNum && (ret != -1))
437 *lpRegNum = 'a' + i;
438
439 TRACE("(%p, %p, %d, %p) returning %d\n",
440 hList, lpData, cbData, lpRegNum, ret);
441
442 return ret;
443}
#define cmp(status, error)
Definition: error.c:114
MRUBinaryCmpFn binary_cmpfn
char * LPSTR
Definition: xmlstorage.h:182

Referenced by AddMRUData(), FindMRUStringA(), FindMRUStringW(), init_functions(), and SHAddToRecentDocs().

◆ FindMRUStringA()

INT WINAPI FindMRUStringA ( HANDLE  hList,
LPCSTR  lpszString,
LPINT  lpRegNum 
)

Definition at line 635 of file comctl32undoc.c.

636{
637 DWORD len = MultiByteToWideChar(CP_ACP, 0, lpszString, -1, NULL, 0);
638 LPWSTR stringW = Alloc(len * sizeof(WCHAR));
639 INT ret;
640
641 MultiByteToWideChar(CP_ACP, 0, lpszString, -1, stringW, len);
642 ret = FindMRUData(hList, stringW, len * sizeof(WCHAR), lpRegNum);
643 Free(stringW);
644 return ret;
645}

◆ FindMRUStringW()

INT WINAPI FindMRUStringW ( HANDLE  hList,
LPCWSTR  lpszString,
LPINT  lpRegNum 
)

Definition at line 614 of file comctl32undoc.c.

615{
616 return FindMRUData(hList, lpszString,
617 (lstrlenW(lpszString) + 1) * sizeof(WCHAR), lpRegNum);
618}

◆ Free()

BOOL WINAPI Free ( LPVOID  lpMem)

Definition at line 113 of file comctl32undoc.c.

114{
115 return !LocalFree( lpMem );
116}
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1594

◆ FreeMRUList()

void WINAPI FreeMRUList ( HANDLE  hMRUList)

Definition at line 348 of file comctl32undoc.c.

349{
350 LPWINEMRULIST mp = hMRUList;
351 UINT i;
352
353 TRACE("(%p)\n", hMRUList);
354 if (!hMRUList)
355 return;
356
357 if (mp->wineFlags & WMRUF_CHANGED) {
358 /* need to open key and then save the info */
359 MRU_SaveChanged( mp );
360 }
361
362 for(i=0; i<mp->extview.uMax; i++)
363 Free(mp->array[i]);
364
365 Free(mp->realMRU);
366 Free(mp->array);
368 Free(mp);
369}

Referenced by COpenWithList::AddAppToMRUList(), init_functions(), COpenWithList::LoadMRUList(), and SHAddToRecentDocs().

◆ GetSize()

DWORD WINAPI GetSize ( LPVOID  lpMem)

Definition at line 132 of file comctl32undoc.c.

133{
134 return LocalSize( lpMem );
135}
SIZE_T NTAPI LocalSize(HLOCAL hMem)
Definition: heapmem.c:1794

Referenced by DECLARE_INTERFACE_(), and InitFunctionPtrs().

◆ MRU_SaveChanged()

static void MRU_SaveChanged ( LPWINEMRULIST  mp)
static

Definition at line 279 of file comctl32undoc.c.

280{
281 UINT i, err;
282 HKEY newkey;
283 WCHAR realname[2];
284 LPWINEMRUITEM witem;
285
286 /* or should we do the following instead of RegOpenKeyEx:
287 */
288
289 /* open the sub key */
291 0, KEY_WRITE, &newkey))) {
292 /* not present - what to do ??? */
293 ERR("Could not open key, error=%d, attempting to create\n",
294 err);
296 0,
297 NULL,
300 0,
301 &newkey,
302 0))) {
303 ERR("failed to create key /%s/, err=%d\n",
305 return;
306 }
307 }
308 if (mp->wineFlags & WMRUF_CHANGED) {
309 mp->wineFlags &= ~WMRUF_CHANGED;
310 err = RegSetValueExW(newkey, strMRUList, 0, REG_SZ, (LPBYTE)mp->realMRU,
311 (lstrlenW(mp->realMRU) + 1)*sizeof(WCHAR));
312 if (err) {
313 ERR("error saving MRUList, err=%d\n", err);
314 }
315 TRACE("saving MRUList=/%s/\n", debugstr_w(mp->realMRU));
316 }
317 realname[1] = 0;
318 for(i=0; i<mp->cursize; i++) {
319 witem = mp->array[i];
320 if (witem->itemFlag & WMRUIF_CHANGED) {
321 witem->itemFlag &= ~WMRUIF_CHANGED;
322 realname[0] = 'a' + i;
323 err = RegSetValueExW(newkey, realname, 0,
324 (mp->extview.fFlags & MRU_BINARY) ?
326 &witem->datastart, witem->size);
327 if (err) {
328 ERR("error saving /%s/, err=%d\n", debugstr_w(realname), err);
329 }
330 TRACE("saving value for name /%s/ size=%d\n",
331 debugstr_w(realname), witem->size);
332 }
333 }
334 RegCloseKey( newkey );
335}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3333
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4882
#define REG_SZ
Definition: layer.c:22
#define REG_BINARY
Definition: nt_native.h:1496

Referenced by AddMRUData(), and FreeMRUList().

◆ ReAlloc()

LPVOID WINAPI ReAlloc ( LPVOID  lpSrc,
DWORD  dwSize 
)

Definition at line 92 of file comctl32undoc.c.

93{
94 if (lpSrc)
96 else
98}
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1625
#define LMEM_MOVEABLE
Definition: winbase.h:395

Referenced by Str_SetPtrAtoW(), and Str_SetPtrWtoA().

◆ SendNotify()

LRESULT WINAPI SendNotify ( HWND  hwndTo,
HWND  hwndFrom,
UINT  uCode,
LPNMHDR  lpHdr 
)

Definition at line 1123 of file comctl32undoc.c.

1124{
1126
1127 TRACE("(%p %p %d %p)\n",
1128 hwndTo, hwndFrom, uCode, lpHdr);
1129
1130 notify.hwndFrom = hwndFrom;
1131 notify.hwndTo = hwndTo;
1132 notify.dwParam5 = 0;
1133 notify.dwParam6 = 0;
1134
1135 return DoNotify (&notify, uCode, lpHdr);
1136}
static LRESULT DoNotify(const NOTIFYDATA *lpNotify, UINT uCode, LPNMHDR lpHdr)
int notify
Definition: msacm.c:1366

◆ SendNotifyEx()

LRESULT WINAPI SendNotifyEx ( HWND  hwndTo,
HWND  hwndFrom,
UINT  uCode,
LPNMHDR  lpHdr,
DWORD  dwParam5 
)

Definition at line 1160 of file comctl32undoc.c.

1162{
1164 HWND hwndNotify;
1165
1166 TRACE("(%p %p %d %p 0x%08x)\n",
1167 hwndFrom, hwndTo, uCode, lpHdr, dwParam5);
1168
1169 hwndNotify = hwndTo;
1170 if (!hwndTo) {
1171 if (IsWindow (hwndFrom)) {
1172 hwndNotify = GetParent (hwndFrom);
1173 if (!hwndNotify)
1174 return 0;
1175 }
1176 }
1177
1178 notify.hwndFrom = hwndFrom;
1179 notify.hwndTo = hwndNotify;
1180 notify.dwParam5 = dwParam5;
1181 notify.dwParam6 = 0;
1182
1183 return DoNotify (&notify, uCode, lpHdr);
1184}
BOOL WINAPI IsWindow(_In_opt_ HWND)
HWND WINAPI GetParent(_In_ HWND)

◆ Str_GetPtrAtoW()

INT Str_GetPtrAtoW ( LPCSTR  lpSrc,
LPWSTR  lpDest,
INT  nMaxLen 
)

Definition at line 947 of file comctl32undoc.c.

948{
949 INT len;
950
951 TRACE("(%s %p %d)\n", debugstr_a(lpSrc), lpDest, nMaxLen);
952
953 if (!lpDest && lpSrc)
954 return MultiByteToWideChar(CP_ACP, 0, lpSrc, -1, 0, 0);
955
956 if (nMaxLen == 0)
957 return 0;
958
959 if (lpSrc == NULL) {
960 lpDest[0] = '\0';
961 return 0;
962 }
963
964 len = MultiByteToWideChar(CP_ACP, 0, lpSrc, -1, 0, 0);
965 if (len >= nMaxLen)
966 len = nMaxLen - 1;
967
968 MultiByteToWideChar(CP_ACP, 0, lpSrc, -1, lpDest, len);
969 lpDest[len] = '\0';
970
971 return len;
972}

Referenced by TOOLTIPS_GetDispInfoA().

◆ Str_GetPtrWtoA()

INT Str_GetPtrWtoA ( LPCWSTR  lpSrc,
LPSTR  lpDest,
INT  nMaxLen 
)

Definition at line 906 of file comctl32undoc.c.

907{
908 INT len;
909
910 TRACE("(%s %p %d)\n", debugstr_w(lpSrc), lpDest, nMaxLen);
911
912 if (!lpDest && lpSrc)
913 return WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL);
914
915 if (nMaxLen == 0)
916 return 0;
917
918 if (lpSrc == NULL) {
919 lpDest[0] = '\0';
920 return 0;
921 }
922
923 len = WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, 0, 0, NULL, NULL);
924 if (len >= nMaxLen)
925 len = nMaxLen - 1;
926
927 WideCharToMultiByte(CP_ACP, 0, lpSrc, -1, lpDest, len, NULL, NULL);
928 lpDest[len] = '\0';
929
930 return len;
931}

Referenced by HEADER_GetItemT(), REBAR_GetBandInfoT(), TAB_GetItemT(), and TOOLBAR_GetButtonInfoT().

◆ Str_SetPtrAtoW()

BOOL Str_SetPtrAtoW ( LPWSTR lppDest,
LPCSTR  lpSrc 
)

Definition at line 992 of file comctl32undoc.c.

993{
994 TRACE("(%p %s)\n", lppDest, lpSrc);
995
996 if (lpSrc) {
997 INT len = MultiByteToWideChar(CP_ACP,0,lpSrc,-1,NULL,0);
998 LPWSTR ptr = ReAlloc (*lppDest, len*sizeof(WCHAR));
999
1000 if (!ptr)
1001 return FALSE;
1002 MultiByteToWideChar(CP_ACP,0,lpSrc,-1,ptr,len);
1003 *lppDest = ptr;
1004 }
1005 else {
1006 Free (*lppDest);
1007 *lppDest = NULL;
1008 }
1009
1010 return TRUE;
1011}
LPVOID WINAPI ReAlloc(LPVOID lpSrc, DWORD dwSize)
Definition: comctl32undoc.c:92
static PVOID ptr
Definition: dispmode.c:27

Referenced by HEADER_CopyHDItemForNotify(), HEADER_PrepareCallbackItems(), HEADER_StoreHDItemInHeader(), REBAR_InsertBandT(), REBAR_SetBandInfoT(), set_string_index(), TAB_InsertItemT(), TAB_SetItemT(), and TOOLBAR_AddStringA().

◆ Str_SetPtrWtoA()

BOOL Str_SetPtrWtoA ( LPSTR lppDest,
LPCWSTR  lpSrc 
)

Definition at line 1030 of file comctl32undoc.c.

1031{
1032 TRACE("(%p %s)\n", lppDest, debugstr_w(lpSrc));
1033
1034 if (lpSrc) {
1036 LPSTR ptr = ReAlloc (*lppDest, len*sizeof(CHAR));
1037
1038 if (!ptr)
1039 return FALSE;
1041 *lppDest = ptr;
1042 }
1043 else {
1044 Free (*lppDest);
1045 *lppDest = NULL;
1046 }
1047
1048 return TRUE;
1049}
char CHAR
Definition: xmlstorage.h:175

Referenced by HEADER_CopyHDItemForNotify(), notify_forward_header(), and PAGER_ConvertText().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( commctrl  )

Variable Documentation

◆ strMRUList

const WCHAR strMRUList[] = { 'M','R','U','L','i','s','t',0 }
static

Definition at line 54 of file comctl32undoc.c.

Referenced by create_mru_list(), and MRU_SaveChanged().