⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kmisc.c

📁 可用于嵌入式编程学习
💻 C
📖 第 1 页 / 共 5 页
字号:
	       	pCurThread->aky = pcstk->akyLast;
	    else {
			pCurThread->aky = pCurThread->pOwnerProc->aky;
	       	AddAccess(&pCurThread->aky, ProcArray[0].aky);
	        AddAccess(&pCurThread->aky, pProc->aky);
	    }
	}
	SetCPUASID(pCurThread);
	randdw1 = ((randdw1<<5) | (randdw1>>27)) ^ (CurMSec & 0x1f);
	try {
		dwRet = (*(DWORD (*)(LPVOID, LPVOID, LPVOID, LPVOID))(ZeroPtr(pcbi->pfn)))(pcbi->pvArg0,p2,p3,p4);
	} except (EXCEPTION_EXECUTE_HANDLER) {
		dwFault = 1;
		dwRet = 0; // set return value
	}
	SwitchBack();
	if (dwFault)
        RaiseException(STATUS_INVALID_PARAMETER, EXCEPTION_NONCONTINUABLE, 0, 0);
	return dwRet;
}

DWORD SC_PerformCallBack4(CALLBACKINFO *pcbi, LPVOID p2, LPVOID p3, LPVOID p4) {
	if (pCurProc->bTrustLevel == KERN_TRUST_FULL)
		return PerformCallBack4Int(pcbi,p2,p3,p4);
  	RaiseException(STATUS_INVALID_PARAMETER, EXCEPTION_NONCONTINUABLE, 0, 0);
	return 0;
}

HGDIOBJ SC_SelectObject(HANDLE hDC, HANDLE hObj) {
	CALLSTACK cstk;
	HGDIOBJ hRet;
    const CINFO *pci;
	pci = SwitchToProc(&cstk,SH_GDI);
    try {
		hRet = (*(HGDIOBJ (*)(HANDLE,HANDLE))(pci->ppfnMethods[SELECTOBJECT]))(hDC,hObj);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		hRet = 0;
	}
	SwitchBack();
	return hRet;
}

BOOL SC_PatBlt(HDC hdcDest,int nXLeft,int nYLeft,int nWidth,int nHeight,DWORD dwRop) {
	CALLSTACK cstk;
	BOOL bRet = 0;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_GDI);
    try {
		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;
}

BOOL SC_GetTextExtentExPointW(HDC hdc,LPCWSTR lpszStr,int cchString,int nMaxExtent,LPINT lpnFit,LPINT alpDx,LPSIZE lpSize) {
	CALLSTACK cstk;
	BOOL bRet;
    const CINFO *pci;
	MapArgPtr(lpszStr);
	MapArgPtr(lpnFit);
	MapArgPtr(alpDx);
	MapArgPtr(lpSize);
    pci = SwitchToProc(&cstk,SH_GDI);
    try {
		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;
}

HBRUSH SC_GetSysColorBrush(int nIndex) {
	CALLSTACK cstk;
	HBRUSH hRet ;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_GDI);
    try {
		hRet = (*(HBRUSH (*)(int))(pci->ppfnMethods[GETSYSCOLORBRUSH]))(nIndex);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		hRet = 0;
	}
	SwitchBack();
	return hRet;
}

COLORREF SC_SetBkColor(HDC hDC,COLORREF dwColor) {
	CALLSTACK cstk;
	COLORREF cr ;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_GDI);
    try {
		cr = (*(COLORREF (*)(HDC,COLORREF))(pci->ppfnMethods[SETBKCOLOR]))(hDC,dwColor);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		cr = 0;
	}
	SwitchBack();
	return cr;
}

HWND SC_GetParent(HWND hwnd) {
	CALLSTACK cstk;
	HWND hRet ;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		hRet = (*(HWND (*)(HWND))(pci->ppfnMethods[MID_GetParent]))(hwnd);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		hRet = 0;
	}
	SwitchBack();
	return hRet;
}

BOOL SC_ClientToScreen(HWND hwnd, LPPOINT lpPoint) {
	CALLSTACK cstk;
	BOOL bRet ;
    const CINFO *pci;
	MapArgPtr(lpPoint);
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		bRet = (*(BOOL (*)(HWND, LPPOINT))(pci->ppfnMethods[MID_ClientToScreen]))(hwnd,lpPoint);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		bRet = 0;
	}
	SwitchBack();
	return bRet;
}

LRESULT SC_DefWindowProcW(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
	CALLSTACK cstk;
	LRESULT lRet ;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		lRet = (*(LRESULT (*)(HWND, UINT, WPARAM, LPARAM))(pci->ppfnMethods[MID_DefWindowProcW]))(hwnd,msg,wParam,lParam);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		lRet = 0;
	}
	SwitchBack();
	return lRet;
}

BOOL SC_GetClipCursor(LPRECT lpRect) {
	CALLSTACK cstk;
	BOOL bRet;
    const CINFO *pci;
	MapArgPtr(lpRect);
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		bRet = (*(BOOL (*)(LPRECT))(pci->ppfnMethods[MID_GetClipCursor]))(lpRect);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		bRet = 0;
	}
	SwitchBack();
	return bRet;
}

HDC SC_GetDC (HWND hwnd) {
	CALLSTACK cstk;
	HDC hRet;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		hRet = (*(HDC (*)(HWND))(pci->ppfnMethods[MID_GetDC]))(hwnd);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		hRet = 0;
	}
	SwitchBack();
	return hRet;
}

HWND SC_GetFocus() {
	CALLSTACK cstk;
	HWND hRet;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		hRet = (*(HWND (*)())(pci->ppfnMethods[MID_GetFocus]))();
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		hRet = 0;
	}
	SwitchBack();
	return hRet;
}

BOOL SC_GetMessageW(PMSG pMsgr, HWND hwnd, UINT wMsgFilterMin, UINT wMsgFilterMax) {
	CALLSTACK cstk;
	BOOL bRet;
    const CINFO *pci;
	MapArgPtr(pMsgr);
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		bRet = (*(BOOL (*)(PMSG,HWND,UINT,UINT))(pci->ppfnMethods[MID_GetMessageW]))(pMsgr,hwnd,wMsgFilterMin,wMsgFilterMax);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		bRet = 0;
	}
	SwitchBack();
	return bRet;
}

HWND SC_GetWindow(HWND hwnd, UINT uCmd) {
	CALLSTACK cstk;
	HWND hRet;
    const CINFO *pci;
	pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		hRet = (*(HWND (*)(HWND,UINT))(pci->ppfnMethods[MID_GetWindow]))(hwnd,uCmd);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		hRet = 0;
	}
	SwitchBack();
	return hRet;
}

BOOL SC_PeekMessageW(PMSG pMsg, HWND hWnd, UINT wMsgFilterMin,UINT wMsgFilterMax, UINT wRemoveMsg) {
	CALLSTACK cstk;
	BOOL bRet;
    const CINFO *pci;
	MapArgPtr(pMsg);
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		bRet = (*(BOOL (*)(PMSG,HWND,UINT,UINT,UINT))(pci->ppfnMethods[MID_PeekMessageW]))(pMsg,hWnd,wMsgFilterMin,wMsgFilterMax,wRemoveMsg);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		bRet = 0;
	}
	SwitchBack();
	return bRet;
}

BOOL SC_ReleaseDC(HWND hwnd, HDC hdc) {
	CALLSTACK cstk;
	BOOL bRet;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		bRet = (*(BOOL (*)(HWND,HDC))(pci->ppfnMethods[MID_ReleaseDC]))(hwnd,hdc);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		bRet = 0;
	}
	SwitchBack();
	return bRet;
}

LRESULT SC_SendMessageW(HWND hwnd, UINT Msg, WPARAM wParam, LPARAM lParam) {
	CALLSTACK cstk;
	LRESULT lRet;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		lRet = (*(LRESULT (*)(HWND,UINT,WPARAM,LPARAM))(pci->ppfnMethods[MID_SendMessageW]))(hwnd,Msg,wParam,lParam);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		lRet = 0;
	}
	SwitchBack();
	return lRet;
}

int SC_SetScrollInfo(HWND hwnd, int fnBar, LPCSCROLLINFO lpsi, BOOL fRedraw) {
	CALLSTACK cstk;
	int iRet;
    const CINFO *pci;
	MapArgPtr(lpsi);
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		iRet = (*(int (*)(HWND,int,LPCSCROLLINFO,BOOL))(pci->ppfnMethods[MID_SetScrollInfo]))(hwnd,fnBar,lpsi,fRedraw);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		iRet = 0;
	}
	SwitchBack();
	return iRet;
}

LONG SC_SetWindowLongW(HWND hwnd, int nIndex, LONG lNewLong) {
	CALLSTACK cstk;
	LONG lRet;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		lRet = (*(LONG (*)(HWND,int,LONG))(pci->ppfnMethods[MID_SetWindowLongW]))(hwnd,nIndex,lNewLong);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		lRet = 0;
	}
	SwitchBack();
	return lRet;
}

BOOL SC_SetWindowPos(HWND hwnd, HWND hwndInsertAfter, int x, int y, int dx,int dy, UINT fuFlags) {
	CALLSTACK cstk;
	BOOL bRet;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		bRet = (*(BOOL (*)(HWND,HWND,int,int,int,int,UINT))(pci->ppfnMethods[MID_SetWindowPos]))(hwnd,hwndInsertAfter,x,y,dx,dy,fuFlags);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		bRet = 0;
	}
	SwitchBack();
	return bRet;
}

HBRUSH SC_CreateSolidBrush(COLORREF crColor) {
	CALLSTACK cstk;
	HBRUSH hRet;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_GDI);
    try {
		hRet = (*(HBRUSH (*)(COLORREF))(pci->ppfnMethods[CREATESOLIDBRUSH]))(crColor);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		hRet = 0;
	}
	SwitchBack();
	return hRet;
}

BOOL SC_DeleteMenu(HMENU hmenu, UINT uPosition, UINT uFlags) {
	CALLSTACK cstk;
	BOOL bRet;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_WMGR);
    try {
		bRet = (*(BOOL (*)(HMENU, UINT, UINT))(pci->ppfnMethods[MID_DeleteMenu]))(hmenu,uPosition,uFlags);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		bRet = 0;
	}
	SwitchBack();
	return bRet;
}

BOOL SC_DeleteObject(HGDIOBJ hObject) {
	CALLSTACK cstk;
	BOOL bRet;
    const CINFO *pci;
    pci = SwitchToProc(&cstk,SH_GDI);
    try {
		bRet = (*(BOOL (*)(HGDIOBJ))(pci->ppfnMethods[DELETEOBJECT]))(hObject);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		bRet = 0;
	}
	SwitchBack();
	return bRet;
}

int SC_DrawTextW(HDC hdc,LPCWSTR lpszStr,int cchStr,RECT *lprc,UINT wFormat) {
	CALLSTACK cstk;
	int iRet;
    const CINFO *pci;
	MapArgPtr(lpszStr);
	MapArgPtr(lprc);
    pci = SwitchToProc(&cstk,SH_GDI);
    try {
		iRet = (*(int (*)(HDC,LPCWSTR,int,RECT *,UINT))(pci->ppfnMethods[DRAWTEXTW]))(hdc,lpszStr,cchStr,lprc,wFormat);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		iRet = 0;
	}
	SwitchBack();
	return iRet;
}

BOOL SC_ExtTextOutW(HDC hdc,int X,int Y,UINT fuOptions,CONST RECT *lprc, LPCWSTR lpszString, UINT cbCount, CONST INT *lpDx) {
	CALLSTACK cstk;
	BOOL bRet;
    const CINFO *pci;
	MapArgPtr(lprc);
	MapArgPtr(lpszString);
	MapArgPtr(lpDx);
    pci = SwitchToProc(&cstk,SH_GDI);
    try {
		bRet = (*(BOOL (*)(HDC,int,int,UINT,CONST RECT *, LPCWSTR, UINT, CONST INT *))(pci->ppfnMethods[EXTTEXTOUTW]))(hdc,X,Y,fuOptions,lprc,lpszString,cbCount,lpDx);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		bRet = 0;
	}
	SwitchBack();
	return bRet;
}

int SC_FillRect(HDC hdc,CONST RECT *lprc,HBRUSH hbr) {
	CALLSTACK cstk;
	int iRet;
    const CINFO *pci;
	MapArgPtr(lprc);
    pci = SwitchToProc(&cstk,SH_GDI);
    try {
		iRet = (*(int (*)(HDC,CONST RECT *, HBRUSH))(pci->ppfnMethods[FILLRECT]))(hdc,lprc,hbr);
	} except(EXCEPTION_EXECUTE_HANDLER) {
		(*(void (*)(void))pGwesHandler)();
		iRet = 0;
	}
	SwitchBack();
	return iRet;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -