static void Shutdown (void) { Shutdown_RegExp(); Shutdown_Hash(); Shutdown_Util(); Shutdown_Math(); Shutdown_File(); Shutdown_IO(); Shutdown_Base(); _RPT0(_CRT_WARN, "--- Libraries deinitialized\n"); if (sqvm) sq_close(sqvm); sqvm = NULL; _RPT0(_CRT_WARN, "--- Squirrel deinitialized\n"); #if defined(_MSC_VER) && defined(_DEBUG) // Wait for any key SetConsoleTitle("Squirrel Shell " SHELL_VERSION_STR " (" SHELL_CPUARCH ") - Finished"); while (_kbhit()) _getch(); _getch(); #endif }
// The DLL's main procedure BOOL WINAPI DllMain (HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) { // Find out why we're being called switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: #ifndef _WIN32_WCE #ifdef _MSC_VER _RPT0(_CRT_WARN, "MMShellHook : Hook DLL loaded\n"); #endif #endif // Save the instance handle hInstance = (HINSTANCE)hInst; // ALWAYS return TRUE to avoid breaking unhookable applications!!! return TRUE; case DLL_PROCESS_DETACH: #ifndef _WIN32_WCE #ifdef _MSC_VER _RPT0(_CRT_WARN, "MMShellHook : Hook DLL unloaded\n"); #endif #endif return TRUE; default: return TRUE; } }
void WriteToLog(TCHAR *buffer) { DWORD written; TCHAR timebuffer[128]; GetTickCount(); if (logfile == NULL) return; SetFilePointer(logfile, 0, 0, FILE_END); if (-1 != logop) { wsprintf(timebuffer, _T("%04d %04d.%03d "), (++logop)%10000, (GetTickCount() / 1000) % 10000, GetTickCount() % 1000); #ifdef _UNICODE #ifdef _RPTW0 _RPTW0(_CRT_WARN, timebuffer); _RPTW0(_CRT_WARN, buffer); #endif #else _RPT0(_CRT_WARN, timebuffer); _RPT0(_CRT_WARN, buffer); #endif WriteFile(logfile, timebuffer, lstrlen(timebuffer)*sizeof(TCHAR), &written, NULL); } WriteFile(logfile, buffer, lstrlen(buffer)*sizeof(TCHAR), &written, NULL); // FlushFileBuffers(logfile); }
STDMETHODIMP CAVIStreamRemote::QueryInterface(const IID& iid, void **ppv) { _RPT1(0,"%08lx->CAVIStreamRemote::QueryInterface()\n", this); _RPT3(0,"\tGUID: {%08lx-%04x-%04x-", iid.Data1, iid.Data2, iid.Data3); _RPT4(0,"%02x%02x-%02x%02x", iid.Data4[0], iid.Data4[1], iid.Data4[2], iid.Data4[3]); _RPT4(0,"%02x%02x%02x%02x} (", iid.Data4[4], iid.Data4[5], iid.Data4[6], iid.Data4[7]); if (iid == IID_IUnknown) { *ppv = (IUnknown *)this; _RPT0(0,"IUnknown)\n"); } else if (iid == IID_IClassFactory) { *ppv = (IClassFactory *)&iclassfactory; _RPT0(0,"IClassFactory)\n"); } else if (iid == IID_IAVIStream) { *ppv = (IAVIStream *)this; _RPT0(0,"IAVIStream)\n"); } else { _RPT0(0,"unknown)\n"); *ppv = NULL; return ResultFromScode(E_NOINTERFACE); } AddRef(); return NULL; }
TCPRecievePacket::TCPRecievePacket(SOCKET _s) : s(_s) { isDisconnected = false; int recieved = 0; while (recieved < 4) { int bytesRecv = recv(s, (char*) & dataSize + recieved, 4 - recieved, 0 ); if (bytesRecv == WSAECONNRESET || bytesRecv <= 0) { _RPT0(0, "TCPServer: Could not retrieve packet size!\n"); isDisconnected = true; return ; } recieved += bytesRecv; } if (dataSize <= 0) { _RPT0(0, "TCPServer: Packet size less than 0!"); isDisconnected = true; dataSize = 0; return ; } data = (BYTE*)malloc(dataSize); recieved = 0; while (recieved < dataSize) { int bytesRecv = recv(s, (char*) & data[recieved], dataSize - recieved, 0 ); if (bytesRecv == WSAECONNRESET || bytesRecv <= 0) { _RPT0(0, "TCPServer: Could not retrieve packet data!"); isDisconnected = true; return ; } recieved += bytesRecv; } }
// The DLL's main procedure BOOL WINAPI DllMain (HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) { // Find out why we're being called switch (ul_reason_for_call) { case DLL_PROCESS_ATTACH: #ifdef _MSC_VER _RPT0(_CRT_WARN, "vncHooks : Hook DLL loaded\n"); #endif // Save the instance handle hInstance = (HINSTANCE)hInst; // Call the initialisation function appHookedOK = InitInstance(); // ALWAYS return TRUE to avoid breaking unhookable applications!!! return TRUE; case DLL_PROCESS_DETACH: #ifdef _MSC_VER _RPT0(_CRT_WARN, "vncHooks : Hook DLL unloaded\n"); #endif // Call the exit function // If the app failed to hook OK, ExitInstance will still operate OK (hopefully...) ExitInstance(); return TRUE; default: return TRUE; } }
HRESULT audioSource::FillBuffer(IMediaSample *pMediaSample) { _RPT2(_CRT_WARN,"FillBuffer %d %d\n",currentFrame,nr); long lDataLen = pMediaSample->GetSize();; { CAutoLock cAutoLockShared(&m_cSharedState); if (currentFrame >= nr || times[currentFrame]*10000000 > m_rtStop) { _RPT0(_CRT_WARN,"a stopping\n"); done=1; if (stopGraph) return S_FALSE; else { pMediaSample->SetActualDataLength(0); REFERENCE_TIME rtStart, rtStop; rtStart = times[currentFrame-1]*10000000; rtStop = m_rtStop; pMediaSample->SetTime(&rtStart, &rtStop); _RPT0(_CRT_WARN,"a Sleeping \n"); Sleep(1000); return NOERROR; } } double* dData = (double*)frames[currentFrame]; if (subtype == MEDIASUBTYPE_PCM) { short *pData; pMediaSample->GetPointer((BYTE**)&pData); for (int i=lens[currentFrame]*nrChannels-1;i>=0;i--) pData[i] = min((1<<15)-1,dData[i]*(1<<15)); } else { // FLOAT format float *pData; pMediaSample->GetPointer((BYTE**)&pData); for (int i=lens[currentFrame]*nrChannels-1;i>=0;i--) pData[i] = dData[i]; } REFERENCE_TIME rtStart, rtStop; rtStart = times[currentFrame]*10000000; rtStop = rtStart + lens[currentFrame]/(rate*10000000.0); pMediaSample->SetActualDataLength(lens[currentFrame]*wordSize); _RPT4(_CRT_WARN,"a SetTime %d %d %d %d\n",(int)(rtStart>>32),(int)rtStart,(int)(rtStop>>32),(int)rtStop); pMediaSample->SetTime(&rtStart, &rtStop); currentFrame++; } pMediaSample->SetSyncPoint(TRUE); return NOERROR; }
////////////////////////////////////////////////////////////////////////// // CGLLogger bool cgl::CGLLogger::Print( LPCSTR log, ... ) { #ifdef _DEBUG // only output messages when debugging static CHAR buffer[CGL_LOG_BUFFER]; static SYSTEMTIME time; if (std::string(log).size() == 0) { return true; } if (log == "\n") { ////////////////////////////////////////////////////////////////////////// // post blank line _RPT0(0, "\n"); return true; } ////////////////////////////////////////////////////////////////////////// // get arguments va_list pArgList; if (sizeof(va_list) + sizeof(log) > CGL_LOG_BUFFER) { return false; } va_start (pArgList, log); vsprintf_s(buffer, log, pArgList); va_end (pArgList); ////////////////////////////////////////////////////////////////////////// // build log msg char msg[CGL_LOG_BUFFER]; #ifdef TIME_STAMP GetSystemTime(&time); sprintf_s(msg, "CGL - %02i:%02i:%02i.%03i - %s\n", time.wHour, time.wMinute, time.wSecond, time.wMilliseconds, buffer); #else sprintf_s(msg, "CGL - %s\n", buffer); #endif ////////////////////////////////////////////////////////////////////////// // post message to the output window _RPT0(0, msg); ////////////////////////////////////////////////////////////////////////// // reset static data ZeroMemory(&msg[0], sizeof(CGL_LOG_BUFFER)); ZeroMemory(&time, sizeof(time)); #endif // _DEBUG return true; }
TCPClient::TCPClient(const char* _hostname, int _port, const char* compression, IScriptEnvironment* env) : hostname(_hostname), port(_port) { LPDWORD ThreadId = 0; _RPT0(0, "TCPClient: Creating client object.\n"); client = new TCPClientThread(hostname, port, compression, env); _RPT0(0, "TCPClient: Client object created.\n"); // if(!ClientThread) ClientThread = CreateThread(NULL, 0, (unsigned long (__stdcall *)(void *))StartClient, 0, 0 , ThreadId ); }
TCPServer::~TCPServer() { _RPT0(0, "TCPServer: Killing thread.\n"); DWORD dwExitCode = 0; s->KillThread(); while (s->thread_running) { Sleep(10); } _RPT0(0, "TCPServer: Thread killed.\n"); delete s; }
STDMETHODIMP_(ULONG) CAVIStreamRemote::Release() { _RPT0(0,"CAVIStreamRemote::Release()\n"); if (!--m_refs) delete this; --gRefCnt; _RPT0(0,"CAVIStreamRemote::Release() exit\n"); return m_refs; }
TCPClient::~TCPClient() { DWORD dwExitCode = 0; _RPT0(0, "TCPClient: Killing thread.\n"); client->disconnect = true; client->SendRequest(REQUEST_DISCONNECT, 0, 0); while (client->thread_running) { Sleep(10); } client->CleanUp(); delete client; _RPT0(0, "TCPClient: Thread killed.\n"); }
bool XWnd::CreateWndEx(DWORD dwExStyle, LPCWSTR lpWindowName, DWORD dwStyle, int X, int Y, int nWidth, int nHeight, HWND hWndParent, LPCTSTR menuResourceName) { HINSTANCE hInstance = XWinApp::GetInstance(); if (menuResourceName != NULL) { this->_windowMenu = ::LoadMenu(hInstance, menuResourceName); if (this->_windowMenu == NULL) { _RPT0(_CRT_WARN, _T("Can't load window menu.")); return false; } } if (_class == 0) { WNDCLASSEX wcex = {0}; wcex.cbSize = sizeof(WNDCLASSEX); wcex.style = CS_HREDRAW | CS_VREDRAW; wcex.lpfnWndProc = _wndProc; wcex.hInstance = hInstance; wcex.hIcon = ::LoadIcon(NULL, IDI_APPLICATION); wcex.hCursor = ::LoadCursor(NULL, IDC_ARROW); wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+0); wcex.lpszClassName = _T("XWnd"); _class = RegisterClassEx(&wcex); if (_class == 0) return false; } if (HWND hwnd = ::CreateWindowEx( dwExStyle, _T("XWnd"), lpWindowName, dwStyle, X, Y, nWidth, nHeight, hWndParent, this->_windowMenu, hInstance, this)) { _ASSERT(this->_hwnd == hwnd); return true; } _RPT0(_CRT_WARN, _T("Can't create window.")); return false; }
bool __stdcall TCPClient::GetParity(int n) { ClientRequestParity c; memset(&c, 0, sizeof(ClientRequestParity)); c.n = n; client->SendRequest(CLIENT_SEND_PARITY, &c, sizeof(ClientRequestParity)); client->GetReply(); if (client->reply->last_reply_type != SERVER_SENDING_PARITY) { _RPT0(1, "TCPClient: Did not recieve expected packet (SERVER_SENDING_PARITY)"); return false; } ServerParityReply* p = (ServerParityReply *)client->reply->last_reply; _RPT0(0, "TCPClient: Got parity information.\n"); return !!p->parity; }
LRESULT YUVCodec::DecompressExQuery(ICDECOMPRESSEX *icdex, DWORD cbSize) { BITMAPINFOHEADER *bmihInput = icdex->lpbiSrc; // We only accept YUY2! if (bmihInput->biPlanes != 1) return ICERR_BADFORMAT; if (bmihInput->biBitCount != 16) return ICERR_BADFORMAT; if (bmihInput->biCompression != '2YUY') return ICERR_BADFORMAT; if (icdex->lpbiDst) { BITMAPINFOHEADER *bmihOutput = icdex->lpbiDst; // YUY2 can decompress to RGB16, RGB24, and RGB32. if (bmihOutput->biPlanes != 1) return ICERR_BADFORMAT; if (bmihOutput->biCompression != BI_RGB) return ICERR_BADFORMAT; if (bmihOutput->biBitCount != 16 && bmihOutput->biBitCount != 24 && bmihOutput->biBitCount != 32) return ICERR_BADFORMAT; if (bmihOutput->biWidth != bmihInput->biWidth) return ICERR_BADFORMAT; if (bmihOutput->biHeight != bmihInput->biHeight) return ICERR_BADFORMAT; } _RPT0(0,"--------------Accepted!\n"); return ICERR_OK; }
TCPServer::TCPServer(PClip _child, int port, IScriptEnvironment* env) : GenericVideoFilter(_child) { _RPT0(0, "TCPServer: Opening instance\n"); s = new TCPServerListener(port, child, env); // if(!hThread) hThread=CreateThread(NULL, 10000, (unsigned long (__stdcall *)(void *))startWindow, 0, 0 , &id ); // startWindow(); }
void TCPServerListener::SendVideoInfo(ServerReply* s) { _RPT0(0, "TCPServer: Sending VideoInfo!\n"); s->allocateBuffer(sizeof(VideoInfo)); s->setType(SERVER_VIDEOINFO); memcpy(s->data, &child->GetVideoInfo(), sizeof(VideoInfo)); }
void TCPServerListener::SendPendingData(ClientConnection* cc) { if (!cc->isDataPending) { return ; } int bytes_left = cc->totalPendingBytes - cc->pendingBytesSent; int send_bytes = max(0, min(bytes_left, 64 * 1024)); // int send_bytes = bytes_left; int r = send(cc->s, (const char*)(&cc->pendingData[cc->pendingBytesSent]), send_bytes, 0); if (r == SOCKET_ERROR || r < 0) { _RPT0(0, "TCPServer: Could not send packet (SOCKET_ERROR). Connection closed\n"); closesocket(cc->s); cc->isConnected = false; cc->totalPendingBytes = 0; return; } cc->pendingBytesSent += r; if (cc->pendingBytesSent >= cc->totalPendingBytes) { cc->isDataPending = false; delete[] cc->pendingData; cc->totalPendingBytes = 0; } }
void TCPServerListener::AcceptClient(SOCKET AcceptSocket, ClientConnection* s_list) { ServerReply s; // Find free slot int slot = -1; for (int i = FD_SETSIZE ; i >= 0; i--) if (!s_list[i].isConnected) slot = i; if (slot >= 0 ) { s_list[slot].reset(); s_list[slot].s = AcceptSocket; s_list[slot].isConnected = true; int one = 1; // for 4.3 BSD style setsockopt() const static int sendbufsize = 262144; // Maximum send size const static int rcvbufsize = 1024; // Smaller rcv size setsockopt(AcceptSocket, IPPROTO_TCP, TCP_NODELAY, (PCHAR )&one, sizeof(one)); setsockopt(AcceptSocket, SOL_SOCKET, SO_RCVBUF, (char *) &rcvbufsize, sizeof(rcvbufsize)); setsockopt(AcceptSocket, SOL_SOCKET, SO_SNDBUF, (char *) &sendbufsize, sizeof(sendbufsize)); } else { _RPT0(0, "TCPServer: All slots full.\n"); s.allocateBuffer(0); s.data[0] = REQUEST_NOMORESOCKETS; send(AcceptSocket, (const char*)s.data, s.dataSize, 0); closesocket(AcceptSocket); s.freeBuffer(); } }
/// forming path bool MakeFullPath(LPTSTR lpRetval, DWORD dwSize, LPTSTR lpFile) { /*HRESULT hr = SHGetFolderPath(NULL, CSIDL_PERSONAL, NULL, SHGFP_TYPE_CURRENT, lpRetval); size_t nLen = _tcslen(lpRetval); if (lpRetval[nLen - 1] != TEXT('\\')) { _tcscat(lpRetval, TEXT("\\Sar\\")); } else { _tcscat(lpRetval, TEXT("Sar\\")); } _tcscat(lpRetval, lpFile);*/ // RM TODO: fix path, use folders plugin GetModuleFileName(hInst, lpRetval, dwSize); TCHAR *ptrPos = _tcsrchr(lpRetval, '\\'); if (ptrPos) { ptrPos++; _tcscpy (ptrPos, lpFile); } else { _RPT0(_CRT_WARN, "MakeFullPath - unable to form path"); return false; } return true; }
HRESULT audioSource::DecideBufferSize(IMemAllocator *pAlloc,ALLOCATOR_PROPERTIES *pProperties) { _RPT0(_CRT_WARN,"DecideBufferSize\n"); CAutoLock cAutoLock(m_pFilter->pStateLock()); if (!pAlloc || !pProperties) return E_INVALIDARG; ALLOCATOR_PROPERTIES Request, Actual; if (pProperties->cbAlign <= 0) Request.cbAlign = 1; else Request.cbAlign = pProperties->cbAlign; if (pProperties->cbBuffer < maxlen*wordSize) Request.cbBuffer = maxlen*wordSize; else Request.cbBuffer = pProperties->cbBuffer; if (pProperties->cbPrefix < 0) Request.cbPrefix = 0; else Request.cbPrefix = pProperties->cbPrefix; if (pProperties->cBuffers < 2) Request.cBuffers = 2; else Request.cBuffers = pProperties->cBuffers; HRESULT hr = pAlloc->SetProperties(&Request,&Actual); if (SUCCEEDED(hr)) { hr = pAlloc->Commit(); } return hr; }
static void print(const char* buffer) { shdfnd::printFormatted("%s", buffer); #if defined PX_WINDOWS && !defined PX_WINMODERN if(buffer) { _RPT0(_CRT_WARN, buffer); } #endif }
static inline AVP_dword DATA_PARAM put_wchar_string( Serialize* sz, wchar_t * string ) { AVP_dword total_size; if ( string ) { AVP_dword psize = (AVP_dword)wcslen (string) * sizeof(AVP_wchar); AVP_word wsize = (AVP_word)psize; if ( psize >= USHRT_MAX ) { _RPT0( _CRT_ASSERT, "String is too long" ); return 0; } if ( sizeof(AVP_word) != put_word (sz, &wsize) ) return 0; for ( ; *string; string++ ) { if ( put_word(sz, string) != sizeof(AVP_word) ) return 0; } total_size = sizeof(AVP_word) + psize; } else { AVP_word dummy = USHRT_MAX; if ( sizeof(AVP_word) == put_word(sz,&dummy) ) total_size = sizeof(AVP_word); else total_size = 0; } return total_size; }
AVIStripeIndexEntry *AVIStripeIndexLookup::lookup(long sample) { long l, pivot, r; // _RPT1(0, "AVIStripeIndexEntry: looking up %ld\n", sample); l = 0; r = index_table_size-1; while(l <= r) { pivot = (l+r)/2; if (sample > index_table[pivot]) l = pivot+1; else if (sample < index_table[pivot]) r = pivot-1; else { // _RPT2(0,"\tFound in stripe %ld at %ld\n", index_table[pivot].lStripe+1, index_table[pivot].lStripeSample); return &index_table[pivot]; } } _RPT0(0,"\tNot found!\n"); return NULL; }
bool isRenderer(IBaseFilter* filt) { if (!filt) return false; IEnumPins* pinList; int nrOutput = 0; int nrInput = 0; IPin* pin = NULL; if (FAILED(filt->EnumPins(&pinList))) return false; pinList->Reset(); while (pinList->Next(1, &pin, NULL) == S_OK) { if (getPinInfo(pin).dir == PINDIR_OUTPUT) nrOutput++; else nrInput++; pin->Release(); } pinList->Release(); #ifdef _DEBUG FILTER_INFO info; filt->QueryFilterInfo(&info); char str[100]; WideCharToMultiByte( CP_ACP, 0, info.achName, -1, str, 100, NULL, NULL ); _RPT0(_CRT_WARN,str); _RPT2(_CRT_WARN," %d %d\n", nrOutput, nrInput); #endif return nrOutput == 0 && nrInput == 1; // the only filters that have no outputs are renderers }
AVIOutputFile::~AVIOutputFile() { delete index; delete index_audio; delete index_audio2; delete index_video; delete pSegmentHint; freemem(pHeaderBlock); _RPT0(0,"AVIOutputFile: destructor called\n"); if (hFile) { LONG lHi = (LONG)(i64FarthestWritePoint>>32); DWORD dwError; if (0xFFFFFFFF != SetFilePointer(hFile, (LONG)i64FarthestWritePoint, &lHi, FILE_BEGIN) || (dwError = GetLastError()) != NO_ERROR) { SetEndOfFile(hFile); } } delete fastIO; if (hFile) CloseHandle(hFile); }
BOOL APIENTRY DllMain(HANDLE hModule, ULONG ulReason, LPVOID lpReserved) { switch(ulReason) { case DLL_PROCESS_ATTACH: CoInitialize(NULL); _RPT0(0,"Process attach\n"); break; case DLL_PROCESS_DETACH: CoUninitialize(); _RPT0(0,"Process detach\n"); break; } return TRUE; }
HANDEL_EXPORT void xiaMemCheckpoint(int pass) { switch (pass) { case XIA_BEFORE: _CrtMemCheckpoint(&before); break; case XIA_AFTER: _CrtMemCheckpoint(&after); #pragma warning(disable : 4127) _RPT0(_CRT_WARN, "****Dumping Memory Changes Between Checkpoints****\n"); #pragma warning(default : 4127) #pragma warning(disable : 4127) if (!_CrtMemDifference(&difference, &before, &after)) { #pragma warning(default : 4127) _CrtMemDumpStatistics(&difference); } break; } return; }
/// notify bool notify(void *i_data, size_t i_dataSize) { COPYDATASTRUCT cd; #ifdef MAYU64 DWORD_PTR result; #else // MAYU64 DWORD result; #endif // MAYU64 DWORD len; if (g.m_hMailslot != INVALID_HANDLE_VALUE) { BOOL ret; ret = WriteFile(g.m_hMailslot, i_data, i_dataSize, &len, NULL); #ifndef NDEBUG if (ret == 0) { HOOK_RPT2("MAYU: %S WriteFile to mailslot failed(0x%08x)\r\n", g.m_moduleName, GetLastError()); } else { HOOK_RPT1("MAYU: %S WriteFile to mailslot successed\r\n", g.m_moduleName); } #endif // !NDEBUG } else { cd.dwData = reinterpret_cast<Notify *>(i_data)->m_type; cd.cbData = i_dataSize; cd.lpData = i_data; if (g.m_hwndTaskTray == 0 || cd.dwData == Notify::Type_threadDetach) return false; if (!SendMessageTimeout(reinterpret_cast<HWND>(g.m_hwndTaskTray), WM_COPYDATA, NULL, reinterpret_cast<LPARAM>(&cd), SMTO_ABORTIFHUNG | SMTO_NORMAL, 5000, &result)) { _RPT0(_CRT_WARN, "MAYU: SendMessageTimeout() timeouted\r\n"); return false; } } return true; }
void LogInternal(int nLevel, ULONGLONG elapsed, LPCTSTR pszMessage) { // Add timestamp WCHAR buffer[128]; size_t len = _snwprintf_s(buffer, _TRUNCATE, L"%02llu:%02llu:%02llu.%03llu", elapsed / (1000 * 60 * 60), (elapsed / (1000 * 60)) % 60, (elapsed / 1000) % 60, elapsed % 1000); Rainmeter->AddAboutLogInfo(nLevel, buffer, pszMessage); #ifndef _DEBUG if (!Rainmeter->GetLogging()) return; #endif std::wstring message; switch (nLevel) { case LOG_ERROR: message = L"ERRO"; break; case LOG_WARNING: message = L"WARN"; break; case LOG_NOTICE: message = L"NOTE"; break; case LOG_DEBUG: message = L"DBUG"; break; } message += L" ("; message.append(buffer, len); message += L") "; message += pszMessage; message += L'\n'; #ifdef _DEBUG _RPT0(_CRT_WARN, ConvertToAscii(message.c_str()).c_str()); if (!Rainmeter->GetLogging()) return; #endif const WCHAR* logFile = Rainmeter->GetLogFile().c_str(); if (_waccess(logFile, 0) == -1) { // Disable logging if the file was deleted manually Rainmeter->StopLogging(); } else { FILE* file = _wfopen(logFile, L"a+, ccs=UTF-8"); if (file) { fputws(message.c_str(), file); fclose(file); } } }