Re: VC .Net not mature?

From: Olaf Baeyens (olaf.baeyens_at_skyscan.be)
Date: 10/12/04


Date: Tue, 12 Oct 2004 11:20:04 +0200


> In big projects, using only h files could get nasty, because a
modification
> to a single h file would reguire a recompile of tons of files. With cpp
> files, compiles are generally much faster when only implementation (cpp)
is
> changed. Maybe I'll get used to it in time :)
>
This is why I use C# for none-time critical stuff, like the user interface.
And I use managed/unmanaged C++ for performance critical stuff.

> Olaf: what do you mean by "Security Integration"??
>
Default, a C# program (and probably managed C++) program have limited
security rights.
e.g.: Normally, it does not allow LAN rights, like opening files on a LAN,
or execute directly from a LAN network folder.
Create a C# program, copy it to a network drive and double click it will
generate a strange "access violation" like error that will scare anyone the
hell out of his life. This strangce error is just because the C# executable
does not have executable rights on that network drive. Copy it locally to
the C: drive and it works.

In order to make this work, 2 things must be in place.
* First you must provide in AssemblyInfo.cpp something like this:
  The code below gives access just like a typical conventional executable,
which is unrestricted.

[assembly:SecurityPermission(SecurityAction::RequestMinimum,
UnmanagedCode=true)] // Request to run unmanaged code
[assembly:FileIOPermission(SecurityAction::RequestMinimum,
Unrestricted=true)] // Request complete File IO functionality
[assembly:RegistryPermission(SecurityAction::RequestMinimum, All="*")] //
Request complet access to the registery key
[assembly:ZoneIdentityPermission(SecurityAction::RequestMinimum,Zone=Securit
yZone::NoZone)] // Request unrestricted zone

It is up to you to restrict the rights, by removing unnessecary rights.

* Second the administrator must also give you rights, to run on a network
drive.
Normally this is done by goin to control panel/ Administrative Tools/
Microsoft .NET Framework 1.1 Configuration
But I do not prefer this approach since it is too complicated to let the
user do this configuration.

But there is also good news, this configuration can be automated, but you
must use the installer to configure it.
A C# program running on a network drive cannot register itself, but you can
provide a Installer class with the necesary configuration options and if you
provide the [RunInstaller(true)] attribute in that executable. Then the
installer program can load this class and execute the code with enough
rights.

I have to admit that I still do not understand every aspect but I keep on
learning.
I love this security thinng because it lets me create applications that are
more resistant to virusses and worms.
For example if I create a stupid clock, that does not need Internet, then if
a Worm can infect it, it will still be prevented to access the Internet to
infect others. Imagine that your complete OS contains code like this, then
Worms and Virusses would not have as much chance to spread itself.



Relevant Pages

  • Re: ipnat ? Can not connect to 80 port under private address.
    ... Sorry, I requested incorrect syntax. ... Sorry I requested my colleague, but he do not execute my request. ... configuration is incorrect. ...
    (comp.unix.solaris)
  • Re: So leaky that a $4 billion industry was built to protect it
    ... The owner can read and write and execute the file. ... this is similar to the "limited user rights" concept. ... Windoze on the other hand doesn't have this kind of security. ... Can't happen on a Linux system. ...
    (microsoft.public.windowsxp.general)
  • Re: Driver verifier cause SYSTEM_SERVICE_EXCEPTION
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... a request that has a cancel routine assigned to it (e.g. you called ... > An exception happened while executing a system service routine. ...
    (microsoft.public.development.device.drivers)
  • Re: Basic Authentication + IIS 5 + Windows 2000 + Frontpage 2002 = failure?
    ... This posting is provided “AS IS” with no warranties, and confers no rights. ... |> In my setup, I cannot log in to the local computer, only the domain. ... |>> extra bit added to the configuration of this puzzle, ... |>> authenticate, and can use the local administrator account to ...
    (microsoft.public.inetserver.iis.security)
  • No rights to report server bin folder
    ... rights to the folder but I still get the same problem. ... Exception Details: System.UnauthorizedAccessException: Access to the path ... granting access rights to the resource to the ASP.NET request identity. ... System.IO.Directory.GetDirectories(String path, String searchPattern) ...
    (microsoft.public.inetserver.iis.security)