MCPcopy Create free account
hub / github.com/ConEmu/ConEmu / apiWriteConsoleW

Function apiWriteConsoleW

src/ConEmuHk/ExtConsole.cpp:888–928  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

886#endif
887
888BOOL WINAPI apiWriteConsoleW(HANDLE hConsoleOutput, const VOID *lpBuffer, DWORD nNumberOfCharsToWrite, LPDWORD lpNumberOfCharsWritten, LPVOID lpReserved, WriteConsoleW_t lpfn = NULL)
889{
890 BOOL lbRc = FALSE;
891
892 // Don't use static var, it may be changed in runtime
893 WriteConsoleW_t fnWriteConsoleW = lpfn;
894
895 if (!fnWriteConsoleW)
896 {
897 _ASSERTE(FALSE && "Is not supposed to be used out of ConEmuHk itself, therefore lpfn must be passed into");
898 {
899 HMODULE hHooks = GetModuleHandle(ConEmuHk_DLL_3264);
900 if (hHooks && (hHooks != ghOurModule))
901 {
902 typedef FARPROC (WINAPI* GetWriteConsoleW_t)();
903 GetWriteConsoleW_t getf = (GetWriteConsoleW_t)GetProcAddress(hHooks, "GetWriteConsoleW");
904 if (!getf)
905 {
906 _ASSERTE(getf!=NULL);
907 return FALSE;
908 }
909
910 fnWriteConsoleW = (WriteConsoleW_t)getf();
911 if (!fnWriteConsoleW)
912 {
913 _ASSERTE(fnWriteConsoleW!=NULL);
914 return FALSE;
915 }
916 }
917
918 if (!fnWriteConsoleW)
919 {
920 fnWriteConsoleW = WriteConsoleW;
921 }
922 }
923 }
924
925 lbRc = fnWriteConsoleW(hConsoleOutput, lpBuffer, nNumberOfCharsToWrite, lpNumberOfCharsWritten, lpReserved);
926
927 return lbRc;
928}
929
930
931static BOOL IntWriteText(HANDLE h, SHORT x, SHORT ForceDumpX,

Callers 1

IntWriteTextFunction · 0.85

Calls 1

GetProcAddressFunction · 0.85

Tested by

no test coverage detected