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:
0
sheet/KexLinkage.cpp
Normal file → Executable file
0
sheet/KexLinkage.cpp
Normal file → Executable file
4
sheet/KexLinkage.h
Normal file → Executable file
4
sheet/KexLinkage.h
Normal file → Executable file
@ -33,9 +33,9 @@ using namespace std;
|
||||
class KexLinkage
|
||||
{
|
||||
typedef void (*kexGetModuleSettings_t)(const char* module,
|
||||
char* conf_name, BYTE* ldr_flags);
|
||||
char* conf_name, DWORD* mod_flags);
|
||||
typedef void (*kexSetModuleSettings_t)(const char* module,
|
||||
const char* conf_name, BYTE ldr_flags);
|
||||
const char* conf_name, DWORD mod_flags);
|
||||
typedef unsigned long (*kexGetKEXVersion_t)(void);
|
||||
typedef int (*kexIsDebugCore_t)(void);
|
||||
|
||||
|
69
sheet/factory.cpp
Normal file → Executable file
69
sheet/factory.cpp
Normal file → Executable file
@ -25,72 +25,71 @@
|
||||
#include "sheet.h"
|
||||
#include "KexLinkage.h"
|
||||
|
||||
Factory::Factory()
|
||||
CFactory::CFactory()
|
||||
{
|
||||
m_RefCount = 0;
|
||||
m_cRef = 1;
|
||||
InterlockedIncrement(&g_LockCount);
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP_(ULONG) Factory::AddRef()
|
||||
CFactory::~CFactory()
|
||||
{
|
||||
g_LockCount++;
|
||||
return ++m_RefCount;
|
||||
InterlockedDecrement(&g_LockCount);
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP_(ULONG) Factory::Release()
|
||||
STDMETHODIMP CFactory::QueryInterface(const IID& iid, void** ppv)
|
||||
{
|
||||
g_LockCount--;
|
||||
return --m_RefCount;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP Factory::QueryInterface(REFIID riid,LPVOID *ppv)
|
||||
{
|
||||
if (riid==IID_IUnknown)
|
||||
if (iid==IID_IUnknown)
|
||||
*ppv = static_cast<IUnknown*>(this);
|
||||
else if (riid==IID_IClassFactory)
|
||||
else if (iid==IID_IClassFactory)
|
||||
*ppv = static_cast<IClassFactory*>(this);
|
||||
else
|
||||
{
|
||||
*ppv = NULL;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
AddRef();
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP Factory::LockServer(BOOL bLock)
|
||||
STDMETHODIMP_(ULONG) CFactory::AddRef()
|
||||
{
|
||||
if (bLock==TRUE)
|
||||
g_LockCount++;
|
||||
else
|
||||
g_LockCount--;
|
||||
return S_OK;
|
||||
return InterlockedIncrement(&m_cRef);
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP Factory::CreateInstance(IUnknown *pUnkOuter,REFIID riid, LPVOID *ppv)
|
||||
STDMETHODIMP_(ULONG) CFactory::Release()
|
||||
{
|
||||
*ppv = NULL;
|
||||
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;
|
||||
|
||||
if (!KexLinkage::instance.IsReady())
|
||||
return E_ACCESSDENIED;
|
||||
return E_NOINTERFACE;
|
||||
|
||||
KexShlExt* pShlExt = new KexShlExt;
|
||||
if (pShlExt == NULL)
|
||||
return E_OUTOFMEMORY;
|
||||
|
||||
HRESULT hr = pShlExt->QueryInterface(riid,ppv);
|
||||
if (FAILED(hr))
|
||||
{
|
||||
delete pShlExt;
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
hr = pShlExt->QueryInterface(iid, ppv);
|
||||
pShlExt->Release();
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDMETHODIMP CFactory::LockServer(BOOL bLock)
|
||||
{
|
||||
if (bLock)
|
||||
InterlockedIncrement(&g_LockCount);
|
||||
else
|
||||
InterlockedDecrement(&g_LockCount);
|
||||
return S_OK;
|
||||
}
|
||||
|
21
sheet/factory.h
Normal file → Executable file
21
sheet/factory.h
Normal file → Executable file
@ -22,21 +22,26 @@
|
||||
#ifndef _FACTORY_H
|
||||
#define _FACTORY_H
|
||||
|
||||
class Factory : public IClassFactory
|
||||
class CFactory : public IClassFactory
|
||||
{
|
||||
ULONG m_RefCount;
|
||||
|
||||
public:
|
||||
Factory();
|
||||
// Constructor
|
||||
CFactory();
|
||||
|
||||
// IUnknown
|
||||
STDMETHODIMP QueryInterface(REFIID riid,LPVOID *ppv);
|
||||
// Destructor
|
||||
~CFactory();
|
||||
|
||||
// Interface IUnknown
|
||||
STDMETHODIMP QueryInterface(const IID& iid, void** ppv);
|
||||
STDMETHODIMP_(ULONG) AddRef();
|
||||
STDMETHODIMP_(ULONG) Release();
|
||||
|
||||
// IClassFactory
|
||||
STDMETHODIMP CreateInstance(IUnknown *pUnkOuter,REFIID riid, LPVOID *ppv);
|
||||
// Interface IClassFactory
|
||||
STDMETHODIMP CreateInstance(IUnknown* pUnkOuter, const IID& iid, void** ppv);
|
||||
STDMETHODIMP LockServer(BOOL bLock);
|
||||
|
||||
private:
|
||||
long m_cRef;
|
||||
};
|
||||
|
||||
#endif // _FACTORY_H
|
||||
|
0
sheet/fast_com_unload.reg
Normal file → Executable file
0
sheet/fast_com_unload.reg
Normal file → Executable file
12
sheet/resource.h
Normal file → Executable file
12
sheet/resource.h
Normal file → Executable file
@ -2,6 +2,12 @@
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by sheet.rc
|
||||
//
|
||||
#define TIP_DISABLE 1
|
||||
#define TIP_COMPAT 2
|
||||
#define TIP_SYSTEM 3
|
||||
#define TIP_NOINHERIT 4
|
||||
#define TIP_OVERRIDE 5
|
||||
#define TIP_LOG 6
|
||||
#define IDD_PROPPAGE 102
|
||||
#define IDC_CHECK 1000
|
||||
#define IDC_COMPAT 1000
|
||||
@ -12,6 +18,10 @@
|
||||
#define IDC_GCOMPAT 1006
|
||||
#define IDC_TCOMPAT 1007
|
||||
#define IDC_LOG 1008
|
||||
#define IDC_NOINHERIT 1009
|
||||
#define IDC_GADVAN 1010
|
||||
#define IDC_CHECK1 1011
|
||||
#define IDC_OVERRIDE 1011
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
@ -19,7 +29,7 @@
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 102
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1009
|
||||
#define _APS_NEXT_CONTROL_VALUE 1012
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
28
sheet/server.cpp
Normal file → Executable file
28
sheet/server.cpp
Normal file → Executable file
@ -25,7 +25,7 @@
|
||||
#include "factory.h"
|
||||
#include "sheet.h"
|
||||
|
||||
UINT g_LockCount;
|
||||
long g_LockCount;
|
||||
HMODULE g_hModule;
|
||||
|
||||
|
||||
@ -169,19 +169,29 @@ STDAPI DllUnregisterServer()
|
||||
}
|
||||
|
||||
|
||||
STDAPI DllGetClassObject(REFCLSID rclsid,REFIID riid,LPVOID * ppv)
|
||||
STDAPI DllGetClassObject(const CLSID& clsid, const IID& iid, void** ppv)
|
||||
{
|
||||
static Factory factory;
|
||||
*ppv = NULL;
|
||||
|
||||
if (rclsid != CLSID_KexShlExt)
|
||||
return CLASS_E_CLASSNOTAVAILABLE;
|
||||
HRESULT hr;
|
||||
|
||||
return factory.QueryInterface(riid,ppv);
|
||||
if (clsid == CLSID_KexShlExt)
|
||||
{
|
||||
CFactory* factory = new CFactory;
|
||||
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)
|
||||
BOOL APIENTRY DllMain(HINSTANCE hModule, DWORD dwReason, LPVOID lpReserved)
|
||||
{
|
||||
if (dwReason == DLL_PROCESS_ATTACH)
|
||||
{
|
||||
|
0
sheet/server.def
Normal file → Executable file
0
sheet/server.def
Normal file → Executable file
2
sheet/server.h
Normal file → Executable file
2
sheet/server.h
Normal file → Executable file
@ -22,7 +22,7 @@
|
||||
#ifndef _SERVER_H
|
||||
#define _SERVER_H
|
||||
|
||||
extern UINT g_LockCount;
|
||||
extern long g_LockCount;
|
||||
extern HMODULE g_hModule;
|
||||
|
||||
#endif // _SERVER_H
|
||||
|
199
sheet/sheet.cpp
Normal file → Executable file
199
sheet/sheet.cpp
Normal file → Executable file
@ -27,16 +27,72 @@
|
||||
#include "resource.h"
|
||||
#include "KexLinkage.h"
|
||||
|
||||
struct CTips
|
||||
{
|
||||
char* _TIP_DISABLE;
|
||||
char* _TIP_COMPAT;
|
||||
char* _TIP_SYSTEM;
|
||||
char* _TIP_NOINHERIT;
|
||||
char* _TIP_OVERRIDE;
|
||||
char* _TIP_LOG;
|
||||
|
||||
CTips()
|
||||
{
|
||||
_TIP_DISABLE = _TIP_COMPAT = _TIP_SYSTEM = _TIP_NOINHERIT
|
||||
= _TIP_OVERRIDE = _TIP_LOG = NULL;
|
||||
loaded = false;
|
||||
}
|
||||
|
||||
~CTips()
|
||||
{
|
||||
if (loaded)
|
||||
{
|
||||
free(_TIP_DISABLE);
|
||||
free(_TIP_COMPAT);
|
||||
free(_TIP_SYSTEM);
|
||||
free(_TIP_NOINHERIT);
|
||||
free(_TIP_OVERRIDE);
|
||||
free(_TIP_LOG);
|
||||
}
|
||||
}
|
||||
|
||||
void load_tips()
|
||||
{
|
||||
if (loaded)
|
||||
return;
|
||||
loaded = true;
|
||||
_TIP_DISABLE = load_string(TIP_DISABLE);
|
||||
_TIP_COMPAT = load_string(TIP_COMPAT);
|
||||
_TIP_SYSTEM = load_string(TIP_SYSTEM);
|
||||
_TIP_NOINHERIT = load_string(TIP_NOINHERIT);
|
||||
_TIP_OVERRIDE = load_string(TIP_OVERRIDE);
|
||||
_TIP_LOG = load_string(TIP_LOG);
|
||||
}
|
||||
|
||||
private:
|
||||
bool loaded;
|
||||
|
||||
char* load_string(int sID)
|
||||
{
|
||||
char buf[512];
|
||||
LoadString(g_hModule, sID, buf, sizeof(buf));
|
||||
buf[sizeof(buf) - 1] = '\0';
|
||||
return strdup(buf);
|
||||
}
|
||||
} tips;
|
||||
|
||||
|
||||
|
||||
KexShlExt::KexShlExt()
|
||||
{
|
||||
g_LockCount++;
|
||||
m_RefCount = 0;
|
||||
m_cRef = 1;
|
||||
InterlockedIncrement(&g_LockCount);
|
||||
}
|
||||
|
||||
|
||||
KexShlExt::~KexShlExt()
|
||||
{
|
||||
g_LockCount--;
|
||||
InterlockedDecrement(&g_LockCount);
|
||||
}
|
||||
|
||||
|
||||
@ -61,18 +117,18 @@ STDMETHODIMP KexShlExt::QueryInterface(REFIID riid,LPVOID *ppv)
|
||||
|
||||
STDMETHODIMP_(ULONG) KexShlExt::AddRef()
|
||||
{
|
||||
return ++m_RefCount;
|
||||
return InterlockedIncrement(&m_cRef);
|
||||
}
|
||||
|
||||
|
||||
STDMETHODIMP_(ULONG) KexShlExt::Release()
|
||||
{
|
||||
if (!--m_RefCount)
|
||||
if (InterlockedDecrement(&m_cRef) == 0)
|
||||
{
|
||||
delete this;
|
||||
return 0;
|
||||
}
|
||||
return m_RefCount;
|
||||
return m_cRef;
|
||||
}
|
||||
|
||||
|
||||
@ -114,16 +170,16 @@ __end:
|
||||
|
||||
bool KexShlExt::ResolveShortcut(const char* shortcutPath, char* filePath)
|
||||
{
|
||||
HRESULT result;
|
||||
IShellLink* shellLink;
|
||||
HRESULT result;
|
||||
IShellLink* shellLink;
|
||||
IPersistFile* persistFile;
|
||||
char path[MAX_PATH];
|
||||
WCHAR tmp[MAX_PATH];
|
||||
char path[MAX_PATH];
|
||||
WCHAR tmp[MAX_PATH];
|
||||
|
||||
CoInitialize(NULL);
|
||||
|
||||
result = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||
IID_IShellLink, (void**) &shellLink);
|
||||
result = CoCreateInstance(CLSID_ShellLink, NULL, CLSCTX_INPROC_SERVER,
|
||||
IID_IShellLink, (void**) &shellLink);
|
||||
|
||||
if (FAILED(result))
|
||||
{
|
||||
@ -142,8 +198,7 @@ bool KexShlExt::ResolveShortcut(const char* shortcutPath, char* filePath)
|
||||
result = shellLink->Resolve(NULL, SLR_UPDATE);
|
||||
if (SUCCEEDED(result))
|
||||
{
|
||||
result = shellLink->GetPath(path,
|
||||
MAX_PATH, NULL, SLGP_RAWPATH);
|
||||
result = shellLink->GetPath(path, MAX_PATH, NULL, SLGP_RAWPATH);
|
||||
if (SUCCEEDED(result))
|
||||
lstrcpyn(filePath, path, MAX_PATH);
|
||||
}
|
||||
@ -156,7 +211,7 @@ bool KexShlExt::ResolveShortcut(const char* shortcutPath, char* filePath)
|
||||
|
||||
CoUninitialize();
|
||||
|
||||
return SUCCEEDED(result);
|
||||
return SUCCEEDED(result);
|
||||
}
|
||||
|
||||
STDMETHODIMP KexShlExt::Initialize(LPCITEMIDLIST pidlFolder,
|
||||
@ -172,13 +227,13 @@ STDMETHODIMP KexShlExt::Initialize(LPCITEMIDLIST pidlFolder,
|
||||
|
||||
InitCommonControls();
|
||||
|
||||
if (FAILED(pDataObj->GetData(&etc, &stg)))
|
||||
return E_INVALIDARG;
|
||||
if (FAILED(pDataObj->GetData(&etc, &stg)))
|
||||
return E_INVALIDARG;
|
||||
|
||||
// Get an HDROP handle.
|
||||
hdrop = (HDROP) GlobalLock (stg.hGlobal);
|
||||
// Get an HDROP handle.
|
||||
hdrop = (HDROP) GlobalLock(stg.hGlobal);
|
||||
|
||||
if (!hdrop)
|
||||
if (!hdrop)
|
||||
{
|
||||
ReleaseStgMedium(&stg);
|
||||
return E_INVALIDARG;
|
||||
@ -186,10 +241,14 @@ STDMETHODIMP KexShlExt::Initialize(LPCITEMIDLIST pidlFolder,
|
||||
|
||||
ms = new ModuleSetting;
|
||||
if (!ms)
|
||||
{
|
||||
GlobalUnlock(stg.hGlobal);
|
||||
ReleaseStgMedium(&stg);
|
||||
return E_OUTOFMEMORY;
|
||||
}
|
||||
|
||||
// Determine how many files are involved in this operation.
|
||||
UINT numFiles = DragQueryFile (hdrop, 0xFFFFFFFF, NULL, 0);
|
||||
UINT numFiles = DragQueryFile(hdrop, 0xFFFFFFFF, NULL, 0);
|
||||
|
||||
if (numFiles != 1)
|
||||
result = E_FAIL;
|
||||
@ -235,7 +294,7 @@ STDMETHODIMP KexShlExt::AddPages(LPFNADDPROPSHEETPAGE lpfnAddPageProc, LPARAM lP
|
||||
psp.pfnDlgProc = DlgProc;
|
||||
psp.pfnCallback = CallbackProc;
|
||||
psp.lParam = (LPARAM) ms;
|
||||
psp.pcRefParent = &g_LockCount;
|
||||
psp.pcRefParent = (UINT*) &g_LockCount;
|
||||
|
||||
hPage = CreatePropertySheetPage(&psp);
|
||||
if (hPage)
|
||||
@ -272,13 +331,20 @@ BOOL CALLBACK KexShlExt::DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||
|
||||
RECT r;
|
||||
POINT p;
|
||||
|
||||
GetWindowRect(GetDlgItem(hwnd, IDC_GADVAN), &r);
|
||||
p.x = r.left;
|
||||
p.y = r.top;
|
||||
ScreenToClient(hwnd, &p);
|
||||
MoveWindow(GetDlgItem(hwnd, IDC_GADVAN), p.x, p.y, w - 2 * p.x, r.bottom - r.top, TRUE);
|
||||
|
||||
GetWindowRect(GetDlgItem(hwnd, IDC_GCOMPAT), &r);
|
||||
p.x = r.left;
|
||||
p.y = r.top;
|
||||
ScreenToClient(hwnd, &p);
|
||||
MoveWindow(GetDlgItem(hwnd, IDC_GCOMPAT), p.x, p.y, w - 2 * p.x, r.bottom - r.top, TRUE);
|
||||
|
||||
//reposition horizontal spacer and version text
|
||||
MoveWindow(GetDlgItem(hwnd, IDC_GCOMPAT), p.x, p.y, w - 2 * p.x, r.bottom - r.top, TRUE);
|
||||
MoveWindow(GetDlgItem(hwnd, IDC_HORIZ1), p.x, h - 14 - p.x, w - 2 * p.x, 1, TRUE);
|
||||
MoveWindow(GetDlgItem(hwnd, IDC_KEXVER), p.x, h - 12 - p.x, w - 2 * p.x, 12, TRUE);
|
||||
GetWindowRect(GetDlgItem(hwnd, IDC_TCOMPAT), &r);
|
||||
@ -304,6 +370,7 @@ BOOL CALLBACK KexShlExt::DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_COMPAT), FALSE);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_SYSTEM), FALSE);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_LOG), FALSE);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_NOINHERIT), FALSE);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -311,6 +378,7 @@ BOOL CALLBACK KexShlExt::DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_SYSTEM),
|
||||
IsDlgButtonChecked(hwnd, IDC_COMPAT));
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_LOG), TRUE);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_NOINHERIT), TRUE);
|
||||
}
|
||||
PropSheet_Changed(GetParent(hwnd), hwnd);
|
||||
break;
|
||||
@ -321,6 +389,7 @@ BOOL CALLBACK KexShlExt::DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
|
||||
break;
|
||||
case IDC_SYSTEM:
|
||||
case IDC_LOG:
|
||||
case IDC_NOINHERIT:
|
||||
PropSheet_Changed(GetParent(hwnd), hwnd);
|
||||
break;
|
||||
}
|
||||
@ -359,19 +428,22 @@ void KexShlExt::OnInitDialog(HWND hwnd, ModuleSetting* ms)
|
||||
SendMessage(GetDlgItem(hwnd, IDC_SYSTEM), CB_SETCURSEL, i, 0);
|
||||
break;
|
||||
}
|
||||
if (!(ms->flags & 128) && (KexLinkage::instance.disable_extensions || !default_index_valid))
|
||||
ms->flags |= 1;
|
||||
if (ms->flags & 1)
|
||||
if (!(ms->flags & KRF_VALID_FLAG) && (KexLinkage::instance.disable_extensions || !default_index_valid))
|
||||
ms->flags |= KRF_KEX_DISABLE;
|
||||
if (ms->flags & KRF_KEX_DISABLE)
|
||||
{
|
||||
CheckDlgButton(hwnd, IDC_DISABLE, BST_CHECKED);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_COMPAT), FALSE);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_SYSTEM), FALSE);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_LOG), FALSE);
|
||||
EnableWindow(GetDlgItem(hwnd, IDC_NOINHERIT), FALSE);
|
||||
}
|
||||
if (ms->flags & 4)
|
||||
{
|
||||
if (ms->flags & KRF_LOG_APIS)
|
||||
CheckDlgButton(hwnd, IDC_LOG, BST_CHECKED);
|
||||
}
|
||||
if (ms->flags & KRF_NO_INHERIT)
|
||||
CheckDlgButton(hwnd, IDC_NOINHERIT, BST_CHECKED);
|
||||
if (ms->flags & KRF_OVERRIDE_PROC_MOD)
|
||||
CheckDlgButton(hwnd, IDC_OVERRIDE, BST_CHECKED);
|
||||
|
||||
//set KernelEx version
|
||||
unsigned long ver = KexLinkage::instance.m_kexGetKEXVersion();
|
||||
@ -381,22 +453,45 @@ void KexShlExt::OnInitDialog(HWND hwnd, ModuleSetting* ms)
|
||||
ver>>24, (ver>>16) & 0xff, ver & 0xffff, debug ? "DEBUG" : "");
|
||||
SendMessage(GetDlgItem(hwnd, IDC_KEXVER), WM_SETTEXT, 0, (LPARAM) ver_s);
|
||||
|
||||
ShowWindow(GetDlgItem(hwnd, IDC_OVERRIDE), debug ? SW_SHOW : SW_HIDE);
|
||||
ShowWindow(GetDlgItem(hwnd, IDC_LOG), debug ? SW_SHOW : SW_HIDE);
|
||||
if (!debug)
|
||||
{
|
||||
RECT r;
|
||||
HWND h = GetDlgItem(hwnd, IDC_GADVAN);
|
||||
GetWindowRect(h, &r);
|
||||
r.bottom -= 40; //height between IDC_LOG and element above
|
||||
SetWindowPos(h, NULL, 0, 0, r.right - r.left, r.bottom - r.top, SWP_NOMOVE);
|
||||
}
|
||||
|
||||
tips.load_tips();
|
||||
|
||||
HWND hwndTip = CreateTooltipWindow(hwnd);
|
||||
CreateTooltip(hwndTip, hwnd, IDC_DISABLE, tips._TIP_DISABLE);
|
||||
CreateTooltip(hwndTip, hwnd, IDC_COMPAT, tips._TIP_COMPAT);
|
||||
CreateTooltip(hwndTip, hwnd, IDC_SYSTEM, tips._TIP_SYSTEM);
|
||||
CreateTooltip(hwndTip, hwnd, IDC_NOINHERIT, tips._TIP_NOINHERIT);
|
||||
CreateTooltip(hwndTip, hwnd, IDC_OVERRIDE, tips._TIP_OVERRIDE);
|
||||
CreateTooltip(hwndTip, hwnd, IDC_LOG, tips._TIP_LOG);
|
||||
}
|
||||
|
||||
|
||||
void KexShlExt::OnApply(HWND hwnd)
|
||||
{
|
||||
ModuleSetting* ms = (ModuleSetting*) GetWindowLong(hwnd, GWL_USERDATA);
|
||||
BYTE flags = 0;
|
||||
DWORD flags = 0;
|
||||
const char* conf = "";
|
||||
if (IsDlgButtonChecked(hwnd, IDC_DISABLE))
|
||||
flags |= 1;
|
||||
flags |= KRF_KEX_DISABLE;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_COMPAT))
|
||||
conf = KexLinkage::instance.confs[SendMessage(
|
||||
GetDlgItem(hwnd, IDC_SYSTEM), CB_GETCURSEL, 0, 0)].name;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_LOG))
|
||||
flags |= 4;
|
||||
flags |= KRF_LOG_APIS;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_NOINHERIT))
|
||||
flags |= KRF_NO_INHERIT;
|
||||
if (IsDlgButtonChecked(hwnd, IDC_OVERRIDE))
|
||||
flags |= KRF_OVERRIDE_PROC_MOD;
|
||||
|
||||
if (flags != ms->flags || strcmp(conf, ms->conf) != 0)
|
||||
KexLinkage::instance.m_kexSetModuleSettings(ms->file, conf, flags);
|
||||
@ -405,8 +500,44 @@ void KexShlExt::OnApply(HWND hwnd)
|
||||
|
||||
UINT CALLBACK KexShlExt::CallbackProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp)
|
||||
{
|
||||
if (uMsg == PSPCB_RELEASE)
|
||||
if (uMsg == PSPCB_RELEASE)
|
||||
delete (ModuleSetting*) ppsp->lParam;
|
||||
|
||||
return 1; // used for PSPCB_CREATE - let the page be created
|
||||
return 1; // used for PSPCB_CREATE - let the page be created
|
||||
}
|
||||
|
||||
HWND KexShlExt::CreateTooltipWindow(HWND parent)
|
||||
{
|
||||
HWND hwndTip;
|
||||
hwndTip = CreateWindow(TOOLTIPS_CLASS, NULL,
|
||||
WS_POPUP | TTS_ALWAYSTIP | TTS_BALLOON,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
CW_USEDEFAULT, CW_USEDEFAULT,
|
||||
parent, NULL, g_hModule, NULL);
|
||||
SendMessage(hwndTip, TTM_SETMAXTIPWIDTH, 0, 300);
|
||||
SendMessage(hwndTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, MAKELONG(32767, 0));
|
||||
return hwndTip;
|
||||
}
|
||||
|
||||
bool KexShlExt::CreateTooltip(HWND hwndTip, HWND hDlg, int toolID, char* pText)
|
||||
{
|
||||
if (!hwndTip || !toolID || !hDlg || !pText)
|
||||
return false;
|
||||
|
||||
// Get the window of the tool.
|
||||
HWND hwndTool = GetDlgItem(hDlg, toolID);
|
||||
if (!hwndTool)
|
||||
return false;
|
||||
|
||||
// Associate the tooltip with the tool.
|
||||
TOOLINFO toolInfo;
|
||||
toolInfo.cbSize = sizeof(toolInfo);
|
||||
toolInfo.hwnd = hDlg;
|
||||
toolInfo.uFlags = TTF_IDISHWND | TTF_SUBCLASS;
|
||||
toolInfo.uId = (UINT_PTR) hwndTool;
|
||||
toolInfo.lpszText = pText;
|
||||
toolInfo.hinst = g_hModule;
|
||||
SendMessage(hwndTip, TTM_ADDTOOL, 0, (LPARAM) &toolInfo);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
0
sheet/sheet.dsp
Normal file → Executable file
0
sheet/sheet.dsp
Normal file → Executable file
31
sheet/sheet.h
Normal file → Executable file
31
sheet/sheet.h
Normal file → Executable file
@ -28,25 +28,17 @@ struct ModuleSetting
|
||||
{
|
||||
char file[MAX_PATH];
|
||||
char conf[256];
|
||||
BYTE flags;
|
||||
DWORD flags;
|
||||
};
|
||||
|
||||
class KexShlExt : public IShellExtInit,
|
||||
public IShellPropSheetExt
|
||||
{
|
||||
protected:
|
||||
ULONG m_RefCount;
|
||||
ModuleSetting* ms;
|
||||
|
||||
bool IsPEModule(const char* path);
|
||||
bool ResolveShortcut(const char* shortcutPath, char* filePath);
|
||||
static BOOL CALLBACK DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static UINT CALLBACK CallbackProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp);
|
||||
static void OnInitDialog(HWND hwnd, ModuleSetting* ms);
|
||||
static void OnApply(HWND hwnd);
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
KexShlExt();
|
||||
|
||||
// Destructor
|
||||
~KexShlExt();
|
||||
|
||||
// IUnknown
|
||||
@ -60,6 +52,21 @@ public:
|
||||
// IShellPropSheetExt
|
||||
STDMETHODIMP AddPages(LPFNADDPROPSHEETPAGE, LPARAM);
|
||||
STDMETHODIMP ReplacePage(UINT, LPFNADDPROPSHEETPAGE, LPARAM);
|
||||
|
||||
protected:
|
||||
ModuleSetting* ms;
|
||||
|
||||
bool IsPEModule(const char* path);
|
||||
bool ResolveShortcut(const char* shortcutPath, char* filePath);
|
||||
static BOOL CALLBACK DlgProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam);
|
||||
static UINT CALLBACK CallbackProc(HWND hwnd, UINT uMsg, LPPROPSHEETPAGE ppsp);
|
||||
static void OnInitDialog(HWND hwnd, ModuleSetting* ms);
|
||||
static void OnApply(HWND hwnd);
|
||||
static HWND CreateTooltipWindow(HWND parent);
|
||||
static bool CreateTooltip(HWND hwndTip, HWND hDlg, int toolID, char* pText);
|
||||
|
||||
private:
|
||||
long m_cRef;
|
||||
};
|
||||
|
||||
#endif // _SHEET_H
|
||||
|
57
sheet/sheet.rc
Normal file → Executable file
57
sheet/sheet.rc
Normal file → Executable file
@ -15,7 +15,7 @@
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Polish resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_POL)
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_PLK)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_POLISH, SUBLANG_DEFAULT
|
||||
#pragma code_page(1250)
|
||||
@ -54,8 +54,8 @@ END
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 1,0,0,3
|
||||
PRODUCTVERSION 1,0,0,3
|
||||
FILEVERSION 1,0,0,4
|
||||
PRODUCTVERSION 1,0,0,4
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
@ -73,14 +73,14 @@ BEGIN
|
||||
VALUE "Comments", "\0"
|
||||
VALUE "CompanyName", "Xeno86\0"
|
||||
VALUE "FileDescription", "sheet\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 3\0"
|
||||
VALUE "FileVersion", "1, 0, 0, 4\0"
|
||||
VALUE "InternalName", "sheet\0"
|
||||
VALUE "LegalCopyright", "Copyright <20> 2009, Xeno86\0"
|
||||
VALUE "LegalCopyright", "Copyright <20> 2009-2010, Xeno86\0"
|
||||
VALUE "LegalTrademarks", "\0"
|
||||
VALUE "OriginalFilename", "sheet.dll\0"
|
||||
VALUE "PrivateBuild", "\0"
|
||||
VALUE "ProductName", "KernelEx\0"
|
||||
VALUE "ProductVersion", "1, 0, 0, 3\0"
|
||||
VALUE "ProductVersion", "1, 0, 0, 4\0"
|
||||
VALUE "SpecialBuild", "\0"
|
||||
END
|
||||
END
|
||||
@ -110,26 +110,31 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_PROPPAGE DIALOG DISCARDABLE 0, 0, 190, 127
|
||||
IDD_PROPPAGE DIALOG DISCARDABLE 0, 0, 190, 177
|
||||
STYLE WS_CHILD | WS_DISABLED | WS_CAPTION
|
||||
CAPTION "Compatibility"
|
||||
FONT 8, "MS Sans Serif"
|
||||
BEGIN
|
||||
GROUPBOX "Compatibility mode",IDC_GCOMPAT,7,30,176,64
|
||||
CONTROL "Run this program in compatibility mode for:",IDC_COMPAT,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,57,164,10
|
||||
GROUPBOX "Compatibility options",IDC_GCOMPAT,7,30,176,64
|
||||
CONTROL "Disable KernelEx extensions",IDC_DISABLE,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,15,43,165,10
|
||||
CONTROL "Use specific compatibility mode:",IDC_COMPAT,"Button",
|
||||
BS_AUTOCHECKBOX | WS_TABSTOP,15,57,164,10
|
||||
COMBOBOX IDC_SYSTEM,15,70,157,60,CBS_DROPDOWNLIST | WS_DISABLED |
|
||||
WS_VSCROLL | WS_TABSTOP
|
||||
CONTROL "Disable KernelEx extensions for this program",
|
||||
IDC_DISABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,43,
|
||||
165,10
|
||||
LTEXT "kexver here",IDC_KEXVER,7,111,71,9,WS_DISABLED
|
||||
LTEXT "If you have problems with this program, try selecting\na different compatibility mode.",
|
||||
LTEXT "kexver here",IDC_KEXVER,7,161,71,9,WS_DISABLED
|
||||
LTEXT "Try changing compatibility options if you have problems\nwith running this program.",
|
||||
IDC_TCOMPAT,7,7,175,22
|
||||
CONTROL "",IDC_HORIZ1,"Static",SS_BLACKFRAME | SS_SUNKEN,7,109,
|
||||
CONTROL "",IDC_HORIZ1,"Static",SS_BLACKFRAME | SS_SUNKEN,7,160,
|
||||
176,1
|
||||
GROUPBOX "Advanced options",IDC_GADVAN,7,100,176,57
|
||||
CONTROL "Don't use these settings in child processes",
|
||||
IDC_NOINHERIT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,
|
||||
113,164,10
|
||||
CONTROL "Override settings of invidual modules",IDC_OVERRIDE,
|
||||
"Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,127,164,10
|
||||
CONTROL "Enable api logging",IDC_LOG,"Button",BS_AUTOCHECKBOX |
|
||||
NOT WS_VISIBLE | WS_TABSTOP,15,96,74,10
|
||||
NOT WS_VISIBLE | WS_TABSTOP,15,141,164,10
|
||||
END
|
||||
|
||||
|
||||
@ -146,11 +151,27 @@ BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 183
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 120
|
||||
BOTTOMMARGIN, 170
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE DISCARDABLE
|
||||
BEGIN
|
||||
TIP_DISABLE "Use this option to run this program as if KernelEx wasn't installed."
|
||||
TIP_COMPAT "Changes operating system identification and emulates different operating system behavior. Choose operating system which is required to run this program."
|
||||
TIP_SYSTEM "Select operating system to emulate from the list."
|
||||
TIP_NOINHERIT "Disables inheritance of these settings. Normally programs started by this application use settings from this tab as their default settings. Use this option to disable such behaviour."
|
||||
TIP_OVERRIDE "Disables usage of per module settings. Use this option to use same settings for all modules in the application."
|
||||
TIP_LOG "Use this option to enable api spying debugging feature."
|
||||
END
|
||||
|
||||
#endif // English (U.S.) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
Reference in New Issue
Block a user