📄 kmodeentries.cpp
字号:
HBRUSH hbr
)
{
CALLSTACK cstk;
int iRet;
// Need to map pointers before switching to target proc.
MapArgPtr(lprc);
const CINFO* pci = SwitchToProc(&cstk,SH_GDI);
__try
{
iRet = ((GweApiSet2_t*)(pci->ppfnMethods)) -> m_pFillRect(hdc,lprc,hbr);
// iRet = (*(int (*)(HDC,CONST RECT *, HBRUSH))(pci->ppfnMethods[FILLRECT]))(hdc,lprc,hbr);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
iRet = 0;
}
SwitchBack();
return iRet;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern "C"
SHORT
SC_GetAsyncKeyState(
INT vKey
)
{
CALLSTACK cstk;
SHORT sRet;
const CINFO* pci = SwitchToProc(&cstk,SH_WMGR);
__try
{
sRet = ((GweApiSet1_t*)(pci->ppfnMethods)) -> m_pGetAsyncKeyState(vKey);
// sRet = (*(SHORT (*)(INT))(pci->ppfnMethods[MID_GetAsyncKeyState]))(vKey);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
sRet = 0;
}
SwitchBack();
return sRet;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern "C"
int
SC_GetDlgCtrlID(
HWND hWnd
)
{
CALLSTACK cstk;
int iRet;
const CINFO* pci = SwitchToProc(&cstk,SH_WMGR);
__try
{
iRet = ((GweApiSet1_t*)(pci->ppfnMethods)) -> m_pGetDlgCtrlID(hWnd);
// iRet = (*(int (*)(HWND))(pci->ppfnMethods[MID_GetDlgCtrlID]))(hWnd);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
iRet = 0;
}
SwitchBack();
return iRet;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern "C"
HGDIOBJ
SC_GetStockObject(
int fnObject
)
{
CALLSTACK cstk;
HGDIOBJ hRet;
const CINFO* pci = SwitchToProc(&cstk,SH_GDI);
__try
{
hRet = ((GweApiSet2_t*)(pci->ppfnMethods)) -> m_pGetStockObject(fnObject);
// hRet = (*(HGDIOBJ (*)(int))(pci->ppfnMethods[GETSTOCKOBJECT]))(fnObject);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
hRet = 0;
}
SwitchBack();
return hRet;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern "C"
BOOL
SC_ClientToScreen(
HWND hwnd,
LPPOINT lpPoint
)
{
CALLSTACK cstk;
BOOL bRet;
// Need to map pointers before switching to target proc.
MapArgPtr(lpPoint);
const CINFO* pci = SwitchToProc(&cstk,SH_WMGR);
__try
{
bRet = ((GweApiSet1_t*)(pci->ppfnMethods)) -> m_pClientToScreen(hwnd,lpPoint);
// bRet = (*(BOOL (*)(HWND, LPPOINT))(pci->ppfnMethods[MID_ClientToScreen]))(hwnd,lpPoint);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
bRet = 0;
}
SwitchBack();
return bRet;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern "C"
HBRUSH
SC_GetSysColorBrush(
int nIndex
)
{
CALLSTACK cstk;
HBRUSH hRet ;
const CINFO *pci;
pci = SwitchToProc(&cstk,SH_GDI);
__try
{
hRet = ((GweApiSet2_t*)(pci->ppfnMethods)) -> m_pGetSysColorBrush(nIndex);
// hRet = (*(HBRUSH (*)(int))(pci->ppfnMethods[GETSYSCOLORBRUSH]))(nIndex);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
hRet = 0;
}
SwitchBack();
return hRet;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern "C"
HWND
SC_GetParent(
HWND hwnd
)
{
CALLSTACK cstk;
HWND hRet;
const CINFO* pci = SwitchToProc(&cstk,SH_WMGR);
__try
{
hRet = ((GweApiSet1_t*)(pci->ppfnMethods)) -> m_pGetParent(hwnd);
// hRet = (*(HWND (*)(HWND))(pci->ppfnMethods[MID_GetParent]))(hwnd);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
hRet = 0;
}
SwitchBack();
return hRet;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern "C"
COLORREF
SC_SetBkColor(
HDC hDC,
COLORREF dwColor
)
{
CALLSTACK cstk;
COLORREF cr;
const CINFO* pci = SwitchToProc(&cstk,SH_GDI);
__try
{
cr = ((GweApiSet2_t*)(pci->ppfnMethods)) -> m_pSetBkColor(hDC,dwColor);
// cr = (*(COLORREF (*)(HDC,COLORREF))(pci->ppfnMethods[SETBKCOLOR]))(hDC,dwColor);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
cr = 0;
}
SwitchBack();
return cr;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern "C"
BOOL
SC_GetTextExtentExPointW(
HDC hdc,
LPCWSTR lpszStr,
int cchString,
int nMaxExtent,
LPINT lpnFit,
LPINT alpDx,
LPSIZE lpSize
)
{
CALLSTACK cstk;
BOOL bRet;
// Need to map pointers before switching to target proc.
MapArgPtr(lpszStr);
MapArgPtr(lpnFit);
MapArgPtr(alpDx);
MapArgPtr(lpSize);
const CINFO* pci = SwitchToProc(&cstk,SH_GDI);
__try
{
bRet = ((GweApiSet2_t*)(pci->ppfnMethods)) -> m_pGetTextExtentExPointW(hdc,lpszStr,cchString,nMaxExtent,lpnFit,alpDx,lpSize);
// bRet = (*(BOOL (*)(HDC,LPCWSTR,int,int,LPINT,LPINT,LPSIZE))(pci->ppfnMethods[GETTEXTEXTENTEXPOINTW]))(hdc,lpszStr,cchString,nMaxExtent,lpnFit,alpDx,lpSize);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
bRet = 0;
}
SwitchBack();
return bRet;
}
extern "C"
HGDIOBJ
SC_SelectObject(
HDC hDC,
HANDLE hObj
)
{
CALLSTACK cstk;
HGDIOBJ hRet;
const CINFO* pci = SwitchToProc(&cstk,SH_GDI);
__try
{
hRet = ((GweApiSet2_t*)(pci->ppfnMethods)) -> m_pSelectObject(hDC,hObj);
// hRet = (*(HGDIOBJ (*)(HANDLE,HANDLE))(pci->ppfnMethods[SELECTOBJECT]))(hDC,hObj);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
hRet = 0;
}
SwitchBack();
return hRet;
}
//------------------------------------------------------------------------------
//------------------------------------------------------------------------------
extern "C"
BOOL
SC_PatBlt(
HDC hdcDest,
int nXLeft,
int nYLeft,
int nWidth,
int nHeight,
DWORD dwRop
)
{
CALLSTACK cstk;
BOOL bRet = 0;
const CINFO* pci = SwitchToProc(&cstk,SH_GDI);
__try
{
bRet = ((GweApiSet2_t*)(pci->ppfnMethods)) -> m_pPatBlt(hdcDest,nXLeft,nYLeft,nWidth,nHeight,dwRop);
// bRet = (*(BOOL (*)(HDC,int,int,int,int,DWORD))(pci->ppfnMethods[PATBLT]))(hdcDest,nXLeft,nYLeft,nWidth,nHeight,dwRop);
}
__except(EXCEPTION_EXECUTE_HANDLER)
{
(*(void (*)(void))pGwesHandler)();
bRet = 0;
}
SwitchBack();
return bRet;
}
// NOTE: we do not need to validate the pointers if the following functions are called directly
// -- the thread is in KMode already, it can do anything it wants.
static KmodeEntries_t g_KmodeEntries =
{
SC_EventModify, // 0
SC_ReleaseMutex,
SC_CreateAPIHandle,
SC_MapViewOfFile,
SC_ThreadGetPrio,
SC_ThreadSetPrio,
SC_SelectObject,
SC_PatBlt,
SC_GetTextExtentExPointW,
SC_GetSysColorBrush, // 9
SC_SetBkColor, // 010
SC_GetParent,
SC_InvalidateRect,
NKRegOpenKeyExW,
NKRegQueryValueExW,
SC_CreateFileW,
SC_ReadFile,
SC_OpenDatabaseEx,
SC_SeekDatabase,
SC_ReadRecordPropsEx, // 019
NKRegCreateKeyExW, // 020
SC_DeviceIoControl,
SC_CloseHandle,
NKRegCloseKey,
SC_ClientToScreen,
SC_DefWindowProcW,
SC_GetClipCursor,
SC_GetDC,
SC_GetFocus,
SC_GetMessageW, // 029
SC_GetWindow, // 030
SC_PeekMessageW,
SC_ReleaseDC,
SC_SendMessageW,
SC_SetScrollInfo,
SC_SetWindowLongW,
SC_SetWindowPos,
SC_CreateSolidBrush,
SC_DeleteMenu,
SC_DeleteObject, // 039
SC_DrawTextW, // 040
SC_ExtTextOutW,
SC_FillRect,
SC_GetAsyncKeyState,
SC_GetDlgCtrlID,
SC_GetStockObject,
SC_GetSystemMetrics,
SC_RegisterClassWStub,
SC_RegisterClipboardFormatW,
SC_SetBkMode, // 049
SC_SetTextColor, // 050
SC_TransparentImage,
SC_IsDialogMessageW,
SC_PostMessageW,
SC_IsWindowVisible,
SC_GetKeyState,
SC_BeginPaint,
SC_EndPaint,
SC_PerformCallBack4,
SC_CeWriteRecordProps, // 059
SC_ReadFileWithSeek, // 060
SC_WriteFileWithSeek, // 061
};
extern "C"
void*
KmodeEntries(
void
)
{
return &g_KmodeEntries;
}
#ifdef NEVER_DEFINE
extern "C"
const PFNVOID ExtraMethods[] = {
(PFNVOID)SC_EventModify, // 000
(PFNVOID)SC_ReleaseMutex, // 001
(PFNVOID)SC_CreateAPIHandle, // 002
(PFNVOID)SC_MapViewOfFile, // 003
(PFNVOID)SC_ThreadGetPrio, // 004
(PFNVOID)SC_ThreadSetPrio, // 005
(PFNVOID)SC_SelectObject, // 006
(PFNVOID)SC_PatBlt, // 007
(PFNVOID)SC_GetTextExtentExPointW,// 008
(PFNVOID)SC_GetSysColorBrush, // 009
(PFNVOID)SC_SetBkColor, // 010
(PFNVOID)SC_GetParent, // 011
(PFNVOID)SC_InvalidateRect, // 012
(PFNVOID)NKRegOpenKeyExW, // 013
(PFNVOID)NKRegQueryValueExW, // 014
(PFNVOID)SC_CreateFileW, // 015
(PFNVOID)SC_ReadFile, // 016
(PFNVOID)SC_OpenDatabaseEx, // 017
(PFNVOID)SC_SeekDatabase, // 018
(PFNVOID)SC_ReadRecordPropsEx, // 019
(PFNVOID)NKRegCreateKeyExW, // 020
(PFNVOID)SC_DeviceIoControl, // 021
(PFNVOID)SC_CloseHandle, // 022
(PFNVOID)NKRegCloseKey, // 023
(PFNVOID)SC_ClientToScreen, // 024
(PFNVOID)SC_DefWindowProcW, // 025
(PFNVOID)SC_GetClipCursor, // 026
(PFNVOID)SC_GetDC, // 027
(PFNVOID)SC_GetFocus, // 028
(PFNVOID)SC_GetMessageW, // 029
(PFNVOID)SC_GetWindow, // 030
(PFNVOID)SC_PeekMessageW, // 031
(PFNVOID)SC_ReleaseDC, // 032
(PFNVOID)SC_SendMessageW, // 033
(PFNVOID)SC_SetScrollInfo, // 034
(PFNVOID)SC_SetWindowLongW, // 035
(PFNVOID)SC_SetWindowPos, // 036
(PFNVOID)SC_CreateSolidBrush, // 037
(PFNVOID)SC_DeleteMenu, // 038
(PFNVOID)SC_DeleteObject, // 039
(PFNVOID)SC_DrawTextW, // 040
(PFNVOID)SC_ExtTextOutW, // 041
(PFNVOID)SC_FillRect, // 042
(PFNVOID)SC_GetAsyncKeyState, // 043
(PFNVOID)SC_GetDlgCtrlID, // 044
(PFNVOID)SC_GetStockObject, // 045
(PFNVOID)SC_GetSystemMetrics, // 046
(PFNVOID)SC_RegisterClassWStub, // 047
(PFNVOID)SC_RegisterClipboardFormatW, // 048
(PFNVOID)SC_SetBkMode, // 049
(PFNVOID)SC_SetTextColor, // 050
(PFNVOID)SC_TransparentImage, // 051
(PFNVOID)SC_IsDialogMessageW, // 052
(PFNVOID)SC_PostMessageW, // 053
(PFNVOID)SC_IsWindowVisible, // 054
(PFNVOID)SC_GetKeyState, // 055
(PFNVOID)SC_BeginPaint, // 056
(PFNVOID)SC_EndPaint, // 057
(PFNVOID)SC_PerformCallBack4, // 058
(PFNVOID)SC_CeWriteRecordProps, // 059
(PFNVOID)SC_ReadFileWithSeek, // 060
(PFNVOID)SC_WriteFileWithSeek, // 061
};
ERRFALSE(sizeof(ExtraMethods) == sizeof(ExtraMethods[0])*62);
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -