Fixed mapping of file extensions to text.
This commit is contained in:
parent
f7a3fc105d
commit
d72ace49d9
@ -12,19 +12,23 @@
|
|||||||
|
|
||||||
#include "shlobj.h"
|
#include "shlobj.h"
|
||||||
#include "shell32_main.h"
|
#include "shell32_main.h"
|
||||||
|
#include "shlguid.h"
|
||||||
|
#include "shresdef.h"
|
||||||
|
|
||||||
DEFAULT_DEBUG_CHANNEL(shell)
|
DEFAULT_DEBUG_CHANNEL(shell)
|
||||||
|
|
||||||
#define MAX_EXTENSION_LENGTH 20
|
#define MAX_EXTENSION_LENGTH 20
|
||||||
|
|
||||||
BOOL HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len)
|
BOOL HCR_MapTypeToValue ( LPCSTR szExtension, LPSTR szFileType, DWORD len, BOOL bPrependDot)
|
||||||
{ HKEY hkey;
|
{ HKEY hkey;
|
||||||
char szTemp[MAX_EXTENSION_LENGTH + 2];
|
char szTemp[MAX_EXTENSION_LENGTH + 2];
|
||||||
|
|
||||||
TRACE("%s %p\n",szExtension, szFileType );
|
TRACE("%s %p\n",szExtension, szFileType );
|
||||||
|
|
||||||
strcpy(szTemp, ".");
|
if (bPrependDot)
|
||||||
strncat(szTemp, szExtension, MAX_EXTENSION_LENGTH);
|
strcpy(szTemp, ".");
|
||||||
|
|
||||||
|
lstrcpynA(szTemp+((bPrependDot)?1:0), szExtension, MAX_EXTENSION_LENGTH);
|
||||||
|
|
||||||
if (RegOpenKeyExA(HKEY_CLASSES_ROOT,szTemp,0,0x02000000,&hkey))
|
if (RegOpenKeyExA(HKEY_CLASSES_ROOT,szTemp,0,0x02000000,&hkey))
|
||||||
{ return FALSE;
|
{ return FALSE;
|
||||||
@ -108,26 +112,40 @@ BOOL HCR_GetDefaultIcon (LPCSTR szClass, LPSTR szDest, DWORD len, LPDWORD dwNr)
|
|||||||
BOOL HCR_GetClassName (REFIID riid, LPSTR szDest, DWORD len)
|
BOOL HCR_GetClassName (REFIID riid, LPSTR szDest, DWORD len)
|
||||||
{ HKEY hkey;
|
{ HKEY hkey;
|
||||||
char xriid[50];
|
char xriid[50];
|
||||||
|
BOOL ret = FALSE;
|
||||||
|
DWORD buflen = len;
|
||||||
|
|
||||||
strcpy(xriid,"CLSID\\");
|
strcpy(xriid,"CLSID\\");
|
||||||
WINE_StringFromCLSID(riid,&xriid[strlen(xriid)]);
|
WINE_StringFromCLSID(riid,&xriid[strlen(xriid)]);
|
||||||
|
|
||||||
TRACE("%s\n",xriid );
|
TRACE("%s\n",xriid );
|
||||||
|
|
||||||
if (RegOpenKeyExA(HKEY_CLASSES_ROOT,xriid,0,KEY_READ,&hkey))
|
if (!RegOpenKeyExA(HKEY_CLASSES_ROOT,xriid,0,KEY_READ,&hkey))
|
||||||
{ return FALSE;
|
{
|
||||||
|
if (!RegQueryValueExA(hkey,"",0,NULL,szDest,&len))
|
||||||
|
{
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
RegCloseKey(hkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RegQueryValueExA(hkey,"",0,NULL,szDest,&len))
|
if (!ret || !szDest[0])
|
||||||
{ RegCloseKey(hkey);
|
{
|
||||||
return FALSE;
|
if(IsEqualIID(riid, &CLSID_ShellDesktop))
|
||||||
}
|
{
|
||||||
|
LoadStringA(shell32_hInstance, IDS_DESKTOP, szDest, buflen);
|
||||||
RegCloseKey(hkey);
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
else if (IsEqualIID(riid, &IID_MyComputer))
|
||||||
|
{
|
||||||
|
LoadStringA(shell32_hInstance, IDS_MYCOMPUTER, szDest, buflen);
|
||||||
|
ret = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
TRACE("-- %s\n", szDest);
|
TRACE("-- %s\n", szDest);
|
||||||
|
|
||||||
return TRUE;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/***************************************************************************************
|
/***************************************************************************************
|
||||||
@ -156,7 +174,7 @@ BOOL HCR_GetFolderAttributes (REFIID riid, LPDWORD szDest)
|
|||||||
{
|
{
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
RegCloseKey(hkey);
|
RegCloseKey(hkey);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user