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

📄 kmisc.c

📁 wince下的源代码集合打包
💻 C
📖 第 1 页 / 共 5 页
字号:
		iRet = (*(int (*)(int))(pci->ppfnMethods[MID_GetSystemMetrics]))(nIndex);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		iRet = 0;	}	SwitchBack();	return iRet;}ATOM SC_RegisterClassWStub(CONST WNDCLASSW *lpWndClass, LPCWSTR lpszClassName, HANDLE hprcWndProc) {	CALLSTACK cstk;	ATOM aRet;    const CINFO *pci;	MapArgPtr(lpWndClass);	MapArgPtr(lpszClassName);    pci = SwitchToProc(&cstk,SH_WMGR);    try {		aRet = (*(ATOM (*)(CONST WNDCLASSW *, LPCWSTR, HANDLE))(pci->ppfnMethods[MID_RegisterClassWStub]))(lpWndClass,lpszClassName,hprcWndProc);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		aRet = 0;	}	SwitchBack();	return aRet;}UINT SC_RegisterClipboardFormatW(LPCWSTR lpszFormat) {	CALLSTACK cstk;	UINT uRet;    const CINFO *pci;	MapArgPtr(lpszFormat);    pci = SwitchToProc(&cstk,SH_WMGR);    try {		uRet = (*(UINT (*)(LPCWSTR))(pci->ppfnMethods[MID_RegisterClipboardFormatW]))(lpszFormat);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		uRet = 0;	}	SwitchBack();	return uRet;}int SC_SetBkMode(HDC hdc,int iBkMode) {	CALLSTACK cstk;	int iRet;    const CINFO *pci;    pci = SwitchToProc(&cstk,SH_GDI);    try {		iRet = (*(int (*)(HDC,int))(pci->ppfnMethods[SETBKMODE]))(hdc,iBkMode);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		iRet = 0;	}	SwitchBack();	return iRet;}COLORREF SC_SetTextColor(HDC hdc,COLORREF crColor) {	CALLSTACK cstk;	COLORREF cRet ;    const CINFO *pci;    pci = SwitchToProc(&cstk,SH_GDI);    try {		cRet = (*(COLORREF (*)(HDC,COLORREF))(pci->ppfnMethods[SETTEXTCOLOR]))(hdc,crColor);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		cRet = 0;	}	SwitchBack();	return cRet;}BOOL SC_InvalidateRect(HWND hwnd, LPCRECT prc, BOOL fErase) {	CALLSTACK cstk;	BOOL bRet;    const CINFO *pci;	MapArgPtr(prc);    pci = SwitchToProc(&cstk,SH_WMGR);    try {		bRet = (*(BOOL (*)(HWND, LPCRECT, BOOL))(pci->ppfnMethods[MID_InvalidateRect]))(hwnd,prc,fErase);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		bRet = 0;	}	SwitchBack();	return bRet;}BOOL SC_TransparentImage(HDC hdcDest, int nXDest, int nYDest, int nWidthDest, int nHeightDest,		HANDLE hImgSrc, int nXSrc, int nYSrc, int nWidthSrc, int nHeightSrc, COLORREF crTransparentColor) {	CALLSTACK cstk;	BOOL bRet;    const CINFO *pci;    pci = SwitchToProc(&cstk,SH_GDI);    try {		bRet = (*(BOOL (*)(HDC,int,int,int,int,HANDLE,int,int,int,int,COLORREF))(pci->ppfnMethods[TRANSPARENTIMAGE]))			(hdcDest, nXDest, nYDest, nWidthDest, nHeightDest, hImgSrc, nXSrc, nYSrc, nWidthSrc, nHeightSrc, crTransparentColor);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		bRet = 0;	}	SwitchBack();	return bRet;}BOOL SC_IsDialogMessageW(HWND hDlg, LPMSG lpMsg) {	CALLSTACK cstk;	BOOL bRet;    const CINFO *pci;	MapArgPtr(lpMsg);    pci = SwitchToProc(&cstk,SH_WMGR);    try {		bRet = (*(BOOL (*)(HWND,LPMSG))(pci->ppfnMethods[MID_IsDialogMessageW]))(hDlg,lpMsg);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		bRet = 0;	}	SwitchBack();	return bRet;}BOOL SC_PostMessageW(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam) {	CALLSTACK cstk;	BOOL bRet;    const CINFO *pci;    pci = SwitchToProc(&cstk,SH_WMGR);    try {		bRet = (*(BOOL (*)(HWND,UINT,WPARAM,LPARAM))(pci->ppfnMethods[MID_PostMessageW]))(hWnd,Msg,wParam,lParam);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		bRet = 0;	}	SwitchBack();	return bRet;}BOOL SC_IsWindowVisible(HWND hWnd) {	CALLSTACK cstk;	BOOL bRet;    const CINFO *pci;    pci = SwitchToProc(&cstk,SH_WMGR);    try {		bRet = (*(BOOL (*)(HWND))(pci->ppfnMethods[MID_IsWindowVisible]))(hWnd);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		bRet = 0;	}	SwitchBack();	return bRet;}SHORT SC_GetKeyState(int nVirtKey){	CALLSTACK cstk;	SHORT sRet;    const CINFO *pci;    pci = SwitchToProc(&cstk,SH_WMGR);    try {		sRet = (*(SHORT (*)(int))(pci->ppfnMethods[MID_GetKeyState]))(nVirtKey);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		sRet = 0;	}	SwitchBack();	return sRet;}HDC SC_BeginPaint(HWND hwnd, LPPAINTSTRUCT pps) {	CALLSTACK cstk;	HDC hRet;    const CINFO *pci;	MapArgPtr(pps);    pci = SwitchToProc(&cstk,SH_WMGR);    try {		hRet = (*(HDC (*)(HWND,LPPAINTSTRUCT))(pci->ppfnMethods[MID_BeginPaint]))(hwnd,pps);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		hRet = 0;	}	SwitchBack();	return hRet;}BOOL SC_EndPaint(HWND hwnd, LPPAINTSTRUCT pps) {	CALLSTACK cstk;	BOOL bRet;    const CINFO *pci;	MapArgPtr(pps);    pci = SwitchToProc(&cstk,SH_WMGR);    try {		bRet = (*(BOOL (*)(HWND,LPPAINTSTRUCT))(pci->ppfnMethods[MID_EndPaint]))(hwnd,pps);	} except(EXCEPTION_EXECUTE_HANDLER) {		(*(void (*)(void))pGwesHandler)();		bRet = 0;	}	SwitchBack();	return bRet;}LONG SC_RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult) {	CALLSTACK cstk;	LONG lRet ;    const CINFO *pci;    MapArgPtr(lpSubKey);    MapArgPtr(phkResult);    pci = SwitchToProc(&cstk,SH_FILESYS_APIS);	lRet = (*(LONG (*)(HKEY,LPCWSTR,DWORD,REGSAM,PHKEY))(pci->ppfnMethods[23]))(hKey,lpSubKey,ulOptions,samDesired,phkResult);	SwitchBack();	return lRet;}LONG SC_RegCloseKey(HKEY hKey) {	CALLSTACK cstk;	LONG lRet ;    const CINFO *pci;    pci = SwitchToProc(&cstk,SH_FILESYS_APIS);	lRet = (*(LONG (*)(HKEY))(pci->ppfnMethods[17]))(hKey);	SwitchBack();	return lRet;}LONG SC_RegQueryValueExW(HKEY hKey, LPCWSTR lpValueName, LPDWORD lpReserved, LPDWORD lpType, LPBYTE lpData, LPDWORD lpcbData) {	CALLSTACK cstk;	LONG lRet ;    const CINFO *pci;    MapArgPtr(lpValueName);    MapArgPtr(lpReserved);    MapArgPtr(lpType);    MapArgPtr(lpData);    MapArgPtr(lpcbData);    pci = SwitchToProc(&cstk,SH_FILESYS_APIS);	lRet = (*(LONG (*)(HKEY,LPCWSTR,LPDWORD,LPDWORD,LPBYTE,LPDWORD))(pci->ppfnMethods[25]))(hKey,lpValueName,lpReserved,lpType,lpData,lpcbData);	SwitchBack();	return lRet;}LONG SC_RegCreateKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD Reserved, LPWSTR lpClass, DWORD dwOptions, REGSAM samDesired, LPSECURITY_ATTRIBUTES lpSecurityAttributes, PHKEY phkResult, LPDWORD lpdwDisposition) {	CALLSTACK cstk;	LONG lRet ;    const CINFO *pci;    MapArgPtr(lpSubKey);    MapArgPtr(lpClass);    MapArgPtr(lpSecurityAttributes);    MapArgPtr(phkResult);    MapArgPtr(lpdwDisposition);    pci = SwitchToProc(&cstk,SH_FILESYS_APIS);	lRet = (*(LONG (*)(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM,LPSECURITY_ATTRIBUTES,PHKEY,LPDWORD))(pci->ppfnMethods[18]))(hKey,lpSubKey,Reserved,lpClass,dwOptions,samDesired,lpSecurityAttributes,phkResult,lpdwDisposition);	SwitchBack();	return lRet;}HANDLE SC_CreateFileW(LPCWSTR lpFileName, DWORD dwDesiredAccess, DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, HANDLE hTemplateFile){	CALLSTACK cstk;	HANDLE h;    const CINFO *pci;    MapArgPtr(lpFileName);    MapArgPtr(lpSecurityAttributes);    pci = SwitchToProc(&cstk,SH_FILESYS_APIS);	h = (*(HANDLE (*)(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE))(pci->ppfnMethods[9]))(lpFileName,dwDesiredAccess,dwShareMode,lpSecurityAttributes,dwCreationDisposition,dwFlagsAndAttributes,hTemplateFile); 	SwitchBack();	return h;}BOOL SC_ReadFile(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped) {	CALLSTACK cstk;	BOOL b = FALSE;    const CINFO *pci;    MapArgPtr(lpBuffer);    MapArgPtr(lpNumberOfBytesRead);    MapArgPtr(lpOverlapped);    if (!(pci = SwitchToProcHandle(&cstk,&hFile,HT_FILE)))    	SetLastError(ERROR_INVALID_HANDLE);	else {		__try {			b = (*(BOOL (*)(HANDLE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED))(pci->ppfnMethods[2]))(hFile,lpBuffer,nNumberOfBytesToRead,lpNumberOfBytesRead,lpOverlapped);		} __except (EXCEPTION_EXECUTE_HANDLER) {		    SetLastError(ERROR_INVALID_PARAMETER);		}		SwitchBack();	}	return b;}CEOID SC_CeWriteRecordProps(HANDLE hDbase, CEOID oidRecord, WORD cPropID, CEPROPVAL *rgPropVal) {	CALLSTACK cstk;	CEOID oid = 0;    const CINFO *pci;    MapArgPtr(rgPropVal);    if (!(pci = SwitchToProcHandle(&cstk,&hDbase,HT_DBFILE)))    	SetLastError(ERROR_INVALID_HANDLE);	else {		__try {			oid = (*(CEOID (*)(HANDLE,CEOID,WORD,CEPROPVAL *))(pci->ppfnMethods[5]))(hDbase,oidRecord,cPropID,rgPropVal);		} __except (EXCEPTION_EXECUTE_HANDLER) {		    SetLastError(ERROR_INVALID_PARAMETER);		}		SwitchBack();	}	return oid;}BOOL SC_ReadFileWithSeek(HANDLE hFile, LPVOID lpBuffer, DWORD nNumberOfBytesToRead, LPDWORD lpNumberOfBytesRead, LPOVERLAPPED lpOverlapped, DWORD dwLowOffset, DWORD dwHighOffset) {	CALLSTACK cstk;	BOOL b = 0;    const CINFO *pci;    MapArgPtr(lpBuffer);    MapArgPtr(lpNumberOfBytesRead);    MapArgPtr(lpOverlapped);    if (!(pci = SwitchToProcHandle(&cstk,&hFile,HT_FILE)))    	SetLastError(ERROR_INVALID_HANDLE);	else {		__try {			b = (*(BOOL (*)(HANDLE, LPVOID, DWORD, LPDWORD, LPOVERLAPPED, DWORD, DWORD))(pci->ppfnMethods[12]))				(hFile, lpBuffer, nNumberOfBytesToRead, lpNumberOfBytesRead, lpOverlapped, dwLowOffset, dwHighOffset);		} __except (EXCEPTION_EXECUTE_HANDLER) {		    SetLastError(ERROR_INVALID_PARAMETER);		}		SwitchBack();	}	return b;}BOOL SC_WriteFileWithSeek(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped, DWORD dwLowOffset, DWORD dwHighOffset) {	CALLSTACK cstk;	BOOL b = 0;    const CINFO *pci;    MapArgPtr(lpBuffer);    MapArgPtr(lpNumberOfBytesWritten);    MapArgPtr(lpOverlapped);    if (!(pci = SwitchToProcHandle(&cstk,&hFile,HT_FILE)))    	SetLastError(ERROR_INVALID_HANDLE);	else {		__try {			b = (*(BOOL (*)(HANDLE, LPCVOID, DWORD, LPDWORD, LPOVERLAPPED, DWORD, DWORD))(pci->ppfnMethods[13]))				(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped, dwLowOffset, dwHighOffset);		} __except (EXCEPTION_EXECUTE_HANDLER) {		    SetLastError(ERROR_INVALID_PARAMETER);		}		SwitchBack();	}	return b;}BOOL SC_CloseHandle(HANDLE hObj) {	CALLSTACK cstk;	BOOL b = FALSE;    const CINFO *pci;    if (!(pci = SwitchToProcHandleClosing(&cstk,&hObj,&b))) {    	if (!b)    		SetLastError(ERROR_INVALID_HANDLE);	} else {		__try {			b = (*(BOOL (*)(HANDLE))(pci->ppfnMethods[0]))(hObj);		} __except (EXCEPTION_EXECUTE_HANDLER) {		    SetLastError(ERROR_INVALID_PARAMETER);		}		SwitchBack();	}	return b;}BOOL SC_DeviceIoControl(HANDLE hDevice, DWORD dwIoControlCode, LPVOID lpInBuf, DWORD nInBufSize, LPVOID lpOutBuf, DWORD nOutBufSize, LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped) {	CALLSTACK cstk;	BOOL b = FALSE;    const CINFO *pci;    MapArgPtr(lpInBuf);    MapArgPtr(lpOutBuf);    MapArgPtr(lpBytesReturned);    MapArgPtr(lpOverlapped);    if (!(pci = SwitchToProcHandle(&cstk,&hDevice,HT_FILE)))    	SetLastError(ERROR_INVALID_HANDLE);	else {		__try {			b = (*(BOOL (*)(HANDLE,DWORD,LPVOID,DWORD,LPVOID,DWORD,LPDWORD,LPOVERLAPPED))(pci->ppfnMethods[11]))(hDevice,dwIoControlCode,lpInBuf,nInBufSize,lpOutBuf,nOutBufSize,lpBytesReturned,lpOverlapped);		} __except (EXCEPTION_EXECUTE_HANDLER) {		    SetLastError(ERROR_INVALID_PARAMETER);		}		SwitchBack();	}	return b;}HANDLE SC_OpenDatabaseEx(PCEGUID pguid, PCEOID poid, LPWSTR lpszName, CEPROPID propid, DWORD dwFlags, CENOTIFYREQUEST *pReq) {	CALLSTACK cstk;	HANDLE h;    const CINFO *pci;    MapArgPtr(pguid);    MapArgPtr(poid);    MapArgPtr(lpszName);    MapArgPtr(pReq);    pci = SwitchToProc(&cstk,SH_FILESYS_APIS);	h = (*(HANDLE (*)(PCEGUID,PCEOID,LPWSTR,CEPROPID,DWORD,CENOTIFYREQUEST *))(pci->ppfnMethods[16]))(pguid,poid,lpszName,propid,dwFlags,pReq); 	SwitchBack();	return h;}CEOID SC_SeekDatabase(HANDLE hDatabase, DWORD dwSeekType, DWORD dwValue, LPDWORD lpdwIndex) {	CALLSTACK cstk;	CEOID oid = 0;    const CINFO *pci;    MapArgPtr(lpdwIndex);    if (!(pci = SwitchToProcHandle(&cstk,&hDatabase,HT_DBFILE)))    	SetLastError(ERROR_INVALID_HANDLE);	else {		__try {			oid = (*(CEOID (*)(HANDLE,DWORD,DWORD,LPDWORD))(pci->ppfnMethods[2]))(hDatabase,dwSeekType,dwValue,lpdwIndex);		} __except (EXCEPTION_EXECUTE_HANDLER) {		    SetLastError(ERROR_INVALID_PARAMETER);		}		SwitchBack();	}	return oid;}CEOID SC_ReadRecordPropsEx (HANDLE hDbase, DWORD dwFlags, LPWORD lpcPropID, CEPROPID *rgPropID, LPBYTE *lplpBuffer, LPDWORD lpcbBuffer, HANDLE hHeap) {	CALLSTACK cstk;	CEOID oid = 0;    const CINFO *pci;    MapArgPtr(lpcPropID);    MapArgPtr(rgPropID);    MapArgPtr(lplpBuffer);    MapArgPtr(lpcbBuffer);    if (!(pci = SwitchToProcHandle(&cstk,&hDbase,HT_DBFILE)))    	SetLastError(ERROR_INVALID_HANDLE);	else {		__try {			oid = (*(CEOID (*)(HANDLE,DWORD,LPWORD,CEPROPID *,LPBYTE *,LPDWORD,HANDLE))(pci->ppfnMethods[

⌨️ 快捷键说明

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