Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ ThrowExceptionEncryptDecryptFail()

static unsafe void System.IO.FileSystem.ThrowExceptionEncryptDecryptFail ( string fullPath)
inlinestaticprivate

Definition at line 205 of file FileSystem.cs.

206 {
208 if (lastWin32Error == 5)
209 {
210 string text = DriveInfoInternal.NormalizeDriveName(Path.GetPathRoot(fullPath));
211 using (DisableMediaInsertionPrompt.Create())
212 {
213 if (!Interop.Kernel32.GetVolumeInformation(text, null, 0, null, null, out var fileSystemFlags, null, 0))
214 {
216 throw Win32Marshal.GetExceptionForWin32Error(lastWin32Error, text);
217 }
218 if (((ulong)fileSystemFlags & 0x20000uL) == 0L)
219 {
220 throw new NotSupportedException(SR.PlatformNotSupported_FileEncryption);
221 }
222 }
223 }
224 throw Win32Marshal.GetExceptionForWin32Error(lastWin32Error, fullPath);
225 }
static unsafe bool GetVolumeInformation(string drive, char *volumeName, int volumeNameBufLen, int *volSerialNumber, int *maxFileNameLen, out int fileSystemFlags, char *fileSystemName, int fileSystemNameBufLen)

References System.IO.DisableMediaInsertionPrompt.Create(), System.IO.Win32Marshal.GetExceptionForWin32Error(), System.Runtime.InteropServices.Marshal.GetLastWin32Error(), System.IO.Path.GetPathRoot(), Interop.Kernel32.GetVolumeInformation(), System.L, System.IO.DriveInfoInternal.NormalizeDriveName(), System.SR.PlatformNotSupported_FileEncryption, and System.text.

Referenced by System.IO.FileSystem.Decrypt(), and System.IO.FileSystem.Encrypt().