FullTrust for calling Process members

  • Thread starter Thread starter Jeffrey
  • Start date Start date
J

Jeffrey

hello,

I have to call the Handle from a process and FullTrust is needed
otherwise it happens an exception.


currently i am using only this code and the exception occurs.
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]


how is PermissionState.Unrestricted to implement?


jeff
 
Jeffrey,

Can you be a little more specific? There are a lot of things that go
into determining the permissions that an application is granted. Is your
app an ASP.NET app, or a windows forms app?

Also, the code you mentioned is an attribute, there is nothing really
executed per-se. Whatever that attribute is applied to is demanding full
trust from the caller (which isn't what you want).

What are you trying to do?
 
Inline.
Willy.
Jeffrey said:
hello,

I have to call the Handle from a process and FullTrust is needed
otherwise it happens an exception.
What exception? What do you mean exactly with "call the Handle", if you mean
use the Process handle, then your exception has nothing to do with CAS. A
pocess handle is a kernel object and is protected by an ACL.

currently i am using only this code and the exception occurs.
[PermissionSet(SecurityAction.LinkDemand, Name="FullTrust")]


how is PermissionState.Unrestricted to implement?


jeff
 
it is a windows app.
the handle is a Handle from the System.Diagnostics.Process class.
the exception is a
System.ComponentModel.Win32Exception: Zugriff verweigert
at System.Diagnostics.ProcessManager.OpenProcess(Int32 processId,
Int32 access, Boolean throwIfExited)
at System.Diagnostics.Process.GetProcessHandle(Int32 access, Boolean
throwIfExited)
at System.Diagnostics.Process.GetProcessHandle(Int32 access)
at System.Diagnostics.Process.OpenProcessHandle()
at System.Diagnostics.Process.get_Handle()


jeff
 
That's what I guessed, the current process has no rights to use the process
handle, this has nothing to do with CAS, it's a windows security thing.
Regular users (even administrators) have no unlimited privileges, so it's
quite normal the your application cannot call OpenProcess(...).

What are you trying to achieve?

Willy.
 
using GetForegroundWindow delivers a handle from the window which has
currently the focus. with the (GetForegroundWindow)handle and the
handle from the diagnostics.process class i try to get some proberties
from the diagnostics.process class.

is there a possibility to get the handle from diagnostics.process
without exception?
(acl never heared before)


jeff
 
Note that handle obained with GetForegroundWindow is a window handle not a
process handle, not sure how you get at the Process from this handle.
Please show some code.

Willy.
 
Back
Top