Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Library: Grafik / Sound / Multimedia (https://www.delphipraxis.net/21-library-grafik-sound-multimedia/)
-   -   Delphi DRM-Schutz von WMA-Dateien erkennen (https://www.delphipraxis.net/74871-drm-schutz-von-wma-dateien-erkennen.html)

CalganX 9. Aug 2006 22:11


DRM-Schutz von WMA-Dateien erkennen
 
SirThornberry hat hier einen Code gepostet, mit dem es möglich ist zu erkennen, ob eine WMA-Datei mit einem DRM-Schutz versehen ist.
Der Code bedient sich dieser WinAPI-Funktion: http://msdn.microsoft.com/library/de...tprotected.asp

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;
Oder alternativ mit statisch eingebundener Bibliothek:
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;


Alle Zeitangaben in WEZ +1. Es ist jetzt 16:54 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz