473,385 Members | 1,356 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

who created a process?


Is there a way to find out the name
of the user who created a process.
Some kind of process property or method
that would report the user name how launched
it?
(but not Environment.UserName)

Thanks,

--
Strah
Nov 15 '05 #1
6 7844

"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...

Is there a way to find out the name
of the user who created a process.
Some kind of process property or method
that would report the user name how launched
it?
(but not Environment.UserName)


Are you talking about the current process, or
another process?

-c
Nov 15 '05 #2
another process

--
Strah

"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:LW*********************@twister.austin.rr.com ...

"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...

Is there a way to find out the name
of the user who created a process.
Some kind of process property or method
that would report the user name how launched
it?
(but not Environment.UserName)


Are you talking about the current process, or
another process?

-c

Nov 15 '05 #3
Here's an example of how to do it in Delphi. The code
should help you see the steps you need to take to do
the PInvoke calls in C#.
http://tinyurl.com/k1ki [Experts-Exchange.com]

First, you have to get the Process ID somehow.

EnumProcesses in Psapi.dll will return you an array of
Process ID's.

You can then call OpenProcess from Kernel32.dll and
pass in a parameter that tells Win32 you're going to
inspect the Process's user token.

Then you can call OpenProcessToken() to get the process
security token.

From there, you can call GetTokenInformation() to
get the SID owner of the token.

Finally, you can call LookupAccountSid() to get the
name of the user with that SID.

If you need help getting started, let us know, becase
it's too lengthy of a process to post here in one
post.

-c
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl...
another process

--
Strah

"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:LW*********************@twister.austin.rr.com ...

"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...

Is there a way to find out the name
of the user who created a process.
Some kind of process property or method
that would report the user name how launched
it?
(but not Environment.UserName)


Are you talking about the current process, or
another process?

-c


Nov 15 '05 #4
I would definitely appreciate help on this...
seems a bit too mouthful for me...

Some steps though I have already resolved
like ProcessID... I have that resolved,
but the rest of it .... hugh..

Thanks,

--
Strah
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:R8*********************@twister.austin.rr.com ...
Here's an example of how to do it in Delphi. The code
should help you see the steps you need to take to do
the PInvoke calls in C#.
http://tinyurl.com/k1ki [Experts-Exchange.com]

First, you have to get the Process ID somehow.

EnumProcesses in Psapi.dll will return you an array of
Process ID's.

You can then call OpenProcess from Kernel32.dll and
pass in a parameter that tells Win32 you're going to
inspect the Process's user token.

Then you can call OpenProcessToken() to get the process
security token.

From there, you can call GetTokenInformation() to
get the SID owner of the token.

Finally, you can call LookupAccountSid() to get the
name of the user with that SID.

If you need help getting started, let us know, becase
it's too lengthy of a process to post here in one
post.

-c
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl...
another process

--
Strah

"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:LW*********************@twister.austin.rr.com ...

"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:O7**************@TK2MSFTNGP12.phx.gbl...
>
> Is there a way to find out the name
> of the user who created a process.
> Some kind of process property or method
> that would report the user name how launched
> it?
> (but not Environment.UserName)

Are you talking about the current process, or
another process?

-c



Nov 15 '05 #5
Ok, you can't do this in .NET using just the
framework, you have to use PInvoke to call these
Win32 APIs.

Unfortunately I don't have time right now to start
on it, but I might have some time tonight to
start a skeleton for you or try to convert some of
that Delphi code.

-c

"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:eP*************@tk2msftngp13.phx.gbl...
I would definitely appreciate help on this...
seems a bit too mouthful for me...

Some steps though I have already resolved
like ProcessID... I have that resolved,
but the rest of it .... hugh..

Thanks,

--
Strah
"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:R8*********************@twister.austin.rr.com ...
Here's an example of how to do it in Delphi. The code
should help you see the steps you need to take to do
the PInvoke calls in C#.
http://tinyurl.com/k1ki [Experts-Exchange.com]

First, you have to get the Process ID somehow.

EnumProcesses in Psapi.dll will return you an array of
Process ID's.

You can then call OpenProcess from Kernel32.dll and
pass in a parameter that tells Win32 you're going to
inspect the Process's user token.

Then you can call OpenProcessToken() to get the process
security token.

From there, you can call GetTokenInformation() to
get the SID owner of the token.

Finally, you can call LookupAccountSid() to get the
name of the user with that SID.

If you need help getting started, let us know, becase
it's too lengthy of a process to post here in one
post.

-c
"Strahimir Antoljak" <st***@netzero.net> wrote in message
news:eM**************@TK2MSFTNGP12.phx.gbl...
another process

--
Strah

"Chad Myers" <cm****@N0.SP.4M.austin.rr.com> wrote in message
news:LW*********************@twister.austin.rr.com ...
>
> "Strahimir Antoljak" <st***@netzero.net> wrote in message
> news:O7**************@TK2MSFTNGP12.phx.gbl...
> >
> > Is there a way to find out the name
> > of the user who created a process.
> > Some kind of process property or method
> > that would report the user name how launched
> > it?
> > (but not Environment.UserName)
>
> Are you talking about the current process, or
> another process?
>
> -c
>
>



Nov 15 '05 #6
Please don't multipost, answer was given in microsoft.public.dotnet.framework

Willy.
Nov 15 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Mav | last post by:
Hi, I am writing a perl script on windows that try to get the pid for a program that created another processes. ...... @args = ("\"$devPath\\devenv.com\" ..\\Solution\\My.sln /build Debug");...
1
by: Tom L | last post by:
I have a vb.net app that I created a setup for. I can install it and run it just fine on my XP box, but I'm having problems ont he NT4 workstation box. the nt4 box has sp6a, the .net 1.1 clr,...
2
by: Phil Galey | last post by:
I have a FileSystemWatcher that triggers when a PDF file is created. However, the creation of the PDF file is about a 7 or 8 second process ... I cannot refer to the file during that time because...
11
by: Dica | last post by:
i'm getting an error about 'the process cannot access the file becaise it is being used by another process.' write after i've created a new file and try to open it for writing with xmlTextWriter....
7
by: Ryan Taylor | last post by:
Hi. I have some code that dynamically generates a PDF and spits this content directly to the web browser. I use HTMLDoc to create the Pdf's from html. So the user can click on a button "Print...
3
by: mareal | last post by:
I am using the System.Diagnostics.Process class in order to loop thru all the processes running. Within that loop I am looking for the process name “aspnet_wp” in order to get the process ID....
9
by: Tushar | last post by:
Followup-To: microsoft.public.dotnet.general Does anyone know when is this event raised, is it: 1) When the file is created but may not have been closed 2) When the file is created AND it has...
4
by: assgar | last post by:
Hi I am stuck on a problem. I use 3 scripts(form, function and process). Development on win2003 server. Final server will be linux Apache,Mysql and PHP is being used. The form displays...
2
by: Dwight Johnson | last post by:
I am building a website in VS2005. I basically have one page, default.aspx, which contains placeholder objects into which I add various controls that are dynamically created. I have a dropdownlist...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.