1
0
mirror of https://github.com/UzixLS/KernelEx.git synced 2025-07-19 07:21:20 +03:00

import KernelEx-4.5-Beta1

This commit is contained in:
UzixLS
2018-11-03 16:21:13 +03:00
parent d6aad6c6c5
commit 09929b2b7d
392 changed files with 17832 additions and 2491 deletions

97
kexCOM/factory.cpp Executable file
View File

@ -0,0 +1,97 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include "factory.h"
#include "server.h"
#include "shelllink.h"
CFactory::CFactory(IClassFactory* prevCF)
{
m_cRef = 1;
m_prevCF = prevCF;
InterlockedIncrement(&g_LockCount);
}
CFactory::~CFactory()
{
m_prevCF->Release();
InterlockedDecrement(&g_LockCount);
}
STDMETHODIMP CFactory::QueryInterface(const IID& iid, void** ppv)
{
if (iid == IID_IUnknown)
*ppv = static_cast<IUnknown*>(this);
else if (iid == IID_IClassFactory)
*ppv = static_cast<IClassFactory*>(this);
else
{
*ppv = NULL;
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
STDMETHODIMP_(ULONG) CFactory::AddRef()
{
return InterlockedIncrement(&m_cRef);
}
STDMETHODIMP_(ULONG) CFactory::Release()
{
if (InterlockedDecrement(&m_cRef) == 0)
{
delete this;
return 0;
}
return m_cRef;
}
STDMETHODIMP CFactory::CreateInstance(IUnknown* pUnkOuter, const IID& iid, void** ppv)
{
HRESULT hr;
if (pUnkOuter != NULL)
return CLASS_E_NOAGGREGATION;
IUnknown* pUnk;
hr = m_prevCF->CreateInstance(NULL, IID_IUnknown, (void**) &pUnk);
if (FAILED(hr))
return hr;
CShellLink* pObject = new CShellLink(pUnk);
if (pObject == NULL)
return E_OUTOFMEMORY;
hr = pObject->QueryInterface(iid, ppv);
pObject->Release();
return hr;
}
STDMETHODIMP CFactory::LockServer(BOOL bLock)
{
if (bLock)
InterlockedIncrement(&g_LockCount);
else
InterlockedDecrement(&g_LockCount);
return S_OK;
}

49
kexCOM/factory.h Executable file
View File

@ -0,0 +1,49 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __FACTORY_H
#define __FACTORY_H
#include <objbase.h>
class CFactory : public IClassFactory
{
public:
// Constructor
CFactory(IClassFactory* prevCF);
// Destructor
~CFactory();
// IUnknown
STDMETHODIMP QueryInterface(const IID& iid, void** ppv);
STDMETHODIMP_(ULONG) AddRef();
STDMETHODIMP_(ULONG) Release();
// Interface IClassFactory
STDMETHODIMP CreateInstance(IUnknown* pUnknownOuter, const IID& iid, void** ppv);
STDMETHODIMP LockServer(BOOL bLock);
private:
long m_cRef;
IClassFactory* m_prevCF;
};
#endif

133
kexCOM/kexCOM.dsp Executable file
View File

@ -0,0 +1,133 @@
# Microsoft Developer Studio Project File - Name="kexCOM" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
CFG=kexCOM - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "kexCOM.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "kexCOM.mak" CFG="kexCOM - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "kexCOM - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE "kexCOM - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
MTL=midl.exe
RSC=rc.exe
!IF "$(CFG)" == "kexCOM - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KEXCOM_EXPORTS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KEXCOM_EXPORTS" /YX /FD /c
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x415 /d "NDEBUG"
# ADD RSC /l 0x415 /d "NDEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../kexcrt/kexcrt.lib libc.lib /nologo /entry:"DllMain@12" /dll /map /machine:I386 /nodefaultlib /OPT:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ELSEIF "$(CFG)" == "kexCOM - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Ignore_Export_Lib 0
# PROP Target_Dir ""
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KEXCOM_EXPORTS" /YX /FD /GZ /c
# ADD CPP /nologo /MTd /W3 /Gm /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "KEXCOM_EXPORTS" /YX /FD /GZ /c
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
# ADD BASE RSC /l 0x415 /d "_DEBUG"
# ADD RSC /l 0x415 /d "_DEBUG"
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../kexcrt/kexcrt.lib libc.lib /nologo /entry:"DllMain@12" /dll /debug /machine:I386 /nodefaultlib /OPT:NOWIN98
# SUBTRACT LINK32 /pdb:none
!ENDIF
# Begin Target
# Name "kexCOM - Win32 Release"
# Name "kexCOM - Win32 Debug"
# Begin Group "Source Files"
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
# Begin Source File
SOURCE=.\factory.cpp
# End Source File
# Begin Source File
SOURCE=.\server.cpp
# End Source File
# Begin Source File
SOURCE=.\server.def
# End Source File
# Begin Source File
SOURCE=.\shelllink.cpp
# End Source File
# End Group
# Begin Group "Header Files"
# PROP Default_Filter "h;hpp;hxx;hm;inl"
# Begin Source File
SOURCE=.\factory.h
# End Source File
# Begin Source File
SOURCE=.\server.h
# End Source File
# Begin Source File
SOURCE=.\shelllink.h
# End Source File
# End Group
# Begin Group "Resource Files"
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
# End Group
# End Target
# End Project

168
kexCOM/server.cpp Executable file
View File

@ -0,0 +1,168 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <objbase.h>
#include <shlguid.h>
#include <shlwapi.h>
#include "server.h"
#include "factory.h"
long g_LockCount;
HMODULE g_hModule;
static HMODULE hShell32;
static LPFNGETCLASSOBJECT SHGetClassObject;
/* Hall of shame */
static const char* blacklist[] = {
"COOLTYPE.DLL", /* Adobe Acrobat Reader 5.0.5, Adobe Photoshop 7.0 */
NULL,
};
static bool is_blacklisted()
{
for (int i = 0 ; blacklist[i] ; i++)
{
if (GetModuleHandle(blacklist[i]))
return true;
}
return false;
}
static bool is_shell32_v5()
{
DLLGETVERSIONPROC DllGetVersion;
DLLVERSIONINFO dvi;
HRESULT hr;
dvi.cbSize = sizeof(dvi);
DllGetVersion = (DLLGETVERSIONPROC) GetProcAddress(hShell32, "DllGetVersion");
if (!DllGetVersion)
return false;
hr = DllGetVersion(&dvi);
if (SUCCEEDED(hr) && dvi.dwMajorVersion >= 5)
return true;
return false;
}
static bool is_failsafe_mode()
{
static int s = -1;
if (s == -1)
s = GetSystemMetrics(SM_CLEANBOOT);
return s != 0;
}
STDAPI DllCanUnloadNow()
{
return (g_LockCount > 0) ? S_FALSE : S_OK;
}
STDAPI DllRegisterServer()
{
LONG result;
char filename[MAX_PATH];
// SHELL32 v5.0 and above has ShellLinkW - kexCOM is not needed
if (is_shell32_v5())
return S_OK;
GetModuleFileName(g_hModule, filename, sizeof(filename));
result = RegSetValue(HKEY_CLASSES_ROOT,
"CLSID\\{00021401-0000-0000-C000-000000000046}\\InProcServer32",
REG_SZ, filename, strlen(filename));
return (result == ERROR_SUCCESS) ? S_OK : E_FAIL;
}
STDAPI DllUnregisterServer()
{
LONG result;
const char szShell32[] = { "shell32.dll" };
result = RegSetValue(HKEY_CLASSES_ROOT,
"CLSID\\{00021401-0000-0000-C000-000000000046}\\InProcServer32",
REG_SZ, szShell32, strlen(szShell32));
return (result == ERROR_SUCCESS) ? S_OK : E_FAIL;
}
STDAPI DllGetClassObject(const CLSID& clsid, const IID& iid, void** ppv)
{
HRESULT hr;
if (is_failsafe_mode())
return SHGetClassObject(clsid, iid, ppv);
if (clsid == CLSID_ShellLink)
{
IClassFactory* pcf;
hr = SHGetClassObject(CLSID_ShellLink, IID_IClassFactory, (void**) &pcf);
if (FAILED(hr))
return hr;
CFactory* factory = new CFactory(pcf);
if (!factory)
return E_OUTOFMEMORY;
hr = factory->QueryInterface(iid, ppv);
factory->Release();
return hr;
}
else
{
*ppv = NULL;
return CLASS_E_CLASSNOTAVAILABLE;
}
}
BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
{
if (dwReason == DLL_PROCESS_ATTACH)
{
if (is_blacklisted())
return FALSE;
g_hModule = hModule;
DisableThreadLibraryCalls(hModule);
hShell32 = LoadLibrary("SHELL32");
SHGetClassObject = (LPFNGETCLASSOBJECT) GetProcAddress(hShell32, "DllGetClassObject");
}
else if (dwReason == DLL_PROCESS_DETACH)
{
FreeLibrary(hShell32);
}
return TRUE;
}

6
kexCOM/server.def Executable file
View File

@ -0,0 +1,6 @@
EXPORTS
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
DllGetClassObject PRIVATE
DllCanUnloadNow PRIVATE

28
kexCOM/server.h Executable file
View File

@ -0,0 +1,28 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef _SERVER_H
#define _SERVER_H
extern long g_LockCount;
extern HMODULE g_hModule;
#endif // _SERVER_H

703
kexCOM/shelllink.cpp Executable file
View File

@ -0,0 +1,703 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#include <malloc.h>
#include "shelllink.h"
#include "server.h"
// Constructor
CShellLink::CShellLink(IUnknown *prevUnk)
{
InterlockedIncrement(&g_LockCount);
m_cRef = 1;
m_Unknown = prevUnk;
m_ShellLinkA = NULL;
m_PersistFile = NULL;
m_PersistStream = NULL;
m_ShellExtInit = NULL;
m_ContextMenu = NULL;
m_ContextMenu2 = NULL;
m_DropTarget = NULL;
m_ExtractIconA = NULL;
}
// Destructor
CShellLink::~CShellLink()
{
InterlockedDecrement(&g_LockCount);
if (m_ShellLinkA)
m_ShellLinkA->Release();
if (m_PersistFile)
m_PersistFile->Release();
if (m_PersistStream)
m_PersistStream->Release();
if (m_ShellExtInit)
m_ShellExtInit->Release();
if (m_ContextMenu)
m_ContextMenu->Release();
if (m_ContextMenu2)
m_ContextMenu2->Release();
if (m_DropTarget)
m_DropTarget->Release();
if (m_ExtractIconA)
m_ExtractIconA->Release();
m_Unknown->Release();
}
// IUnknown
HRESULT STDMETHODCALLTYPE CShellLink::QueryInterface(
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject)
{
HRESULT hr;
if (riid == IID_IUnknown)
{
hr = S_OK;
*ppvObject = static_cast<IUnknown*>(static_cast<IShellLinkA*>(this));
}
else if (riid == IID_IShellLinkA)
{
if (m_ShellLinkA)
m_ShellLinkA->Release();
hr = m_Unknown->QueryInterface(IID_IShellLinkA, (void**) &m_ShellLinkA);
*ppvObject = static_cast<IShellLinkA*>(this);
}
else if (riid == IID_IShellLinkW)
{
if (m_ShellLinkA)
m_ShellLinkA->Release();
hr = m_Unknown->QueryInterface(IID_IShellLinkA, (void**) &m_ShellLinkA);
*ppvObject = static_cast<IShellLinkW*>(this);
}
else if (riid == IID_IPersistFile)
{
if (m_PersistFile)
m_PersistFile->Release();
hr = m_Unknown->QueryInterface(IID_IPersistFile, (void**) &m_PersistFile);
*ppvObject = static_cast<IPersistFile*>(this);
}
else if (riid == IID_IPersistStream)
{
if (m_PersistStream)
m_PersistStream->Release();
hr = m_Unknown->QueryInterface(IID_IPersistStream, (void**) &m_PersistStream);
*ppvObject = static_cast<IPersistStream*>(this);
}
else if (riid == IID_IShellExtInit)
{
if (m_ShellExtInit)
m_ShellExtInit->Release();
hr = m_Unknown->QueryInterface(IID_IShellExtInit, (void**) &m_ShellExtInit);
*ppvObject = static_cast<IShellExtInit*>(this);
}
else if (riid == IID_IContextMenu)
{
if (m_ContextMenu)
m_ContextMenu->Release();
hr = m_Unknown->QueryInterface(IID_IContextMenu, (void**) &m_ContextMenu);
*ppvObject = static_cast<IContextMenu*>(this);
}
else if (riid == IID_IContextMenu2)
{
if (m_ContextMenu2)
m_ContextMenu2->Release();
hr = m_Unknown->QueryInterface(IID_IContextMenu2, (void**) &m_ContextMenu2);
*ppvObject = static_cast<IContextMenu2*>(this);
}
else if (riid == IID_IDropTarget)
{
if (m_DropTarget)
m_DropTarget->Release();
hr = m_Unknown->QueryInterface(IID_IDropTarget, (void**) &m_DropTarget);
*ppvObject = static_cast<IDropTarget*>(this);
}
else if (riid == IID_IExtractIconA)
{
if (m_ExtractIconA)
m_ExtractIconA->Release();
hr = m_Unknown->QueryInterface(IID_IExtractIconA, (void**) &m_ExtractIconA);
*ppvObject = static_cast<IExtractIconA*>(this);
}
else if (riid == IID_IExtractIconW)
{
if (m_ExtractIconA)
m_ExtractIconA->Release();
hr = m_Unknown->QueryInterface(IID_IExtractIconA, (void**) &m_ExtractIconA);
*ppvObject = static_cast<IExtractIconW*>(this);
}
else
{
hr = E_NOINTERFACE;
}
if (SUCCEEDED(hr))
AddRef();
else
*ppvObject = NULL;
return hr;
}
ULONG STDMETHODCALLTYPE CShellLink::AddRef( void)
{
return InterlockedIncrement(&m_cRef);
}
ULONG STDMETHODCALLTYPE CShellLink::Release( void)
{
if (InterlockedDecrement(&m_cRef) == 0)
{
delete this;
return 0;
}
return m_cRef;
}
// IShellLinkA
HRESULT STDMETHODCALLTYPE CShellLink::GetPath(
/* [size_is][out] */ LPSTR pszFile,
/* [in] */ int cch,
/* [full][out][in] */ WIN32_FIND_DATAA *pfd,
/* [in] */ DWORD fFlags)
{
return m_ShellLinkA->GetPath(pszFile, cch, pfd, fFlags);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetIDList(
/* [out] */ LPITEMIDLIST *ppidl)
{
return m_ShellLinkA->GetIDList(ppidl);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetIDList(
/* [in] */ LPCITEMIDLIST pidl)
{
return m_ShellLinkA->SetIDList(pidl);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetDescription(
/* [size_is][out] */ LPSTR pszName,
/* [in] */ int cch)
{
return m_ShellLinkA->GetDescription(pszName, cch);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetDescription(
/* [in] */ LPCSTR pszName)
{
return m_ShellLinkA->SetDescription(pszName);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetWorkingDirectory(
/* [size_is][out] */ LPSTR pszDir,
/* [in] */ int cch)
{
return m_ShellLinkA->GetWorkingDirectory(pszDir, cch);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetWorkingDirectory(
/* [in] */ LPCSTR pszDir)
{
return m_ShellLinkA->SetWorkingDirectory(pszDir);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetArguments(
/* [size_is][out] */ LPSTR pszArgs,
/* [in] */ int cch)
{
return m_ShellLinkA->GetArguments(pszArgs, cch);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetArguments(
/* [in] */ LPCSTR pszArgs)
{
return m_ShellLinkA->SetArguments(pszArgs);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetHotkey(
/* [out] */ WORD *pwHotkey)
{
return m_ShellLinkA->GetHotkey(pwHotkey);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetHotkey(
/* [in] */ WORD wHotkey)
{
return m_ShellLinkA->SetHotkey(wHotkey);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetShowCmd(
/* [out] */ int *piShowCmd)
{
return m_ShellLinkA->GetShowCmd(piShowCmd);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetShowCmd(
/* [in] */ int iShowCmd)
{
return m_ShellLinkA->SetShowCmd(iShowCmd);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation(
/* [size_is][out] */ LPSTR pszIconPath,
/* [in] */ int cch,
/* [out] */ int *piIcon)
{
return m_ShellLinkA->GetIconLocation(pszIconPath, cch, piIcon);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation(
/* [in] */ LPCSTR pszIconPath,
/* [in] */ int iIcon)
{
return m_ShellLinkA->SetIconLocation(pszIconPath, iIcon);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetRelativePath(
/* [in] */ LPCSTR pszPathRel,
/* [in] */ DWORD dwReserved)
{
return m_ShellLinkA->SetRelativePath(pszPathRel, dwReserved);
}
HRESULT STDMETHODCALLTYPE CShellLink::Resolve(
/* [in] */ HWND hwnd,
/* [in] */ DWORD fFlags)
{
return m_ShellLinkA->Resolve(hwnd, fFlags);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetPath(
/* [in] */ LPCSTR pszFile)
{
return m_ShellLinkA->SetPath(pszFile);
}
// IShellLinkW
HRESULT STDMETHODCALLTYPE CShellLink::GetPath(
/* [size_is][out] */ LPWSTR pszFile,
/* [in] */ int cch,
/* [full][out][in] */ WIN32_FIND_DATAW *pfd,
/* [in] */ DWORD fFlags)
{
HRESULT hr;
LPSTR pszFileA;
WIN32_FIND_DATAA fdA;
pszFileA = (LPSTR) alloca(cch);
hr = m_ShellLinkA->GetPath(pszFileA, cch, &fdA, fFlags);
if (FAILED(hr))
return hr;
MultiByteToWideChar(CP_ACP, 0, pszFileA, -1, pszFile, cch);
if (pfd)
{
pfd->dwFileAttributes = fdA.dwFileAttributes;
pfd->ftCreationTime = fdA.ftCreationTime;
pfd->ftLastAccessTime = fdA.ftLastAccessTime;
pfd->ftLastWriteTime = fdA.ftLastWriteTime;
pfd->nFileSizeHigh = fdA.nFileSizeHigh;
pfd->nFileSizeLow = fdA.nFileSizeLow;
pfd->dwReserved0 = fdA.dwReserved0;
pfd->dwReserved1 = fdA.dwReserved1;
MultiByteToWideChar(CP_ACP, 0, fdA.cFileName, -1, pfd->cFileName, sizeof(pfd->cFileName));
MultiByteToWideChar(CP_ACP, 0, fdA.cAlternateFileName, -1, pfd->cAlternateFileName, sizeof(pfd->cAlternateFileName));
}
return hr;
}
//HRESULT STDMETHODCALLTYPE CShellLink::GetIDList(
// /* [out] */ LPITEMIDLIST *ppidl)
//{
//}
//
//HRESULT STDMETHODCALLTYPE CShellLink::SetIDList(
// /* [in] */ LPCITEMIDLIST pidl)
//{
//}
HRESULT STDMETHODCALLTYPE CShellLink::GetDescription(
/* [size_is][out] */ LPWSTR pszName,
int cch)
{
HRESULT hr;
LPSTR pszNameA;
pszNameA = (LPSTR) alloca(cch);
hr = m_ShellLinkA->GetDescription(pszNameA, cch);
if (SUCCEEDED(hr))
MultiByteToWideChar(CP_ACP, 0, pszNameA, -1, pszName, cch);
return hr;
}
HRESULT STDMETHODCALLTYPE CShellLink::SetDescription(
/* [in] */ LPCWSTR pszName)
{
LPSTR pszNameA;
int lenA;
lenA = (lstrlenW(pszName) + 1) * 2;
pszNameA = (LPSTR) alloca(lenA);
WideCharToMultiByte(CP_ACP, 0, pszName, -1, pszNameA, lenA, NULL, NULL);
return m_ShellLinkA->SetDescription(pszNameA);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetWorkingDirectory(
/* [size_is][out] */ LPWSTR pszDir,
int cch)
{
HRESULT hr;
LPSTR pszDirA;
pszDirA = (LPSTR) alloca(cch);
hr = m_ShellLinkA->GetWorkingDirectory(pszDirA, cch);
if (SUCCEEDED(hr))
MultiByteToWideChar(CP_ACP, 0, pszDirA, -1, pszDir, cch);
return hr;
}
HRESULT STDMETHODCALLTYPE CShellLink::SetWorkingDirectory(
/* [in] */ LPCWSTR pszDir)
{
LPSTR pszDirA;
int lenA;
lenA = (lstrlenW(pszDir) + 1) * 2;
pszDirA = (LPSTR) alloca(lenA);
WideCharToMultiByte(CP_ACP, 0, pszDir, -1, pszDirA, lenA, NULL, NULL);
return m_ShellLinkA->SetWorkingDirectory(pszDirA);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetArguments(
/* [size_is][out] */ LPWSTR pszArgs,
int cch)
{
HRESULT hr;
LPSTR pszArgsA;
pszArgsA = (LPSTR) alloca(cch);
hr = m_ShellLinkA->GetArguments(pszArgsA, cch);
if (SUCCEEDED(hr))
MultiByteToWideChar(CP_ACP, 0, pszArgsA, -1, pszArgs, cch);
return hr;
}
HRESULT STDMETHODCALLTYPE CShellLink::SetArguments(
/* [in] */ LPCWSTR pszArgs)
{
LPSTR pszArgsA;
int lenA;
lenA = (lstrlenW(pszArgs) + 1) * 2;
pszArgsA = (LPSTR) alloca(lenA);
WideCharToMultiByte(CP_ACP, 0, pszArgs, -1, pszArgsA, lenA, NULL, NULL);
return m_ShellLinkA->SetArguments(pszArgsA);
}
//HRESULT STDMETHODCALLTYPE CShellLink::GetHotkey(
// /* [out] */ WORD *pwHotkey)
//{
//}
//
//HRESULT STDMETHODCALLTYPE CShellLink::SetHotkey(
// /* [in] */ WORD wHotkey)
//{
//}
//
//HRESULT STDMETHODCALLTYPE CShellLink::GetShowCmd(
// /* [out] */ int *piShowCmd)
//{
//}
//
//HRESULT STDMETHODCALLTYPE CShellLink::SetShowCmd(
// /* [in] */ int iShowCmd)
//{
//}
HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation(
/* [size_is][out] */ LPWSTR pszIconPath,
/* [in] */ int cch,
/* [out] */ int *piIcon)
{
HRESULT hr;
LPSTR pszIconPathA;
pszIconPathA = (LPSTR) alloca(cch);
hr = m_ShellLinkA->GetIconLocation(pszIconPathA, cch, piIcon);
if (SUCCEEDED(hr))
MultiByteToWideChar(CP_ACP, 0, pszIconPathA, -1, pszIconPath, cch);
return hr;
}
HRESULT STDMETHODCALLTYPE CShellLink::SetIconLocation(
/* [in] */ LPCWSTR pszIconPath,
/* [in] */ int iIcon)
{
LPSTR pszIconPathA;
int lenA;
lenA = (lstrlenW(pszIconPath) + 1) * 2;
pszIconPathA = (LPSTR) alloca(lenA);
WideCharToMultiByte(CP_ACP, 0, pszIconPath, -1, pszIconPathA, lenA, NULL, NULL);
return m_ShellLinkA->SetIconLocation(pszIconPathA, iIcon);
}
HRESULT STDMETHODCALLTYPE CShellLink::SetRelativePath(
/* [in] */ LPCWSTR pszPathRel,
/* [in] */ DWORD dwReserved)
{
LPSTR pszPathRelA;
int lenA;
lenA = (lstrlenW(pszPathRel) + 1) * 2;
pszPathRelA = (LPSTR) alloca(lenA);
WideCharToMultiByte(CP_ACP, 0, pszPathRel, -1, pszPathRelA, lenA, NULL, NULL);
return m_ShellLinkA->SetRelativePath(pszPathRelA, dwReserved);
}
//HRESULT STDMETHODCALLTYPE CShellLink::Resolve(
// /* [in] */ HWND hwnd,
// /* [in] */ DWORD fFlags)
//{
//}
HRESULT STDMETHODCALLTYPE CShellLink::SetPath(
/* [in] */ LPCWSTR pszFile)
{
LPSTR pszFileA;
int lenA;
lenA = (lstrlenW(pszFile) + 1) * 2;
pszFileA = (LPSTR) alloca(lenA);
WideCharToMultiByte(CP_ACP, 0, pszFile, -1, pszFileA, lenA, NULL, NULL);
return m_ShellLinkA->SetPath(pszFileA);
}
// IPersist
HRESULT STDMETHODCALLTYPE CShellLink::GetClassID(
/* [out] */ CLSID *pClassID)
{
return m_PersistFile->GetClassID(pClassID);
}
// IPersistFile
HRESULT STDMETHODCALLTYPE CShellLink::IsDirty( void)
{
return m_PersistFile->IsDirty();
}
HRESULT STDMETHODCALLTYPE CShellLink::Load(
/* [in] */ LPCOLESTR pszFileName,
/* [in] */ DWORD dwMode)
{
return m_PersistFile->Load(pszFileName, dwMode);
}
HRESULT STDMETHODCALLTYPE CShellLink::Save(
/* [unique][in] */ LPCOLESTR pszFileName,
/* [in] */ BOOL fRemember)
{
return m_PersistFile->Save(pszFileName, fRemember);
}
HRESULT STDMETHODCALLTYPE CShellLink::SaveCompleted(
/* [unique][in] */ LPCOLESTR pszFileName)
{
return m_PersistFile->SaveCompleted(pszFileName);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetCurFile(
/* [out] */ LPOLESTR *ppszFileName)
{
return m_PersistFile->GetCurFile(ppszFileName);
}
// IPersistStream
//HRESULT STDMETHODCALLTYPE CShellLink::IsDirty( void)
//{
//}
HRESULT STDMETHODCALLTYPE CShellLink::Load(
/* [unique][in] */ IStream *pStm)
{
return m_PersistStream->Load(pStm);
}
HRESULT STDMETHODCALLTYPE CShellLink::Save(
/* [unique][in] */ IStream *pStm,
/* [in] */ BOOL fClearDirty)
{
return m_PersistStream->Save(pStm, fClearDirty);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetSizeMax(
/* [out] */ ULARGE_INTEGER *pcbSize)
{
return m_PersistStream->GetSizeMax(pcbSize);
}
// IShellExtInit
HRESULT STDMETHODCALLTYPE CShellLink::Initialize(
/* [in] */ LPCITEMIDLIST pidlFolder,
/* [in] */ IDataObject *pdtobj,
/* [in] */ HKEY hkeyProgID)
{
return m_ShellExtInit->Initialize(pidlFolder, pdtobj, hkeyProgID);
}
// IContextMenu
HRESULT STDMETHODCALLTYPE CShellLink::QueryContextMenu(
HMENU hmenu,
UINT indexMenu,
UINT idCmdFirst,
UINT idCmdLast,
UINT uFlags)
{
return m_ContextMenu->QueryContextMenu(hmenu, indexMenu, idCmdFirst, idCmdLast, uFlags);
}
HRESULT STDMETHODCALLTYPE CShellLink::InvokeCommand(
LPCMINVOKECOMMANDINFO lpici)
{
return m_ContextMenu->InvokeCommand(lpici);
}
HRESULT STDMETHODCALLTYPE CShellLink::GetCommandString(
UINT_PTR idCmd,
UINT uType,
UINT *pwReserved,
LPSTR pszName,
UINT cchMax)
{
return m_ContextMenu->GetCommandString(idCmd, uType, pwReserved, pszName, cchMax);
}
// IContextMenu2
HRESULT STDMETHODCALLTYPE CShellLink::HandleMenuMsg(
UINT uMsg,
WPARAM wParam,
LPARAM lParam)
{
return m_ContextMenu2->HandleMenuMsg(uMsg, wParam, lParam);
}
// IDropTarget
HRESULT STDMETHODCALLTYPE CShellLink::DragEnter(
/* [unique][in] */ IDataObject *pDataObj,
/* [in] */ DWORD grfKeyState,
/* [in] */ POINTL pt,
/* [out][in] */ DWORD *pdwEffect)
{
return m_DropTarget->DragEnter(pDataObj, grfKeyState, pt, pdwEffect);
}
HRESULT STDMETHODCALLTYPE CShellLink::DragOver(
/* [in] */ DWORD grfKeyState,
/* [in] */ POINTL pt,
/* [out][in] */ DWORD *pdwEffect)
{
return m_DropTarget->DragOver(grfKeyState, pt, pdwEffect);
}
HRESULT STDMETHODCALLTYPE CShellLink::DragLeave( void)
{
return m_DropTarget->DragLeave();
}
HRESULT STDMETHODCALLTYPE CShellLink::Drop(
/* [unique][in] */ IDataObject *pDataObj,
/* [in] */ DWORD grfKeyState,
/* [in] */ POINTL pt,
/* [out][in] */ DWORD *pdwEffect)
{
return m_DropTarget->Drop(pDataObj, grfKeyState, pt, pdwEffect);
}
// IExtractIconA
HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation(
UINT uFlags,
LPSTR szIconFile,
UINT cchMax,
int *piIndex,
UINT *pwFlags)
{
return m_ExtractIconA->GetIconLocation(uFlags, szIconFile, cchMax, piIndex, pwFlags);
}
HRESULT STDMETHODCALLTYPE CShellLink::Extract(
LPCSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize)
{
return m_ExtractIconA->Extract(pszFile, nIconIndex, phiconLarge, phiconSmall, nIconSize);
}
// IExtractIconW
HRESULT STDMETHODCALLTYPE CShellLink::GetIconLocation(
UINT uFlags,
LPWSTR szIconFile,
UINT cchMax,
int *piIndex,
UINT *pwFlags)
{
HRESULT hr;
LPSTR szIconFileA;
szIconFileA = (LPSTR) alloca(cchMax);
hr = m_ExtractIconA->GetIconLocation(uFlags, szIconFileA, cchMax, piIndex, pwFlags);
if (SUCCEEDED(hr))
MultiByteToWideChar(CP_ACP, 0, szIconFileA, -1, szIconFile, cchMax);
return hr;
}
HRESULT STDMETHODCALLTYPE CShellLink::Extract(
LPCWSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize)
{
LPSTR pszFileA;
int lenA;
lenA = (lstrlenW(pszFile) + 1) * 2;
pszFileA = (LPSTR) alloca(lenA);
WideCharToMultiByte(CP_ACP, 0, pszFile, -1, pszFileA, lenA, NULL, NULL);
return m_ExtractIconA->Extract(pszFileA, nIconIndex, phiconLarge, phiconSmall, nIconSize);
}

329
kexCOM/shelllink.h Executable file
View File

@ -0,0 +1,329 @@
/*
* KernelEx
* Copyright (C) 2009, Xeno86
*
* This file is part of KernelEx source code.
*
* KernelEx is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published
* by the Free Software Foundation; version 2 of the License.
*
* KernelEx 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GNU Make; see the file COPYING. If not, write to
* the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#ifndef __SHELLLINK_H
#define __SHELLLINK_H
#include <shlobj.h>
class CShellLink : public IShellLinkA,
public IShellLinkW,
public IPersistFile,
public IPersistStream,
public IShellExtInit,
public IContextMenu2,
public IDropTarget,
public IExtractIconA,
public IExtractIconW
{
public:
// Constructor
CShellLink(IUnknown *prevUnk);
// Destructor
~CShellLink();
// IUnknown
HRESULT STDMETHODCALLTYPE QueryInterface(
/* [in] */ REFIID riid,
/* [iid_is][out] */ void **ppvObject);
ULONG STDMETHODCALLTYPE AddRef( void);
ULONG STDMETHODCALLTYPE Release( void);
// IShellLinkA
HRESULT STDMETHODCALLTYPE GetPath(
/* [size_is][out] */ LPSTR pszFile,
/* [in] */ int cch,
/* [full][out][in] */ WIN32_FIND_DATAA *pfd,
/* [in] */ DWORD fFlags);
HRESULT STDMETHODCALLTYPE GetIDList(
/* [out] */ LPITEMIDLIST *ppidl);
HRESULT STDMETHODCALLTYPE SetIDList(
/* [in] */ LPCITEMIDLIST pidl);
HRESULT STDMETHODCALLTYPE GetDescription(
/* [size_is][out] */ LPSTR pszName,
/* [in] */ int cch);
HRESULT STDMETHODCALLTYPE SetDescription(
/* [in] */ LPCSTR pszName);
HRESULT STDMETHODCALLTYPE GetWorkingDirectory(
/* [size_is][out] */ LPSTR pszDir,
/* [in] */ int cch);
HRESULT STDMETHODCALLTYPE SetWorkingDirectory(
/* [in] */ LPCSTR pszDir);
HRESULT STDMETHODCALLTYPE GetArguments(
/* [size_is][out] */ LPSTR pszArgs,
/* [in] */ int cch);
HRESULT STDMETHODCALLTYPE SetArguments(
/* [in] */ LPCSTR pszArgs);
HRESULT STDMETHODCALLTYPE GetHotkey(
/* [out] */ WORD *pwHotkey);
HRESULT STDMETHODCALLTYPE SetHotkey(
/* [in] */ WORD wHotkey);
HRESULT STDMETHODCALLTYPE GetShowCmd(
/* [out] */ int *piShowCmd);
HRESULT STDMETHODCALLTYPE SetShowCmd(
/* [in] */ int iShowCmd);
HRESULT STDMETHODCALLTYPE GetIconLocation(
/* [size_is][out] */ LPSTR pszIconPath,
/* [in] */ int cch,
/* [out] */ int *piIcon);
HRESULT STDMETHODCALLTYPE SetIconLocation(
/* [in] */ LPCSTR pszIconPath,
/* [in] */ int iIcon);
HRESULT STDMETHODCALLTYPE SetRelativePath(
/* [in] */ LPCSTR pszPathRel,
/* [in] */ DWORD dwReserved);
HRESULT STDMETHODCALLTYPE Resolve(
/* [in] */ HWND hwnd,
/* [in] */ DWORD fFlags);
HRESULT STDMETHODCALLTYPE SetPath(
/* [in] */ LPCSTR pszFile);
// IShellLinkW
HRESULT STDMETHODCALLTYPE GetPath(
/* [size_is][out] */ LPWSTR pszFile,
/* [in] */ int cch,
/* [full][out][in] */ WIN32_FIND_DATAW *pfd,
/* [in] */ DWORD fFlags);
// HRESULT STDMETHODCALLTYPE GetIDList(
// /* [out] */ LPITEMIDLIST *ppidl);
//
// HRESULT STDMETHODCALLTYPE SetIDList(
// /* [in] */ LPCITEMIDLIST pidl);
HRESULT STDMETHODCALLTYPE GetDescription(
/* [size_is][out] */ LPWSTR pszName,
int cch);
HRESULT STDMETHODCALLTYPE SetDescription(
/* [in] */ LPCWSTR pszName);
HRESULT STDMETHODCALLTYPE GetWorkingDirectory(
/* [size_is][out] */ LPWSTR pszDir,
int cch);
HRESULT STDMETHODCALLTYPE SetWorkingDirectory(
/* [in] */ LPCWSTR pszDir);
HRESULT STDMETHODCALLTYPE GetArguments(
/* [size_is][out] */ LPWSTR pszArgs,
int cch);
HRESULT STDMETHODCALLTYPE SetArguments(
/* [in] */ LPCWSTR pszArgs);
// HRESULT STDMETHODCALLTYPE GetHotkey(
// /* [out] */ WORD *pwHotkey);
//
// HRESULT STDMETHODCALLTYPE SetHotkey(
// /* [in] */ WORD wHotkey);
//
// HRESULT STDMETHODCALLTYPE GetShowCmd(
// /* [out] */ int *piShowCmd);
//
// HRESULT STDMETHODCALLTYPE SetShowCmd(
// /* [in] */ int iShowCmd);
HRESULT STDMETHODCALLTYPE GetIconLocation(
/* [size_is][out] */ LPWSTR pszIconPath,
/* [in] */ int cch,
/* [out] */ int *piIcon);
HRESULT STDMETHODCALLTYPE SetIconLocation(
/* [in] */ LPCWSTR pszIconPath,
/* [in] */ int iIcon);
HRESULT STDMETHODCALLTYPE SetRelativePath(
/* [in] */ LPCWSTR pszPathRel,
/* [in] */ DWORD dwReserved);
// HRESULT STDMETHODCALLTYPE Resolve(
// /* [in] */ HWND hwnd,
// /* [in] */ DWORD fFlags);
HRESULT STDMETHODCALLTYPE SetPath(
/* [in] */ LPCWSTR pszFile);
// IPersist
HRESULT STDMETHODCALLTYPE GetClassID(
/* [out] */ CLSID *pClassID);
// IPersistFile
HRESULT STDMETHODCALLTYPE IsDirty( void);
HRESULT STDMETHODCALLTYPE Load(
/* [in] */ LPCOLESTR pszFileName,
/* [in] */ DWORD dwMode);
HRESULT STDMETHODCALLTYPE Save(
/* [unique][in] */ LPCOLESTR pszFileName,
/* [in] */ BOOL fRemember);
HRESULT STDMETHODCALLTYPE SaveCompleted(
/* [unique][in] */ LPCOLESTR pszFileName);
HRESULT STDMETHODCALLTYPE GetCurFile(
/* [out] */ LPOLESTR *ppszFileName);
// IPersistStream
// HRESULT STDMETHODCALLTYPE IsDirty( void);
HRESULT STDMETHODCALLTYPE Load(
/* [unique][in] */ IStream *pStm);
HRESULT STDMETHODCALLTYPE Save(
/* [unique][in] */ IStream *pStm,
/* [in] */ BOOL fClearDirty);
HRESULT STDMETHODCALLTYPE GetSizeMax(
/* [out] */ ULARGE_INTEGER *pcbSize);
// IShellExtInit
HRESULT STDMETHODCALLTYPE Initialize(
/* [in] */ LPCITEMIDLIST pidlFolder,
/* [in] */ IDataObject *pdtobj,
/* [in] */ HKEY hkeyProgID);
// IContextMenu
HRESULT STDMETHODCALLTYPE QueryContextMenu(
HMENU hmenu,
UINT indexMenu,
UINT idCmdFirst,
UINT idCmdLast,
UINT uFlags);
HRESULT STDMETHODCALLTYPE InvokeCommand(
LPCMINVOKECOMMANDINFO lpici);
HRESULT STDMETHODCALLTYPE GetCommandString(
UINT_PTR idCmd,
UINT uType,
UINT *pwReserved,
LPSTR pszName,
UINT cchMax);
// IContextMenu2
HRESULT STDMETHODCALLTYPE HandleMenuMsg(
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
// IDropTarget
HRESULT STDMETHODCALLTYPE DragEnter(
/* [unique][in] */ IDataObject *pDataObj,
/* [in] */ DWORD grfKeyState,
/* [in] */ POINTL pt,
/* [out][in] */ DWORD *pdwEffect);
HRESULT STDMETHODCALLTYPE DragOver(
/* [in] */ DWORD grfKeyState,
/* [in] */ POINTL pt,
/* [out][in] */ DWORD *pdwEffect);
HRESULT STDMETHODCALLTYPE DragLeave( void);
HRESULT STDMETHODCALLTYPE Drop(
/* [unique][in] */ IDataObject *pDataObj,
/* [in] */ DWORD grfKeyState,
/* [in] */ POINTL pt,
/* [out][in] */ DWORD *pdwEffect);
// IExtractIconA
HRESULT STDMETHODCALLTYPE GetIconLocation(
UINT uFlags,
LPSTR szIconFile,
UINT cchMax,
int *piIndex,
UINT *pwFlags);
HRESULT STDMETHODCALLTYPE Extract(
LPCSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize);
// IExtractIconW
HRESULT STDMETHODCALLTYPE GetIconLocation(
UINT uFlags,
LPWSTR szIconFile,
UINT cchMax,
int *piIndex,
UINT *pwFlags);
HRESULT STDMETHODCALLTYPE Extract(
LPCWSTR pszFile,
UINT nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIconSize);
private:
long m_cRef;
IUnknown *m_Unknown;
IShellLinkA *m_ShellLinkA;
// IShellLinkW *m_ShellLinkW;
IPersistFile *m_PersistFile;
IPersistStream *m_PersistStream;
IShellExtInit *m_ShellExtInit;
IContextMenu *m_ContextMenu;
IContextMenu2 *m_ContextMenu2;
IDropTarget *m_DropTarget;
IExtractIconA *m_ExtractIconA;
// IExtractIconW *m_ExtractIconW;
};
#endif