Search code examples
.netencryptionencodingdrmwma

How to detect the usage rights (DRM) of a file


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.


Solution

  • 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);