Make The Program Run At Startup - need help - C++

Discussion in 'C++' started by Scripting, Feb 16, 2011.

  1. Scripting

    Scripting John Hoder

    Joined:
    Jun 29, 2010
    Messages:
    421
    Likes Received:
    57
    Trophy Points:
    0
    Occupation:
    School for life
    Location:
    /root
    Hey guys, I'm gonna make a joke on the teacher of mine :D. I'm gonna send her an E-mail with a exe file, which has to have ICON of Microsoft power point, and it's function is to mess up the mouse cursor, so she won't be able to use that mouse, and i need that program to add itself to the registry (or somewhere else) to make it run at startup.


    And I have already made Cursor messing up code, but i'm having problems with that adding it to the registry. I need Ur HELP !!!

    BTW. I also don't know how to add an ICON to that program.

    And I Use C++


    Here is the code of mine ( to mess up the mouse cursor):
    Code:
    #include <windows.h>
    #include <ctime>
    
    int rnd(int, int);
    
    int main() {
       srand((unsigned)time(0)); // seed random
       
       /* I have added some explanation for U aneesh :D */
       /* Get the screen resolution */
       int SCR_WIDTH =      GetSystemMetrics(SM_CXSCREEN) - 1; 
       int SCR_HEIGHT =   GetSystemMetrics(SM_CYSCREEN) - 1;
    
       int xspeed, yspeed;
       int x = SCR_WIDTH / 2, y = SCR_HEIGHT /2; // start in middle of screen
    
       for(int g = 0; g < 100; g++) { // do program 100 times and then quit
    
          /*   random x and y speed between -10 and 10 
             minus x will make it go left, plus x right
             minus y up and plus y down */
          xspeed = rnd(-10, 10);
          yspeed = rnd(-10, 10);
    
          for(int i = 0; i < 10; i++) {         
             x += xspeed;
             y += yspeed;         
             SetCursorPos(x, y);
    
             /* Check for hitting the side of screen */
             if(x >= SCR_WIDTH) {
                xspeed = -xspeed; // convert plus to minus or minus to plus
             } else if(x <= 0) {
                xspeed = -xspeed;
             } else if(y >= SCR_HEIGHT) {
                yspeed = -yspeed;
             } else if(y <= 0) {
                yspeed = -yspeed;
             }
    
             Sleep(10);
          }
       }
    
       return 0;
    }
    
    int rnd(int min, int max) {
       return rand() % (max - min) + min;
    }
    
     
    Last edited: Feb 16, 2011
  2. jimblumberg

    jimblumberg New Member

    Joined:
    May 30, 2010
    Messages:
    120
    Likes Received:
    29
    Trophy Points:
    0
    You really don't expect help on Malware do you?

    Jim
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    The help that you need is not for malware. To have anything run at startup you need to make entries in Registry at

    [HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run]
     
    Scripting likes this.
  4. Scripting

    Scripting John Hoder

    Joined:
    Jun 29, 2010
    Messages:
    421
    Likes Received:
    57
    Trophy Points:
    0
    Occupation:
    School for life
    Location:
    /root
    Yeah, I know that I have to make registry entry, but I expected someone will tell me how to :(

    I mean, i want that program to add itself to that registry when I run it (BTW. It's for scientific purposes :) )


    And I have in registry folders - [Run, Run-, RunOnce], so which do I have to choose?
     
    Last edited: Feb 16, 2011
  5. jimblumberg

    jimblumberg New Member

    Joined:
    May 30, 2010
    Messages:
    120
    Likes Received:
    29
    Trophy Points:
    0
     
  6. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
     
    Scripting likes this.
  7. jimblumberg

    jimblumberg New Member

    Joined:
    May 30, 2010
    Messages:
    120
    Likes Received:
    29
    Trophy Points:
    0
    But the fact remains the OP did tell us what his program is to do. And by telling him anything you will helping in the manufacture of malware. Shouldn't you as an administrator of this web site try to prevent this? Shouldn't you be at least closing this thread, if not taking actions against the OP, to send a message that this site does not condone malware of any kind?

    Jim
     
  8. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Scripting likes this.
  9. Scripting

    Scripting John Hoder

    Joined:
    Jun 29, 2010
    Messages:
    421
    Likes Received:
    57
    Trophy Points:
    0
    Occupation:
    School for life
    Location:
    /root
    Thx Shabbir, I regard highly your help, but I know everything about simply regystry, but I need to understand EDITING REGISTRY in C++, E.g Use RegOpenKeyEx(), RegGetValue(), RegSetKeyValue(), RegCloseKey() etc.
     
  10. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Yes those functions can help
     
    Scripting likes this.
  11. Scripting

    Scripting John Hoder

    Joined:
    Jun 29, 2010
    Messages:
    421
    Likes Received:
    57
    Trophy Points:
    0
    Occupation:
    School for life
    Location:
    /root
    Yeah, but i don't understand how to use them :(
     
  12. Scripting

    Scripting John Hoder

    Joined:
    Jun 29, 2010
    Messages:
    421
    Likes Received:
    57
    Trophy Points:
    0
    Occupation:
    School for life
    Location:
    /root
    I would be very delighted if U would suggest me some good site or explain it by yourself ( or anybody else).
     
  13. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,375
    Likes Received:
    388
    Trophy Points:
    83
    Google each of them and you will find samples of how to use them
     
    Scripting likes this.
  14. Scripting

    Scripting John Hoder

    Joined:
    Jun 29, 2010
    Messages:
    421
    Likes Received:
    57
    Trophy Points:
    0
    Occupation:
    School for life
    Location:
    /root
    ok, thx a lot shabbir, i hope i will find something interesting.
     
  15. Scripting

    Scripting John Hoder

    Joined:
    Jun 29, 2010
    Messages:
    421
    Likes Received:
    57
    Trophy Points:
    0
    Occupation:
    School for life
    Location:
    /root
    Damn, I have not found anything good.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice