Commit 472a5e52 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Fixed GetClassFile implementation.

parent e23c96f6
...@@ -1211,12 +1211,14 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid) ...@@ -1211,12 +1211,14 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
{ {
IStorage *pstg=0; IStorage *pstg=0;
HRESULT res; HRESULT res;
int nbElm=0,length=0,i=0; int nbElm, length, i;
LONG sizeProgId=20; LONG sizeProgId;
LPOLESTR *pathDec=0,absFile=0,progId=0; LPOLESTR *pathDec=0,absFile=0,progId=0;
WCHAR extention[100]={0}; LPWSTR extension;
static const WCHAR bkslashW[] = {'\\',0};
static const WCHAR dotW[] = {'.',0};
TRACE("()\n"); TRACE("%s, %p\n", debugstr_w(filePathName), pclsid);
/* if the file contain a storage object the return the CLSID writen by IStorage_SetClass method*/ /* if the file contain a storage object the return the CLSID writen by IStorage_SetClass method*/
if((StgIsStorageFile(filePathName))==S_OK){ if((StgIsStorageFile(filePathName))==S_OK){
...@@ -1260,23 +1262,24 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid) ...@@ -1260,23 +1262,24 @@ HRESULT WINAPI GetClassFile(LPCOLESTR filePathName,CLSID *pclsid)
absFile=pathDec[nbElm-1]; absFile=pathDec[nbElm-1];
/* failed if the path represente a directory and not an absolute file name*/ /* failed if the path represente a directory and not an absolute file name*/
if (lstrcmpW(absFile,(LPOLESTR)"\\")) if (!lstrcmpW(absFile, bkslashW))
return MK_E_INVALIDEXTENSION; return MK_E_INVALIDEXTENSION;
/* get the extension of the file */ /* get the extension of the file */
extension = NULL;
length=lstrlenW(absFile); length=lstrlenW(absFile);
for(i=length-1; ( (i>=0) && (extention[i]=absFile[i]) );i--); for(i = length-1; (i >= 0) && *(extension = &absFile[i]) != '.'; i--)
/* nothing */;
/* get the progId associated to the extension */ if (!extension || !lstrcmpW(extension, dotW))
progId=CoTaskMemAlloc(sizeProgId); return MK_E_INVALIDEXTENSION;
res=RegQueryValueW(HKEY_CLASSES_ROOT,extention,progId,&sizeProgId); res=RegQueryValueW(HKEY_CLASSES_ROOT, extension, NULL, &sizeProgId);
if (res==ERROR_MORE_DATA){ /* get the progId associated to the extension */
progId = CoTaskMemAlloc(sizeProgId);
res = RegQueryValueW(HKEY_CLASSES_ROOT, extension, progId, &sizeProgId);
progId = CoTaskMemRealloc(progId,sizeProgId);
res=RegQueryValueW(HKEY_CLASSES_ROOT,extention,progId,&sizeProgId);
}
if (res==ERROR_SUCCESS) if (res==ERROR_SUCCESS)
/* return the clsid associated to the progId */ /* return the clsid associated to the progId */
res= CLSIDFromProgID(progId,pclsid); res= CLSIDFromProgID(progId,pclsid);
......
...@@ -1096,6 +1096,8 @@ int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable) ...@@ -1096,6 +1096,8 @@ int WINAPI FileMonikerImpl_DecomposePath(LPCOLESTR str, LPOLESTR** stringTable)
int len=lstrlenW(str); int len=lstrlenW(str);
TRACE("%s, %p\n", debugstr_w(str), *stringTable);
strgtable =CoTaskMemAlloc(len*sizeof(LPOLESTR)); strgtable =CoTaskMemAlloc(len*sizeof(LPOLESTR));
if (strgtable==NULL) if (strgtable==NULL)
......
...@@ -66,7 +66,7 @@ init OLE32_DllEntryPoint ...@@ -66,7 +66,7 @@ init OLE32_DllEntryPoint
64 stub DllGetClassObjectWOW 64 stub DllGetClassObjectWOW
65 stdcall DoDragDrop(ptr ptr long ptr) DoDragDrop 65 stdcall DoDragDrop(ptr ptr long ptr) DoDragDrop
66 stub EnableHookObject 66 stub EnableHookObject
67 stdcall GetClassFile(ptr ptr) GetClassFile 67 stdcall GetClassFile(wstr ptr) GetClassFile
68 stdcall GetConvertStg(ptr) GetConvertStg 68 stdcall GetConvertStg(ptr) GetConvertStg
69 stub GetDocumentBitStg 69 stub GetDocumentBitStg
70 stdcall GetHGlobalFromILockBytes(ptr ptr) GetHGlobalFromILockBytes 70 stdcall GetHGlobalFromILockBytes(ptr ptr) GetHGlobalFromILockBytes
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment