Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Software Development
Tag Cloud
access acer asus bios bsod computer crash desktop dns driver drivers error ethernet excel freeze gaming graphics hard drive hardware hdmi internet laptop malware memory monitor motherboard network printer problem ram registry repair router slow software sound trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
call exe with vc++

Reply  
Thread Tools
ankur3020's Avatar
Computer Specs
Junior Member with 21 posts.
 
Join Date: Oct 2008
Experience: Beginner
15-Nov-2009, 05:34 AM #1
Smile call exe with vc++
Can some one tell me syntax to call myexe placed in system32 folder without mentioned drive letter in path of syntax.

something like "%systemroot%/system32...." exact way i do not know.
IMM's Avatar
IMM IMM is offline IMM is authorized to help remove malware.
Malware Removal Specialist with 3,260 posts.
 
Join Date: Feb 2002
15-Nov-2009, 07:47 PM #2
If I correctly understand what you are asking (and you have included windows.h)-- I think you should probably use GetSystemDirectory()
http://msdn.microsoft.com/en-us/libr...73(VS.85).aspx
You could also use CSIDL_SYSTEM with SHGetFolderPath()
http://msdn.microsoft.com/en-us/libr...81(VS.85).aspx
but for the system folder - I think it just calls GetSystemDirectory anyway

There are other ways to skin this cat tho'

Are you using one of the _exec functions to load and execute the new process? (or _spawn? -- or system()? )
In the largest number of cases the system32 folder will be in the path anyway and the exe will be found w/o a path.

Last edited by IMM; 15-Nov-2009 at 07:56 PM..
ankur3020's Avatar
Computer Specs
Junior Member with 21 posts.
 
Join Date: Oct 2008
Experience: Beginner
16-Nov-2009, 10:25 AM #3
i used following syntax and it is not calling my exe. please check whether it is correct or not, if not please correct it. Also i have not added windows.h

ShellExecute(NULL, NULL, _T("\%systemroot%\%\\system32\\me.exe"), NULL, NULL, SW_SHOW)

in case above syntax is correct should adding of windows.h will make it work.?

pls guide.
mt2002's Avatar
Computer Specs
Senior Member with 926 posts.
 
Join Date: Sep 2005
Location: 127.0.0.1
Experience: Advanced
19-Nov-2009, 08:34 PM #4
Quote:
Originally Posted by ankur3020
in case above syntax is correct should adding of windows.h will make it work.?
Ugh. How much experience do you have in C? You should know the answer to this question already.

Check the return value of the function - with this page. This will give you a hint of both the issue and where to begin looking to resolve it.
ankur3020's Avatar
Computer Specs
Junior Member with 21 posts.
 
Join Date: Oct 2008
Experience: Beginner
20-Nov-2009, 08:28 AM #5
i m beginner. can u please tell me the right line to be added in stead of mine wrong line.
mt2002's Avatar
Computer Specs
Senior Member with 926 posts.
 
Join Date: Sep 2005
Location: 127.0.0.1
Experience: Advanced
20-Nov-2009, 09:42 PM #6
I cant answer what is wrong without knowing what error it is returning.

Also, it is recommend to have good experience in C prior to going into the Win32 API.
ankur3020's Avatar
Computer Specs
Junior Member with 21 posts.
 
Join Date: Oct 2008
Experience: Beginner
21-Nov-2009, 11:02 AM #7
i resolved . thanks for guidance.
ankur3020's Avatar
Computer Specs
Junior Member with 21 posts.
 
Join Date: Oct 2008
Experience: Beginner
22-Nov-2009, 04:26 AM #8
one more query..

i used following and it is working..

ShellExecute(NULL, TEXT("open"), TEXT("me.exe"), NULL, TEXT("system32"), SW_SHOW);

but if i use following it does not

ShellExecute(NULL, TEXT("open"), TEXT("me.exe"), NULL, TEXT("system32\\drivers"), SW_SHOW);

can u guide on this? in second case i placed my exe in drivers folder.
IMM's Avatar
IMM IMM is offline IMM is authorized to help remove malware.
Malware Removal Specialist with 3,260 posts.
 
Join Date: Feb 2002
22-Nov-2009, 07:22 AM #9
I can't see the error messages but it is likely on vista that you (the program) don't have the privileges to run from this folder.
ankur3020's Avatar
Computer Specs
Junior Member with 21 posts.
 
Join Date: Oct 2008
Experience: Beginner
23-Nov-2009, 09:27 AM #10
I am using xp sp3, and vs 2008.

I am not getting any error while building exe neither running exe , but the problem is that this exe not calling me.exe placed in drivers folder.
mt2002's Avatar
Computer Specs
Senior Member with 926 posts.
 
Join Date: Sep 2005
Location: 127.0.0.1
Experience: Advanced
27-Nov-2009, 01:44 PM #11
Quote:
Originally Posted by mt2002 View Post
I cant answer what is wrong without knowing what error it is returning.
Trust me, it helps
Reply

Tags
call, exe

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 09:00 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.