Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   C++ (http://www.programmingforums.org/forum15.html)
-   -   Weird Problem In Prog (http://www.programmingforums.org/showthread.php?t=1397)

FoZ Dec 3rd, 2004 11:34 AM

:

#include <windows.h>
#include <iostream>
using namespace std;

int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd) {
  SetConsoleTitle("FoZ's IE Modder Version 1");
  int msgbx;
  msgbx=MessageBox(NULL,"I accept no responsibility for any damage that this program\n"
        "causes. There is only a very small chance of anything wrong\n"
        "happening but nothing that would seriously damage your system.\n\n"
        "Click Yes to continue and use the program.\n"
        "Click No to quit the program",
        "Warning!",
        MB_YESNO|MB_ICONWARNING);
  if (msgbx==IDYES) {
  cout << "This program changes the text on the bar after the website title eg;" << endl;
  cout << "Google - Microsoft Internet Explorer" << endl;
  cout << "to..." << endl;
  cout << "Google - H1j4ck3d M1cr0s0f7 1n73rn37 3xpl0r3r" << endl << endl;
  choices:
  cout << "What number would you like to do?" << endl;
  cout << "1) Edit the text" << endl;
  int choice;
  cout << "2) Reset the text back to the original" << endl;
  cin >> choice;
  if (choice==1) {
    char newtext[100];
    cout << "What would you like the new text to say? - ";
    cin.getline(newtext,sizeof(newtext));
    cin.ignore();
    HKEY key;
    RegCreateKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Internet Explorer\\Main\\",&key);
    RegSetValueEx(key,"Window Title",NULL,REG_SZ,(LPBYTE)newtext,sizeof(newtext));
    RegCloseKey(key);
    cout << "Window text now set to " << newtext;
    getchar();
    }
  if (choice==2) {
    HKEY key;
    char IE[30]="Microsoft Internet Explorer";
    RegCreateKey(HKEY_CURRENT_USER,"Software\\Microsoft\\Internet Explorer\\Main\\",&key);
    RegSetValueEx(key,"Window Title",NULL,REG_SZ,(LPBYTE)IE,sizeof(IE));
    RegCloseKey(key);
    cout << "Window text set to original";
    }
  if (choice!=1 & choice!=2) {
    cout << endl << "Incorrect choice! Try again." << endl << endl;
    goto choices;
    }
    }
  if (msgbx==IDNO) {
    exit(0);
    }
return 0;
}

This is what it does when it is run...

Quote:


This program changes the text on the bar after the website title eg;
Google - Microsoft Internet Explorer
to...
Google - H1j4ck3d M1cr0s0f7 1n73rn37 3xpl0r3r

What number would you like to do?
1) Edit the text
2) Reset the text back to the original
1
What would you like the new text to say? - testing testing 123
Window text now set to *CLOSES*

But 2 works fine and resets it so it can't be the setting of it and i can't see what input it would take that wouldn't show up and would cancel out getchar();

Eggbert Dec 4th, 2004 10:48 AM

>RegSetValueEx(key,"Window Title",NULL,REG_SZ,(LPBYTE)newtext,sizeof(newtext));
sizeof is a bad choice here because no matter what text was entered, sizeof(newtext) will be 100. Perhaps strlen would be better, but don't forget to include <cstring>.


All times are GMT -5. The time now is 8:26 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC