if RegGetValueNames(HKLM, PlayerExts + 'Types', WMPNum) then for I := 0 to GetArrayLength(WMPNum)-1 do begin if RegQueryStringValue(HKLM, PlayerExts + 'Types', WMPNum[I], WMPExt) and (WMPExt <> '') begin Ext := Ext + ';'; WMPExt := WMPExt + ';'; P := Pos(Ext, Lowercase(WMPExt)); if (P > 0) and ((P = 1) or (WMPExt[P - 1] = ';')) then begin while (P > 0) and ((P = 1) or (WMPExt[P - 1] = ';')) do begin Delete(WMPExt,P,Length(Ext)); P := Pos(Ext, Lowercase(WMPExt)); end; while (Length(WMPExt) > 0) and (WMPExt[Length(WMPExt)] = ';') do Delete(WMPExt,Length(WMPExt),1); if (WMPExt = '') then if RegDeleteValue(HKLM, PlayerExts + 'Types', WMPNum[I]) then begin RegDeleteValue(HKLM, PlayerExts + 'Descriptions', WMPNum[I]); RegDeleteValue(HKLM, PlayerExts + 'MUIDescriptions', WMPNum[I]); end else RegWriteStringValue(HKLM, PlayerExts + 'Types', WMPNum[I], WMPExt); end; end; end;