ReactOS 0.4.15-dev-5666-gc548b97
comctl32undoc.c File Reference
#include "config.h"
#include "wine/port.h"
#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 "wine/unicode.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 37 of file comctl32undoc.c.

◆ MRU_BINARY

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

Definition at line 242 of file comctl32undoc.c.

◆ MRU_CACHEWRITE

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

Definition at line 243 of file comctl32undoc.c.

◆ MRU_STRING

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

Definition at line 241 of file comctl32undoc.c.

◆ NONAMELESSUNION

#define NONAMELESSUNION

Definition at line 38 of file comctl32undoc.c.

◆ WMRUF_CHANGED

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

Definition at line 275 of file comctl32undoc.c.

◆ WMRUIF_CHANGED

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

Definition at line 261 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 210 of file comctl32undoc.c.

◆ MRUINFOA

◆ MRUINFOW

◆ MRUStringCmpFnA

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

Definition at line 208 of file comctl32undoc.c.

◆ MRUStringCmpFnW

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

Definition at line 209 of file comctl32undoc.c.

◆ NOTIFYDATA

◆ WINEMRUITEM

◆ WINEMRULIST

Function Documentation

◆ AddMRUData()

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

Definition at line 465 of file comctl32undoc.c.

466{
467 LPWINEMRULIST mp = hList;
468 LPWINEMRUITEM witem;
469 INT i, replace;
470
471 if ((replace = FindMRUData (hList, lpData, cbData, NULL)) >= 0) {
472 /* Item exists, just move it to the front */
473 LPWSTR pos = strchrW(mp->realMRU, replace + 'a');
474 while (pos > mp->realMRU)
475 {
476 pos[0] = pos[-1];
477 pos--;
478 }
479 }
480 else {
481 /* either add a new entry or replace oldest */
482 if (mp->cursize < mp->extview.uMax) {
483 /* Add in a new item */
484 replace = mp->cursize;
485 mp->cursize++;
486 }
487 else {
488 /* get the oldest entry and replace data */
489 replace = mp->realMRU[mp->cursize - 1] - 'a';
490 Free(mp->array[replace]);
491 }
492
493 /* Allocate space for new item and move in the data */
494 mp->array[replace] = witem = Alloc(cbData + sizeof(WINEMRUITEM));
495 witem->itemFlag |= WMRUIF_CHANGED;
496 witem->size = cbData;
497 memcpy( &witem->datastart, lpData, cbData);
498
499 /* now rotate MRU list */
500 for(i=mp->cursize-1; i>=1; i--)
501 mp->realMRU[i] = mp->realMRU[i-1];
502 }
503
504 /* The new item gets the front spot */
506 mp->realMRU[0] = replace + 'a';
507
508 TRACE("(%p, %p, %d) adding data, /%c/ now most current\n",
509 hList, lpData, cbData, replace+'a');
510
511 if (!(mp->extview.fFlags & MRU_CACHEWRITE)) {
512 /* save changed stuff right now */
513 MRU_SaveChanged( mp );
514 }
515
516 return replace;
517}
#define WMRUIF_CHANGED
INT WINAPI FindMRUData(HANDLE hList, LPCVOID lpData, DWORD cbData, LPINT lpRegNum)
LPVOID WINAPI Alloc(DWORD dwSize)
Definition: comctl32undoc.c:71
static void MRU_SaveChanged(LPWINEMRULIST mp)
#define WMRUF_CHANGED
#define MRU_CACHEWRITE
#define NULL
Definition: types.h:112
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
#define strchrW(s, c)
Definition: unicode.h:34
INT replace(TCHAR source[MAX_PATH], TCHAR dest[MAX_PATH], DWORD dwFlags, BOOL *doMore)
Definition: replace.c:47
#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 566 of file comctl32undoc.c.

567{
568 DWORD len;
570 INT ret;
571
572 TRACE("(%p,%s)\n", hList, debugstr_a(lpszString));
573
574 if (!hList)
575 return -1;
576
577 if (IsBadStringPtrA(lpszString, -1))
578 {
580 return 0;
581 }
582
583 len = MultiByteToWideChar(CP_ACP, 0, lpszString, -1, NULL, 0) * sizeof(WCHAR);
584 stringW = Alloc(len);
585 if (!stringW)
586 return -1;
587
588 MultiByteToWideChar(CP_ACP, 0, lpszString, -1, stringW, len/sizeof(WCHAR));
590 Free(stringW);
591 return ret;
592}
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:987
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 544 of file comctl32undoc.c.

545{
546 TRACE("(%p,%s)\n", hList, debugstr_w(lpszString));
547
548 if (!hList)
549 return -1;
550
551 if (!lpszString || IsBadStringPtrW(lpszString, -1))
552 {
554 return 0;
555 }
556
557 return AddMRUData(hList, lpszString,
558 (strlenW(lpszString) + 1) * sizeof(WCHAR));
559}
BOOL NTAPI IsBadStringPtrW(IN LPCWSTR lpsz, IN UINT_PTR ucchMax)
Definition: except.c:948
#define debugstr_w
Definition: kernel32.h:32
#define strlenW(s)
Definition: unicode.h:28

Referenced by COpenWithList::AddAppToMRUList().

◆ Alloc()

LPVOID WINAPI Alloc ( DWORD  dwSize)

Definition at line 71 of file comctl32undoc.c.

72{
74}
HLOCAL NTAPI LocalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:1373
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
#define LMEM_ZEROINIT
Definition: winbase.h:375

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 653 of file comctl32undoc.c.

654{
655 UINT i, err;
656 HKEY newkey;
657 DWORD datasize, dwdisp;
658 WCHAR realname[2];
659 LPWINEMRUITEM witem;
660 DWORD type;
661
662 /* get space to save indices that will turn into names
663 * but in order of most to least recently used
664 */
665 mp->realMRU = Alloc((mp->extview.uMax + 2) * sizeof(WCHAR));
666
667 /* get space to save pointers to actual data in order of
668 * 'a' to 'z' (0 to n).
669 */
670 mp->array = Alloc(mp->extview.uMax * sizeof(LPVOID));
671
672 /* open the sub key */
674 0,
675 NULL,
678 0,
679 &newkey,
680 &dwdisp))) {
681 /* error - what to do ??? */
682 ERR("(%u %u %x %p %s %p): Could not open key, error=%d\n",
683 mp->extview.cbSize, mp->extview.uMax, mp->extview.fFlags,
686 return 0;
687 }
688
689 /* get values from key 'MRUList' */
690 if (newkey) {
691 datasize = (mp->extview.uMax + 1) * sizeof(WCHAR);
692 if (RegQueryValueExW( newkey, strMRUList, 0, &type,
693 (LPBYTE)mp->realMRU, &datasize)) {
694 /* not present - set size to 1 (will become 0 later) */
695 datasize = 1;
696 *mp->realMRU = 0;
697 }
698 else
699 datasize /= sizeof(WCHAR);
700
701 TRACE("MRU list = %s, datasize = %d\n", debugstr_w(mp->realMRU), datasize);
702
703 mp->cursize = datasize - 1;
704 /* datasize now has number of items in the MRUList */
705
706 /* get actual values for each entry */
707 realname[1] = 0;
708 for(i=0; i<mp->cursize; i++) {
709 realname[0] = 'a' + i;
710 if(RegQueryValueExW( newkey, realname, 0, &type, 0, &datasize)) {
711 /* not present - what to do ??? */
712 ERR("Key %s not found 1\n", debugstr_w(realname));
713 }
714 mp->array[i] = witem = Alloc(datasize + sizeof(WINEMRUITEM));
715 witem->size = datasize;
716 if(RegQueryValueExW( newkey, realname, 0, &type,
717 &witem->datastart, &datasize)) {
718 /* not present - what to do ??? */
719 ERR("Key %s not found 2\n", debugstr_w(realname));
720 }
721 }
722 RegCloseKey( newkey );
723 }
724 else
725 mp->cursize = 0;
726
727 TRACE("(%u %u %x %p %s %p): Current Size = %d\n",
728 mp->extview.cbSize, mp->extview.uMax, mp->extview.fFlags,
730 mp->extview.u.string_cmpfn, mp->cursize);
731 return mp;
732}
#define ERR(fmt,...)
Definition: debug.h:110
#define RegCloseKey(hKey)
Definition: registry.h:47
static const WCHAR strMRUList[]
Definition: comctl32undoc.c:57
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:1091
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
Definition: reg.c:4121
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::@327 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 813 of file comctl32undoc.c.

814{
815 return CreateMRUListLazyA (lpcml, 0, 0, 0);
816}
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 771 of file comctl32undoc.c.

773{
774 LPWINEMRULIST mp;
775 DWORD len;
776
777 /* Native does not check for a NULL lpcml */
778
779 if (!lpcml->hKey || IsBadStringPtrA(lpcml->lpszSubKey, -1))
780 return 0;
781
782 mp = Alloc(sizeof(WINEMRULIST));
783 memcpy(&mp->extview, lpcml, sizeof(MRUINFOA));
784 len = MultiByteToWideChar(CP_ACP, 0, lpcml->lpszSubKey, -1, NULL, 0);
785 mp->extview.lpszSubKey = Alloc(len * sizeof(WCHAR));
787 mp->extview.lpszSubKey, len);
788 mp->isUnicode = FALSE;
789 return create_mru_list(mp);
790}
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 739 of file comctl32undoc.c.

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

Referenced by CreateMRUListW(), and init_functions().

◆ CreateMRUListW()

HANDLE WINAPI CreateMRUListW ( const MRUINFOW infoW)

Definition at line 797 of file comctl32undoc.c.

798{
799 return CreateMRUListLazyW(infoW, 0, 0, 0);
800}
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 606 of file comctl32undoc.c.

607{
608 FIXME("(%p, %d): stub\n", hList, nItemPos);
609 return TRUE;
610}
#define FIXME(fmt,...)
Definition: debug.h:111

◆ DoNotify()

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

Definition at line 1074 of file comctl32undoc.c.

1075{
1076 NMHDR nmhdr;
1077 LPNMHDR lpNmh = NULL;
1078 UINT idFrom = 0;
1079
1080 TRACE("(%p %p %d %p 0x%08x)\n",
1081 lpNotify->hwndFrom, lpNotify->hwndTo, uCode, lpHdr,
1082 lpNotify->dwParam5);
1083
1084 if (!lpNotify->hwndTo)
1085 return 0;
1086
1087 if (lpNotify->hwndFrom == (HWND)-1) {
1088 lpNmh = lpHdr;
1089 idFrom = lpHdr->idFrom;
1090 }
1091 else {
1092 if (lpNotify->hwndFrom)
1093 idFrom = GetDlgCtrlID (lpNotify->hwndFrom);
1094
1095 lpNmh = (lpHdr) ? lpHdr : &nmhdr;
1096
1097 lpNmh->hwndFrom = lpNotify->hwndFrom;
1098 lpNmh->idFrom = idFrom;
1099 lpNmh->code = uCode;
1100 }
1101
1102 return SendMessageW (lpNotify->hwndTo, WM_NOTIFY, idFrom, (LPARAM)lpNmh);
1103}
#define WM_NOTIFY
Definition: richedit.h:61
UINT_PTR idFrom
Definition: winuser.h:3148
UINT code
Definition: winuser.h:3149
HWND hwndFrom
Definition: winuser.h:3147
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 863 of file comctl32undoc.c.

865{
866 const WINEMRULIST *mp = hList;
867 LPWINEMRUITEM witem;
869 DWORD lenA;
870
871 if (!mp) return -1;
872 if ((nItemPos < 0) || !lpBuffer) return mp->cursize;
873 if (nItemPos >= mp->cursize) return -1;
874 desired = mp->realMRU[nItemPos];
875 desired -= 'a';
876 TRACE("nItemPos=%d, desired=%d\n", nItemPos, desired);
877 witem = mp->array[desired];
878 if(mp->extview.fFlags & MRU_BINARY) {
879 datasize = min( witem->size, nBufferSize );
880 memcpy( lpBuffer, &witem->datastart, datasize);
881 } else {
882 lenA = WideCharToMultiByte(CP_ACP, 0, (LPWSTR)&witem->datastart, -1,
883 NULL, 0, NULL, NULL);
884 datasize = min( lenA, nBufferSize );
887 ((char *)lpBuffer)[ datasize - 1 ] = '\0';
888 datasize = lenA - 1;
889 }
890 TRACE("(%p, %d, %p, %d): returning len=%d\n",
891 hList, nItemPos, lpBuffer, nBufferSize, datasize);
892 return datasize;
893}
#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 837 of file comctl32undoc.c.

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

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

◆ FindMRUData()

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

Definition at line 391 of file comctl32undoc.c.

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

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

◆ FindMRUStringW()

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

Definition at line 617 of file comctl32undoc.c.

618{
619 return FindMRUData(hList, lpszString,
620 (lstrlenW(lpszString) + 1) * sizeof(WCHAR), lpRegNum);
621}
#define lstrlenW
Definition: compat.h:750

◆ Free()

BOOL WINAPI Free ( LPVOID  lpMem)

Definition at line 116 of file comctl32undoc.c.

117{
118 return !LocalFree( lpMem );
119}
HLOCAL NTAPI LocalFree(HLOCAL hMem)
Definition: heapmem.c:1577

◆ FreeMRUList()

void WINAPI FreeMRUList ( HANDLE  hMRUList)

Definition at line 351 of file comctl32undoc.c.

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

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

◆ GetSize()

DWORD WINAPI GetSize ( LPVOID  lpMem)

Definition at line 135 of file comctl32undoc.c.

136{
137 return LocalSize( lpMem );
138}
SIZE_T NTAPI LocalSize(HLOCAL hMem)
Definition: heapmem.c:1777

Referenced by DECLARE_INTERFACE_(), and InitFunctionPtrs().

◆ MRU_SaveChanged()

static void MRU_SaveChanged ( LPWINEMRULIST  mp)
static

Definition at line 282 of file comctl32undoc.c.

283{
284 UINT i, err;
285 HKEY newkey;
286 WCHAR realname[2];
287 LPWINEMRUITEM witem;
288
289 /* or should we do the following instead of RegOpenKeyEx:
290 */
291
292 /* open the sub key */
294 0, KEY_WRITE, &newkey))) {
295 /* not present - what to do ??? */
296 ERR("Could not open key, error=%d, attempting to create\n",
297 err);
299 0,
300 NULL,
303 0,
304 &newkey,
305 0))) {
306 ERR("failed to create key /%s/, err=%d\n",
308 return;
309 }
310 }
311 if (mp->wineFlags & WMRUF_CHANGED) {
312 mp->wineFlags &= ~WMRUF_CHANGED;
313 err = RegSetValueExW(newkey, strMRUList, 0, REG_SZ, (LPBYTE)mp->realMRU,
314 (strlenW(mp->realMRU) + 1)*sizeof(WCHAR));
315 if (err) {
316 ERR("error saving MRUList, err=%d\n", err);
317 }
318 TRACE("saving MRUList=/%s/\n", debugstr_w(mp->realMRU));
319 }
320 realname[1] = 0;
321 for(i=0; i<mp->cursize; i++) {
322 witem = mp->array[i];
323 if (witem->itemFlag & WMRUIF_CHANGED) {
324 witem->itemFlag &= ~WMRUIF_CHANGED;
325 realname[0] = 'a' + i;
326 err = RegSetValueExW(newkey, realname, 0,
327 (mp->extview.fFlags & MRU_BINARY) ?
329 &witem->datastart, witem->size);
330 if (err) {
331 ERR("error saving /%s/, err=%d\n", debugstr_w(realname), err);
332 }
333 TRACE("saving value for name /%s/ size=%d\n",
334 debugstr_w(realname), witem->size);
335 }
336 }
337 RegCloseKey( newkey );
338}
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3356
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:4900
#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 95 of file comctl32undoc.c.

96{
97 if (lpSrc)
99 else
101}
HLOCAL NTAPI LocalReAlloc(HLOCAL hMem, SIZE_T dwBytes, UINT uFlags)
Definition: heapmem.c:1608
#define LMEM_MOVEABLE
Definition: winbase.h:369

Referenced by Str_SetPtrAtoW(), and Str_SetPtrWtoA().

◆ SendNotify()

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

Definition at line 1126 of file comctl32undoc.c.

1127{
1129
1130 TRACE("(%p %p %d %p)\n",
1131 hwndTo, hwndFrom, uCode, lpHdr);
1132
1133 notify.hwndFrom = hwndFrom;
1134 notify.hwndTo = hwndTo;
1135 notify.dwParam5 = 0;
1136 notify.dwParam6 = 0;
1137
1138 return DoNotify (&notify, uCode, lpHdr);
1139}
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 1163 of file comctl32undoc.c.

1165{
1167 HWND hwndNotify;
1168
1169 TRACE("(%p %p %d %p 0x%08x)\n",
1170 hwndFrom, hwndTo, uCode, lpHdr, dwParam5);
1171
1172 hwndNotify = hwndTo;
1173 if (!hwndTo) {
1174 if (IsWindow (hwndFrom)) {
1175 hwndNotify = GetParent (hwndFrom);
1176 if (!hwndNotify)
1177 return 0;
1178 }
1179 }
1180
1181 notify.hwndFrom = hwndFrom;
1182 notify.hwndTo = hwndNotify;
1183 notify.dwParam5 = dwParam5;
1184 notify.dwParam6 = 0;
1185
1186 return DoNotify (&notify, uCode, lpHdr);
1187}
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 950 of file comctl32undoc.c.

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

Referenced by TOOLTIPS_GetDispInfoA().

◆ Str_GetPtrWtoA()

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

Definition at line 909 of file comctl32undoc.c.

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

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

◆ Str_SetPtrAtoW()

BOOL Str_SetPtrAtoW ( LPWSTR lppDest,
LPCSTR  lpSrc 
)

Definition at line 995 of file comctl32undoc.c.

996{
997 TRACE("(%p %s)\n", lppDest, lpSrc);
998
999 if (lpSrc) {
1000 INT len = MultiByteToWideChar(CP_ACP,0,lpSrc,-1,NULL,0);
1001 LPWSTR ptr = ReAlloc (*lppDest, len*sizeof(WCHAR));
1002
1003 if (!ptr)
1004 return FALSE;
1005 MultiByteToWideChar(CP_ACP,0,lpSrc,-1,ptr,len);
1006 *lppDest = ptr;
1007 }
1008 else {
1009 Free (*lppDest);
1010 *lppDest = NULL;
1011 }
1012
1013 return TRUE;
1014}
LPVOID WINAPI ReAlloc(LPVOID lpSrc, DWORD dwSize)
Definition: comctl32undoc.c:95
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 1033 of file comctl32undoc.c.

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

Referenced by HEADER_CopyHDItemForNotify(), and notify_forward_header().

◆ 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 57 of file comctl32undoc.c.

Referenced by create_mru_list(), and MRU_SaveChanged().