Sweden-Number/dlls/shell32/classes.c

96 lines
1.8 KiB
C
Raw Normal View History

1998-11-22 19:26:23 +01:00
/*
* file type mapping
* (HKEY_CLASSES_ROOT - Stuff)
*
*
*/
#include <stdlib.h>
#include <string.h>
#include "debug.h"
#include "winerror.h"
#include "winreg.h"
1998-11-22 19:26:23 +01:00
#include "shlobj.h"
1998-11-22 19:26:23 +01:00
#include "shell32_main.h"
BOOL HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len)
1998-11-22 19:26:23 +01:00
{ HKEY hkey;
TRACE(shell, "%s %p\n",szExtension, szFileType );
if (RegOpenKeyExA(HKEY_CLASSES_ROOT,szExtension,0,0x02000000,&hkey))
1998-11-22 19:26:23 +01:00
{ return FALSE;
}
if (RegQueryValueA(hkey,NULL,szFileType,&len))
1998-11-22 19:26:23 +01:00
{ RegCloseKey(hkey);
return FALSE;
}
RegCloseKey(hkey);
TRACE(shell, "-- %s\n", szFileType );
return TRUE;
}
BOOL HCR_GetExecuteCommand ( LPCSTR szClass, LPCSTR szVerb, LPSTR szDest, DWORD len )
{ HKEY hkey;
char sTemp[256];
TRACE(shell, "%s %s\n",szClass, szVerb );
sprintf(sTemp, "%s\\shell\\%s\\command",szClass, szVerb);
if (RegOpenKeyExA(HKEY_CLASSES_ROOT,sTemp,0,0x02000000,&hkey))
{ return FALSE;
}
if (RegQueryValueA(hkey,NULL,szDest,&len))
{ RegCloseKey(hkey);
return FALSE;
}
RegCloseKey(hkey);
TRACE(shell, "-- %s\n", szDest );
return TRUE;
}
1998-12-14 18:33:00 +01:00
/***************************************************************************************
* HCR_GetDefaultIcon [internal]
*
* Gets the icon for a filetype
*/
BOOL HCR_GetDefaultIcon (LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr)
1998-12-14 18:33:00 +01:00
{ HKEY hkey;
char sTemp[256];
char sNum[5];
TRACE(shell, "%s\n",szClass );
sprintf(sTemp, "%s\\DefaultIcon",szClass);
if (RegOpenKeyExA(HKEY_CLASSES_ROOT,sTemp,0,0x02000000,&hkey))
1998-12-14 18:33:00 +01:00
{ return FALSE;
}
if (RegQueryValueA(hkey,NULL,szDest,&len))
1998-12-14 18:33:00 +01:00
{ RegCloseKey(hkey);
return FALSE;
}
RegCloseKey(hkey);
if (ParseFieldA (szDest, 2, sNum, 5))
1998-12-14 18:33:00 +01:00
{ *dwNr=atoi(sNum);
}
ParseFieldA (szDest, 1, szDest, len);
1998-12-14 18:33:00 +01:00
TRACE(shell, "-- %s %li\n", szDest, *dwNr );
return TRUE;
}
1998-11-22 19:26:23 +01:00