> I have a class in my application that monitors for a few given processes
> going up or down so that the user can be shown visually that something is
[quoted text clipped - 3 lines]
>
> System.ComponentModel.Win32Exception: Access is denied
While I don't have a definite answer, at first glance the exception seems
pretty clear: you don't have the security privileges needed to change the
property on that process, because doing so requires opening the process
handle in a way that's not allowed (probably with write access to change
some Windows state of the process). It seems likely to me that Server
2003 SP2 changed the default security settings to disallow this.
You may be able to find the setting that was changed (probably in the
Security Policy, either Local or Group depending on your configuration)
and revert back to the older setting. But it would probably be better to
stick with the new setting for security reasons, and ensure that you have
the proper security rights to access the property you want.
Pete
George Davis - 11 Jun 2007 18:38 GMT
Hi Peter,
I agree that it looks like a security issue but this was tested with the
same admin user on the same machine and SP2 was the only change (no changes
to group policies). When I used Process Explorer to look at the Security
settings for the app while running, the only privilege that the app had when
running SP1 that it didn't have with SP2 was "SeDebugPrivilege". From what I
can find on this privilege, it is for use in attaching a debugger to a
process. The list of privileges disabled (according to Process Explorer) in
SP1 and SP2 were:
(SP1) (SP2) SeBackupPrivilege
(SP1) (SP2) SeCreatePagefilePrivilege
(SP2) SeDebugPrivilege - not disabled in SP1
(SP1) (SP2) SeIncreaseBasePriorityPrivilege
(SP1) (SP2) SeIncreaseQuotaPrivilege
(SP1) (SP2) SeLoadDriverPrivilege
(SP1) (SP2) SeManageVolumePrivilege
(SP1) (SP2) SeProfileSingleProcessPrivilege
(SP1) (SP2) SeRemoteShutdownPrivilege
(SP1) (SP2) SeRestorePrivelege
(SP1) (SP2) SeSecurityPrivilege
(SP1) (SP2) SeShutdownPrivilege
(SP1) (SP2) SeSystemEnvironmentProfile
(SP1) (SP2) SeSystemProfilePrivilege
(SP1) (SP2) SeSystemtimePrivilege
(SP1) (SP2) SeTakeOwnershipPrivilege
(SP1) (SP2) SeUndockPrivilege
All "enabled" privileges were the same on SP1 and SP2. This might still be
a security issue but I'm just in search of how to fix this whether it's
through configuration/security changes or code changes.
Thanks,
George
> > I have a class in my application that monitors for a few given processes
> > going up or down so that the user can be shown visually that something is
[quoted text clipped - 18 lines]
>
> Pete
InDepth - 12 Jun 2007 09:23 GMT
MSDN documentation states:
"To open a handle to another another local process and obtain full access
rights, you must enable the SeDebugPrivilege privilege"
(for example, http://msdn2.microsoft.com/en-us/library/ms684320.aspx)
And to get events from another process requires full access rights.
> Hi Peter,
>
[quoted text clipped - 61 lines]
>>
>> Pete
George Davis - 19 Jun 2007 00:58 GMT
My boss found a code fix that will elevate your privileges so that you can
register for events on other processes:
System.Diagnostics.Process.EnterDebugMode();
From the MSDN help on this method:
"Puts a Process component in state to interact with operating system
processes that run in a special mode by enabling the native property
SeDebugPrivilege on the current thread."
When you get done, you can use the following line to lower your privilege
level back to "normal":
System.Diagnostics.Process.LeaveDebugMode();
I hope this saves someone else the many, many frustrating hours of searching
I put in trying to find a fix for this.
--George
> MSDN documentation states:
> "To open a handle to another another local process and obtain full access
[quoted text clipped - 68 lines]
> >>
> >> Pete