Einzelnen Beitrag anzeigen

Benutzerbild von SirThornberry
SirThornberry
(Moderator)

Registriert seit: 23. Sep 2003
Ort: Bockwen
12.235 Beiträge
 
Delphi 2006 Professional
 

Re: DRM-Kopierschutz in WMA-Dateien erkennen

  Alt 9. Aug 2006, 20:45
Schau mal unter
http://msdn.microsoft.com/library/de...plications.asp

Da gibts unter "Sample" das "DRMHeader". Eventuell wird dort gezeigt wie man raus findet ob ein DRM-Header vorhanden ist oder nicht.

bzw. gibts hier die funktion zum checken:
http://msdn.microsoft.com/library/de...tprotected.asp

[Edit=Ergänzung]
Daraus entspringt folgender Delphicode:
Delphi-Quellcode:
function IsFileDRMProtected(AFileName: String): Boolean;
var lCheckProc: function(const AFileName: PWideChar; var AIsProtected: Bool): HRESULT; stdcall;
    lLibHandle: Cardinal;
    lWideChar : PWideChar;
    lSize : Integer;
    lRes : HRESULT;
    lIsProtected: Bool;
begin
  lLibHandle := LoadLibrary('wmvcore.dll');
  if (lLibHandle > 0) then
  begin
    lCheckProc := GetProcAddress(lLibHandle, 'WMIsContentProtected');
    if Assigned(lCheckProc) then
    begin
      GetMem(lWideChar, MAX_PATH * SizeOf(WideChar));
      StringToWideChar(AFileName, lWideChar, MAX_PATH);
      lRes := lCheckProc(lWideChar, lIsProtected);
      case lRes of
        S_OK: result := lIsProtected
        else result := False;
      end;
    end
    else
      result := False;
  end
  else
    result := False;
end;
bzw. wenn die Api-Funktion statich eingebunden wird
Delphi-Quellcode:
type
  function WMIsContentProtected(const AFileName: PWideChar; var AIsProtected: Bool): HRESULT; stdcall; external 'wmvcore.dll';

[...]

function IsFileDRMProtected(AFileName: String): Boolean;
var lWideChar : PWideChar;
    lSize : Integer;
    lRes : HRESULT;
    lIsProtected: Bool;
begin
  GetMem(lWideChar, MAX_PATH * SizeOf(WideChar));
  StringToWideChar(AFileName, lWideChar, MAX_PATH);
  lRes := WMIsContentProtected(lWideChar, lIsProtected);
  case lRes of
    S_OK: result := lIsProtected
    else result := False;
  end;
end;
Im übrigen hat es gereicht im msdn (http://msdn.microsoft.com/library) nach "wma drm" zu suchen.
Jens
Mit Source ist es wie mit Kunst - Hauptsache der Künstler versteht's
  Mit Zitat antworten Zitat