New HCR_GetDefaultIcon (internal).
[wine/multimedia.git] / dlls / shell32 / classes.c
blob2acab33a1db602d7ddb94b7fe7feb7cf20c0b627
1 /*
2 * file type mapping
3 * (HKEY_CLASSES_ROOT - Stuff)
6 */
7 #include <stdlib.h>
8 #include <string.h>
9 #include "debug.h"
10 #include "shlobj.h"
11 #include "shell.h"
12 #include "winerror.h"
13 #include "commctrl.h"
15 #include "shell32_main.h"
17 BOOL32 HCR_MapTypeToValue ( LPSTR szExtension, LPSTR szFileType, DWORD len)
18 { HKEY hkey;
20 TRACE(shell, "%s %p\n",szExtension, szFileType );
22 if (RegOpenKeyEx32A(HKEY_CLASSES_ROOT,szExtension,0,0x02000000,&hkey))
23 { return FALSE;
26 if (RegQueryValue32A(hkey,NULL,szFileType,&len))
27 { RegCloseKey(hkey);
28 return FALSE;
31 RegCloseKey(hkey);
33 TRACE(shell, "-- %s\n", szFileType );
35 return TRUE;
37 BOOL32 HCR_GetExecuteCommand ( LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len )
38 { HKEY hkey;
39 char sTemp[256];
41 TRACE(shell, "%s %s\n",szClass, szVerb );
43 sprintf(sTemp, "%s\\shell\\%s\\command",szClass, szVerb);
45 if (RegOpenKeyEx32A(HKEY_CLASSES_ROOT,sTemp,0,0x02000000,&hkey))
46 { return FALSE;
49 if (RegQueryValue32A(hkey,NULL,szDest,&len))
50 { RegCloseKey(hkey);
51 return FALSE;
53 RegCloseKey(hkey);
55 TRACE(shell, "-- %s\n", szDest );
57 return TRUE;
60 /***************************************************************************************
61 * HCR_GetDefaultIcon [internal]
63 * Gets the icon for a filetype
65 BOOL32 HCR_GetDefaultIcon (LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr)
66 { HKEY hkey;
67 char sTemp[256];
68 char sNum[5];
70 TRACE(shell, "%s\n",szClass );
72 sprintf(sTemp, "%s\\DefaultIcon",szClass);
74 if (RegOpenKeyEx32A(HKEY_CLASSES_ROOT,sTemp,0,0x02000000,&hkey))
75 { return FALSE;
78 if (RegQueryValue32A(hkey,NULL,szDest,&len))
79 { RegCloseKey(hkey);
80 return FALSE;
83 RegCloseKey(hkey);
85 if (ParseField32A (szDest, 2, sNum, 5))
86 { *dwNr=atoi(sNum);
89 ParseField32A (szDest, 1, szDest, len);
91 TRACE(shell, "-- %s %li\n", szDest, *dwNr );
93 return TRUE;