From 04ec181c6c5f0c6e9ff5faf16c70dc0b71da8df4 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Mon, 19 Mar 2018 10:10:12 +0300 Subject: [PATCH] shell32/tests: Add a basic test for SHLimitInputEdit(). Signed-off-by: Nikolay Sivov Signed-off-by: Alexandre Julliard --- dlls/shell32/tests/shlfolder.c | 29 +++++++++++++++++++++++++++++ include/shlobj.h | 1 + include/shobjidl.idl | 14 ++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/dlls/shell32/tests/shlfolder.c b/dlls/shell32/tests/shlfolder.c index 1b140c05013..95ebb92e5c5 100644 --- a/dlls/shell32/tests/shlfolder.c +++ b/dlls/shell32/tests/shlfolder.c @@ -5217,6 +5217,34 @@ static void test_GetDefaultSearchGUID(void) CoUninitialize(); } +static void test_SHLimitInputEdit(void) +{ + IShellFolder *desktop; + HRESULT hr; + HWND hwnd; + + hr = SHGetDesktopFolder(&desktop); + ok(hr == S_OK, "Failed to get desktop folder, hr %#x.\n", hr); + + hr = SHLimitInputEdit(NULL, desktop); +todo_wine + ok(hr == E_FAIL, "Unexpected hr %#x.\n", hr); + + hwnd = CreateWindowA("EDIT", NULL, WS_VISIBLE, 0, 0, 100, 30, NULL, NULL, NULL, NULL); + ok(hwnd != NULL, "Failed to create Edit control.\n"); + + hr = SHLimitInputEdit(hwnd, desktop); +todo_wine + ok(hr == S_OK, "Failed to set input limits, hr %#x.\n", hr); + + hr = SHLimitInputEdit(hwnd, desktop); +todo_wine + ok(hr == S_OK, "Failed to set input limits, hr %#x.\n", hr); + + DestroyWindow(hwnd); + IShellFolder_Release(desktop); +} + START_TEST(shlfolder) { init_function_pointers(); @@ -5258,6 +5286,7 @@ START_TEST(shlfolder) test_DataObject(); test_GetDefaultColumn(); test_GetDefaultSearchGUID(); + test_SHLimitInputEdit(); OleUninitialize(); } diff --git a/include/shlobj.h b/include/shlobj.h index 09efc18ee5c..7cdb4f873d3 100644 --- a/include/shlobj.h +++ b/include/shlobj.h @@ -1801,6 +1801,7 @@ HRESULT WINAPI CDefFolderMenu_Create2(LPCITEMIDLIST pidlFolder, HWND hwnd, UINT IContextMenu **ppcm); int WINAPI PickIconDlg(HWND owner, WCHAR *path, UINT path_len, int *index); +HRESULT WINAPI SHLimitInputEdit(HWND hwnd, IShellFolder *folder); #include diff --git a/include/shobjidl.idl b/include/shobjidl.idl index 5e4da5de28c..e0fe01c2c10 100644 --- a/include/shobjidl.idl +++ b/include/shobjidl.idl @@ -3699,6 +3699,20 @@ typedef enum ASSOC_FILTER } ASSOC_FILTER; cpp_quote("HRESULT WINAPI SHAssocEnumHandlers(PCWSTR extra, ASSOC_FILTER filter, IEnumAssocHandlers **handlersenum);") +[ + uuid(1df0d7f1-b267-4d28-8b10-12e23202a5c4), +] +interface IItemNameLimits : IUnknown +{ + HRESULT GetValidCharacters( + [out, string] LPWSTR *validchars, + [out, string] LPWSTR *invalidchars); + + HRESULT GetMaxLength( + [in, string] LPCWSTR name, + [out] int *max_length); +} + /***************************************************************************** * ShellObjects typelibrary */