自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

Windows 10竟會(huì)損壞用戶文件?教你解決這個(gè)Bug

系統(tǒng) Windows
根據(jù)Windows Latest的報(bào)道,微軟最新發(fā)布的一份支持文件披露,如果在Win10的2004或者更高版本中,使用文件資源管理器修改Flac音樂(lè)文件的metadata,就會(huì)損耗Flac音頻文件。

如果你是一名音樂(lè)發(fā)燒友,那么應(yīng)該知道Flac這種常見(jiàn)的無(wú)損音樂(lè)格式。Flac音樂(lè)文件支持metadata,用戶可以編輯metadata,讓音樂(lè)文件帶有藝術(shù)家、所屬專(zhuān)輯、音軌等等信息。通常來(lái)說(shuō),metadata和音頻數(shù)據(jù)并不相關(guān),修改metadata并不會(huì)影響音頻本身。但是,近日微軟官方公布了Windows 10中存在一個(gè)Bug,在Win10中用資源管理器修改Flac文件的metadata,竟會(huì)導(dǎo)致音頻的損壞!

根據(jù)Windows Latest的報(bào)道,微軟最新發(fā)布的一份支持文件披露,如果在Windows 10的2004或者更高版本中,使用文件資源管理器修改Flac音樂(lè)文件的metadata,就會(huì)損耗Flac音頻文件。這個(gè)Bug在Windows 10專(zhuān)業(yè)版、家庭版、企業(yè)版、工作站版乃至其他版本的Windows 10中均有出現(xiàn)。

根據(jù)微軟本月早些時(shí)候發(fā)布的支持文件,Windows 10的文件資源管理器導(dǎo)致了這個(gè)錯(cuò)誤,它破壞了Flac文件頭包含的ID3框架也就是metadata,而這個(gè)ID3框架負(fù)責(zé)存儲(chǔ)音頻的注釋?zhuān)缫魳?lè)標(biāo)題、藝術(shù)家、專(zhuān)輯、曲目編號(hào)等。在Windows 10上,F(xiàn)lac的處理程序忽視了ID3框架,該程序認(rèn)為Flac文件在使用4字節(jié)的文件頭,當(dāng)Flac文件被Windows 10編輯的時(shí)候,ID3框架被覆蓋了,導(dǎo)致沒(méi)有了開(kāi)始代碼,導(dǎo)致了音樂(lè)播放器無(wú)法識(shí)別被修改后的文件。

因此,在Windows 10中,如果你直接用文件資源管理器修改Flac音樂(lè)文件的標(biāo)題、藝術(shù)家等metadata,會(huì)導(dǎo)致該文件無(wú)法播放。

幸運(yùn)的是,微軟已經(jīng)確定了Bug的根本原因,用戶可以通過(guò)Windows Update升級(jí)KB5003214補(bǔ)丁進(jìn)行修復(fù)。

在KB5003214補(bǔ)丁中,微軟確認(rèn)了上文提到的錯(cuò)誤已經(jīng)被修復(fù),修改了Flac的標(biāo)題、藝術(shù)家等metadata后,F(xiàn)lac不會(huì)再變得無(wú)法播放。而對(duì)于已經(jīng)損壞了的Flac文件,微軟則發(fā)布了一個(gè)PowerShell腳本來(lái)進(jìn)行修復(fù),運(yùn)行該腳本后Flac文件即可重新播放,不過(guò)已經(jīng)從ID3框架中丟失了的metadata信息并不能恢復(fù)。

下面是利用PowerShell腳本修復(fù)Flac文件的具體方法。

1、開(kāi)啟記事本;

2、復(fù)制以下字符,粘貼到記事本中:

  1. # Copyright 2021 Microsoft 
  2.  
  3.  # This script will repair a FLAC file that has been corrupted by Media Foundation in reference to KB5003430. 
  4.  
  5.  # Refer to KB5003430 for further information 
  6.  
  7.  param( 
  8.  
  9.  [parameter(Mandatory=$true
  10.  
  11.  HelpMessage="The path to the FLAC file that has been corrupted by Media Foundation"
  12.  
  13.  ValueFromRemainingArguments=$true)] 
  14.  
  15.  [ValidateScript({ -not [String]::IsNullOrEmpty($_) -and (Test-Path $_) })] 
  16.  
  17.  [String]$File 
  18.  
  19.  ) 
  20.  
  21.  # We need to back up the current file incase we have any errors 
  22.  
  23.  $FileDirectory = Split-Path -Resolve $File 
  24.  
  25.  $Filename = Split-Path -Leaf -Resolve $File 
  26.  
  27.  $FullPath = Join-Path -Resolve $FileDirectory $Filename 
  28.  
  29.  $Filename = [String]::Format("Backup_{0:yyyyMMdd_hhmmss}_{1}", [DateTime]::Now, $Filename) 
  30.  
  31.  $BackupLocation = Join-Path $FileDirectory $Filename 
  32.  
  33.  Write-Output "Microsoft FLAC Repair Tool. This tool will repair a FLAC audio file that was corrupted when editing its details." 
  34.  
  35.  Write-Output "Affected File: $FullPath" 
  36.  
  37.  Write-Output "A backup of the file will be made: $BackupLocation" 
  38.  
  39.  Write-Output "Do you wish to continue?" 
  40.  
  41.  $choice=$host.ui.PromptForChoice("Fixing FLAC Script""Do you wish to continue", ('&Yes''&No'), 1) 
  42.  
  43.  function ParseStreamInfoMetadataBlock([System.IO.FileStream]$stream) 
  44.  
  45.  { 
  46.  
  47.  $blockType = $stream.ReadByte() 
  48.  
  49.  $lastBlock = ($blockType -shr 7) -ne 0 
  50.  
  51.  $blockType = $blockType -band 0x7F 
  52.  
  53.  if ($blockType -ne 0) 
  54.  
  55.  { 
  56.  
  57.  return $false 
  58.  
  59.  } 
  60.  
  61.  $blockSize = (($stream.ReadByte() -shl 16) -bor ($stream.ReadByte() -shl 8) -bor $stream.ReadByte()) 
  62.  
  63.  if ($blockSize -lt 34) 
  64.  
  65.  { 
  66.  
  67.  return $false 
  68.  
  69.  } 
  70.  
  71.  $minAudioBlockSize = ($stream.ReadByte() -shl 8) -bor $stream.ReadByte() 
  72.  
  73.  $maxAudioBlockSize = ($stream.ReadByte() -shl 8) -bor $stream.ReadByte() 
  74.  
  75.  if ($minAudioBlockSize -lt 16 -or $maxAudioBlockSize -lt 16) 
  76.  
  77.  { 
  78.  
  79.  return $false 
  80.  
  81.  } 
  82.  
  83.  $minFrameSize = (($stream.ReadByte() -shl 16) -bor ($stream.ReadByte() -shl 8) -bor $stream.ReadByte()) 
  84.  
  85.  $maxFrameSize = (($stream.ReadByte() -shl 16) -bor ($stream.ReadByte() -shl 8) -bor $stream.ReadByte()) 
  86.  
  87.  $sampleInfo = (($stream.ReadByte() -shl 24) -bor ($stream.ReadByte() -shl 16) -bor ($stream.ReadByte() -shl 8) -bor $stream.ReadByte()) 
  88.  
  89.  $sampleRate = $sampleInfo -shr 12 
  90.  
  91.  $channelCount = (($sampleInfo -shr 9) -band 0x7) + 1 
  92.  
  93.  $bitsPerSample = (($sampleInfo -shr 4) -band 0x1F) + 1 
  94.  
  95.  [UInt64]$sampleCount = (($stream.ReadByte() -shl 24) -bor ($stream.ReadByte() -shl 16) -bor ($stream.ReadByte() -shl 8) -bor $stream.ReadByte()) 
  96.  
  97.  $sampleCount = (([UInt64]$sampleInfo -band 0xF) -shl 32) -bor $sampleCount 
  98.  
  99.  $MD5HashBytes = New-Object byte[] 16 
  100.  
  101.  $stream.Read($MD5HashBytes, 0, $MD5HashBytes.Length) 
  102.  
  103.  $MD5Hash = [Guid]($MD5HashBytes) 
  104.  
  105.  if ($sampleRate -eq 0) 
  106.  
  107.  { 
  108.  
  109.  return $false 
  110.  
  111.  } 
  112.  
  113.  # Passing these checks means that we likely have a stream info header and can rebuild the file 
  114.  
  115.  Write-Output "File Stream Information" 
  116.  
  117.  Write-Output "Sample Rate: $sampleRate" 
  118.  
  119.  Write-Output "Audio Channels: $channelCount" 
  120.  
  121.  Write-Output "Sample Depth: $bitsPerSample" 
  122.  
  123.  Write-Output "MD5 Audio Sample Hash: $MD5Hash" 
  124.  
  125.  return $true 
  126.  
  127.  } 
  128.  
  129.  if ($choice -eq 0) 
  130.  
  131.  { 
  132.  
  133.  Copy-Item $FullPath -Destination $BackupLocation -Force 
  134.  
  135.  $stream = [System.IO.File]::Open($FullPath, [System.IO.FileMode]::Open
  136.  
  137.  $stream.Seek(4, [System.IO.SeekOrigin]::Begin
  138.  
  139.  while ($stream.ReadByte() -eq 0) {} 
  140.  
  141.  # We now need to figure out where a valid FLAC metadata frame begins 
  142.  
  143.  # We are likely pointing to the last byte of the size member so we'll seek back 4 bytes and retry 
  144.  
  145.  $flacDataStartPosition = $stream.Position - 4 
  146.  
  147.  $stream.Seek($flacDataStartPosition, [System.IO.SeekOrigin]::Begin
  148.  
  149.  while (-not(ParseStreamInfoMetadataBlock($stream))) 
  150.  
  151.  { 
  152.  
  153.  $flacDataStartPosition = $flacDataStartPosition + 1 
  154.  
  155.  $stream.Seek($flacDataStartPosition, [System.IO.SeekOrigin]::Begin
  156.  
  157.  } 
  158.  
  159.  # Insert the start code 
  160.  
  161.  $stream.Seek($flacDataStartPosition, [System.IO.SeekOrigin]::Begin
  162.  
  163.  if (Test-Path "$FullPath.tmp"
  164.  
  165.  { 
  166.  
  167.  Remove-Item "$FullPath.tmp" 
  168.  
  169.  } 
  170.  
  171.  $fixedStream = [System.IO.File]::Open("$FullPath.tmp", [System.IO.FileMode]::CreateNew) 
  172.  
  173.  [byte[]]$startCode = [char[]]('f''L''a''C'); 
  174.  
  175.  $fixedStream.Write($startCode, 0, $startCode.Length) 
  176.  
  177.  $stream.CopyTo($fixedStream) 
  178.  
  179.  $stream.Close() 
  180.  
  181.  $fixedStream.Close() 
  182.  
  183.  Move-Item -Force "$FullPath.tmp" $FullPath 
  184.  
  185.  } 

 3、保存文件,在“另存為”對(duì)話框中,將目錄定位到你想要保存PowerShell腳本的位置;

4、在文件名輸入框中,輸入“FixFlacFiles.ps1”,將另存為文件的類(lèi)型更改為T(mén)ext Documents (*.txt);

5、進(jìn)入到你保存該P(yáng)owerShell腳本的目錄;

6、右鍵點(diǎn)擊剛剛保存的腳本,然后選擇“使用PowerShell運(yùn)行”;

7、出現(xiàn)提示時(shí),輸入無(wú)法播放的Flac文件的文件名,然后按下回車(chē)鍵。

微軟建議大家安裝本月推送的可選累積更新,以避免修改Flac文件metadata出現(xiàn)的問(wèn)題。

 

責(zé)任編輯:姜華 來(lái)源: PConline原創(chuàng)
相關(guān)推薦

2021-06-03 11:12:32

Windows 10Bug文件

2019-09-11 08:48:17

Windows 10WindowsBug

2020-05-06 19:16:45

Windows 10Windows微軟

2021-01-31 07:42:26

Windows10操作系統(tǒng)微軟

2021-06-02 16:31:16

微軟Windows 10Windows

2020-02-05 09:53:03

Windows 10系統(tǒng)文件Windows

2019-03-04 11:30:07

修復(fù)Windows 10系統(tǒng)文件

2021-03-11 00:27:42

Windows 10Windows微軟

2021-09-28 08:41:08

Windows 10操作系統(tǒng)微軟

2021-09-29 08:44:19

Win10補(bǔ)丁漏洞

2018-07-09 08:35:45

Windows 10WindowsBug

2020-12-31 06:00:13

微軟Windows 10Windows

2021-06-01 06:41:32

Windows10操作系統(tǒng)微軟

2020-12-21 08:37:23

Windows10操作系統(tǒng)KB4592438

2021-06-02 08:02:34

Windows10操作系統(tǒng)微軟

2018-08-16 10:15:41

修復(fù)Windows 10bootres.dll

2020-12-24 05:53:55

Windows10操作系統(tǒng)21H2

2019-01-02 10:32:56

Linux系統(tǒng)文件運(yùn)維

2018-12-11 11:13:25

Linux系統(tǒng)恢復(fù)

2020-03-16 17:00:29

Windows 10WindowsWord
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號(hào)