|
ohhh cool...thanx...can you give me a little more detail or give me a link to read...
there are 10 type of people in the world...
01 who understand binary.
10 who don't...
|
|
|
|
|
|
Someone plz tell me the function to get the current location of the program in MFC ?
|
|
|
|
|
|
Thanks alot
|
|
|
|
|
Hi All,
Help me out, it's very urgent.
How to Run UNIX based EXE [MKS] through Shell in VC++ application.
Intermediate Shell should not be seen (It can be hide); target application should rum through SHELL.
And Target Application status should be returned whether target application run or not.
Example:
Intermediate Shell Target Application
SHELL.exe -------------------------' Sample.exe
If any error occurs while running Target Application, return that status to application.
I am doing through _spawnl() API.
Int lnSts =_spawnl(_P_NOWAIT,"SHELL.exe","SHELL.exe","-Lc Target.EXE",NULL);
But in this case if my target application having any problem like Target EXE has Segmentation Error. _spawnl will not return Target Application Fail Error.
Is there any VC++ API, which executes any process through shell and returns its status?
Please help us. Any suggestion most welcome.
Pawan
|
|
|
|
|
Maybe I'm missing something but I'm reading this as "run a Unix executable binary on a Windows machine?" Can't be done by any means.
Judy
|
|
|
|
|
I suppose he's talking about Windows executables [^]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Thanks all for your quick reply.
We have a MKS emulator installed on our Windows XP systems.
We have to develop an application in VC++ that will execute those MKS based exes using shell.
We use sh- Lc command to run these exes manually in shell.
we are currently doing this using _spawnl() API as below:
Int lnSts =_spawnl(_P_NOWAIT,"SHELL.exe","SHELL.exe","-Lc Target.EXE",NULL);
target.exe is the unix based exe.
we want to know the status of target.exe (whether properly executed or not)
_spawnl() is giving return status of target when _P_WAIT mode is on.
In that case, we need to wait till the target exe is completely executed.
And dont want to wait for that in out application. We just want to boot the target and know if that application successfully booted or not.
Is there any API/ method for doing this?
Any help is appreciated.
Thanks again!
|
|
|
|
|
I doubt it. How would you define "booted okay" which I take to mean it started okay and is now doing its thing. Applications either run or don't run (services don't count for this discussion, since you don't start a service this way) and you can't tell if they ran until they are done. There is the WaitForInputIdle function for GUI apps but I don't know enough about how your emulator works to know if it exposes that amount of info about the app it is running to the outside OS.
Judy
|
|
|
|
|
I think you're looking for wait() or waitpid(). Don't know if this exists in the windows world but in general, spawn() with a NOWAIT returns the pid of the spawned process. You use waitpid to wait for the exit status. Using a NOHANG flag with waitpid prevents blocking. Either poll with a waitpid or perhaps kick off another thread that does a wait.
No doubt there is a more windowzee way of doing this.
|
|
|
|
|
Manasi D wrote: How to Run UNIX based EXE [MKS] through Shell in VC++ application.
You mean - you want to run a native unix file under windows? And that's urgent?
That's impossible, my friend.
And who is voting me down on a programming forum for no good reason?!
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
modified on Friday, May 9, 2008 11:42 AM
|
|
|
|
|
bro, please delete your last sentence, which sends oil on fire for nothing. i've counter-voted that post BTW.
|
|
|
|
|
Thanks for the vote Tox.
You take time to come and participate in the discussions and someone votes you low without any valid reason. I know you too would have had this experience. It just is plainly annoying.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Dont' worry (be happy) your score is raising.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
It was me.
[Rude/inflammatory content removed by poster]
modified on Friday, May 9, 2008 12:56 PM
|
|
|
|
|
enhzflep wrote: It was me.
May I please know the reason behind you down-voting my answer?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Certainly, of course it will make me look more of a fool, but such is life...
Um, when I gave that undeserved vote, It was after I had read the second post by Manasi D in this thread. The one where the fact that an emulator was being used was stated.
When I look at the forum this instant, I see that the post you made that I down-voted was made 1 hr 57 mins ago.
The post that clarified that an emulator was used was made 1 hr 38 mins ago.
I did not even think to look at these times when I handed you the 1.
Obviously, your post was made some 19 minutes before the clarification was made.
So again, I accept the label of idiot .
Sorry for the upset I've caused.
Simon.
|
|
|
|
|
enhzflep wrote: When I look at the forum this instant, I see that the post you made that I down-voted was made 1 hr 57 mins ago.
The post that clarified that an emulator was used was made 1 hr 38 mins ago.
That sums it up. Sorry for calling you an idiot and thanks for taking the time to explain.
[Shameless] After the upgradation of CP, You can re-vote on any post, just in case, FYI. [/Shameless]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: Sorry for calling you an idiot and thanks for taking the time to explain. [Smile]
[Shameless] After the upgradation of CP, You can re-vote on any post, just in case, FYI. [Red faced] [/Shameless]
Don't worry about it. I was(am?) an idiot, I just reject spineless .
Post re-voted.(5)
seeya!
|
|
|
|
|
Manasi D wrote: How to Run UNIX based EXE [MKS] through Shell in VC++ application
not sure, but wouldn't having a cygwin help ?
otherwise, i'm not sure at all this can be done...
|
|
|
|
|
Cygwin is just an emulator. The OP wants to run a UNIX binary under a windows machine. Cygwin (or nothing else) can run a native UNIX app on Windows. Talk about doing the impossible.
And that is an urgent query, if you haven't noticed it yet.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Rajesh R Subramanian wrote: Cygwin (or nothing else) can run a native UNIX app on Windows. Talk about doing the impossible.
For the record I am not the guy who voted you down.
But I wanted to say that you are absolutely incorrect. Compilers simply generate machine code and Unix/Linux ELF binaries are nothing more than a file format. The instructions inside are still x86 instructions. I have done many experiments executing simple ELF binaries on Windows as have many others before me. For simple commandline/shell ELF binaries all you need to do is implement some of the missing libc and/or ncurses functions. It certainly becomes more difficult when the complexity of the ELF is increased. For example non-static ELF binaries which are loading many shared objects can be extremely difficult to load in Windows.
At any rate I just wanted to point out that you should never say something is impossible. There are many talented researchers who read this forum who just might do the impossible.
Best Wishes,
-David Delaune
|
|
|
|
|
Randor wrote: The instructions inside are still x86 instructions. I have done many experiments executing simple ELF binaries on Windows as have many others before me. For simple commandline/shell ELF binaries all you need to do is implement some of the missing libc and/or ncurses functions. It certainly becomes more difficult when the complexity of the ELF is increased.
Believe me or not, I hesitated a moment to choose between "impossible" and "next to impossible". Because I've heard this hack, only from an old professor of mine. While you say that you've experimented on similar stuff, I can guess your age and experience. So, my respect for you has gone up by two notches. And thanks for the inputs; that's a lot interesting. I'll probably read up on that in free time.
[ADD]And needless to say, I know that you won't be the one down-voting. [/ADD]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
modified on Friday, May 9, 2008 11:30 AM
|
|
|
|
|
I agree with you i know wine [^]on linux runs native win32 code even directX code. Rajesh knows i won't vote down.
|
|
|
|