Accessing Windows Media Database
WMPTalk.com Forum Index WMPTalk.com
Discuss Windows Media Player
 
 FAQFAQ   MemberlistMemberlist     RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 
Google
 
Web wmptalk.com
Accessing Windows Media Database

 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> SDK
Author Message
Gregory Hassett
Guest





Posted: Wed Nov 23, 2005 9:30 pm    Post subject: Accessing Windows Media Database Reply with quote

I am writing a service which runs in the LOCALSYSTEM account. The service
knows, at installation time, the user who is installing it (say, for
example, "ghassett"). The service does not ask the user for his Windows
password during installation, and does not know it.

When the service runs, it needs to access ghassett's music library --
stored, incidentally at C:\Documents and Settings\ghassett\Local
Settings\Application Data\Microsoft\Media Player\CurrentDatabase_219.wmdb.
This WMDB file is readable by the LOCALSYSTEM account.

The usual way to do this is to use the Windows Media COM component, like the
C# code that follows. Unfortunately, COM does not want to access ghassett's
library, since the service that instantiates the COM object is "logged in"
under the LOCALSYSTEM account.

I would like to either (a) get COM to read the library I want to read and
give me playlists and track information from ghassett's library, or (b)
parse this library file myself to extract the playlists, tracks, etc. Any
ideas?

Thanks!

Greg Hassett

(Here's an extract/simplification of the C# code that runs inside my service
and attempts to walk the playlists inside ghassett's library -- if I run the
service under ghassett's account, all is fine. If I run it under
LOCALSYSTEM (which I must do in the real world), I have the problems stated
above).

private WindowsMediaPlayerClass WMP = null;
WMP = new WindowsMediaPlayerClass ();

ArrayList retval = new ArrayList ();

for (int i = 0; i < WMP.playlistCollection.getAll().count; i++)
{
try
{
IWMPPlaylist playlist = WMP.playlistCollection.getAll().Item(i);
retval.Add (playlist);
}
catch (Exception ex)
{
log (ex);
}
}

return retval;

Back to top
 
Post new topic   Reply to topic    WMPTalk.com Forum Index -> SDK All times are GMT
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



Microsoft Office Forum New Topics
Powered by phpBB