scrrun: Store full path in folder object.

This commit is contained in:
Robert Wilhelm 2022-09-06 08:18:50 +02:00 committed by Alexandre Julliard
parent 4e360e8d42
commit 97b83a6dec
2 changed files with 19 additions and 3 deletions

View file

@ -2699,6 +2699,7 @@ static const IFolderVtbl foldervtbl = {
HRESULT create_folder(const WCHAR *path, IFolder **folder)
{
struct folder *object;
DWORD len;
*folder = NULL;
@ -2709,13 +2710,28 @@ HRESULT create_folder(const WCHAR *path, IFolder **folder)
object->IFolder_iface.lpVtbl = &foldervtbl;
object->ref = 1;
object->path = SysAllocString(path);
if (!object->path)
len = GetFullPathNameW(path, 0, NULL, NULL);
if (!len)
{
free(object);
return E_FAIL;
}
object->path = SysAllocStringLen(NULL, len);
if(!object->path)
{
free(object);
return E_OUTOFMEMORY;
}
if (!GetFullPathNameW(path, len, object->path, NULL))
{
SysFreeString(object->path);
free(object);
return E_FAIL;
}
init_classinfo(&CLSID_Folder, (IUnknown *)&object->IFolder_iface, &object->classinfo);
*folder = &object->IFolder_iface;

View file

@ -973,7 +973,7 @@ static void test_GetFolder(void)
SysFreeString(str);
hr = IFolder_get_Path(folder, &str);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
todo_wine ok(!PathIsRelativeW(str), "path %s is relative.\n", wine_dbgstr_w(str));
ok(!PathIsRelativeW(str), "path %s is relative.\n", wine_dbgstr_w(str));
SysFreeString(str);
IFolder_Release(folder);
RemoveDirectoryW(dir);