11961d708SKatayama Hirofumi MZ /*
21961d708SKatayama Hirofumi MZ  * PROJECT:     ReactOS api tests
31961d708SKatayama Hirofumi MZ  * LICENSE:     LGPL-2.1-or-later (https://spdx.org/licenses/LGPL-2.1-or-later)
41961d708SKatayama Hirofumi MZ  * PURPOSE:     Tests for MRU List
51961d708SKatayama Hirofumi MZ  * COPYRIGHT:   Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz@gmail.com>
61961d708SKatayama Hirofumi MZ  */
71961d708SKatayama Hirofumi MZ 
81961d708SKatayama Hirofumi MZ #include <apitest.h>
91961d708SKatayama Hirofumi MZ #include <winreg.h>
101961d708SKatayama Hirofumi MZ #include <shlwapi.h>
111961d708SKatayama Hirofumi MZ #include <shlobj.h>
121961d708SKatayama Hirofumi MZ #include <shlobj_undoc.h>
131961d708SKatayama Hirofumi MZ #include <shlguid_undoc.h>
141961d708SKatayama Hirofumi MZ #include <stdio.h>
151961d708SKatayama Hirofumi MZ #include <shlwapi_undoc.h>
161961d708SKatayama Hirofumi MZ #include <versionhelpers.h>
171961d708SKatayama Hirofumi MZ #include <strsafe.h>
181961d708SKatayama Hirofumi MZ #include <wine/test.h>
191961d708SKatayama Hirofumi MZ #include <pseh/pseh2.h>
201961d708SKatayama Hirofumi MZ 
211961d708SKatayama Hirofumi MZ #define SUBKEY0 L"Software\\MRUListTest"
22*1da71e25SKatayama Hirofumi MZ #define SUBSUBKEY0 L"Software\\MRUListTest\\0"
231961d708SKatayama Hirofumi MZ #define TEXT0 L"This is a test."
241961d708SKatayama Hirofumi MZ #define TEXT1 L"ReactOS rocks!"
251961d708SKatayama Hirofumi MZ 
MRUList_DataList_0(void)26*1da71e25SKatayama Hirofumi MZ static void MRUList_DataList_0(void)
271961d708SKatayama Hirofumi MZ {
281961d708SKatayama Hirofumi MZ     HRESULT hr;
291961d708SKatayama Hirofumi MZ     IMruDataList *pList = NULL;
301961d708SKatayama Hirofumi MZ     UINT iSlot1, iSlot2, iSlot3;
311961d708SKatayama Hirofumi MZ     DWORD cbText;
321961d708SKatayama Hirofumi MZ     WCHAR szText[MAX_PATH];
331961d708SKatayama Hirofumi MZ 
341961d708SKatayama Hirofumi MZ     hr = CoCreateInstance(CLSID_MruLongList, NULL, CLSCTX_INPROC_SERVER,
351961d708SKatayama Hirofumi MZ                           IID_IMruDataList, (LPVOID*)&pList);
361961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
371961d708SKatayama Hirofumi MZ     if (pList == NULL)
381961d708SKatayama Hirofumi MZ     {
391961d708SKatayama Hirofumi MZ         skip("pList was NULL\n");
401961d708SKatayama Hirofumi MZ         return;
411961d708SKatayama Hirofumi MZ     }
421961d708SKatayama Hirofumi MZ 
431961d708SKatayama Hirofumi MZ     hr = pList->InitData(26, 0, HKEY_CURRENT_USER, SUBKEY0, NULL);
441961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
451961d708SKatayama Hirofumi MZ 
461961d708SKatayama Hirofumi MZ     cbText = (wcslen(TEXT0) + 1) * sizeof(WCHAR);
471961d708SKatayama Hirofumi MZ     hr = pList->AddData((BYTE*)TEXT0, cbText, &iSlot1);
481961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
491961d708SKatayama Hirofumi MZ     ok_int(iSlot1, 0);
501961d708SKatayama Hirofumi MZ 
511961d708SKatayama Hirofumi MZ     hr = pList->FindData((BYTE*)TEXT0, cbText, &iSlot2);
521961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
531961d708SKatayama Hirofumi MZ     ok_int(iSlot1, iSlot2);
541961d708SKatayama Hirofumi MZ 
551961d708SKatayama Hirofumi MZ     cbText = sizeof(szText);
561961d708SKatayama Hirofumi MZ     hr = pList->GetData(iSlot1, (BYTE*)szText, cbText);
571961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
581961d708SKatayama Hirofumi MZ     ok_wstr(szText, TEXT0);
591961d708SKatayama Hirofumi MZ 
601961d708SKatayama Hirofumi MZ     cbText = (wcslen(TEXT1) + 1) * sizeof(WCHAR);
611961d708SKatayama Hirofumi MZ     hr = pList->AddData((BYTE*)TEXT1, cbText, &iSlot3);
621961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
631961d708SKatayama Hirofumi MZ     ok_int(iSlot3, 1);
641961d708SKatayama Hirofumi MZ 
651961d708SKatayama Hirofumi MZ     pList->Release();
661961d708SKatayama Hirofumi MZ }
671961d708SKatayama Hirofumi MZ 
MRUList_Check(LPCWSTR pszSubKey,LPCWSTR pszValueName,LPCVOID pvData,DWORD cbData)68*1da71e25SKatayama Hirofumi MZ static INT MRUList_Check(LPCWSTR pszSubKey, LPCWSTR pszValueName, LPCVOID pvData, DWORD cbData)
691961d708SKatayama Hirofumi MZ {
701961d708SKatayama Hirofumi MZ     BYTE abData[512];
71*1da71e25SKatayama Hirofumi MZ     LONG error;
72*1da71e25SKatayama Hirofumi MZ     DWORD dwSize = cbData;
731961d708SKatayama Hirofumi MZ 
74*1da71e25SKatayama Hirofumi MZ     error = SHGetValueW(HKEY_CURRENT_USER, pszSubKey, pszValueName, NULL, abData, &dwSize);
75*1da71e25SKatayama Hirofumi MZ     if (error != ERROR_SUCCESS)
76*1da71e25SKatayama Hirofumi MZ         return -999;
77*1da71e25SKatayama Hirofumi MZ 
78*1da71e25SKatayama Hirofumi MZ #if 0
79*1da71e25SKatayama Hirofumi MZ     printf("dwSize: %ld\n", dwSize);
80*1da71e25SKatayama Hirofumi MZ     for (DWORD i = 0; i < dwSize; ++i)
811961d708SKatayama Hirofumi MZ     {
821961d708SKatayama Hirofumi MZ         printf("%02X ", abData[i]);
831961d708SKatayama Hirofumi MZ     }
841961d708SKatayama Hirofumi MZ     printf("\n");
851961d708SKatayama Hirofumi MZ #endif
86*1da71e25SKatayama Hirofumi MZ 
87*1da71e25SKatayama Hirofumi MZ     if (dwSize != cbData)
88*1da71e25SKatayama Hirofumi MZ         return +999;
89*1da71e25SKatayama Hirofumi MZ 
90*1da71e25SKatayama Hirofumi MZ     if (!pvData)
91*1da71e25SKatayama Hirofumi MZ         return TRUE;
92*1da71e25SKatayama Hirofumi MZ 
93*1da71e25SKatayama Hirofumi MZ     return memcmp(abData, pvData, cbData) == 0;
941961d708SKatayama Hirofumi MZ }
951961d708SKatayama Hirofumi MZ 
MRUList_DataList_1(void)96*1da71e25SKatayama Hirofumi MZ static void MRUList_DataList_1(void)
971961d708SKatayama Hirofumi MZ {
981961d708SKatayama Hirofumi MZ     HRESULT hr;
991961d708SKatayama Hirofumi MZ     IMruDataList *pList = NULL;
1001961d708SKatayama Hirofumi MZ     UINT iSlot;
1011961d708SKatayama Hirofumi MZ 
1021961d708SKatayama Hirofumi MZ     hr = CoCreateInstance(CLSID_MruLongList, NULL, CLSCTX_INPROC_SERVER,
1031961d708SKatayama Hirofumi MZ                           IID_IMruDataList, (LPVOID*)&pList);
1041961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
1051961d708SKatayama Hirofumi MZ     if (pList == NULL)
1061961d708SKatayama Hirofumi MZ     {
1071961d708SKatayama Hirofumi MZ         skip("pList was NULL\n");
1081961d708SKatayama Hirofumi MZ         return;
1091961d708SKatayama Hirofumi MZ     }
1101961d708SKatayama Hirofumi MZ 
1111961d708SKatayama Hirofumi MZ     hr = pList->InitData(26, 0, HKEY_CURRENT_USER, SUBKEY0, NULL);
1121961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
1131961d708SKatayama Hirofumi MZ 
1141961d708SKatayama Hirofumi MZ     DWORD cbText = (wcslen(TEXT0) + 1) * sizeof(WCHAR);
1151961d708SKatayama Hirofumi MZ     hr = pList->FindData((BYTE*)TEXT0, cbText, &iSlot);
1161961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
1171961d708SKatayama Hirofumi MZ     ok_int(iSlot, 1);
1181961d708SKatayama Hirofumi MZ 
1191961d708SKatayama Hirofumi MZ     hr = pList->Delete(iSlot);
1201961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
1211961d708SKatayama Hirofumi MZ 
1221961d708SKatayama Hirofumi MZ     iSlot = 0xCAFE;
1231961d708SKatayama Hirofumi MZ     cbText = (wcslen(TEXT0) + 1) * sizeof(WCHAR);
1241961d708SKatayama Hirofumi MZ     hr = pList->FindData((BYTE*)TEXT0, cbText, &iSlot);
1251961d708SKatayama Hirofumi MZ     ok_hex(hr, E_FAIL);
1261961d708SKatayama Hirofumi MZ     ok_int(iSlot, 0xCAFE);
1271961d708SKatayama Hirofumi MZ 
1281961d708SKatayama Hirofumi MZ     pList->Release();
1291961d708SKatayama Hirofumi MZ }
1301961d708SKatayama Hirofumi MZ 
MRUList_DataList_2(void)131*1da71e25SKatayama Hirofumi MZ static void MRUList_DataList_2(void)
1321961d708SKatayama Hirofumi MZ {
1331961d708SKatayama Hirofumi MZ     HRESULT hr;
1341961d708SKatayama Hirofumi MZ     IMruDataList *pList = NULL;
1351961d708SKatayama Hirofumi MZ 
1361961d708SKatayama Hirofumi MZ     hr = CoCreateInstance(CLSID_MruLongList, NULL, CLSCTX_INPROC_SERVER,
1371961d708SKatayama Hirofumi MZ                           IID_IMruDataList, (LPVOID*)&pList);
1381961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
1391961d708SKatayama Hirofumi MZ     if (pList == NULL)
1401961d708SKatayama Hirofumi MZ     {
1411961d708SKatayama Hirofumi MZ         skip("pList was NULL\n");
1421961d708SKatayama Hirofumi MZ         return;
1431961d708SKatayama Hirofumi MZ     }
1441961d708SKatayama Hirofumi MZ 
1451961d708SKatayama Hirofumi MZ     hr = pList->InitData(26, 0, HKEY_CURRENT_USER, SUBKEY0, NULL);
1461961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
1471961d708SKatayama Hirofumi MZ 
1481961d708SKatayama Hirofumi MZ     WCHAR szText[MAX_PATH];
1491961d708SKatayama Hirofumi MZ     DWORD cbText = sizeof(szText);
1501961d708SKatayama Hirofumi MZ     StringCchCopyW(szText, _countof(szText), L"====");
1511961d708SKatayama Hirofumi MZ     hr = pList->GetData(0, (BYTE*)szText, cbText);
1521961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
1531961d708SKatayama Hirofumi MZ     ok_wstr(szText, L"ABC");
1541961d708SKatayama Hirofumi MZ 
1551961d708SKatayama Hirofumi MZ     StringCchCopyW(szText, _countof(szText), L"====");
1561961d708SKatayama Hirofumi MZ     cbText = sizeof(szText);
1571961d708SKatayama Hirofumi MZ     hr = pList->GetData(1, (BYTE*)szText, cbText);
1581961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
1591961d708SKatayama Hirofumi MZ     ok_wstr(szText, L"XYZ");
1601961d708SKatayama Hirofumi MZ 
1611961d708SKatayama Hirofumi MZ     pList->Release();
1621961d708SKatayama Hirofumi MZ }
1631961d708SKatayama Hirofumi MZ 
MRUList_DataList(void)164*1da71e25SKatayama Hirofumi MZ static void MRUList_DataList(void)
1651961d708SKatayama Hirofumi MZ {
1661961d708SKatayama Hirofumi MZ     if (IsWindowsVistaOrGreater())
1671961d708SKatayama Hirofumi MZ     {
1681961d708SKatayama Hirofumi MZ         skip("Vista+ doesn't support CLSID_MruLongList\n");
1691961d708SKatayama Hirofumi MZ         return;
1701961d708SKatayama Hirofumi MZ     }
1711961d708SKatayama Hirofumi MZ 
1721961d708SKatayama Hirofumi MZ     SHDeleteKeyW(HKEY_CURRENT_USER, SUBKEY0);
1731961d708SKatayama Hirofumi MZ 
1741961d708SKatayama Hirofumi MZ     LONG error;
1751961d708SKatayama Hirofumi MZ     error = SHSetValueW(HKEY_CURRENT_USER, SUBKEY0, NULL, REG_SZ, L"", sizeof(UNICODE_NULL));
1761961d708SKatayama Hirofumi MZ     ok_long(error, ERROR_SUCCESS);
1771961d708SKatayama Hirofumi MZ 
1781961d708SKatayama Hirofumi MZ     error = SHGetValueW(HKEY_CURRENT_USER, SUBKEY0, NULL, NULL, NULL, NULL);
1791961d708SKatayama Hirofumi MZ     ok_long(error, ERROR_SUCCESS);
1801961d708SKatayama Hirofumi MZ 
181*1da71e25SKatayama Hirofumi MZ     MRUList_DataList_0();
182*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"MRUListEx", "\x01\x00\x00\x00\x00\x00\x00\x00\xFF\xFF\xFF\xFF", 12), TRUE);
1831961d708SKatayama Hirofumi MZ 
184*1da71e25SKatayama Hirofumi MZ     MRUList_DataList_1();
185*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"MRUListEx", "\x01\x00\x00\x00\xFF\xFF\xFF\xFF", 8), TRUE);
1861961d708SKatayama Hirofumi MZ 
1871961d708SKatayama Hirofumi MZ     error = SHDeleteValueW(HKEY_CURRENT_USER, SUBKEY0, L"MRUList");
1881961d708SKatayama Hirofumi MZ     ok_long(error, ERROR_FILE_NOT_FOUND);
1891961d708SKatayama Hirofumi MZ     error = SHDeleteValueW(HKEY_CURRENT_USER, SUBKEY0, L"MRUListEx");
1901961d708SKatayama Hirofumi MZ     ok_long(error, ERROR_SUCCESS);
1911961d708SKatayama Hirofumi MZ 
1921961d708SKatayama Hirofumi MZ     error = SHSetValueW(HKEY_CURRENT_USER, SUBKEY0, L"MRUList", REG_SZ, L"ab", 3 * sizeof(WCHAR));
1931961d708SKatayama Hirofumi MZ     ok_long(error, ERROR_SUCCESS);
1941961d708SKatayama Hirofumi MZ     error = SHSetValueW(HKEY_CURRENT_USER, SUBKEY0, L"a", REG_BINARY, L"ABC", 4 * sizeof(WCHAR));
1951961d708SKatayama Hirofumi MZ     ok_long(error, ERROR_SUCCESS);
1961961d708SKatayama Hirofumi MZ     error = SHSetValueW(HKEY_CURRENT_USER, SUBKEY0, L"b", REG_BINARY, L"XYZ", 4 * sizeof(WCHAR));
1971961d708SKatayama Hirofumi MZ     ok_long(error, ERROR_SUCCESS);
1981961d708SKatayama Hirofumi MZ 
199*1da71e25SKatayama Hirofumi MZ     MRUList_DataList_2();
200*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"MRUListEx", "\x00\x00\x00\x00\x01\x00\x00\x00\xFF\xFF\xFF\xFF", 12), TRUE);
2011961d708SKatayama Hirofumi MZ 
2021961d708SKatayama Hirofumi MZ     error = SHDeleteValueW(HKEY_CURRENT_USER, SUBKEY0, L"MRUList");
2031961d708SKatayama Hirofumi MZ     ok_long(error, ERROR_FILE_NOT_FOUND);
2041961d708SKatayama Hirofumi MZ     error = SHDeleteValueW(HKEY_CURRENT_USER, SUBKEY0, L"MRUListEx");
2051961d708SKatayama Hirofumi MZ     ok_long(error, ERROR_SUCCESS);
2061961d708SKatayama Hirofumi MZ 
2071961d708SKatayama Hirofumi MZ     SHDeleteKeyW(HKEY_CURRENT_USER, SUBKEY0);
2081961d708SKatayama Hirofumi MZ }
2091961d708SKatayama Hirofumi MZ 
MRUList_PidlList_0(void)210*1da71e25SKatayama Hirofumi MZ static void MRUList_PidlList_0(void)
211*1da71e25SKatayama Hirofumi MZ {
212*1da71e25SKatayama Hirofumi MZ     HRESULT hr;
213*1da71e25SKatayama Hirofumi MZ     IMruPidlList *pList = NULL;
214*1da71e25SKatayama Hirofumi MZ 
215*1da71e25SKatayama Hirofumi MZ     hr = CoCreateInstance(CLSID_MruPidlList, NULL, CLSCTX_INPROC_SERVER,
216*1da71e25SKatayama Hirofumi MZ                           IID_IMruPidlList, (LPVOID*)&pList);
217*1da71e25SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
218*1da71e25SKatayama Hirofumi MZ     if (pList == NULL)
219*1da71e25SKatayama Hirofumi MZ     {
220*1da71e25SKatayama Hirofumi MZ         skip("pList was NULL\n");
221*1da71e25SKatayama Hirofumi MZ         return;
222*1da71e25SKatayama Hirofumi MZ     }
223*1da71e25SKatayama Hirofumi MZ 
224*1da71e25SKatayama Hirofumi MZ     LONG error;
225*1da71e25SKatayama Hirofumi MZ 
226*1da71e25SKatayama Hirofumi MZ     error = SHGetValueW(HKEY_CURRENT_USER, SUBKEY0, NULL, NULL, NULL, NULL);
227*1da71e25SKatayama Hirofumi MZ     ok_long(error, ERROR_FILE_NOT_FOUND);
228*1da71e25SKatayama Hirofumi MZ 
229*1da71e25SKatayama Hirofumi MZ     hr = pList->InitList(32, HKEY_CURRENT_USER, SUBKEY0);
230*1da71e25SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
231*1da71e25SKatayama Hirofumi MZ 
232*1da71e25SKatayama Hirofumi MZ     error = SHGetValueW(HKEY_CURRENT_USER, SUBKEY0, NULL, NULL, NULL, NULL);
233*1da71e25SKatayama Hirofumi MZ     ok_long(error, ERROR_FILE_NOT_FOUND);
234*1da71e25SKatayama Hirofumi MZ 
235*1da71e25SKatayama Hirofumi MZ     LPITEMIDLIST pidl1, pidl2;
236*1da71e25SKatayama Hirofumi MZ     SHGetSpecialFolderLocation(NULL, CSIDL_DESKTOP, &pidl1);
237*1da71e25SKatayama Hirofumi MZ     SHGetSpecialFolderLocation(NULL, CSIDL_PERSONAL, &pidl2);
238*1da71e25SKatayama Hirofumi MZ 
239*1da71e25SKatayama Hirofumi MZ     UINT uNodeSlot1 = 0xDEADFACE;
240*1da71e25SKatayama Hirofumi MZ     hr = pList->UsePidl(pidl1, &uNodeSlot1);
241*1da71e25SKatayama Hirofumi MZ     ok_hex(uNodeSlot1, 1);
242*1da71e25SKatayama Hirofumi MZ 
243*1da71e25SKatayama Hirofumi MZ     // "NodeSlot" value
244*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"NodeSlot", "\x01\x00\x00\x00", 4), TRUE);
245*1da71e25SKatayama Hirofumi MZ 
246*1da71e25SKatayama Hirofumi MZ     // "NodeSlots" value (Not "NodeSlot")
247*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"NodeSlots", "\x02", 1), TRUE);
248*1da71e25SKatayama Hirofumi MZ 
249*1da71e25SKatayama Hirofumi MZ     UINT uNodeSlot2 = 0xDEADFACE;
250*1da71e25SKatayama Hirofumi MZ     hr = pList->UsePidl(pidl2, &uNodeSlot2);
251*1da71e25SKatayama Hirofumi MZ     ok_hex(uNodeSlot2, 2);
252*1da71e25SKatayama Hirofumi MZ 
253*1da71e25SKatayama Hirofumi MZ     // "0" value
254*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"0", NULL, 22), TRUE);
255*1da71e25SKatayama Hirofumi MZ 
256*1da71e25SKatayama Hirofumi MZ     // "MRUListEx" value
257*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"MRUListEx", "\x00\x00\x00\x00\xFF\xFF\xFF\xFF", 8), TRUE);
258*1da71e25SKatayama Hirofumi MZ 
259*1da71e25SKatayama Hirofumi MZ     // "NodeSlot" value
260*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"NodeSlot", "\x01\x00\x00\x00", 4), TRUE);
261*1da71e25SKatayama Hirofumi MZ 
262*1da71e25SKatayama Hirofumi MZ     // "NodeSlots" value
263*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"NodeSlots", "\x02\x02", 2), TRUE);
264*1da71e25SKatayama Hirofumi MZ 
265*1da71e25SKatayama Hirofumi MZ     // SUBSUBKEY0: "MRUListEx" value
266*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBSUBKEY0, L"MRUListEx", "\xFF\xFF\xFF\xFF", 4), TRUE);
267*1da71e25SKatayama Hirofumi MZ 
268*1da71e25SKatayama Hirofumi MZ     // SUBSUBKEY0: "NodeSlot" value
269*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBSUBKEY0, L"NodeSlot", "\x02\x00\x00\x00", 4), TRUE);
270*1da71e25SKatayama Hirofumi MZ 
271*1da71e25SKatayama Hirofumi MZ     // QueryPidl
272*1da71e25SKatayama Hirofumi MZ     UINT anNodeSlot[2], cNodeSlots;
273*1da71e25SKatayama Hirofumi MZ     FillMemory(anNodeSlot, sizeof(anNodeSlot), 0xCC);
274*1da71e25SKatayama Hirofumi MZ     cNodeSlots = 0xDEAD;
275*1da71e25SKatayama Hirofumi MZ     hr = pList->QueryPidl(pidl1, _countof(anNodeSlot), anNodeSlot, &cNodeSlots);
276*1da71e25SKatayama Hirofumi MZ     ok_long(hr, S_OK);
277*1da71e25SKatayama Hirofumi MZ     ok_int(anNodeSlot[0], 1);
278*1da71e25SKatayama Hirofumi MZ     ok_int(anNodeSlot[1], 0xCCCCCCCC);
279*1da71e25SKatayama Hirofumi MZ     ok_int(cNodeSlots, 1);
280*1da71e25SKatayama Hirofumi MZ 
281*1da71e25SKatayama Hirofumi MZ     hr = pList->PruneKids(pidl1);
282*1da71e25SKatayama Hirofumi MZ 
283*1da71e25SKatayama Hirofumi MZ     // "MRUListEx" value
284*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"MRUListEx", "\x00\x00\x00\x00\xFF\xFF\xFF\xFF", 8), TRUE);
285*1da71e25SKatayama Hirofumi MZ 
286*1da71e25SKatayama Hirofumi MZ     // "NodeSlot" value
287*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"NodeSlot", "\x01\x00\x00\x00", 4), TRUE);
288*1da71e25SKatayama Hirofumi MZ 
289*1da71e25SKatayama Hirofumi MZ     // "NodeSlots" value
290*1da71e25SKatayama Hirofumi MZ     ok_int(MRUList_Check(SUBKEY0, L"NodeSlots", "\x02\x00", 2), TRUE);
291*1da71e25SKatayama Hirofumi MZ 
292*1da71e25SKatayama Hirofumi MZ     FillMemory(anNodeSlot, sizeof(anNodeSlot), 0xCC);
293*1da71e25SKatayama Hirofumi MZ     cNodeSlots = 0xBEEF;
294*1da71e25SKatayama Hirofumi MZ     hr = pList->QueryPidl(pidl1, 0, anNodeSlot, &cNodeSlots);
295*1da71e25SKatayama Hirofumi MZ     ok_long(hr, E_FAIL);
296*1da71e25SKatayama Hirofumi MZ     ok_int(anNodeSlot[0], 0xCCCCCCCC);
297*1da71e25SKatayama Hirofumi MZ     ok_int(anNodeSlot[1], 0xCCCCCCCC);
298*1da71e25SKatayama Hirofumi MZ     ok_int(cNodeSlots, 0);
299*1da71e25SKatayama Hirofumi MZ 
300*1da71e25SKatayama Hirofumi MZ     FillMemory(anNodeSlot, sizeof(anNodeSlot), 0xCC);
301*1da71e25SKatayama Hirofumi MZ     cNodeSlots = 0xDEAD;
302*1da71e25SKatayama Hirofumi MZ     hr = pList->QueryPidl(pidl1, _countof(anNodeSlot), anNodeSlot, &cNodeSlots);
303*1da71e25SKatayama Hirofumi MZ     ok_long(hr, S_OK);
304*1da71e25SKatayama Hirofumi MZ     ok_int(anNodeSlot[0], 1);
305*1da71e25SKatayama Hirofumi MZ     ok_int(anNodeSlot[1], 0xCCCCCCCC);
306*1da71e25SKatayama Hirofumi MZ     ok_int(cNodeSlots, 1);
307*1da71e25SKatayama Hirofumi MZ 
308*1da71e25SKatayama Hirofumi MZ     FillMemory(anNodeSlot, sizeof(anNodeSlot), 0xCC);
309*1da71e25SKatayama Hirofumi MZ     cNodeSlots = 0xDEAD;
310*1da71e25SKatayama Hirofumi MZ     hr = pList->QueryPidl(pidl2, _countof(anNodeSlot), anNodeSlot, &cNodeSlots);
311*1da71e25SKatayama Hirofumi MZ     ok_long(hr, S_FALSE);
312*1da71e25SKatayama Hirofumi MZ     ok_int(anNodeSlot[0], 1);
313*1da71e25SKatayama Hirofumi MZ     ok_int(anNodeSlot[1], 0xCCCCCCCC);
314*1da71e25SKatayama Hirofumi MZ     ok_int(cNodeSlots, 1);
315*1da71e25SKatayama Hirofumi MZ 
316*1da71e25SKatayama Hirofumi MZ     pList->Release();
317*1da71e25SKatayama Hirofumi MZ     ILFree(pidl1);
318*1da71e25SKatayama Hirofumi MZ     ILFree(pidl2);
319*1da71e25SKatayama Hirofumi MZ }
320*1da71e25SKatayama Hirofumi MZ 
MRUList_PidlList(void)321*1da71e25SKatayama Hirofumi MZ static void MRUList_PidlList(void)
322*1da71e25SKatayama Hirofumi MZ {
323*1da71e25SKatayama Hirofumi MZ     if (IsWindowsVistaOrGreater())
324*1da71e25SKatayama Hirofumi MZ     {
325*1da71e25SKatayama Hirofumi MZ         skip("Vista+ doesn't support CLSID_MruPidlList\n");
326*1da71e25SKatayama Hirofumi MZ         return;
327*1da71e25SKatayama Hirofumi MZ     }
328*1da71e25SKatayama Hirofumi MZ 
329*1da71e25SKatayama Hirofumi MZ     SHDeleteKeyW(HKEY_CURRENT_USER, SUBKEY0);
330*1da71e25SKatayama Hirofumi MZ 
331*1da71e25SKatayama Hirofumi MZ     MRUList_PidlList_0();
332*1da71e25SKatayama Hirofumi MZ 
333*1da71e25SKatayama Hirofumi MZ     SHDeleteKeyW(HKEY_CURRENT_USER, SUBKEY0);
334*1da71e25SKatayama Hirofumi MZ }
335*1da71e25SKatayama Hirofumi MZ 
START_TEST(MRUList)3361961d708SKatayama Hirofumi MZ START_TEST(MRUList)
3371961d708SKatayama Hirofumi MZ {
3381961d708SKatayama Hirofumi MZ     HRESULT hr = CoInitialize(NULL);
3391961d708SKatayama Hirofumi MZ     ok_hex(hr, S_OK);
3401961d708SKatayama Hirofumi MZ 
341*1da71e25SKatayama Hirofumi MZ     MRUList_DataList();
342*1da71e25SKatayama Hirofumi MZ     MRUList_PidlList();
3431961d708SKatayama Hirofumi MZ 
3441961d708SKatayama Hirofumi MZ     if (SUCCEEDED(hr))
3451961d708SKatayama Hirofumi MZ         CoUninitialize();
3461961d708SKatayama Hirofumi MZ }
347