diff --git a/HookMsg/Spy.cpp b/HookMsg/Spy.cpp new file mode 100644 index 0000000..2cfe2a4 --- /dev/null +++ b/HookMsg/Spy.cpp @@ -0,0 +1,161 @@ +// Spy.cpp + +#include "stdafx.h" +#include "Spy.h" + +HLSTOCKWINDOWDATA g_HLStockWindowData = {0,}; +COPYDATASTRUCT g_HLStockWindowData_CDS = { 0, sizeof(HLSTOCKWINDOWDATA), &g_HLStockWindowData }; + +APPENV g_AppEnv = { + 10000, // ÇöÀç°¡ Ç×½Ãüũ ÁÖ±â. + 1, // Ç¥Áؽ𣠸ÂÃß±â. + "0311", // ÀÚµ¿Àüȯ È­¸é¹øÈ£. (0311:¸Åµµ) + 1, // ¸Å¼öÀÜ·® Àü·®Ãë¼Ò. + 0, + 1, // Using sound effect. + 500, // 7121 Click Delay. + 1, // 7121 ÀÚµ¿ Ŭ¸¯±â´É. + 1, // 7121 Ŭ¸¯ ÈÄ ÀÚµ¿Àá±è±â´É. + 2000, // 7121 Ŭ¸¯(Àá±èÈÄ µ¿ÀÛÁ¦Çѽð£). + 300, // ÇöÀç°¡ ¿äûÈÄ ÀÀ´äÁ¦Çѽð£. (Á¦Çѽð£Ãʰú½Ã ¸Å¼ö¾ÊÇÔ.) + {0,0}, // Lock Unlock Hot key + {0,0}, // Àá±Ý»óÅ NewsPlus Á¾¸ñÄÚµå ÇÖŰ. + 1, // °ø½Ã ¸Å¼ö·¹º§(ÀϹÝ). + 2, // °ø½Ã ¸Å¼ö·¹º§(Ưº°). + 3, // ´º½ºÇ÷¯½º ¸Å¼ö·¹º§(ÀϹÝ). + 4, // ´º½ºÇ÷¯½º ¸Å¼ö·¹º§(Ưº°). + 100, // °ø½Ã °Å·¡±Ý¾×(ÀϹÝ). + 200, // °ø½Ã °Å·¡±Ý¾×(Ưº°). + 300, // ´º½ºÇ÷¯½º °Å·¡±Ý¾×(ÀϹÝ). + 400, // ´º½ºÇ÷¯½º °Å·¡±Ý¾×(Ưº°). + 1, // ÇÏÇѰ¡À϶§ Á¤º¸Ã¢ º¸À̱â. + 1, // Á¾¸ñÄÚµå ÀÔ·ÂÈÄ ÀÚµ¿Àá±Ý(Áߺ¹/¼öÁ¾Á¾¸ñ½Ã). + 0, // Á¾¸ñÄÚµå ÀÔ·ÂÈÄ ÀÚµ¿Àá±Ý(¸Å¼öÈÄ). + 1, // °Å·¡·® üũ. + 1, // °Å·¡±Ý¾× üũ. + 10000, // °Å·¡·®. + 20000, // °Å·¡±Ý¾×. + 0, // ¸Å¼ö ¸ÅÅ©·Î»ç¿ë 1. + {0,0}, // ¸Å¼ö ÇÖŰ1. + 0, // ¸Å¼ö ¸ÅÅ©·Î»ç¿ë 2. + {0,0}, // ¸Å¼ö ÇÖŰ2. + 0, // ¸Å¼ö ¸ÅÅ©·Î»ç¿ë 3. + {0,0}, // ¸Å¼ö ÇÖŰ3. + 0, // ¸Å¼ö ¸ÅÅ©·Î»ç¿ë 4. + {0,0}, // ¸Å¼ö ÇÖŰ4. +}; + +APPENV_DEBUG g_AppEnv_Debug = { + 0, // Trace Àü¿ë.(Ç¥Ãâ½Ã°£ ÃøÁ¤À» À§ÇØ) +}; + +WINDOWPLACEMENT gwndpl; +HMODULE g_hUserDll = NULL; + +CCondition g_Condition; // Á¶°Ç ó¸®. +CConfigINI g_ConfigINI; // config.ini +CStockData * g_pStockData=NULL; // ÁÖ½ÄÁ¾¸ñ µ¥ÀÌÅÍ. +CFile * g_pLogFile=NULL; + + +//////////////////////////////////////////////////////////////// +// 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 ); +} +