https://git.reactos.org/?p=reactos.git;a=commitdiff;h=ba03ffd645520be066ab9…
commit ba03ffd645520be066ab91f690fe6b840c424ee6
Author: Stanislav Motylkov <x86corez(a)gmail.com>
AuthorDate: Tue Dec 20 20:08:08 2022 +0300
Commit: Stanislav Motylkov <x86corez(a)gmail.com>
CommitDate: Tue Dec 20 20:08:08 2022 +0300
[NTOBJSHEX] Formatting only
---
dll/shellext/ntobjshex/foldercommon.cpp | 9 +-
dll/shellext/ntobjshex/foldercommon.h | 47 ++--
dll/shellext/ntobjshex/ntobjenum.cpp | 47 ++--
dll/shellext/ntobjshex/ntobjenum.h | 22 +-
dll/shellext/ntobjshex/ntobjfolder.cpp | 231 ++++++++++---------
dll/shellext/ntobjshex/ntobjfolder.h | 12 +-
dll/shellext/ntobjshex/ntobjshex.cpp | 9 +-
dll/shellext/ntobjshex/regfolder.cpp | 381 +++++++++++++++++---------------
dll/shellext/ntobjshex/regfolder.h | 10 +-
9 files changed, 391 insertions(+), 377 deletions(-)
diff --git a/dll/shellext/ntobjshex/foldercommon.cpp
b/dll/shellext/ntobjshex/foldercommon.cpp
index b67e01edb23..d5050cd5883 100644
--- a/dll/shellext/ntobjshex/foldercommon.cpp
+++ b/dll/shellext/ntobjshex/foldercommon.cpp
@@ -1,9 +1,8 @@
/*
- * PROJECT: ReactOS shell extensions
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll/shellext/ntobjshex/ntobjfolder.cpp
- * PURPOSE: NT Object Namespace shell extension
- * PROGRAMMERS: David Quintana <gigaherz(a)gmail.com>
+ * PROJECT: NT Object Namespace shell extension
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: Folder view class placeholder file
+ * COPYRIGHT: Copyright 2015-2017 David Quintana <gigaherz(a)gmail.com>
*/
#include "precomp.h"
diff --git a/dll/shellext/ntobjshex/foldercommon.h
b/dll/shellext/ntobjshex/foldercommon.h
index 3a6b472ce8c..2983f328198 100644
--- a/dll/shellext/ntobjshex/foldercommon.h
+++ b/dll/shellext/ntobjshex/foldercommon.h
@@ -1,10 +1,10 @@
/*
- * PROJECT: ReactOS shell extensions
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll/shellext/ntobjshex/ntobjfolder.h
- * PURPOSE: NT Object Namespace shell extension
- * PROGRAMMERS: David Quintana <gigaherz(a)gmail.com>
+ * PROJECT: NT Object Namespace shell extension
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: Folder view class header and implementation
+ * COPYRIGHT: Copyright 2015-2017 David Quintana <gigaherz(a)gmail.com>
*/
+
#pragma once
extern const GUID CLSID_NtObjectFolder;
@@ -24,16 +24,18 @@ public:
{
switch (uMsg)
{
- case SFVM_DEFVIEWMODE:
- {
- FOLDERVIEWMODE* pViewMode = (FOLDERVIEWMODE*)lParam;
- *pViewMode = FVM_DETAILS;
- return S_OK;
- }
- case SFVM_COLUMNCLICK:
- return S_FALSE;
- case SFVM_BACKGROUNDENUM:
- return S_OK;
+ case SFVM_DEFVIEWMODE:
+ {
+ FOLDERVIEWMODE* pViewMode = (FOLDERVIEWMODE*)lParam;
+ *pViewMode = FVM_DETAILS;
+ return S_OK;
+ }
+
+ case SFVM_COLUMNCLICK:
+ return S_FALSE;
+
+ case SFVM_BACKGROUNDENUM:
+ return S_OK;
}
DbgPrint("MessageSFVCB unimplemented %d %08x %08x\n", uMsg, wParam,
lParam);
@@ -697,12 +699,13 @@ public:
{
switch (uMsg)
{
- case DFM_MERGECONTEXTMENU:
- return S_OK;
- case DFM_INVOKECOMMAND:
- case DFM_INVOKECOMMANDEX:
- case DFM_GETDEFSTATICID: // Required for Windows 7 to pick a default
- return S_FALSE;
+ case DFM_MERGECONTEXTMENU:
+ return S_OK;
+
+ case DFM_INVOKECOMMAND:
+ case DFM_INVOKECOMMANDEX:
+ case DFM_GETDEFSTATICID: // Required for Windows 7 to pick a default
+ return S_FALSE;
}
return E_NOTIMPL;
}
@@ -718,4 +721,4 @@ public:
COM_INTERFACE_ENTRY_IID(IID_IPersistFolder2, IPersistFolder2)
END_COM_MAP()
-};
\ No newline at end of file
+};
diff --git a/dll/shellext/ntobjshex/ntobjenum.cpp b/dll/shellext/ntobjshex/ntobjenum.cpp
index 80ae5da6900..62d1b1940b7 100644
--- a/dll/shellext/ntobjshex/ntobjenum.cpp
+++ b/dll/shellext/ntobjshex/ntobjenum.cpp
@@ -1,19 +1,8 @@
/*
- * Copyright 2004, 2005 Martin Fuchs
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * PROJECT: NT Object Namespace shell extension
+ * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE: NT Object Namespace enumeration functions
+ * COPYRIGHT: Copyright 2004-2005 Martin Fuchs <martin-fuchs(a)gmx.net>
*/
#include "precomp.h"
@@ -73,19 +62,19 @@ static DWORD NtOpenObject(OBJECT_TYPE type, PHANDLE phandle, DWORD
access, LPCWS
switch (type)
{
- case DIRECTORY_OBJECT: return NtOpenDirectoryObject(phandle, access,
&open_struct);
- case SYMBOLICLINK_OBJECT: return NtOpenSymbolicLinkObject(phandle, access,
&open_struct);
- case MUTANT_OBJECT: return NtOpenMutant(phandle, access, &open_struct);
- case SECTION_OBJECT: return NtOpenSection(phandle, access, &open_struct);
- case EVENT_OBJECT: return NtOpenEvent(phandle, access, &open_struct);
- case SEMAPHORE_OBJECT: return NtOpenSemaphore(phandle, access,
&open_struct);
- case TIMER_OBJECT: return NtOpenTimer(phandle, access, &open_struct);
- case KEY_OBJECT: return NtOpenKey(phandle, access, &open_struct);
- case EVENTPAIR_OBJECT: return NtOpenEventPair(phandle, access,
&open_struct);
- case IOCOMPLETION_OBJECT: return NtOpenIoCompletion(phandle, access,
&open_struct);
- case FILE_OBJECT: return NtOpenFile(phandle, access, &open_struct,
&ioStatusBlock, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0);
- default:
- return ERROR_INVALID_FUNCTION;
+ case DIRECTORY_OBJECT: return NtOpenDirectoryObject(phandle, access,
&open_struct);
+ case SYMBOLICLINK_OBJECT: return NtOpenSymbolicLinkObject(phandle, access,
&open_struct);
+ case MUTANT_OBJECT: return NtOpenMutant(phandle, access,
&open_struct);
+ case SECTION_OBJECT: return NtOpenSection(phandle, access,
&open_struct);
+ case EVENT_OBJECT: return NtOpenEvent(phandle, access,
&open_struct);
+ case SEMAPHORE_OBJECT: return NtOpenSemaphore(phandle, access,
&open_struct);
+ case TIMER_OBJECT: return NtOpenTimer(phandle, access,
&open_struct);
+ case KEY_OBJECT: return NtOpenKey(phandle, access, &open_struct);
+ case EVENTPAIR_OBJECT: return NtOpenEventPair(phandle, access,
&open_struct);
+ case IOCOMPLETION_OBJECT: return NtOpenIoCompletion(phandle, access,
&open_struct);
+ case FILE_OBJECT: return NtOpenFile(phandle, access, &open_struct,
&ioStatusBlock, FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, 0);
+ default:
+ return ERROR_INVALID_FUNCTION;
}
}
@@ -748,4 +737,4 @@ HRESULT GetEnumRegistryKey(LPCWSTR path, HKEY root, IEnumIDList **
ppil)
HRESULT GetEnumNTDirectory(LPCWSTR path, IEnumIDList ** ppil)
{
return ShellObjectCreatorInit<CEnumNTDirectory>(path, IID_PPV_ARG(IEnumIDList,
ppil));
-}
\ No newline at end of file
+}
diff --git a/dll/shellext/ntobjshex/ntobjenum.h b/dll/shellext/ntobjshex/ntobjenum.h
index 2f683696006..b277f94bce4 100644
--- a/dll/shellext/ntobjshex/ntobjenum.h
+++ b/dll/shellext/ntobjshex/ntobjenum.h
@@ -1,20 +1,10 @@
/*
- * Copyright 2004 Martin Fuchs
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ * PROJECT: NT Object Namespace shell extension
+ * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later)
+ * PURPOSE: NT Object Namespace enumeration header
+ * COPYRIGHT: Copyright 2004 Martin Fuchs <martin-fuchs(a)gmx.net>
*/
+
#pragma once
@@ -100,4 +90,4 @@ HRESULT GetEnumRegistryRoot(IEnumIDList ** ppil);
HRESULT GetEnumRegistryKey(LPCWSTR path, HKEY root, IEnumIDList ** ppil);
HRESULT GetEnumNTDirectory(LPCWSTR path, IEnumIDList ** ppil);
-HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING
LinkTarget);
\ No newline at end of file
+HRESULT GetNTObjectSymbolicLinkTarget(LPCWSTR path, LPCWSTR entryName, PUNICODE_STRING
LinkTarget);
diff --git a/dll/shellext/ntobjshex/ntobjfolder.cpp
b/dll/shellext/ntobjshex/ntobjfolder.cpp
index 056bf67ca87..020dcc35bfe 100644
--- a/dll/shellext/ntobjshex/ntobjfolder.cpp
+++ b/dll/shellext/ntobjshex/ntobjfolder.cpp
@@ -1,9 +1,8 @@
/*
- * PROJECT: ReactOS shell extensions
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll/shellext/ntobjshex/ntobjfolder.cpp
- * PURPOSE: NT Object Namespace shell extension
- * PROGRAMMERS: David Quintana <gigaherz(a)gmail.com>
+ * PROJECT: NT Object Namespace shell extension
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: NT Object Namespace folder class implementation
+ * COPYRIGHT: Copyright 2015-2017 David Quintana <gigaherz(a)gmail.com>
*/
#include "precomp.h"
@@ -62,32 +61,36 @@ HRESULT STDMETHODCALLTYPE
CNtObjectFolderExtractIcon::GetIconLocation(
switch (entry->objectType)
{
- case DIRECTORY_OBJECT:
- case SYMBOLICLINK_OBJECT:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -((uFlags & GIL_OPENICON) ? IDI_NTOBJECTDIROPEN :
IDI_NTOBJECTDIR);
- *pwFlags = flags;
- return S_OK;
- case DEVICE_OBJECT:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_NTOBJECTDEVICE;
- *pwFlags = flags;
- return S_OK;
- case PORT_OBJECT:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_NTOBJECTPORT;
- *pwFlags = flags;
- return S_OK;
- case KEY_OBJECT:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_REGISTRYKEY;
- *pwFlags = flags;
- return S_OK;
- default:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_NTOBJECTITEM;
- *pwFlags = flags;
- return S_OK;
+ case DIRECTORY_OBJECT:
+ case SYMBOLICLINK_OBJECT:
+ GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
+ *piIndex = -((uFlags & GIL_OPENICON) ? IDI_NTOBJECTDIROPEN :
IDI_NTOBJECTDIR);
+ *pwFlags = flags;
+ return S_OK;
+
+ case DEVICE_OBJECT:
+ GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
+ *piIndex = -IDI_NTOBJECTDEVICE;
+ *pwFlags = flags;
+ return S_OK;
+
+ case PORT_OBJECT:
+ GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
+ *piIndex = -IDI_NTOBJECTPORT;
+ *pwFlags = flags;
+ return S_OK;
+
+ case KEY_OBJECT:
+ GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
+ *piIndex = -IDI_REGISTRYKEY;
+ *pwFlags = flags;
+ return S_OK;
+
+ default:
+ GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
+ *piIndex = -IDI_NTOBJECTITEM;
+ *pwFlags = flags;
+ return S_OK;
}
}
@@ -223,15 +226,17 @@ HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetDefaultColumnState(
{
switch (iColumn)
{
- case NTOBJECT_COLUMN_NAME:
- *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
- return S_OK;
- case NTOBJECT_COLUMN_TYPE:
- *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
- return S_OK;
- case NTOBJECT_COLUMN_LINKTARGET:
- *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT | SHCOLSTATE_SLOW;
- return S_OK;
+ case NTOBJECT_COLUMN_NAME:
+ *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
+ return S_OK;
+
+ case NTOBJECT_COLUMN_TYPE:
+ *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
+ return S_OK;
+
+ case NTOBJECT_COLUMN_LINKTARGET:
+ *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT | SHCOLSTATE_SLOW;
+ return S_OK;
}
return E_INVALIDARG;
@@ -321,75 +326,83 @@ HRESULT STDMETHODCALLTYPE CNtObjectFolder::GetDetailsOf(
switch (iColumn)
{
- case NTOBJECT_COLUMN_NAME:
- psd->fmt = LVCFMT_LEFT;
+ case NTOBJECT_COLUMN_NAME:
+ {
+ psd->fmt = LVCFMT_LEFT;
- MakeStrRetFromString(info->entryName, info->entryNameLength,
&(psd->str));
- return S_OK;
- case NTOBJECT_COLUMN_TYPE:
- psd->fmt = LVCFMT_LEFT;
+ MakeStrRetFromString(info->entryName, info->entryNameLength,
&(psd->str));
+ return S_OK;
+ }
- if (info->objectType < 0)
+ case NTOBJECT_COLUMN_TYPE:
{
- NtPidlTypeData * td = (NtPidlTypeData*) (((PBYTE) info) +
FIELD_OFFSET(NtPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
+ psd->fmt = LVCFMT_LEFT;
+
+ if (info->objectType < 0)
+ {
+ NtPidlTypeData * td = (NtPidlTypeData*) (((PBYTE) info) +
FIELD_OFFSET(NtPidlEntry, entryName) + info->entryNameLength + sizeof(WCHAR));
- if (td->typeNameLength > 0)
- MakeStrRetFromString(td->typeName, td->typeNameLength,
&(psd->str));
+ if (td->typeNameLength > 0)
+ MakeStrRetFromString(td->typeName, td->typeNameLength,
&(psd->str));
+ else
+ MakeStrRetFromString(L"Unknown", &(psd->str));
+ }
else
- MakeStrRetFromString(L"Unknown", &(psd->str));
+ MakeStrRetFromString(ObjectTypeNames[info->objectType],
&(psd->str));
+ return S_OK;
}
- else
- MakeStrRetFromString(ObjectTypeNames[info->objectType],
&(psd->str));
- return S_OK;
- case NTOBJECT_COLUMN_LINKTARGET:
- {
- psd->fmt = LVCFMT_LEFT;
- if (info->objectType == SYMBOLICLINK_OBJECT)
+ case NTOBJECT_COLUMN_LINKTARGET:
{
- WCHAR wbLink[MAX_PATH] = { 0 };
- UNICODE_STRING link;
- RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
-
- HRESULT hr = GetNTObjectSymbolicLinkTarget(m_NtPath, info->entryName,
&link);
+ psd->fmt = LVCFMT_LEFT;
- if (!FAILED_UNEXPECTEDLY(hr) && link.Length > 0)
+ if (info->objectType == SYMBOLICLINK_OBJECT)
{
- MakeStrRetFromString(link.Buffer, link.Length, &(psd->str));
- return S_OK;
+ WCHAR wbLink[MAX_PATH] = { 0 };
+ UNICODE_STRING link;
+ RtlInitEmptyUnicodeString(&link, wbLink, sizeof(wbLink));
+
+ HRESULT hr = GetNTObjectSymbolicLinkTarget(m_NtPath,
info->entryName, &link);
+
+ if (!FAILED_UNEXPECTEDLY(hr) && link.Length > 0)
+ {
+ MakeStrRetFromString(link.Buffer, link.Length,
&(psd->str));
+ return S_OK;
+ }
}
- }
- MakeStrRetFromString(L"", &(psd->str));
- return S_OK;
- }
+ MakeStrRetFromString(L"", &(psd->str));
+ return S_OK;
+ }
}
}
else
{
switch (iColumn)
{
- case NTOBJECT_COLUMN_NAME:
- psd->fmt = LVCFMT_LEFT;
- psd->cxChar = 30;
+ case NTOBJECT_COLUMN_NAME:
+ psd->fmt = LVCFMT_LEFT;
+ psd->cxChar = 30;
- // TODO: Make localizable
- MakeStrRetFromString(L"Object Name", &(psd->str));
- return S_OK;
- case NTOBJECT_COLUMN_TYPE:
- psd->fmt = LVCFMT_LEFT;
- psd->cxChar = 20;
+ // TODO: Make localizable
+ MakeStrRetFromString(L"Object Name", &(psd->str));
+ return S_OK;
- // TODO: Make localizable
- MakeStrRetFromString(L"Object Type", &(psd->str));
- return S_OK;
- case NTOBJECT_COLUMN_LINKTARGET:
- psd->fmt = LVCFMT_LEFT;
- psd->cxChar = 30;
+ case NTOBJECT_COLUMN_TYPE:
+ psd->fmt = LVCFMT_LEFT;
+ psd->cxChar = 20;
- // TODO: Make localizable
- MakeStrRetFromString(L"Symlink Target", &(psd->str));
- return S_OK;
+ // TODO: Make localizable
+ MakeStrRetFromString(L"Object Type", &(psd->str));
+ return S_OK;
+
+ case NTOBJECT_COLUMN_LINKTARGET:
+ psd->fmt = LVCFMT_LEFT;
+ psd->cxChar = 30;
+
+ // TODO: Make localizable
+ MakeStrRetFromString(L"Symlink Target", &(psd->str));
+ return S_OK;
}
}
@@ -403,18 +416,20 @@ HRESULT STDMETHODCALLTYPE CNtObjectFolder::MapColumnToSCID(
static const GUID storage = PSGUID_STORAGE;
switch (iColumn)
{
- case NTOBJECT_COLUMN_NAME:
- pscid->fmtid = storage;
- pscid->pid = PID_STG_NAME;
- return S_OK;
- case NTOBJECT_COLUMN_TYPE:
- pscid->fmtid = storage;
- pscid->pid = PID_STG_STORAGETYPE;
- return S_OK;
- case NTOBJECT_COLUMN_LINKTARGET:
- pscid->fmtid = GUID_NtObjectColumns;
- pscid->pid = NTOBJECT_COLUMN_LINKTARGET;
- return S_OK;
+ case NTOBJECT_COLUMN_NAME:
+ pscid->fmtid = storage;
+ pscid->pid = PID_STG_NAME;
+ return S_OK;
+
+ case NTOBJECT_COLUMN_TYPE:
+ pscid->fmtid = storage;
+ pscid->pid = PID_STG_STORAGETYPE;
+ return S_OK;
+
+ case NTOBJECT_COLUMN_LINKTARGET:
+ pscid->fmtid = GUID_NtObjectColumns;
+ pscid->pid = NTOBJECT_COLUMN_LINKTARGET;
+ return S_OK;
}
return E_INVALIDARG;
}
@@ -441,15 +456,15 @@ HRESULT CNtObjectFolder::CompareIDs(LPARAM lParam, const NtPidlEntry
* first, co
switch (column)
{
- case NTOBJECT_COLUMN_NAME:
- return CompareName(lParam, first, second);
+ case NTOBJECT_COLUMN_NAME:
+ return CompareName(lParam, first, second);
- case NTOBJECT_COLUMN_TYPE:
- return MAKE_COMPARE_HRESULT(second->objectType - first->objectType);
+ case NTOBJECT_COLUMN_TYPE:
+ return MAKE_COMPARE_HRESULT(second->objectType - first->objectType);
- case NTOBJECT_COLUMN_LINKTARGET:
- // Can't sort by link target yet
- return E_INVALIDARG;
+ case NTOBJECT_COLUMN_LINKTARGET:
+ // Can't sort by link target yet
+ return E_INVALIDARG;
}
DbgPrint("Unsupported sorting mode.\n");
@@ -498,4 +513,4 @@ HRESULT CNtObjectFolder::GetInfoFromPidl(LPCITEMIDLIST pcidl, const
NtPidlEntry
*pentry = entry;
return S_OK;
-}
\ No newline at end of file
+}
diff --git a/dll/shellext/ntobjshex/ntobjfolder.h b/dll/shellext/ntobjshex/ntobjfolder.h
index 556ce571528..58e3c09990f 100644
--- a/dll/shellext/ntobjshex/ntobjfolder.h
+++ b/dll/shellext/ntobjshex/ntobjfolder.h
@@ -1,10 +1,10 @@
/*
- * PROJECT: ReactOS shell extensions
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll/shellext/ntobjshex/ntobjfolder.h
- * PURPOSE: NT Object Namespace shell extension
- * PROGRAMMERS: David Quintana <gigaherz(a)gmail.com>
+ * PROJECT: NT Object Namespace shell extension
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: NT Object Namespace folder class header
+ * COPYRIGHT: Copyright 2015-2017 David Quintana <gigaherz(a)gmail.com>
*/
+
#pragma once
extern const GUID CLSID_NtObjectFolder;
@@ -113,4 +113,4 @@ protected:
HRESULT FormatValueData(DWORD contentType, PVOID td, DWORD contentsLength, PCWSTR *
strContents);
HRESULT FormatContentsForDisplay(const NtPidlEntry * info, HKEY rootKey, LPCWSTR
ntPath, PCWSTR * strContents);
-};
\ No newline at end of file
+};
diff --git a/dll/shellext/ntobjshex/ntobjshex.cpp b/dll/shellext/ntobjshex/ntobjshex.cpp
index a3f2ab20b0e..14e4f7b8821 100644
--- a/dll/shellext/ntobjshex/ntobjshex.cpp
+++ b/dll/shellext/ntobjshex/ntobjshex.cpp
@@ -1,9 +1,8 @@
/*
- * PROJECT: ReactOS shell extensions
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll/shellext/ntobjshex/ntobjshex.cpp
- * PURPOSE: NT Object Namespace shell extension
- * PROGRAMMERS: David Quintana <gigaherz(a)gmail.com>
+ * PROJECT: NT Object Namespace shell extension
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: Shell extension entry point and exports
+ * COPYRIGHT: Copyright 2015-2017 David Quintana <gigaherz(a)gmail.com>
*/
#include "precomp.h"
diff --git a/dll/shellext/ntobjshex/regfolder.cpp b/dll/shellext/ntobjshex/regfolder.cpp
index 70f1575d513..685a40cf866 100644
--- a/dll/shellext/ntobjshex/regfolder.cpp
+++ b/dll/shellext/ntobjshex/regfolder.cpp
@@ -1,9 +1,8 @@
/*
- * PROJECT: ReactOS shell extensions
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll/shellext/ntobjshex/regfolder.cpp
- * PURPOSE: NT Object Namespace shell extension
- * PROGRAMMERS: David Quintana <gigaherz(a)gmail.com>
+ * PROJECT: NT Object Namespace shell extension
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: System Registry folder class implementation
+ * COPYRIGHT: Copyright 2015-2017 David Quintana <gigaherz(a)gmail.com>
*/
#include "precomp.h"
@@ -64,22 +63,24 @@ HRESULT STDMETHODCALLTYPE
CRegistryFolderExtractIcon::GetIconLocation(
switch (entry->entryType)
{
- case REG_ENTRY_KEY:
- case REG_ENTRY_ROOT:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_REGISTRYKEY;
- *pwFlags = flags;
- return S_OK;
- case REG_ENTRY_VALUE:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_REGISTRYVALUE;
- *pwFlags = flags;
- return S_OK;
- default:
- GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
- *piIndex = -IDI_NTOBJECTITEM;
- *pwFlags = flags;
- return S_OK;
+ case REG_ENTRY_KEY:
+ case REG_ENTRY_ROOT:
+ GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
+ *piIndex = -IDI_REGISTRYKEY;
+ *pwFlags = flags;
+ return S_OK;
+
+ case REG_ENTRY_VALUE:
+ GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
+ *piIndex = -IDI_REGISTRYVALUE;
+ *pwFlags = flags;
+ return S_OK;
+
+ default:
+ GetModuleFileNameW(g_hInstance, szIconFile, cchMax);
+ *piIndex = -IDI_NTOBJECTITEM;
+ *pwFlags = flags;
+ return S_OK;
}
}
@@ -160,15 +161,17 @@ HRESULT STDMETHODCALLTYPE CRegistryFolder::GetDefaultColumnState(
{
switch (iColumn)
{
- case REGISTRY_COLUMN_NAME:
- *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
- return S_OK;
- case REGISTRY_COLUMN_TYPE:
- *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
- return S_OK;
- case REGISTRY_COLUMN_VALUE:
- *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT | SHCOLSTATE_SLOW;
- return S_OK;
+ case REGISTRY_COLUMN_NAME:
+ *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
+ return S_OK;
+
+ case REGISTRY_COLUMN_TYPE:
+ *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT;
+ return S_OK;
+
+ case REGISTRY_COLUMN_VALUE:
+ *pcsFlags = SHCOLSTATE_TYPE_STR | SHCOLSTATE_ONBYDEFAULT | SHCOLSTATE_SLOW;
+ return S_OK;
}
return E_INVALIDARG;
@@ -264,83 +267,91 @@ HRESULT STDMETHODCALLTYPE CRegistryFolder::GetDetailsOf(
switch (iColumn)
{
- case REGISTRY_COLUMN_NAME:
- psd->fmt = LVCFMT_LEFT;
-
- if (info->entryNameLength > 0)
+ case REGISTRY_COLUMN_NAME:
{
- return MakeStrRetFromString(info->entryName, info->entryNameLength,
&(psd->str));
- }
- return MakeStrRetFromString(L"(Default)", &(psd->str));
-
- case REGISTRY_COLUMN_TYPE:
- psd->fmt = LVCFMT_LEFT;
+ psd->fmt = LVCFMT_LEFT;
- if (info->entryType == REG_ENTRY_ROOT)
- {
- return MakeStrRetFromString(L"Key", &(psd->str));
+ if (info->entryNameLength > 0)
+ {
+ return MakeStrRetFromString(info->entryName,
info->entryNameLength, &(psd->str));
+ }
+ return MakeStrRetFromString(L"(Default)", &(psd->str));
}
- if (info->entryType == REG_ENTRY_KEY)
+ case REGISTRY_COLUMN_TYPE:
{
- if (info->contentsLength > 0)
+ psd->fmt = LVCFMT_LEFT;
+
+ if (info->entryType == REG_ENTRY_ROOT)
+ {
+ return MakeStrRetFromString(L"Key", &(psd->str));
+ }
+
+ if (info->entryType == REG_ENTRY_KEY)
{
- PWSTR td = (PWSTR)(((PBYTE)info) + FIELD_OFFSET(RegPidlEntry,
entryName) + info->entryNameLength + sizeof(WCHAR));
+ if (info->contentsLength > 0)
+ {
+ PWSTR td = (PWSTR)(((PBYTE)info) + FIELD_OFFSET(RegPidlEntry,
entryName) + info->entryNameLength + sizeof(WCHAR));
+
+ return MakeStrRetFromString(td, info->contentsLength,
&(psd->str));
+ }
- return MakeStrRetFromString(td, info->contentsLength,
&(psd->str));
+ return MakeStrRetFromString(L"Key", &(psd->str));
}
- return MakeStrRetFromString(L"Key", &(psd->str));
+ return MakeStrRetFromString(RegistryTypeNames[info->entryType],
&(psd->str));
}
- return MakeStrRetFromString(RegistryTypeNames[info->entryType],
&(psd->str));
-
- case REGISTRY_COLUMN_VALUE:
- psd->fmt = LVCFMT_LEFT;
+ case REGISTRY_COLUMN_VALUE:
+ {
+ psd->fmt = LVCFMT_LEFT;
- PCWSTR strValueContents;
+ PCWSTR strValueContents;
- hr = FormatContentsForDisplay(info, m_hRoot, m_NtPath,
&strValueContents);
- if (FAILED_UNEXPECTEDLY(hr))
- return hr;
+ hr = FormatContentsForDisplay(info, m_hRoot, m_NtPath,
&strValueContents);
+ if (FAILED_UNEXPECTEDLY(hr))
+ return hr;
- if (hr == S_FALSE)
- {
- return MakeStrRetFromString(L"(Empty)", &(psd->str));
- }
+ if (hr == S_FALSE)
+ {
+ return MakeStrRetFromString(L"(Empty)",
&(psd->str));
+ }
- hr = MakeStrRetFromString(strValueContents, &(psd->str));
+ hr = MakeStrRetFromString(strValueContents, &(psd->str));
- CoTaskMemFree((PVOID)strValueContents);
+ CoTaskMemFree((PVOID)strValueContents);
- return hr;
+ return hr;
+ }
}
}
else
{
switch (iColumn)
{
- case REGISTRY_COLUMN_NAME:
- psd->fmt = LVCFMT_LEFT;
- psd->cxChar = 30;
+ case REGISTRY_COLUMN_NAME:
+ psd->fmt = LVCFMT_LEFT;
+ psd->cxChar = 30;
- // TODO: Make localizable
- MakeStrRetFromString(L"Object Name", &(psd->str));
- return S_OK;
- case REGISTRY_COLUMN_TYPE:
- psd->fmt = LVCFMT_LEFT;
- psd->cxChar = 20;
+ // TODO: Make localizable
+ MakeStrRetFromString(L"Object Name", &(psd->str));
+ return S_OK;
- // TODO: Make localizable
- MakeStrRetFromString(L"Content Type", &(psd->str));
- return S_OK;
- case REGISTRY_COLUMN_VALUE:
- psd->fmt = LVCFMT_LEFT;
- psd->cxChar = 20;
+ case REGISTRY_COLUMN_TYPE:
+ psd->fmt = LVCFMT_LEFT;
+ psd->cxChar = 20;
- // TODO: Make localizable
- MakeStrRetFromString(L"Value", &(psd->str));
- return S_OK;
+ // TODO: Make localizable
+ MakeStrRetFromString(L"Content Type", &(psd->str));
+ return S_OK;
+
+ case REGISTRY_COLUMN_VALUE:
+ psd->fmt = LVCFMT_LEFT;
+ psd->cxChar = 20;
+
+ // TODO: Make localizable
+ MakeStrRetFromString(L"Value", &(psd->str));
+ return S_OK;
}
}
@@ -354,18 +365,20 @@ HRESULT STDMETHODCALLTYPE CRegistryFolder::MapColumnToSCID(
static const GUID storage = PSGUID_STORAGE;
switch (iColumn)
{
- case REGISTRY_COLUMN_NAME:
- pscid->fmtid = storage;
- pscid->pid = PID_STG_NAME;
- return S_OK;
- case REGISTRY_COLUMN_TYPE:
- pscid->fmtid = storage;
- pscid->pid = PID_STG_STORAGETYPE;
- return S_OK;
- case REGISTRY_COLUMN_VALUE:
- pscid->fmtid = storage;
- pscid->pid = PID_STG_CONTENTS;
- return S_OK;
+ case REGISTRY_COLUMN_NAME:
+ pscid->fmtid = storage;
+ pscid->pid = PID_STG_NAME;
+ return S_OK;
+
+ case REGISTRY_COLUMN_TYPE:
+ pscid->fmtid = storage;
+ pscid->pid = PID_STG_STORAGETYPE;
+ return S_OK;
+
+ case REGISTRY_COLUMN_VALUE:
+ pscid->fmtid = storage;
+ pscid->pid = PID_STG_CONTENTS;
+ return S_OK;
}
return E_INVALIDARG;
}
@@ -392,15 +405,15 @@ HRESULT CRegistryFolder::CompareIDs(LPARAM lParam, const
RegPidlEntry * first, c
switch (column)
{
- case REGISTRY_COLUMN_NAME:
- return CompareName(lParam, first, second);
+ case REGISTRY_COLUMN_NAME:
+ return CompareName(lParam, first, second);
- case REGISTRY_COLUMN_TYPE:
- return MAKE_COMPARE_HRESULT(second->contentType - first->contentType);
+ case REGISTRY_COLUMN_TYPE:
+ return MAKE_COMPARE_HRESULT(second->contentType - first->contentType);
- case REGISTRY_COLUMN_VALUE:
- // Can't sort by link target yet
- return E_INVALIDARG;
+ case REGISTRY_COLUMN_VALUE:
+ // Can't sort by link target yet
+ return E_INVALIDARG;
}
DbgPrint("Unsupported sorting mode.\n");
@@ -448,99 +461,105 @@ HRESULT CRegistryFolder::FormatValueData(DWORD contentType, PVOID
td, DWORD cont
{
switch (contentType)
{
- case 0:
- {
- PCWSTR strTodo = L"";
- DWORD bufferLength = (wcslen(strTodo) + 1) * sizeof(WCHAR);
- PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
- StringCbCopyW(strValue, bufferLength, strTodo);
- *strContents = strValue;
- return S_OK;
- }
- case REG_SZ:
- case REG_EXPAND_SZ:
- {
- PWSTR strValue = (PWSTR)CoTaskMemAlloc(contentsLength + sizeof(WCHAR));
- StringCbCopyNW(strValue, contentsLength + sizeof(WCHAR), (LPCWSTR)td,
contentsLength);
- *strContents = strValue;
- return S_OK;
- }
- case REG_MULTI_SZ:
- {
- PCWSTR separator = L" "; // To match regedit
- size_t sepChars = wcslen(separator);
- int strings = 0;
- int stringChars = 0;
+ case 0:
+ {
+ PCWSTR strTodo = L"";
+ DWORD bufferLength = (wcslen(strTodo) + 1) * sizeof(WCHAR);
+ PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
+ StringCbCopyW(strValue, bufferLength, strTodo);
+ *strContents = strValue;
+ return S_OK;
+ }
- PCWSTR strData = (PCWSTR)td;
- while (*strData)
+ case REG_SZ:
+ case REG_EXPAND_SZ:
{
- size_t len = wcslen(strData);
- stringChars += len;
- strData += len + 1; // Skips null-terminator
- strings++;
+ PWSTR strValue = (PWSTR)CoTaskMemAlloc(contentsLength + sizeof(WCHAR));
+ StringCbCopyNW(strValue, contentsLength + sizeof(WCHAR), (LPCWSTR)td,
contentsLength);
+ *strContents = strValue;
+ return S_OK;
}
- int cch = stringChars + (strings - 1) * sepChars + 1;
+ case REG_MULTI_SZ:
+ {
+ PCWSTR separator = L" "; // To match regedit
+ size_t sepChars = wcslen(separator);
+ int strings = 0;
+ int stringChars = 0;
+
+ PCWSTR strData = (PCWSTR)td;
+ while (*strData)
+ {
+ size_t len = wcslen(strData);
+ stringChars += len;
+ strData += len + 1; // Skips null-terminator
+ strings++;
+ }
+
+ int cch = stringChars + (strings - 1) * sepChars + 1;
+
+ PWSTR strValue = (PWSTR)CoTaskMemAlloc(cch * sizeof(WCHAR));
- PWSTR strValue = (PWSTR)CoTaskMemAlloc(cch * sizeof(WCHAR));
+ strValue[0] = 0;
- strValue[0] = 0;
+ strData = (PCWSTR)td;
+ while (*strData)
+ {
+ StrCatW(strValue, strData);
+ strData += wcslen(strData) + 1;
+ if (*strData)
+ StrCatW(strValue, separator);
+ }
- strData = (PCWSTR)td;
- while (*strData)
+ *strContents = strValue;
+ return S_OK;
+ }
+
+ case REG_DWORD:
{
- StrCatW(strValue, strData);
- strData += wcslen(strData) + 1;
- if (*strData)
- StrCatW(strValue, separator);
+ DWORD bufferLength = 64 * sizeof(WCHAR);
+ PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
+ StringCbPrintfW(strValue, bufferLength, L"0x%08x (%d)",
+ *(DWORD*)td, *(DWORD*)td);
+ *strContents = strValue;
+ return S_OK;
}
- *strContents = strValue;
- return S_OK;
- }
- case REG_DWORD:
- {
- DWORD bufferLength = 64 * sizeof(WCHAR);
- PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
- StringCbPrintfW(strValue, bufferLength, L"0x%08x (%d)",
- *(DWORD*)td, *(DWORD*)td);
- *strContents = strValue;
- return S_OK;
- }
- case REG_QWORD:
- {
- DWORD bufferLength = 64 * sizeof(WCHAR);
- PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
- StringCbPrintfW(strValue, bufferLength, L"0x%016llx (%lld)",
- *(LARGE_INTEGER*)td, ((LARGE_INTEGER*)td)->QuadPart);
- *strContents = strValue;
- return S_OK;
- }
- case REG_BINARY:
- {
- DWORD bufferLength = (contentsLength * 3 + 1) * sizeof(WCHAR);
- PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
- PWSTR strTemp = strValue;
- PBYTE data = (PBYTE)td;
- for (DWORD i = 0; i < contentsLength; i++)
+ case REG_QWORD:
{
- StringCbPrintfW(strTemp, bufferLength, L"%02x ", data[i]);
- strTemp += 3;
- bufferLength -= 3;
+ DWORD bufferLength = 64 * sizeof(WCHAR);
+ PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
+ StringCbPrintfW(strValue, bufferLength, L"0x%016llx (%lld)",
+ *(LARGE_INTEGER*)td, ((LARGE_INTEGER*)td)->QuadPart);
+ *strContents = strValue;
+ return S_OK;
+ }
+
+ case REG_BINARY:
+ {
+ DWORD bufferLength = (contentsLength * 3 + 1) * sizeof(WCHAR);
+ PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
+ PWSTR strTemp = strValue;
+ PBYTE data = (PBYTE)td;
+ for (DWORD i = 0; i < contentsLength; i++)
+ {
+ StringCbPrintfW(strTemp, bufferLength, L"%02x ", data[i]);
+ strTemp += 3;
+ bufferLength -= 3;
+ }
+ *strContents = strValue;
+ return S_OK;
+ }
+
+ default:
+ {
+ PCWSTR strFormat = L"<Unimplemented value type %d>";
+ DWORD bufferLength = (wcslen(strFormat) + 15) * sizeof(WCHAR);
+ PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
+ StringCbPrintfW(strValue, bufferLength, strFormat, contentType);
+ *strContents = strValue;
+ return S_OK;
}
- *strContents = strValue;
- return S_OK;
- }
- default:
- {
- PCWSTR strFormat = L"<Unimplemented value type %d>";
- DWORD bufferLength = (wcslen(strFormat) + 15) * sizeof(WCHAR);
- PWSTR strValue = (PWSTR)CoTaskMemAlloc(bufferLength);
- StringCbPrintfW(strValue, bufferLength, strFormat, contentType);
- *strContents = strValue;
- return S_OK;
- }
}
}
diff --git a/dll/shellext/ntobjshex/regfolder.h b/dll/shellext/ntobjshex/regfolder.h
index 08f687f8ce7..5780d075f40 100644
--- a/dll/shellext/ntobjshex/regfolder.h
+++ b/dll/shellext/ntobjshex/regfolder.h
@@ -1,10 +1,10 @@
/*
- * PROJECT: ReactOS shell extensions
- * LICENSE: GPL - See COPYING in the top level directory
- * FILE: dll/shellext/ntobjshex/regfolder.h
- * PURPOSE: NT Object Namespace shell extension
- * PROGRAMMERS: David Quintana <gigaherz(a)gmail.com>
+ * PROJECT: NT Object Namespace shell extension
+ * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later)
+ * PURPOSE: System Registry folder class header
+ * COPYRIGHT: Copyright 2015-2017 David Quintana <gigaherz(a)gmail.com>
*/
+
#pragma once
extern const GUID CLSID_RegistryFolder;