https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ab7d8f3616089d903a6337908a9fb8fa033b3394

commit ab7d8f3616089d903a6337908a9fb8fa033b3394
Author:     Katayama Hirofumi MZ <[email protected]>
AuthorDate: Mon Apr 5 04:20:18 2021 +0900
Commit:     GitHub <[email protected]>
CommitDate: Mon Apr 5 04:20:18 2021 +0900

    [BROWSEUI][BROWSEUI_APITEST] Add CLSID_ACLHistory stubs (#3582)
    
    - Initial implement CLSID_ACLHistory as stub.
    - Add IACLHistory testcase into browseui_apitest.
    CORE-9281
---
 dll/win32/browseui/CMakeLists.txt                  |  1 +
 dll/win32/browseui/aclhistory.cpp                  | 51 ++++++++++++++++++++
 dll/win32/browseui/aclhistory.h                    | 34 +++++++++++++
 dll/win32/browseui/browseui.cpp                    |  1 +
 dll/win32/browseui/browseui.rc                     |  1 +
 dll/win32/browseui/precomp.h                       |  1 +
 dll/win32/browseui/res/autocompletehistory.rgs     | 13 +++++
 dll/win32/browseui/resource.h                      |  1 +
 modules/rostests/apitests/browseui/CMakeLists.txt  |  3 +-
 modules/rostests/apitests/browseui/IACLHistory.cpp | 56 ++++++++++++++++++++++
 modules/rostests/apitests/browseui/testlist.c      |  2 +
 11 files changed, 163 insertions(+), 1 deletion(-)

diff --git a/dll/win32/browseui/CMakeLists.txt 
b/dll/win32/browseui/CMakeLists.txt
index 9d199f6c996..d606fbfbb18 100644
--- a/dll/win32/browseui/CMakeLists.txt
+++ b/dll/win32/browseui/CMakeLists.txt
@@ -8,6 +8,7 @@ spec2def(browseui.dll browseui.spec ADD_IMPORTLIB)
 list(APPEND SOURCE
     ACLCustomMRU.cpp
     ACLCustomMRU.h
+    aclhistory.cpp
     aclistisf.cpp
     aclmulti.cpp
     addressband.cpp
diff --git a/dll/win32/browseui/aclhistory.cpp 
b/dll/win32/browseui/aclhistory.cpp
new file mode 100644
index 00000000000..30412e023e8
--- /dev/null
+++ b/dll/win32/browseui/aclhistory.cpp
@@ -0,0 +1,51 @@
+/*
+ * PROJECT:     ReactOS Shell
+ * LICENSE:     LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
+ * PURPOSE:     Implement CLSID_ACLHistory for auto-completion
+ * COPYRIGHT:   Copyright 2021 Katayama Hirofumi MZ 
<[email protected]>
+ */
+
+#include "precomp.h"
+
+CACLHistory::CACLHistory()
+{
+    TRACE("CACLHistory::CACLHistory(%p)\n", this);
+}
+
+CACLHistory::~CACLHistory()
+{
+    TRACE("CACLHistory::~CACLHistory(%p)\n", this);
+}
+
+STDMETHODIMP CACLHistory::Next(ULONG celt, LPOLESTR *rgelt, ULONG 
*pceltFetched)
+{
+    FIXME("CACLHistory::Next(%p, %lu, %p, %p): stub\n", this, celt, rgelt, 
pceltFetched);
+    if (pceltFetched)
+        *pceltFetched = 0;
+    if (rgelt)
+        *rgelt = NULL;
+    if (celt != 1)
+        return E_NOTIMPL;
+    // FIXME: *rgelt, *pceltFetched, return value
+    return E_FAIL;
+}
+
+STDMETHODIMP CACLHistory::Reset()
+{
+    FIXME("CACLHistory::Reset(%p): stub\n", this);
+    return S_OK;
+}
+
+STDMETHODIMP CACLHistory::Skip(ULONG celt)
+{
+    TRACE("CACLHistory::Clone(%p, %lu)\n", this, celt);
+    return E_NOTIMPL;
+}
+
+STDMETHODIMP CACLHistory::Clone(IEnumString **ppenum)
+{
+    FIXME("CACLHistory::Clone(%p, %p): stub\n", this, ppenum);
+    if (ppenum)
+        *ppenum = NULL;
+    return E_NOTIMPL;
+}
diff --git a/dll/win32/browseui/aclhistory.h b/dll/win32/browseui/aclhistory.h
new file mode 100644
index 00000000000..b4a6b6a9d0b
--- /dev/null
+++ b/dll/win32/browseui/aclhistory.h
@@ -0,0 +1,34 @@
+/*
+ * PROJECT:     ReactOS Shell
+ * LICENSE:     LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
+ * PURPOSE:     Implement CLSID_ACLHistory for auto-completion
+ * COPYRIGHT:   Copyright 2021 Katayama Hirofumi MZ 
<[email protected]>
+ */
+
+#pragma once
+
+class CACLHistory
+    : public CComCoClass<CACLHistory, &CLSID_ACLHistory>
+    , public CComObjectRootEx<CComMultiThreadModelNoCS>
+    , public IEnumString
+{
+public:
+    CACLHistory();
+    virtual ~CACLHistory();
+
+    // *** IEnumString methods ***
+    STDMETHODIMP Next(ULONG celt, LPOLESTR *rgelt, ULONG *pceltFetched) 
override;
+    STDMETHODIMP Skip(ULONG celt) override;
+    STDMETHODIMP Reset() override;
+    STDMETHODIMP Clone(IEnumString **ppenum) override;
+
+public:
+    DECLARE_REGISTRY_RESOURCEID(IDR_ACLHISTORY)
+    DECLARE_NOT_AGGREGATABLE(CACLHistory)
+
+    DECLARE_PROTECT_FINAL_CONSTRUCT()
+
+    BEGIN_COM_MAP(CACLHistory)
+        COM_INTERFACE_ENTRY_IID(IID_IEnumString, IEnumString)
+    END_COM_MAP()
+};
diff --git a/dll/win32/browseui/browseui.cpp b/dll/win32/browseui/browseui.cpp
index de1f8bb95ad..ea5b000365f 100644
--- a/dll/win32/browseui/browseui.cpp
+++ b/dll/win32/browseui/browseui.cpp
@@ -138,6 +138,7 @@ public:
 BEGIN_OBJECT_MAP(ObjectMap)
 OBJECT_ENTRY(CLSID_ACLCustomMRU, CACLCustomMRU)
 OBJECT_ENTRY(CLSID_AutoComplete, CAutoComplete)
+OBJECT_ENTRY(CLSID_ACLHistory, CACLHistory)
 OBJECT_ENTRY(CLSID_ACLMulti, CACLMulti)
 OBJECT_ENTRY(CLSID_ACListISF, CACListISF)
 OBJECT_ENTRY(CLSID_SH_AddressBand, CAddressBand)
diff --git a/dll/win32/browseui/browseui.rc b/dll/win32/browseui/browseui.rc
index 774e346c0de..5a6eee380cd 100644
--- a/dll/win32/browseui/browseui.rc
+++ b/dll/win32/browseui/browseui.rc
@@ -33,6 +33,7 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
 IDR_ADDRESSBAND REGISTRY "res/addressband.rgs"
 IDR_ADDRESSEDITBOX REGISTRY "res/addresseditbox.rgs"
 IDR_ACLMULTI REGISTRY "res/autocompletecontainer.rgs"
+IDR_ACLHISTORY REGISTRY "res/autocompletehistory.rgs"
 IDR_BANDPROXY REGISTRY "res/bandproxy.rgs"
 IDR_BANDSITE REGISTRY "res/rebarbandsite.rgs"
 IDR_BANDSITEMENU REGISTRY "res/bandsitemenu.rgs"
diff --git a/dll/win32/browseui/precomp.h b/dll/win32/browseui/precomp.h
index 02c27054544..67fe4c33208 100644
--- a/dll/win32/browseui/precomp.h
+++ b/dll/win32/browseui/precomp.h
@@ -38,6 +38,7 @@
 #include "resource.h"
 
 #include "ACLCustomMRU.h"
+#include "aclhistory.h"
 #include "aclistisf.h"
 #include "aclmulti.h"
 #include "addressband.h"
diff --git a/dll/win32/browseui/res/autocompletehistory.rgs 
b/dll/win32/browseui/res/autocompletehistory.rgs
new file mode 100644
index 00000000000..dfb40b6a6da
--- /dev/null
+++ b/dll/win32/browseui/res/autocompletehistory.rgs
@@ -0,0 +1,13 @@
+HKCR
+{
+       NoRemove CLSID
+       {
+               ForceRemove {00BB2764-6A77-11D0-A535-00C04FD7D062} = s 'ReactOS 
History AutoComplete List'
+               {
+                       InprocServer32 = s '%MODULE%'
+                       {
+                               val ThreadingModel = s 'Apartment'
+                       }
+               }
+       }
+}
diff --git a/dll/win32/browseui/resource.h b/dll/win32/browseui/resource.h
index 1890dc0676a..4bbe766b964 100644
--- a/dll/win32/browseui/resource.h
+++ b/dll/win32/browseui/resource.h
@@ -109,6 +109,7 @@
 #define IDR_FINDFOLDER           147
 #define IDR_USERASSIST           148
 #define IDR_SHELLTASKSCHEDULER   149
+#define IDR_ACLHISTORY           150
 
 #define IDS_SMALLICONS           12301
 #define IDS_LARGEICONS           12302
diff --git a/modules/rostests/apitests/browseui/CMakeLists.txt 
b/modules/rostests/apitests/browseui/CMakeLists.txt
index a3448d69535..c325bf3d423 100644
--- a/modules/rostests/apitests/browseui/CMakeLists.txt
+++ b/modules/rostests/apitests/browseui/CMakeLists.txt
@@ -5,7 +5,8 @@ include_directories(
 list(APPEND SOURCE
     ACListISF.cpp
     IACLCustomMRU.cpp
-         IAutoComplete.cpp
+    IACLHistory.cpp
+    IAutoComplete.cpp
     SHEnumClassesOfCategories.cpp
     SHExplorerParseCmdLine.c
     testlist.c)
diff --git a/modules/rostests/apitests/browseui/IACLHistory.cpp 
b/modules/rostests/apitests/browseui/IACLHistory.cpp
new file mode 100644
index 00000000000..68d25dc0a6a
--- /dev/null
+++ b/modules/rostests/apitests/browseui/IACLHistory.cpp
@@ -0,0 +1,56 @@
+/*
+ * PROJECT:     ReactOS api tests
+ * LICENSE:     LGPL-2.0-or-later (https://spdx.org/licenses/LGPL-2.0-or-later)
+ * PURPOSE:     Test for IACLHistory objects
+ * COPYRIGHT:   Copyright 2021 Katayama Hirofumi MZ 
<[email protected]>
+ */
+
+#define _UNICODE
+#define UNICODE
+#include <apitest.h>
+#include <shlobj.h>
+#include <atlbase.h>
+#include <atlcom.h>
+#include <stdio.h>
+#include <shellutils.h>
+
+struct CCoInit
+{
+    CCoInit() { hres = CoInitialize(NULL); }
+    ~CCoInit() { if (SUCCEEDED(hres)) { CoUninitialize(); } }
+    HRESULT hres;
+};
+
+START_TEST(IACLHistory)
+{
+    CCoInit init;
+    ok_hex(init.hres, S_OK);
+    if (FAILED(init.hres))
+    {
+        skip("CoInitialize failed with 0x%08lX\n", init.hres);
+        return;
+    }
+
+    HRESULT hr;
+    CComPtr<IUnknown> pHistory;
+    hr = CoCreateInstance(CLSID_ACLHistory, NULL, CLSCTX_INPROC_SERVER,
+                          IID_PPV_ARG(IUnknown, &pHistory));
+    ok_long(hr, S_OK);
+    ok_int(!!pHistory, TRUE);
+
+    CComPtr<IEnumString> pEnum;
+    hr = pHistory->QueryInterface(IID_PPV_ARG(IEnumString, &pEnum));
+    ok_long(hr, S_OK);
+
+    hr = pEnum->Reset();
+    ok_long(hr, S_OK);
+    hr = pEnum->Reset();
+    ok_long(hr, S_OK);
+
+    hr = pEnum->Skip(0);
+    ok_long(hr, E_NOTIMPL);
+    hr = pEnum->Skip(1);
+    ok_long(hr, E_NOTIMPL);
+    hr = pEnum->Skip(3);
+    ok_long(hr, E_NOTIMPL);
+}
diff --git a/modules/rostests/apitests/browseui/testlist.c 
b/modules/rostests/apitests/browseui/testlist.c
index 20918608eeb..facd05a2a3c 100644
--- a/modules/rostests/apitests/browseui/testlist.c
+++ b/modules/rostests/apitests/browseui/testlist.c
@@ -5,6 +5,7 @@
 
 extern void func_ACListISF(void);
 extern void func_IACLCustomMRU(void);
+extern void func_IACLHistory(void);
 extern void func_IAutoComplete(void);
 extern void func_SHEnumClassesOfCategories(void);
 extern void func_SHExplorerParseCmdLine(void);
@@ -13,6 +14,7 @@ const struct test winetest_testlist[] =
 {
     { "ACListISF", func_ACListISF },
     { "IACLCustomMRU", func_IACLCustomMRU },
+    { "IACLHistory", func_IACLHistory },
     { "IAutoComplete", func_IAutoComplete },
     { "SHEnumClassesOfCategories", func_SHEnumClassesOfCategories },
     { "SHExplorerParseCmdLine", func_SHExplorerParseCmdLine },

Reply via email to