private static void SetAttributesInternal(string fullPath, FileAttributes attributes)
{
bool r = Interop.Kernel32.SetFileAttributes(fullPath, (int)attributes);
if (!r)
{
int errorCode = Marshal.GetLastWin32Error();
if (errorCode == Interop.Errors.ERROR_INVALID_PARAMETER)
throw new ArgumentException(SR.Arg_InvalidFileAttrs, nameof(attributes));
throw Win32Marshal.GetExceptionForWin32Error(errorCode, fullPath);
}
}