views:

321

answers:

2

Suppose you have a .wma / .wmv file and you want to detect:

  1. is it DRM protected ?
  2. (then hopefully) details of the DRM protection (like when does the license expire etc.)?

Is there a C# / C++ api for it? It seems that Windows Media Player can do it - if you click properties on that file... but Explorer does not show this info.

Note: I do not belive this is a trivial question, I have tried taglib and searched the web for a solution for about 2 hours now.

+3  A: 

From Here. More info on the Format SDK here

In c# using the Format SDK:

[DllImport("WMVCore.dll", CharSet=CharSet.Unicode)]

private static extern int WMIsContentProtected(string pwszFileName, out bool 
pfIsProtected);
keyboardP
This only works for XP :( Well, I did manage to make it work on Win 7, but it does fail on Win 2003.l
Bogdan Gavril
+3  A: 

One method of detecting DRM files under a folder using Powershell is: -

$wmplayer = New-Object -ComObject "WMPlayer.OCX"
ls -recurse | ? { $_.Name -like "*.wma" -and [bool]::Parse($wmplayer.newMedia($_.FullName).getItemInfo("Is_Protected")) }
bsdz