Re: FileIOPermission throws System.ExecutionEngineException

From: Andreas Håkansson (andreas.hakansson_at_nospam.com)
Date: 09/23/04


Date: Thu, 23 Sep 2004 14:08:50 +0200

I can add to the equation that about 10 lines further down the code I
perform the following check

    Dim UnmanagedPerm As SecurityPermission = _
        New SecurityPermission(SecurityPermissionFlag.UnmanagedCode)
    UnmanagedPerm.Demand()

Without any problems. I have disabaled the FileIO security check pending
some feedback, thus I know that this code is executed flawless =/

And if it is of any help, the code I'm working on is controlled by VSS.

//Andreas

"Andreas Håkansson" <andreas.hakansson@nospam.com> skrev i meddelandet
news:%23g9wlUWoEHA.3988@tk2msftngp13.phx.gbl...
> While working at a small application, and trying to be a good .net citizen
> I perform
> a check to see if the executing code has permission to work with files in
> a specific
> directory, like this
>
> Dim FilePerm As FileIOPermission = _
> New FileIOPermission(FileIOPermissionAccess.AllAccess,
> Path.GetDirectoryName(FileName))
> FilePerm.Demand()
>
> However, when the code hits the call to the Demand method it throws an
> ExecutionEngineException with the message
>
> "Unable to retrieve security descriptor for this frame."
>
> The application is a WinForm application and in the Main method I assign
> the
> current users principal to the current thread like this
>
> Shared Sub main()
>
> Dim WinUser As WindowsIdentity = _
> WindowsIdentity.GetCurrent()
> Dim WinPrincipal As New WindowsPrincipal(WinUser)
> System.Threading.Thread.CurrentThread.CurrentPrincipal =
> WinPrincipal
>
> Dim main As New MainForm
> Application.Run(main)
>
> End Sub
>
> Any ideas to the reason for this?
>
> //Andreas
>



Relevant Pages

  • Re: Only execute bit - no copy
    ... The server can't possibly enforce execute-only ... > permission, because all it does is send the data to the client. ... > executing it or copying it. ... So the NFS server has to treat execute ...
    (comp.unix.admin)
  • Re: AIX ASSIGN problems
    ... Have you checked the "permission" values that you have for the various ... > In the execution of the load module that results from a clean bldapp, ... > We verify the environmental variables are accurately set up by executing ...
    (comp.lang.cobol)
  • Re: [ANNOUNCE] Release Digsig 1.3.1: kernel module for run-time authentication of binaries
    ... > with read, then executing? ... clearly that will work on x86. ... The attached patch adds a check for execute permission to the file being ... send the line "unsubscribe linux-kernel" in ...
    (Linux-Kernel)
  • .NET security allowing fulltrust but shouldnt ?!?
    ... I'm trying to set up a SANDBOX-directory to test security issues. ... Therefor I created a Permission Set with low permissions, ... I created a Code Group (Code Groups\All_Code\.NET Sandbox) with an URL ... But when executing my test executable, it runs just fine, without ...
    (microsoft.public.dotnet.security)
  • Re: setting password to ADS object
    ... I am getting an error "Exception has been thrown by the target of an invocation" when I executing the following code. ... (any permission we have to set in ADS/IIS) ...
    (microsoft.public.dotnet.general)