Deny Access to a Drive

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bts145
    New Member
    • Feb 2010
    • 3

    Deny Access to a Drive

    I want to deny access to a drive using vb.net code.


    In folder guard software we can deny access to a drive or make a drive read only
    i want to implement that function in my application
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    I can see no questions nor any attempt on your part to code this.
    Should the volunteers here then assume you are putting this out for bids? Are you looking to hire someone to do this for you?

    Comment

    • bts145
      New Member
      • Feb 2010
      • 3

      #3
      I need the guidance of how to do this .

      i am not asking for the full project with source code

      Comment

      • bts145
        New Member
        • Feb 2010
        • 3

        #4
        System.Security .Permissions.Fi leIOPermission Class

        I tried using System.Security .Permissions.Fi leIOPermission Class

        FileIOPermissio n f = new FileIOPermissio n (FileIOPermissi onAccess.NoAcce ss, "d:\");

        but it did not work

        help needed

        Comment

        • CroCrew
          Recognized Expert Contributor
          • Jan 2008
          • 564

          #5
          Do you want to deny access to a drive within your application or you want your application to add another layer of security to the OS.

          Denying access within your application is not that hard to do but to set and deny access even after your application is not running is a bit trickier. Because I only know of one way and that is tweaking the Windows Registry. Get even harder if you’re trying to deny access to an offsite storage unit.

          I (and I know other too) will be willing to help you out if your willing to post some of your code so I can provide you a better solution to your dilemma. Also, you need to provide a bit more detail on what you are trying to do.

          Good luck,
          CroCrew~

          Comment

          • sashi
            Recognized Expert Top Contributor
            • Jun 2006
            • 1749

            #6
            I am not sure if you could deny access to a drive using vb code, why not try using windows registry?

            I've done the same as above on 2003 Server using the group policy object (GPO), try something like below.

            Open your registry and find or create the key below.

            The "NoViewOnDr ive" value uses a 32-bit bitmask to define local and network drive access for each logical drive in the computer. The lower 26 bits of the 32-bit word correspond to drive letters A through Z. Drives are visible when set to 0 and hidden when set to 1.

            If your not happy working in Hex, add these decimal numbers to hide the drive(s):

            A: 1, B: 2, C: 4, D: 8, E: 16, F: 32, G: 64, H: 128, I: 256, J: 512, K: 1024, L: 2048, M: 4096, N: 8192, O: 16384, P: 32768, Q: 65536, R: 131072, S: 262144, T: 524288, U: 1048576, V: 2097152, W: 4194304, X: 8388608, Y: 16777216, Z: 33554432, ALL: 67108863

            For example to hide drive A and drive D, you would add 1 (A) + 8 (D) which means the value should be set to "9".

            To disable all the drives set the value to "67108863".

            User Key: [HKEY_CURRENT_US ER\Software\Mic rosoft\Windows\ CurrentVersion\ Policies\
            Explorer]
            System Key: [HKEY_LOCAL_MACH INE\Software\Mi crosoft\Windows \CurrentVersion \Policies\
            Explorer]
            Value Name: NoViewOnDrive
            Data Type: REG_DWORD (DWORD Value)
            Value Data: 32-bit bitmask

            Comment

            Working...