•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 391,922 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,704 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser:
Views: 313 | Replies: 8
![]() |
Well. I 'm trying to get a program in C++(MS-DOS) to open another .exe file. I thought there might have been a way with the:
to call it, but somehow it does not work and its like it skips it completely.
I'd appreciate any help. Thankyou.
(Sorry about the title, i meant execute an .exe)
system ("main.exe") ;I'd appreciate any help. Thankyou.
(Sorry about the title, i meant execute an .exe)
Last edited by Dannyo329 : 34 Days Ago at 4:05 am.
•
•
Join Date: Oct 2006
Location: the Netherlands
Posts: 1,570
Reputation:
Rep Power: 8
Solved Threads: 159
your statement should actually work. Perhaps you got the path wrong? You could try something like:
Is it absolutely necessary to open main.exe? I personally don't like the system() command, because if someone would replace the "main.exe" program with a renamed version of "format C: /q" you would be in a hell of a lot of trouble
cpp Syntax (Toggle Plain Text)
system("c:\\mydir\\heres_the_file\\main.exe")
Is it absolutely necessary to open main.exe? I personally don't like the system() command, because if someone would replace the "main.exe" program with a renamed version of "format C: /q" you would be in a hell of a lot of trouble
Last edited by niek_e : 34 Days Ago at 4:21 am.
do NOT pm me for help, it makes me angry. You wouldn't like me when I'm angry...
What he means is that system calls suffer from security issues.
There's nothing to stop a user creating a program called main.cpp which may contain malicious code, then compiling it, and sitting that executable in the same directory as the other executable.
So when his other program calls
In regards to what
There's nothing to stop a user creating a program called main.cpp which may contain malicious code, then compiling it, and sitting that executable in the same directory as the other executable.
So when his other program calls
system("main.exe") it would execute the virus/trojan/whatever.In regards to what
format c: /y does, it should format (wipe) your C:\ drive I believe, although I haven't tested it - obviously. Last edited by iamthwee : 33 Days Ago at 4:30 am.
Member of: F-ugly code club
Join today don't delay!
Join today don't delay!
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,809
Reputation:
Rep Power: 11
Solved Threads: 184
•
•
Join Date: Aug 2005
Location: near St Louis, Missouri, USA
Posts: 10,560
Reputation:
Rep Power: 36
Solved Threads: 860
•
•
•
•
There's nothing to stop a user creating a program called main.cpp which may contain malicious code, then compiling it, and sitting that executable in the same directory as the other executable.
So when his other program callssystem("main.exe")it would execute the virus/trojan/whatever.
In regards to whatformat c: /ydoes, it should format (wipe) your C:\ drive I believe, although I haven't tested it - obviously.
So in that scenerao what is the difference between calling system(), CreateProcess() and ShellExecute() -- they all spawn other processes. system() is no more or less a security risk than any of the others.
I think it's about time we voted for senators with breasts. After all, we've been voting for boobs long enough. ~Clarie Sargent, Arizona senatorial candidate
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
Those who are too smart to engage in politics are punished by being governed by those who are dumber. ~Plato
>So in that scenerao what is the difference between calling system()
There isn't. I never said it was more of a security risk.
I agree with you in the sense that the above quote has a flawed explanation. If you used shellexe createproc (whatever) it would have the same desired affect.
There isn't. I never said it was more of a security risk.
•
•
•
•
I personally don't like the system() command, because if someone would replace the "main.exe"
I agree with you in the sense that the above quote has a flawed explanation. If you used shellexe createproc (whatever) it would have the same desired affect.
Last edited by iamthwee : 32 Days Ago at 8:52 pm. Reason: typoz
Member of: F-ugly code club
Join today don't delay!
Join today don't delay!
•
•
Join Date: Oct 2007
Location: Cherry Hill, NJ
Posts: 1,809
Reputation:
Rep Power: 11
Solved Threads: 184
For the OP, the security danger is in executing less-privileged programs with more-privileged programs. That is, a low-level hax0r can write malicious code and get someone with access rights he doesn't have to execute his program. Doing so gives the executed program all the access rights as the calling program, and the maliciousness is unbounded.
Typically, programs will execute others under [edit]three[/edit] scenarios:
How's that for information overload?
Whew.
Typically, programs will execute others under [edit]three[/edit] scenarios:
- As a user tool.
Programs like Explorer or ObjectDock/Launcher/whatever or Irfanview, WinAmp, etc. need to execute other programs in order to satisfy the user's instructions. Explorer runs the program you double-click. Irfanview uses the QuickTime Player to play .mov files. Etc. - As part of a known software system.
For example, your IDE lets you edit programs: it may use OLE to embed an editor. It calls the compiler and linker and even programs like make to execute scripts that compile and link your program. The fancy GUI program you are using may only display the GUI and interact with the user. It could be actually doing stuff by executing other executables that came with the GUI. Often, the GUI itself is an external program. GIMP, for example, uses GTK, which is provided via a nice DLL sitting in your system32 directory. If you like Linux, your fancy calculators all farm out to bc to do the math. Etc. - As an extension/add-on/plug-in/interpreter to add functionality to a program.
For example, Softimage|XSI uses Perl to allow users to write scripts that do things the program doesn't do itself. Blender uses Python in the same way. (Both are 3D modelling and animation systems.) If you are reading this with Firefox right now, you have probably used some plugins to modify it somewhat. I'm using the Blue Ice 2 theme, and the Hide Menubar, Back/Forward Dropdown Remover, and Download Statusbar plugins. (They're great.) All these were written with some combination of scripting powers: XML, Javascript, VBScript, etc.
Extra care must be taken with this kind of power, because unscrupulous people can easily execute their own evil scripts -- so the interpreter must be executed with less privilege than the calling program.
How's that for information overload?

Whew.
Last edited by Duoas : 32 Days Ago at 10:55 pm.
![]() |
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
•
•
•
•
DaniWeb C++ Marketplace
Similar Threads
- How to make a form in Ms-Access as EXE file? (MS Access and FileMaker Pro)
- Opening .exe (C)
- how to open a exe file using java (Java)
- winupdate.exe problem (Viruses, Spyware and other Nasties)
- How to link an .exe file from a button in VB (Visual Basic 4 / 5 / 6)
- "MiCr0s0ft.exe", "Microsoftx.exe" & "ns.exe" viruses?Please Help (Viruses, Spyware and other Nasties)
- No system restore in Win XP (Windows NT / 2000 / XP / 2003)
- Trouble opening certain files... (Windows 9x / Me)
- Internet Explorer not opening from desktop (Viruses, Spyware and other Nasties)
Other Threads in the C++ Forum
- Previous Thread: trouble using fstream with arrays
- Next Thread: array help



Linear Mode