本文整理汇总了C++中ORIGINAL_KRNL函数的典型用法代码示例。如果您正苦于以下问题:C++ ORIGINAL_KRNL函数的具体用法?C++ ORIGINAL_KRNL怎么用?C++ ORIGINAL_KRNL使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ORIGINAL_KRNL函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnExitProcess
// May be called from "C" programs
VOID WINAPI OnExitProcess(UINT uExitCode)
{
//typedef BOOL (WINAPI* OnExitProcess_t)(UINT uExitCode);
ORIGINAL_KRNL(ExitProcess);
#if 0
if (gbIsLessProcess)
{
_ASSERTE(FALSE && "Continue to ExitProcess");
}
#endif
gnDllState |= ds_OnExitProcess;
#ifdef PRINT_ON_EXITPROCESS_CALLS
wchar_t szInfo[80]; _wsprintf(szInfo, SKIPCOUNT(szInfo) L"\n\x1B[1;31;40m::ExitProcess(%u) called\x1B[m\n", uExitCode);
WriteProcessed(szInfo, lstrlen(szInfo), NULL);
#endif
// And terminate our threads
DoDllStop(false, ds_OnExitProcess);
bool bUseForceTerminate;
// Issue 1865: Due to possible dead locks in LdrpAcquireLoaderLock() call TerminateProcess
bUseForceTerminate = gbHookServerForcedTermination;
#ifdef USE_GH_272_WORKAROUND
// gh#272: For unknown yet reason existance of nvd3d9wrap.dll (or nvd3d9wrapx.dll on 64-bit)
// caused stack overflow with following calls
//
// nvd3d9wrap!GetNVDisplayW+0x174f
// nvd3d9wrap!GetNVDisplayW+0x174f
// user32!_UserClientDllInitialize+0x2ca
// ntdll!LdrpCallInitRoutine+0x14
// ntdll!LdrShutdownProcess+0x1aa
// ntdll!RtlExitUserProcess+0x74
// kernel32!ExitProcessStub+0x12
// CallExit!main+0x47
if (!bUseForceTerminate && GetModuleHandle(WIN3264TEST(L"nvd3d9wrap.dll",L"nvd3d9wrapx.dll")))
{
bUseForceTerminate = true;
}
#endif // USE_GH_272_WORKAROUND
if (bUseForceTerminate)
{
ORIGINAL_KRNL(TerminateProcess);
F(TerminateProcess)(GetCurrentProcess(), uExitCode);
return; // Assume not to get here
}
F(ExitProcess)(uExitCode);
}
示例2: OnCreateConsoleScreenBuffer
HANDLE WINAPI OnCreateConsoleScreenBuffer(DWORD dwDesiredAccess, DWORD dwShareMode, const SECURITY_ATTRIBUTES *lpSecurityAttributes, DWORD dwFlags, LPVOID lpScreenBufferData)
{
//typedef HANDLE(WINAPI* OnCreateConsoleScreenBuffer_t)(DWORD dwDesiredAccess, DWORD dwShareMode, const SECURITY_ATTRIBUTES *lpSecurityAttributes, DWORD dwFlags, LPVOID lpScreenBufferData);
ORIGINAL_KRNL(CreateConsoleScreenBuffer);
#ifdef SHOWCREATEBUFFERINFO
wchar_t szDebugInfo[255];
msprintf(szDebugInfo, countof(szDebugInfo), L"CreateConsoleScreenBuffer(0x%X,0x%X,0x%X,0x%X,0x%X)",
dwDesiredAccess, dwShareMode, (DWORD)(DWORD_PTR)lpSecurityAttributes, dwFlags, (DWORD)(DWORD_PTR)lpScreenBufferData);
#endif
if ((dwShareMode & (FILE_SHARE_READ|FILE_SHARE_WRITE)) != (FILE_SHARE_READ|FILE_SHARE_WRITE))
dwShareMode |= (FILE_SHARE_READ|FILE_SHARE_WRITE);
if ((dwDesiredAccess & (GENERIC_READ|GENERIC_WRITE)) != (GENERIC_READ|GENERIC_WRITE))
dwDesiredAccess |= (GENERIC_READ|GENERIC_WRITE);
if (!ghStdOutHandle)
ghStdOutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
HANDLE h = INVALID_HANDLE_VALUE;
if (F(CreateConsoleScreenBuffer))
h = F(CreateConsoleScreenBuffer)(dwDesiredAccess, dwShareMode, lpSecurityAttributes, dwFlags, lpScreenBufferData);
#ifdef SHOWCREATEBUFFERINFO
msprintf(szDebugInfo+lstrlen(szDebugInfo), 32, L"=0x%X", (DWORD)(DWORD_PTR)h);
GuiMessageBox(ghConEmuWnd, szDebugInfo, L"ConEmuHk", MB_SETFOREGROUND|MB_SYSTEMMODAL);
#endif
return h;
}
示例3: OnGetConsoleWindow
HWND WINAPI OnGetConsoleWindow(void)
{
//typedef HWND (WINAPI* OnGetConsoleWindow_t)(void);
ORIGINAL_KRNL(GetConsoleWindow);
_ASSERTE(F(GetConsoleWindow) != GetRealConsoleWindow);
// && F(GetConsoleWindow) != GetConsoleWindow - for minhook generation
if (ghConEmuWndDC && IsWindow(ghConEmuWndDC) /*ghConsoleHwnd*/)
{
if (ghAttachGuiClient)
{
// В GUI режиме (notepad, putty) отдавать реальный результат GetRealConsoleWindow()
// в этом режиме не нужно отдавать ни ghConEmuWndDC, ни серверную консоль
HWND hReal = GetRealConsoleWindow();
return hReal;
}
else
{
//return ghConsoleHwnd;
return ghConEmuWndDC;
}
}
HWND h;
h = F(GetConsoleWindow)();
return h;
}
示例4: OnFreeConsole
BOOL WINAPI OnFreeConsole(void)
{
//typedef BOOL (WINAPI* OnFreeConsole_t)(void);
ORIGINAL_KRNL(FreeConsole);
BOOL lbRc = FALSE;
if (ph && ph->PreCallBack)
{
SETARGS(&lbRc);
if (!ph->PreCallBack(&args))
return lbRc;
}
//ReleaseConsoleInputSemaphore();
lbRc = F(FreeConsole)();
if (ph && ph->PostCallBack)
{
SETARGS(&lbRc);
ph->PostCallBack(&args);
}
return lbRc;
}
示例5: OnWriteFile
BOOL WINAPI OnWriteFile(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped)
{
//typedef BOOL (WINAPI* OnWriteFile_t)(HANDLE hFile, LPCVOID lpBuffer, DWORD nNumberOfBytesToWrite, LPDWORD lpNumberOfBytesWritten, LPOVERLAPPED lpOverlapped);
ORIGINAL_KRNL(WriteFile);
BOOL lbRc = FALSE;
CEAnsi* pObj = NULL;
if (lpBuffer && nNumberOfBytesToWrite && hFile)
{
bool bConOut = false;
if (HandleKeeper::IsAnsiCapable(hFile, &bConOut) && ((pObj = CEAnsi::Object()) != NULL))
{
lbRc = pObj->OurWriteConsoleA(hFile, (LPCSTR)lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten);
goto wrap;
}
else if (bConOut && CEAnsi::ghAnsiLogFile)
{
CEAnsi::WriteAnsiLogA((LPCSTR)lpBuffer, nNumberOfBytesToWrite);
}
}
lbRc = F(WriteFile)(hFile, lpBuffer, nNumberOfBytesToWrite, lpNumberOfBytesWritten, lpOverlapped);
wrap:
return lbRc;
}
示例6: OnCreateNamedPipeW
HANDLE WINAPI OnCreateNamedPipeW(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances,DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes)
{
//typedef HANDLE(WINAPI* OnCreateNamedPipeW_t)(LPCWSTR lpName, DWORD dwOpenMode, DWORD dwPipeMode, DWORD nMaxInstances,DWORD nOutBufferSize, DWORD nInBufferSize, DWORD nDefaultTimeOut,LPSECURITY_ATTRIBUTES lpSecurityAttributes);
ORIGINAL_KRNL(CreateNamedPipeW);
#ifdef _DEBUG
if (!lpName || !*lpName)
{
_ASSERTE(lpName && *lpName);
}
else
{
int nLen = lstrlen(lpName)+64;
wchar_t* psz = (wchar_t*)malloc(nLen*sizeof(*psz));
if (psz)
{
msprintf(psz, nLen, L"CreateNamedPipeW(%s)\n", lpName);
DebugString(psz);
free(psz);
}
}
#endif
HANDLE hPipe = F(CreateNamedPipeW)(lpName, dwOpenMode, dwPipeMode, nMaxInstances, nOutBufferSize, nInBufferSize, nDefaultTimeOut, lpSecurityAttributes);
return hPipe;
} // OnCreateNamedPipeW
示例7: OnSetConsoleActiveScreenBuffer
BOOL WINAPI OnSetConsoleActiveScreenBuffer(HANDLE hConsoleOutput)
{
//typedef BOOL (WINAPI* OnSetConsoleActiveScreenBuffer_t)(HANDLE hConsoleOutput);
ORIGINAL_KRNL(SetConsoleActiveScreenBuffer);
if (!ghStdOutHandle)
ghStdOutHandle = GetStdHandle(STD_OUTPUT_HANDLE);
#ifdef _DEBUG
HANDLE hOut = GetStdHandle(STD_OUTPUT_HANDLE);
HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE);
HANDLE hErr = GetStdHandle(STD_ERROR_HANDLE);
#endif
BOOL lbRc = FALSE;
if (F(SetConsoleActiveScreenBuffer))
lbRc = F(SetConsoleActiveScreenBuffer)(hConsoleOutput);
if (lbRc && (ghCurrentOutBuffer || (hConsoleOutput != ghStdOutHandle)))
{
#ifdef SHOWCREATEBUFFERINFO
CONSOLE_SCREEN_BUFFER_INFO lsbi = {};
BOOL lbTest = GetConsoleScreenBufferInfo(hConsoleOutput, &lsbi);
DWORD nErrCode = GetLastError();
_ASSERTE(lbTest && lsbi.dwSize.Y && "GetConsoleScreenBufferInfo(hConsoleOutput) failed");
#endif
ghCurrentOutBuffer = hConsoleOutput;
RequestLocalServerParm Parm = {(DWORD)sizeof(Parm), slsf_SetOutHandle, &ghCurrentOutBuffer};
RequestLocalServer(&Parm);
}
return lbRc;
}
示例8: OnTerminateThread
BOOL WINAPI OnTerminateThread(HANDLE hThread, DWORD dwExitCode)
{
//typedef BOOL (WINAPI* OnTerminateThread_t)(HANDLE hThread, UINT dwExitCode);
ORIGINAL_KRNL(TerminateThread);
BOOL lbRc;
#if 0
if (gbIsLessProcess)
{
_ASSERTE(FALSE && "Continue to terminate thread");
}
#endif
if (hThread == GetCurrentThread())
{
// And terminate our service threads
gnDllState |= ds_OnTerminateThread;
// Main thread is abnormally terminating?
if (GetCurrentThreadId() == gnHookMainThreadId)
{
DoDllStop(false, ds_OnTerminateThread);
}
}
lbRc = F(TerminateThread)(hThread, dwExitCode);
return lbRc;
}
示例9: OnSetConsoleMode
BOOL WINAPI OnSetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
{
//typedef BOOL (WINAPI* OnSetConsoleMode_t)(HANDLE hConsoleHandle, DWORD dwMode);
ORIGINAL_KRNL(SetConsoleMode);
BOOL lbRc = FALSE;
#if 0
if (!(dwMode & ENABLE_PROCESSED_OUTPUT))
{
_ASSERTEX((dwMode & ENABLE_PROCESSED_OUTPUT)==ENABLE_PROCESSED_OUTPUT);
}
#endif
if (gbIsVimProcess)
{
if ((dwMode & (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT)) != (ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT))
{
if (CEAnsi::IsOutputHandle(hConsoleHandle))
{
dwMode |= ENABLE_WRAP_AT_EOL_OUTPUT|ENABLE_PROCESSED_OUTPUT;
}
else
{
dwMode |= ENABLE_WINDOW_INPUT;
}
}
}
lbRc = F(SetConsoleMode)(hConsoleHandle, dwMode);
return lbRc;
}
示例10: OnWriteConsoleInputA
BOOL WINAPI OnWriteConsoleInputA(HANDLE hConsoleInput, const INPUT_RECORD *lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten)
{
//typedef BOOL (WINAPI* OnWriteConsoleInputA_t)(HANDLE hConsoleInput, const INPUT_RECORD *lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsWritten);
ORIGINAL_KRNL(WriteConsoleInputA);
BOOL lbRc = FALSE;
#ifdef _DEBUG
PreWriteConsoleInput(FALSE, lpBuffer, nLength);
#endif
if (ph && ph->PreCallBack)
{
SETARGS4(&lbRc,hConsoleInput,lpBuffer,nLength,lpNumberOfEventsWritten);
// Если функция возвращает FALSE - реальная запись не будет вызвана
if (!ph->PreCallBack(&args))
return lbRc;
}
lbRc = F(WriteConsoleInputA)(hConsoleInput, lpBuffer, nLength, lpNumberOfEventsWritten);
if (ph && ph->PostCallBack)
{
SETARGS4(&lbRc,hConsoleInput,lpBuffer,nLength,lpNumberOfEventsWritten);
ph->PostCallBack(&args);
}
return lbRc;
}
示例11: OnGetNumberOfConsoleInputEvents
BOOL WINAPI OnGetNumberOfConsoleInputEvents(HANDLE hConsoleInput, LPDWORD lpcNumberOfEvents)
{
//typedef BOOL (WINAPI* OnGetNumberOfConsoleInputEvents_t)(HANDLE hConsoleInput, LPDWORD lpcNumberOfEvents);
SUPPRESSORIGINALSHOWCALL;
ORIGINAL_KRNL(GetNumberOfConsoleInputEvents);
BOOL lbRc = FALSE;
//if (gpFarInfo && bMainThread)
// TouchReadPeekConsoleInputs();
if (ph && ph->PreCallBack)
{
SETARGS2(&lbRc,hConsoleInput,lpcNumberOfEvents);
// Если функция возвращает FALSE - реальное чтение не будет вызвано
if (!ph->PreCallBack(&args))
return lbRc;
}
lbRc = F(GetNumberOfConsoleInputEvents)(hConsoleInput, lpcNumberOfEvents);
// Hiew fails pasting from clipboard on high speed
if (gbIsHiewProcess && lpcNumberOfEvents && (*lpcNumberOfEvents > 1))
{
*lpcNumberOfEvents = 1;
}
if (ph && ph->PostCallBack)
{
SETARGS2(&lbRc,hConsoleInput,lpcNumberOfEvents);
ph->PostCallBack(&args);
}
return lbRc;
}
示例12: OnReadConsoleInputA
BOOL WINAPI OnReadConsoleInputA(HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead)
{
//typedef BOOL (WINAPI* OnReadConsoleInputA_t)(HANDLE hConsoleInput, PINPUT_RECORD lpBuffer, DWORD nLength, LPDWORD lpNumberOfEventsRead);
SUPPRESSORIGINALSHOWCALL;
ORIGINAL_KRNL(ReadConsoleInputA);
//if (gpFarInfo && bMainThread)
// TouchReadPeekConsoleInputs(0);
BOOL lbRc = FALSE;
#if defined(_DEBUG)
#if 1
UINT nCp = GetConsoleCP();
UINT nOutCp = GetConsoleOutputCP();
UINT nOemCp = GetOEMCP();
UINT nAnsiCp = GetACP();
#endif
#endif
// To minimize startup duration and possible problems
// hook server will start on first 'user interaction'
CheckHookServer();
if (ph && ph->PreCallBack)
{
SETARGS4(&lbRc,hConsoleInput,lpBuffer,nLength,lpNumberOfEventsRead);
// Если функция возвращает FALSE - реальное чтение не будет вызвано
if (!ph->PreCallBack(&args))
return lbRc;
}
CESERVER_CONSOLE_APP_MAPPING* pAppMap = NULL;
PreReadConsoleInput(hConsoleInput, rcif_Ansi|rcif_LLInput, &pAppMap);
//#ifdef USE_INPUT_SEMAPHORE
//DWORD nSemaphore = ghConInSemaphore ? WaitForSingleObject(ghConInSemaphore, INSEMTIMEOUT_READ) : 1;
//_ASSERTE(nSemaphore<=1);
//#endif
lbRc = F(ReadConsoleInputA)(hConsoleInput, lpBuffer, nLength, lpNumberOfEventsRead);
PostReadConsoleInput(hConsoleInput, rcif_Ansi|rcif_LLInput, pAppMap);
//#ifdef USE_INPUT_SEMAPHORE
//if ((nSemaphore == WAIT_OBJECT_0) && ghConInSemaphore) ReleaseSemaphore(ghConInSemaphore, 1, NULL);
//#endif
if (ph && ph->PostCallBack)
{
SETARGS4(&lbRc,hConsoleInput,lpBuffer,nLength,lpNumberOfEventsRead);
ph->PostCallBack(&args);
}
if (lbRc && lpNumberOfEventsRead && *lpNumberOfEventsRead && lpBuffer)
{
OnPeekReadConsoleInput('R', 'A', hConsoleInput, lpBuffer, *lpNumberOfEventsRead);
}
return lbRc;
}
示例13: OnGetLargestConsoleWindowSize
COORD WINAPI OnGetLargestConsoleWindowSize(HANDLE hConsoleOutput)
{
//typedef COORD (WINAPI* OnGetLargestConsoleWindowSize_t)(HANDLE hConsoleOutput);
ORIGINAL_KRNL(GetLargestConsoleWindowSize);
COORD cr = {80,25}, crLocked = {0,0};
if (ghConEmuWndDC && IsVisibleRectLocked(crLocked))
{
cr = crLocked;
}
else
{
if (F(GetLargestConsoleWindowSize))
{
cr = F(GetLargestConsoleWindowSize)(hConsoleOutput);
}
// Wine BUG
//if (!cr.X || !cr.Y)
if ((cr.X == 80 && cr.Y == 24) && IsWine())
{
cr.X = 255;
cr.Y = 255;
}
}
return cr;
}
示例14: OnTerminateProcess
// For example, mintty is terminated ‘abnormally’. It calls TerminateProcess instead of ExitProcess.
BOOL WINAPI OnTerminateProcess(HANDLE hProcess, UINT uExitCode)
{
//typedef BOOL (WINAPI* OnTerminateProcess_t)(HANDLE hProcess, UINT uExitCode);
ORIGINAL_KRNL(TerminateProcess);
BOOL lbRc;
if (hProcess == GetCurrentProcess())
{
#ifdef PRINT_ON_EXITPROCESS_CALLS
wchar_t szInfo[80]; _wsprintf(szInfo, SKIPCOUNT(szInfo) L"\n\x1B[1;31;40m::TerminateProcess(%u) called\x1B[m\n", uExitCode);
WriteProcessed2(szInfo, lstrlen(szInfo), NULL, wps_Error);
#endif
gnDllState |= ds_OnTerminateProcess;
// We don't need to do proper/full deinitialization,
// because the process is to be terminated abnormally
DoDllStop(false, ds_OnTerminateProcess);
lbRc = F(TerminateProcess)(hProcess, uExitCode);
}
else
{
lbRc = F(TerminateProcess)(hProcess, uExitCode);
}
return lbRc;
}
示例15: OnSetConsoleTextAttribute
// Sets the attributes of characters written to the console screen buffer by
// the WriteFile or WriteConsole function, or echoed by the ReadFile or ReadConsole function.
// This function affects text written after the function call.
BOOL WINAPI OnSetConsoleTextAttribute(HANDLE hConsoleOutput, WORD wAttributes)
{
//typedef BOOL (WINAPI* OnSetConsoleTextAttribute_t)(HANDLE hConsoleOutput, WORD wAttributes);
ORIGINAL_KRNL(SetConsoleTextAttribute);
BOOL lbRc = FALSE;
if (ph && ph->PreCallBack)
{
SETARGS2(&lbRc, hConsoleOutput, wAttributes);
ph->PreCallBack(&args);
}
#ifdef _DEBUG
// We do not care if visible ChildGui is doing smth in their console
// Process here only our native console windows
if ((ghAttachGuiClient == NULL) && !gbAttachGuiClient && (wAttributes != 7))
{
wchar_t szDbgInfo[128];
msprintf(szDbgInfo, countof(szDbgInfo), L"PID=%u, SetConsoleTextAttribute=0x%02X(%u)\n", GetCurrentProcessId(), (int)wAttributes, (int)wAttributes);
DebugString(szDbgInfo);
}
#endif
lbRc = F(SetConsoleTextAttribute)(hConsoleOutput, wAttributes);
if (ph && ph->PostCallBack)
{
SETARGS2(&lbRc, hConsoleOutput, wAttributes);
ph->PostCallBack(&args);
}
return lbRc;
}