Avatar of mjgardne
mjgardne

asked on 

Using FileEncryptionStatus() but it fails.

Hello,

I have a Win7 NTFS encrypted drive and am writing a program that will manipulate its files.  I assumed that FileEncryptionStatus() will tell me whether or not a file is encrypted, but when I run my program against a file in the encrypted, not unlocked, drive, it fails with 0x80310000, "This drive is locked by BitLocker Drive Encryption. You must unlock this drive from Control Panel."  My program needs to know whether a file is encrypted in order to use the proper method to copy it, so how can I determine its encryption status if the drive has not been unlocked, which is a requirement.  Would GetFileInformationByHandle()'s attributes work correctly?  I am running my application elevated, as an Administrator, with SEBackupName priv.

Thanks for your help,

Mike
Editors IDEsSystem ProgrammingVisual C++.NET

Avatar of undefined
Last Comment
mjgardne
Avatar of mjgardne
mjgardne

ASKER

I created another function that use GetFileInformationByHandle() and, when the drive is encrypted and locked, the handle fails to create, so I cannot get attribute information about it.  Arggg...  
Avatar of mjgardne
mjgardne

ASKER

For the GetFileInformationByHandle() test, I used the following code to get my handle.  I received the same error as when using FileEncryptionStatus().  :(

hFile = (IntPtr) CreateFile(fullFileName,
			GENERIC_READ,
			FILE_SHARE_READ,
			NULL,
			OPEN_EXISTING,
			(FILE_FLAG_SEQUENTIAL_SCAN |
                            FILE_FLAG_BACKUP_SEMANTICS),
			NULL);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of mjgardne
mjgardne

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
System Programming
System Programming

Kernel and system programming is the process of creating the software necessary for a computer or device to function and operate other programs. Some operating systems (such as Microsoft Windows) are proprietary, but others, such as the various Linux distributions, are open source.

41K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo