MSFN Forum: PerceivedType Question - MSFN Forum

Jump to content



Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

PerceivedType Question How does it work; what am I missing? Rate Topic: -----

#1 User is offline   DukeBlazingstix 

  • Newbie
  • Group: Members
  • Posts: 13
  • Joined: 11-January 04

  Posted 15 June 2006 - 01:46 PM

Before you answer, this isn't the typical PerceivedType="video" question. I'm not trying to get Media Center to recognise QuickTime or Matroska files or anything like that. I'm asking here because it is Windows XP Media Center Edition 2005 (with SP2) that I'm trying to do this on, and want to make sure that I'm not missing something because of some bizarre undocumented difference between vanilla XP and MCE XP.

I'm doing a little tinkering around with the registry trying to reacquaint myself with how Windows deal with filetypes. I used to know a fair bit back in the Windows 95 days, but things have changed a bit since then. Mostly, they've gotten more complicated. :D

I know about the three basic groupings in the [HKEY_CLASSES_ROOT] key (well, three for my purposes). The Extensions (anything beginning with a period), the ProgIDs (anything not), and SystemFileAssociations (among other special ProgIDs, like Folder, File, Directory, *, and one or two others.)

It looks like the [HKEY_CLASSES_ROOT\SystemFileAssociations] is pretty much a subtle way for Microsoft to impose their own programs as the defaults for opening certain extensions. Or at the very least adding those damned annoying "Add To Playlist...", "Add To Sync List...", "Add To Burn List..." menus. But they also have a few more special keys there such as [image], [audio], [text], [video], and a few others. These magic keys correspond to the PerceivedType string value associated with the extensions.

The great thing about that is that you can add the appropriate [shell/open.MPC] to the [SystemFileAssociations\video] key, and suddenly you have "Open in Media Player Classic" on all of your video files. You can even associate a [DefaultIcon] to it.

All this I learned spelunking around MSDN (http://msdn.microsoft.com/library/default...._file_types.asp).

(After way to much set-up, I'm getting to my actual question.)

What I've done, because I'm as particular as the next nerd about certain things, is give [SystemFileAssociations\video] a generic audio/video icon, and marked a bunch of various extensions (.mov, .qt, .rm, .ts, .ogm, .vob, and so on) as PerceivedType="video" and nothing else, with the expectation that they'll show my generic audio/video icon, and I'll also be able to right-click and choose "Play in MPC", or "Play in VLC". I've also created an [.mpeg1] extension and given it all the same properties as the pre-built [.mpg, .mpe, .mpeg, etc].

(And finally, here's the problem/question)
The pre-built [.mpg, .mpe, .mpeg] extensions/progids all work exactly as advertised. They show the icon properly, and the right-click context menus, all pulled right from the [SystemFileAssociations\video] key. Great. But the [.mpeg1, .mov, .qt, .vob] extensions that I created from scratch only show the icon. They're not pulling the right-click context menus correctly. So obviously my assumption is that I'm missing something. Some vital, nearly insignificant-looking, reference that says "Yes, these really are PerceivedType="video" files." Does anybody have any ideas? Anybody with some more knowledge on the subject of Windows File Associations, and Perceived Types than myself, and seemingly MSDN?

For what it's worth, this is a clean install, and I have zero problems with reinstalling for as many times as it takes to get this right. It's not my main machine anyway.


#2 User is offline   palswim 

  • Group: Members
  • Posts: 4
  • Joined: 25-August 09

Posted 25 August 2009 - 04:46 PM

Wow, sorry to resurrect a topic that's over three years old, but I'm wondering the same thing!

I've tried setting FLAC files as ContentType "audio", MKV files as ContentType "video" and other similar types as well. But, it seems that only files which Windows supports out of the box (AVI, MPG, WMV, WAV, MP3, etc.) also support the ContentType-to-SystemFileAssociations mapping.

I also used RegMon to see what Windows was doing and found some confusing data. According to RegMon, for an MKV file, Windows made the following registry queries:
98	0.93894756	explorer.exe:2016	OpenKey	HKCR\.mkv	SUCCESS	Access: 0x1 	
99	0.93896878	explorer.exe:2016	QueryKey	HKCR\.mkv	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\.mkv	
100	0.93900788	explorer.exe:2016	OpenKey	HKCU\Software\Classes\.mkv	NOT FOUND		
101	0.93902910	explorer.exe:2016	QueryValue	HKCR\.mkv\PerceivedType	SUCCESS	"video"	
102	0.93905175	explorer.exe:2016	CloseKey	HKCR\.mkv	SUCCESS		
103	0.93908191	explorer.exe:2016	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]
104	0.93910986	explorer.exe:2016	OpenKey	HKCU\Software\Classes\SystemFileAssociations\video	NOT FOUND		
105	0.93917441	explorer.exe:2016	OpenKey	HKCR\SystemFileAssociations\video	SUCCESS	Access: 0x2000000 	
106	0.93920624	explorer.exe:2016	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]

So, it accesses the PerceivedType value of [HKCR\.mkv] and opens the [HKCR\SystemFileAssociations\video] key, but it never has a QueryKey entry for [HKCR\SystemFileAssociations\video].

On the other hand, for an MPG file, RegMon reported:
60	2.27974176	explorer.exe:2016	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]
61	2.27977014	explorer.exe:2016	OpenKey	HKCU\Software\Classes\SystemFileAssociations\video	NOT FOUND		
62	2.27983928	explorer.exe:2016	OpenKey	HKCR\SystemFileAssociations\video	SUCCESS	Access: 0x2000000 	
63	2.27987504	explorer.exe:2016	QueryKey	HKCR\SystemFileAssociations\video	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\SystemFileAssociations\video	
64	2.27991986	explorer.exe:2016	OpenKey	HKCU\Software\Classes\SystemFileAssociations\video\ShellEx\DataHandler	NOT FOUND		
65	2.27994323	explorer.exe:2016	OpenKey	HKCR\SystemFileAssociations\video\ShellEx\DataHandler	NOT FOUND


Nowhere did Windows access any "PerceivedType" field, but seemingly out of the blue, it went straight to the [HKCR\SystemFileAssociations\video], and both opened and queried it.

Next, I think I'll try making a custom PerceivedType, because maybe Windows has internally reserved "audio" and "video", which would be ridiculous, but would fit with the data I'm seeing.

#3 User is offline   palswim 

  • Group: Members
  • Posts: 4
  • Joined: 25-August 09

Posted 25 August 2009 - 05:08 PM

Also, I'm running XP Pro, so the issue isn't Media Center specific.

#4 User is offline   palswim 

  • Group: Members
  • Posts: 4
  • Joined: 25-August 09

Posted 27 August 2009 - 02:43 PM

Did some more research and found some articles about a function in the Windows APIs: "AssocGetPerceivedType"

http://msdn.microsoft.com/en-us/library/bb...28VS.85%29.aspx
http://www.geoffchappell.com/studies/windo...rceivedtype.htm

I created a quick project which made a few calls to this API
result = AssocGetPerceivedType(".txt", out pType, out pFlag, out psType);
// Call succeeded, pType: 1, pFlag: 5, psType: "text"
result = AssocGetPerceivedType(".mpg", out pType, out pFlag, out psType);
// Call succeeded, pType: 4, pFlag: 38, psType: "video"
result = AssocGetPerceivedType(".mkv", out pType, out pFlag, out psType);
// Call succeeded, pType: 4, pFlag: 1, psType: "video"
// I've done this with other file types too, all with predictable results


So, this call recognizes an MKV as the built-in video type (PERCEIVED_TYPE_VIDEO), and the flags it sets for MPG (Hard-coded, Native Support, WMSDK) versus the flags for MKV (Soft-coded) make sense. But, I guess the right-click algorithm doesn't use this API method.

Edit: Apparently there's some controversy with that non-MSDN link, but it has some really helpful information.

This post has been edited by palswim: 27 August 2009 - 02:55 PM


#5 User is offline   palswim 

  • Group: Members
  • Posts: 4
  • Joined: 25-August 09

Posted 27 August 2009 - 05:16 PM

I checked on Vista, and this problem exists there as well.

I also can confirm that the DefaultIcon key and the OpenWithList keys do, in fact work for any PerceivedType: "video" file. So, it's just accessing shell verbs that seems to pose the problems.

Like the post above, I found another Windows shell API called "AssocQueryString", which makes a lookup of information about a filetype/ProgID. I made a lookup for the MPG filetype and a lookup for the MKV filetype, looking for the verb "MediaInfoTest" (which I created in [HKEY_CLASSES_ROOT\SystemFileAssociations\video\shell] as I tested all of these things).

Note that I'm actually writing this code in C#, so I have to wrap all of these calls with some special code, so the method calls won't quite look correct.

The RegMon output for the call:
result = AssocQueryString( ASSOCF_NOFIXUPS, ASSOCSTR_COMMAND, ".mpg", "MediaInfoTest", out pOut, ref pOutSize);


1	1.74904048	Verbs Test.vshos:4736	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]	
2	1.74907839	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\.mpg	NOT FOUND		
3	1.74912035	Verbs Test.vshos:4736	OpenKey	HKCR\.mpg	SUCCESS	Access: 0x2000000 	
4	1.74930859	Verbs Test.vshos:4736	QueryKey	HKCR\.mpg	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\.mpg	
5	1.74934220	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\.mpg	NOT FOUND		
6	1.74946094	Verbs Test.vshos:4736	QueryValue	HKCR\.mpg\(Default)	SUCCESS	"video.MPEG"	
7	1.74948132	Verbs Test.vshos:4736	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]	
8	1.74964476	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\video.MPEG	NOT FOUND		
9	1.74968994	Verbs Test.vshos:4736	OpenKey	HKCR\video.MPEG	SUCCESS	Access: 0x2000000 	
10	1.74973106	Verbs Test.vshos:4736	QueryKey	HKCR\video.MPEG	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\video.MPEG	
11	1.74975896	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\video.MPEG\CurVer	NOT FOUND		
12	1.74987292	Verbs Test.vshos:4736	OpenKey	HKCR\video.MPEG\CurVer	NOT FOUND		
13	1.74989080	Verbs Test.vshos:4736	QueryKey	HKCR\video.MPEG	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\video.MPEG	
14	1.74991572	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\video.MPEG	NOT FOUND		
15	1.75017715	Verbs Test.vshos:4736	OpenKey	HKCR\video.MPEG	SUCCESS	Access: 0x2000000 	
16	1.75030124	Verbs Test.vshos:4736	CloseKey	HKCR\video.MPEG	SUCCESS		
17	1.75032604	Verbs Test.vshos:4736	QueryKey	HKCR\video.MPEG	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\video.MPEG	
18	1.75037527	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\video.MPEG\shell\MediaInfoTest	NOT FOUND		
19	1.75039172	Verbs Test.vshos:4736	OpenKey	HKCR\video.MPEG\shell\MediaInfoTest	NOT FOUND		
20	1.75055933	Verbs Test.vshos:4736	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]	
21	1.75057948	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\SystemFileAssociations\.mpg	NOT FOUND		
22	1.75069797	Verbs Test.vshos:4736	OpenKey	HKCR\SystemFileAssociations\.mpg	NOT FOUND		
23	1.75072646	Verbs Test.vshos:4736	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]	
24	1.75091529	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\SystemFileAssociations\video	SUCCESS	Access: 0x2000000 	
25	1.75094092	Verbs Test.vshos:4736	QueryKey	HKCU\Software\Classes\SystemFileAssociations\video	SUCCESS	Name: \REGISTRY\USER\S-[redacted]\SystemFileAssociations\video	
26	1.75107753	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\SystemFileAssociations\video\shell\MediaInfoTest	NOT FOUND		
27	1.75117898	Verbs Test.vshos:4736	OpenKey	HKCR\SystemFileAssociations\video\shell\MediaInfoTest	SUCCESS	Access: 0x2000000 	
28	1.75153852	Verbs Test.vshos:4736	QueryKey	HKCR\SystemFileAssociations\video\shell\MediaInfoTest	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\SystemFileAssociations\video\Shell\MediaInfoTest	
29	1.75158155	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\SystemFileAssociations\video\Shell\MediaInfoTest\command	NOT FOUND		
30	1.75164187	Verbs Test.vshos:4736	OpenKey	HKCR\SystemFileAssociations\video\shell\MediaInfoTest\command	SUCCESS	Access: 0x1 	
31	1.75173855	Verbs Test.vshos:4736	QueryKey	HKCR\SystemFileAssociations\video\shell\MediaInfoTest\command	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\SystemFileAssociations\video\Shell\MediaInfoTest\Command	
32	1.75176954	Verbs Test.vshos:4736	OpenKey	HKCU\Software\Classes\SystemFileAssociations\video\Shell\MediaInfoTest\Command	NOT FOUND		
33	1.75183129	Verbs Test.vshos:4736	QueryValue	HKCR\SystemFileAssociations\video\shell\MediaInfoTest\command\(Default)	SUCCESS	""C:\Program Files\video\MediaInfo\MediaInfo.exe" "%1""	
34	1.75188470	Verbs Test.vshos:4736	CloseKey	HKCR\SystemFileAssociations\video\shell\MediaInfoTest\command	SUCCESS		
35	1.75215733	Verbs Test.vshos:4736	CloseKey	HKCR\.mpg	SUCCESS		
36	1.75224137	Verbs Test.vshos:4736	CloseKey	HKCR\video.MPEG	SUCCESS		
37	1.75226486	Verbs Test.vshos:4736	CloseKey	HKCR\SystemFileAssociations\video\shell\MediaInfoTest	SUCCESS		
38	1.75228167	Verbs Test.vshos:4736	CloseKey	HKCU\Software\Classes\SystemFileAssociations\video	SUCCESS


And the RegMon output for the call:
result = AssocQueryString( ASSOCF_NOFIXUPS, ASSOCSTR_COMMAND, ".mkv", "MediaInfoTest", out pOut, ref pOutSize);


1	1.34380400	Verbs Test.vshos:5936	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]	
2	1.34384561	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\.mkv	NOT FOUND		
3	1.34391665	Verbs Test.vshos:5936	OpenKey	HKCR\.mkv	SUCCESS	Access: 0x2000000 	
4	1.34395158	Verbs Test.vshos:5936	QueryKey	HKCR\.mkv	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\.mkv	
5	1.34400380	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\.mkv	NOT FOUND		
6	1.34402895	Verbs Test.vshos:5936	QueryValue	HKCR\.mkv\(Default)	SUCCESS	"avc.Matroska"	
7	1.34406769	Verbs Test.vshos:5936	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]	
8	1.34410048	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\avc.Matroska	NOT FOUND		
9	1.34415972	Verbs Test.vshos:5936	OpenKey	HKCR\avc.Matroska	SUCCESS	Access: 0x2000000 	
10	1.34419596	Verbs Test.vshos:5936	QueryKey	HKCR\avc.Matroska	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\avc.Matroska	
11	1.34424686	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\avc.Matroska\CurVer	NOT FOUND		
12	1.34427392	Verbs Test.vshos:5936	OpenKey	HKCR\avc.Matroska\CurVer	NOT FOUND		
13	1.34430385	Verbs Test.vshos:5936	QueryKey	HKCR\avc.Matroska	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\avc.Matroska	
14	1.34434903	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\avc.Matroska	NOT FOUND		
15	1.34440470	Verbs Test.vshos:5936	OpenKey	HKCR\avc.Matroska	SUCCESS	Access: 0x2000000 	
16	1.34443343	Verbs Test.vshos:5936	CloseKey	HKCR\avc.Matroska	SUCCESS		
17	1.34448373	Verbs Test.vshos:5936	QueryKey	HKCR\avc.Matroska	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\avc.Matroska	
18	1.34453201	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\avc.Matroska\shell\MediaInfoTest	NOT FOUND		
19	1.34456110	Verbs Test.vshos:5936	OpenKey	HKCR\avc.Matroska\shell\MediaInfoTest	NOT FOUND		
20	1.34460723	Verbs Test.vshos:5936	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]	
21	1.34470272	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\SystemFileAssociations\.mkv	NOT FOUND		
22	1.34473240	Verbs Test.vshos:5936	OpenKey	HKCR\SystemFileAssociations\.mkv	NOT FOUND		
23	1.34478295	Verbs Test.vshos:5936	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]	
24	1.34481227	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\.mkv	NOT FOUND		
25	1.34486508	Verbs Test.vshos:5936	OpenKey	HKCR\.mkv	SUCCESS	Access: 0x1 	
26	1.34489107	Verbs Test.vshos:5936	QueryKey	HKCR\.mkv	SUCCESS	Name: \REGISTRY\MACHINE\SOFTWARE\Classes\.mkv	
27	1.34493351	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\.mkv	NOT FOUND		
28	1.34495807	Verbs Test.vshos:5936	QueryValue	HKCR\.mkv\PerceivedType	SUCCESS	"video"	
29	1.34498131	Verbs Test.vshos:5936	CloseKey	HKCR\.mkv	SUCCESS		
30	1.34501874	Verbs Test.vshos:5936	QueryKey	HKCU\Software\Classes	SUCCESS	Name: \REGISTRY\USER\S-[redacted]	
31	1.34505248	Verbs Test.vshos:5936	OpenKey	HKCU\Software\Classes\SystemFileAssociations\video	NOT FOUND		
32	1.34511340	Verbs Test.vshos:5936	OpenKey	HKCR\SystemFileAssociations\video	SUCCESS	Access: 0x2000000 	
33	1.34514999	Verbs Test.vshos:5936	CloseKey	HKCR\.mkv	SUCCESS		
34	1.34517431	Verbs Test.vshos:5936	CloseKey	HKCR\avc.Matroska	SUCCESS		
35	1.34520054	Verbs Test.vshos:5936	CloseKey	HKCR\SystemFileAssociations\video	SUCCESS


If you follow what it's doing, the MKV call finds that the PerceivedType is "video", and then takes the path to access the SystemFileAssociations\video key, but then inexplicably quits once it arrives there. But, the MPG one never queries the PerceivedType value (presumably because it's Hard-coded, like above), yet it heads straight to the SystemFileAssociations\video\shell\MediaInfoTest key.

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy