Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am successfully able to create/access a Ram disk drive of 20MB using the RAMDISK sample in WinDDK using my admin account.

However when i login as non-admin user on the same machine i get an access denied error on double clicking on the same Ram drive to access it. Please anyone here could tell how give access to all user to this drive.

share|improve this question

migrated from stackoverflow.com Oct 9 '11 at 8:46

This question came from our site for professional and enthusiast programmers.

    
Right click, properties, permissions, and look for a way to grant your user account privileges? –  sarnold Oct 7 '11 at 22:39
    
This is not really a programming question. While logged in as admin add permissions for the user you want for the level access needed. Right-Click-Properties-Security –  AJG85 Oct 7 '11 at 22:41
    
AJG85, yes the RamDisk drive is being created programmatically by running the sample code. Which parameters needs to be set in the code in-order to give access to non-admin accounts?? B.T.W when i when i right-click on this drive there is no such tab/button as security. I did try to add permissions to the test non-admin account right-click->Sharing tab->permission->Add->Test but it still give me "access denied" error. –  newdev1 Oct 7 '11 at 23:17

2 Answers 2

I can't imagine why Microsoft would release the ramdisk sample without setting its permissions, but they did... so it defaults to Admin-only permissions.

You'll need to call WdfDeviceInitAssignSDDLString() from within RamDiskEvtDeviceAdd(), after the call to WdfDeviceInitAssignName() and before the call to WdfDeviceCreate(). Note that this function is only available if you link against wdmsec.lib, which you'll need to add to the "sources" file. And you'll probably want to use one of the ACL definition strings in wdmsec.h, though you could write your own if you care to learn its structure.

Another issue with the Microsoft ramdisk sample driver is that it won't work above 32MB (indeed, it will only work for up to 31.99 MB) because the code doesn't handle overflow of the 16-bit bootSector->bsSectors; beyond 0x0000FFFF total sectors, it should set bootSector->bsSectors to zero and use the 32-bit bootSector->bsHugeSectors instead.

Note that after fixing the bootSector->bsHugeSectors issue, you're setting yourself up to run out of nonpaged kernel memory if you're not careful... though in most cases you're safe up to 96MB since in most (modern) cases your WinXP system has 128MB of nonpaged kernel memory available. Just don't forget that your ramdisk driver isn't the only thing that uses the nonpaged pool.

share|improve this answer

I have found the below sample posted on Microsoft support site that creates the Ramdisk drive which is accesable through non-admin accounts. It works on 2000, xp, win7. Havent tried on Vista. http://support.microsoft.com/kb/257405

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.