how to set Security attributes of a process

Hi
i stuck in a strange problem i have exe file on my system when i double click on that exe file a window opens.But when i try to launch the same .exe file using CreateProcess( ) or ShellExecute() API calls then no window opens but the call does not return an error infact PROCESS_INFORMATION structure that i pass to the CreateProcess( ) call have a Handle to the Process and Handle to the thread.
i Checked the task Manager but there is not exe running of that name. Then i used the spy++ tool that comes with the visual Studio from the tools options and searches for the process handle that i get in PROCESS_INFORMATION structure,but no process have the same handle.
I think it may be due to some security attribute setting of the exe file but don't know how to set or change them can any body help me out.
I need to run the exe file through Code.
thanks,
Gagan
[898 byte] By [gagan] at [2007-12-16]
# 1

"anonymous@discussions.microsoft.com"

<gagan@discussions.microsoft.com>
wrote in

message
news:5bd2913e-707c-4e04-b2b9-8fb69e430fe5_WBRev1_@discussions.microsoft.com
>

i stuck in a strange problem i have exe file on my system when i
> double

click on that exe file a window opens.But when i try to launch
> the same

..exe file using CreateProcess( ) or ShellExecute() API calls
> then no

window opens but the call does not return an error infact
>

PROCESS_INFORMATION structure that i pass to the CreateProcess( )
> call

have a Handle to the Process and Handle to the thread.


Do you, by any chance, create the process from inside a service? Services

normally run on their own desktop, that a logged-on user does not see. Any

process started from a service would also run on that desktop. So the process is

running, you just don't see it.

You can specify an alternative desktop for the process using

STARTUPINFO::lpDesktop field. I'm not sure, however, as to how to obtain the

name of the desktop belonging to the currently logged-on user. Besides, there

may me several users logged on at the same time, each with her own

desktop.
--
With best wishes,
Igor

Tandetnik

MVPUser at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 2
Hi Igor

thanks for your reply, But i don't have any idea about the Services.

I am the only user of the System with full Administrator rights. And i m trying to launch the Exe from a Simple Windows Application.
I put a Menu Option under the Help Menu .On whose click I tried to launch the Exe.
Following is extract from my WndProc( ) Fuction

STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory(&si, sizeof(STARTUPINFO));
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
si.cb = sizeof(STARTUPINFO);
case ID_HELP_RUN: if(CreateProcess("ExeName",NULL,&sa,NULL,FALSE,0,NULL,NULL,&si,&pi))
{
MessageBox(NULL,"Exe Launched","Message",MB_OK);
}
Exe Cannot be launched but I can see the MessageBox.

If u could suggest other solution to my problem. I cannot understand why this is happening that i can launch an exe by double clicking on it but not from CreateProcess( ).

thanks,
Gagan

gagan at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...
# 3
Hi Gagan,

Can you turn on audit tracking for processes and see what entries you get in the event log:

In the Start menu: Administrative tools, Local Security Policy
Select Audit Policy under the Local Policies Node in the left hand tre control and then enable Adit Process Tracking for both success and faillure in the right hand pane.

Ronald Laeremans
Visual C++ team

RonaldLaeremans at 2007-8-21 > top of Msdn Tech,Visual C++,Visual C++ General...