// Spy.cpp #include "stdafx.h" #include "Global.h" #include "Resource.h" #include HKEY ghkeySpy = NULL; CHAR gszSpyAppKey[] = "Software\\Yourisoft\\FutureChecker"; CHAR gszKeyPosition[] = "Position"; //LPSTR StripExtension(LPSTR pszFileName); APPENV g_AppEnv = { 1000, // ¼ø¹°Ã¼°á·® Á¦Çѽð£. 5, // ¼ø¹°Ã¼°á·® ¶óÀÎ ¼ö. 0, // ¼ø¹°Ã¼°á·® Â÷À̰è»ê(0), ´Üµ¶ÇÕ»ê(1). 500, // ¼ø¹°Ã¼°á·® »ó½Â ÀνÄ. 500, // ¼ø¹°Ã¼°á·® Ç϶ô ÀνÄ. 1, // ¼ø¹°Ã¼°á·® Àû¿ë¿©ºÎ. "10143", // ¼±¹°Á¾¸ñÄÚµå. 1000, // ¼ø¹°È£°¡ Á¦Çѽð£. 2, // ¼ø¹°È£°¡ È£°¡º¯È­ ´Ü°è. 1, // ¼ø¹°È£°¡ Àû¿ë¿©ºÎ. 0, // Àû¿ë±¸ºÐ ±³ÁýÇÕ(0), ÇÕÁýÇÕ(1). 1000, // Àû¿ë±¸ºÐ ÇÕÁýÇսà Á¦Çѽð£. 1, // ÇÖŰ ½ÇÇàÈÄ Ç®¸²»óÅ °è¼ÓÀ¯Áö. {0,0}, // Àá±Ý/Ç®¸² ÇÖŰ. {0,0}, // »ó½Â Àû¿ë ÇÖŰ. {0,0}, // Ç϶ô Àû¿ë ÇÖŰ. }; WINDOWPLACEMENT gwndpl; HMODULE g_hUserDll = NULL; //CCondition g_Condition; // Á¶°Ç ó¸®. CConfigINI g_ConfigINI; // config.ini CString g_strBankAccount; // °èÁ¹øÈ£. CString g_strBankAccountPermitted; // ÀÎÁõÇã°¡µÈ °èÁ¹øÈ£ ¸®½ºÆ®. //CStockData * g_pStockData; // ÁÖ½ÄÁ¾¸ñ µ¥ÀÌÅÍ. //CFile * g_pLogFile; ICpTdUtilPtr g_objTdUtil; //////////////////////////////////////////////////////////////// // semitransparent Window2000 and WindowsXP only... void CloseSmoothly(HWND hWnd) { // Increase transparency one percent each time... for(int nPercent=100; nPercent >= 0 ;nPercent--) SetTransparent(hWnd, 0, 255 * nPercent/100, LWA_ALPHA); } //////////////////////////////////////////////////////////////// // This function sets the transparency layered window by calling SetLayeredWindowAttributes API function. BOOL SetTransparent(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags) { BOOL bRet = TRUE; typedef BOOL (WINAPI* lpfnSetTransparent)(HWND hWnd, COLORREF crKey, BYTE bAlpha, DWORD dwFlags); // Check that "USER32.dll" library has been loaded successfully... if ( g_hUserDll ) { lpfnSetTransparent pFnSetTransparent = NULL; pFnSetTransparent = (lpfnSetTransparent)GetProcAddress(g_hUserDll, "SetLayeredWindowAttributes"); if (pFnSetTransparent ) bRet = pFnSetTransparent(hWnd, crKey, bAlpha, dwFlags); else bRet = FALSE; } //if( g_hUserDll ) return bRet; } // End of SetTransparent function //////////////////////////////////////////////////////////////// // NT : VER_PLATFORM_WIN32_NT, 95 : VER_PLATFORM_WIN32_WINDOWS DWORD GetOsVersion() { OSVERSIONINFO osversioninfo; osversioninfo.dwOSVersionInfoSize = sizeof(osversioninfo); // Get the current OS version if (!GetVersionEx(&osversioninfo)) return 0; return osversioninfo.dwPlatformId; } //////////////////////////////////////////////////////////////// //»ç¿îµå ¸®¼Ò½º ÆÄÀÏÀ» Ç÷¹ÀÌ ½ÃŲ´Ù ( Plays a WAVE resource ) BOOL PlayResource(WORD wResourceID) { // Get the handle to the current instance of the application HINSTANCE hInstance = AfxGetInstanceHandle(); ASSERT (hInstance != NULL); // Find the WAVE resource HRSRC hResInfo = FindResource(hInstance, MAKEINTRESOURCE(wResourceID), _T("WAVE")); if(hResInfo == NULL) return FALSE; // Load the WAVE resource HANDLE hRes = LoadResource(hInstance, hResInfo); if (hRes == NULL) return FALSE; // Lock the WAVE resource and play it LPSTR lpRes = (LPSTR) LockResource(hRes); if(lpRes==NULL) return FALSE; if (sndPlaySound(lpRes, SND_MEMORY | SND_ASYNC) == NULL) return FALSE; // Free the WAVE resource and return success or failure. FreeResource(hRes); return TRUE; } //////////////////////////////////////////////////////////////// // FormatMessage void Message_Box( PSTR pTitle, DWORD dwError ) { LPVOID lpMsgBuf; FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, NULL, GetLastError(), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), // Default language (LPTSTR) &lpMsgBuf, 0, NULL ); TCHAR szMsg[512] = {0,}; wsprintf( szMsg, "%s\nError code : %d", lpMsgBuf, dwError ); ::MessageBox( NULL, szMsg, pTitle, MB_OK | MB_ICONINFORMATION ); // Free the buffer. LocalFree( lpMsgBuf ); } /*****************************************************************************\ * ReadRegistry * * Opens (creates if necessary) the registry key for spy preferences and then * reads the last saved values. * * Arguments: * none * * Returns: * VOID \*****************************************************************************/ VOID ReadRegistry( VOID ) { DWORD dwType; DWORD cbData; RegCreateKey(HKEY_CURRENT_USER, gszSpyAppKey, &ghkeySpy); cbData = gwndpl.length = sizeof(gwndpl); if (!ghkeySpy || RegQueryValueEx(ghkeySpy, gszKeyPosition, NULL, &dwType, (LPBYTE)&gwndpl, &cbData) != ERROR_SUCCESS) { gwndpl.length = 0; } if (gwndpl.length != sizeof(gwndpl)) { /* gwndpl.length = sizeof(gwndpl); gwndpl.flags = 0; gwndpl.showCmd = SW_SHOWNORMAL; gwndpl.ptMinPosition.x = 0; gwndpl.ptMinPosition.y = 0; gwndpl.ptMaxPosition.x = 0; gwndpl.ptMaxPosition.y = 0; gwndpl.rcNormalPosition.left = 10; gwndpl.rcNormalPosition.top = 10; gwndpl.rcNormalPosition.right = 10 + (GetSystemMetrics(SM_CXSCREEN) / 3); gwndpl.rcNormalPosition.bottom = 10 + (GetSystemMetrics(SM_CYSCREEN) / 3); */ } /* for( int i=0; i< MAX_FIND; i++ ) { cbData = sizeof(HWND); TCHAR szKeyName[100] = {0,}; wsprintf( szKeyName, "HWND_%d", i ); if (!ghkeySpy || RegQueryValueEx(ghkeySpy, szKeyName, NULL, &dwType, (LPBYTE)&g_hFindWindow[i], &cbData) != ERROR_SUCCESS) { g_hFindWindow[i] = NULL; } } */ } /*****************************************************************************\ * WriteRegistry * * Writes out preference data to the registry when the app exits, then * closes the registry key. * * Arguments: * none * * Returns: * VOID \*****************************************************************************/ VOID WriteRegistry( VOID ) { if (ghkeySpy) { WINDOWPLACEMENT wndpl; wndpl.length = sizeof(WINDOWPLACEMENT); ::GetWindowPlacement( AfxGetApp()->GetMainWnd()->m_hWnd, &wndpl); RegSetValueEx(ghkeySpy, gszKeyPosition, 0, REG_BINARY, (LPBYTE)&wndpl, sizeof(wndpl)); /* for( int i=0; i< MAX_FIND; i++ ) { TCHAR szKeyName[100] = {0,}; wsprintf( szKeyName, "HWND_%d", i ); RegSetValueEx(ghkeySpy, szKeyName, 0, REG_DWORD, (LPBYTE)&g_hFindWindow[i], sizeof(DWORD)); } */ // RegSetValueEx(ghkeySpy, gszKeyHWND1, 0, REG_BINARY, // (LPBYTE)g_hFindWindow[0], sizeof(HWND)); // RegSetValueEx(ghkeySpy, gszKeyFileName, 0, REG_SZ, // (LPBYTE)gszFile, (lstrlen(gszFile) + 1) * sizeof(TCHAR)); RegCloseKey(ghkeySpy); } } /*****************************************************************************\ * StripExtension * * Strips the extension off of a filename. * * Arguments: * LPSTR pszFileName - File name to process. * * Returns: * Returns a pointer to the beginning of the filename. The extension * will have been stripped off. * \*****************************************************************************/ /* PRIVATE LPSTR StripExtension( LPSTR pszFileName ) { LPSTR p = pszFileName; while (*p) p++; while (p > pszFileName && *p != '\\' && *p != ':') { p = CharPrev(pszFileName, p); if (*p == '.') { *p = 0; } } if (*p == '\\' || *p == ':') { p++; } return p; } */