Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shcore/main.c | 442 +++++++++++++++++++++++++++++++++++++ dlls/shcore/shcore.spec | 42 ++-- dlls/shcore/tests/shcore.c | 333 ++++++++++++++++++++++++++++ 3 files changed, 796 insertions(+), 21 deletions(-)
diff --git a/dlls/shcore/main.c b/dlls/shcore/main.c index 94e1ab1bbb..45df1a8f45 100644 --- a/dlls/shcore/main.c +++ b/dlls/shcore/main.c @@ -1873,3 +1873,445 @@ DWORD WINAPI SHDeleteValueA(HKEY hkey, const char *subkey, const char *value) CoTaskMemFree(valueW); return ret; } + +/************************************************************************* + * SHCopyKeyA [SHCORE.@] + */ +DWORD WINAPI SHCopyKeyA(HKEY hkey_src, const char *subkey, HKEY hkey_dst, DWORD reserved) +{ + WCHAR *subkeyW = NULL; + DWORD ret; + + TRACE("(%p, %s, %p, %d)\n", hkey_src, debugstr_a(subkey), hkey_dst, reserved); + + if (subkey && FAILED(SHStrDupA(subkey, &subkeyW))) + return 0; + + ret = SHCopyKeyW(hkey_src, subkeyW, hkey_dst, reserved); + CoTaskMemFree(subkeyW); + return ret; +} + +/************************************************************************* + * SHCopyKeyW [SHCORE.@] + */ +DWORD WINAPI SHCopyKeyW(HKEY hkey_src, const WCHAR *subkey, HKEY hkey_dst, DWORD reserved) +{ + DWORD key_count = 0, value_count = 0, max_key_len = 0; + WCHAR name[MAX_PATH], *ptr_name = name; + BYTE buff[1024], *ptr = buff; + DWORD max_data_len = 0, i; + DWORD ret = 0; + + TRACE("(%p, %s, %p, %d)\n", hkey_src, debugstr_w(subkey), hkey_dst, reserved); + + if (!hkey_dst || !hkey_src) + return ERROR_INVALID_PARAMETER; + + if (subkey) + ret = RegOpenKeyExW(hkey_src, subkey, 0, KEY_ALL_ACCESS, &hkey_src); + + if (ret) + hkey_src = NULL; /* Don't close this key since we didn't open it */ + else + { + DWORD max_value_len; + + ret = RegQueryInfoKeyW(hkey_src, NULL, NULL, NULL, &key_count, &max_key_len, + NULL, &value_count, &max_value_len, &max_data_len, NULL, NULL); + if (!ret) + { + /* Get max size for key/value names */ + max_key_len = max(max_key_len, max_value_len); + + if (max_key_len++ > MAX_PATH - 1) + ptr_name = heap_alloc(max_key_len * sizeof(WCHAR)); + + if (max_data_len > sizeof(buff)) + ptr = heap_alloc(max_data_len); + + if (!ptr_name || !ptr) + ret = ERROR_NOT_ENOUGH_MEMORY; + } + } + + for (i = 0; i < key_count && !ret; i++) + { + HKEY hsubkey_src, hsubkey_dst; + DWORD length = max_key_len; + + ret = RegEnumKeyExW(hkey_src, i, ptr_name, &length, NULL, NULL, NULL, NULL); + if (!ret) + { + ret = RegOpenKeyExW(hkey_src, ptr_name, 0, KEY_READ, &hsubkey_src); + if (!ret) + { + /* Create destination sub key */ + ret = RegCreateKeyW(hkey_dst, ptr_name, &hsubkey_dst); + if (!ret) + { + /* Recursively copy keys and values from the sub key */ + ret = SHCopyKeyW(hsubkey_src, NULL, hsubkey_dst, 0); + RegCloseKey(hsubkey_dst); + } + } + RegCloseKey(hsubkey_src); + } + } + + /* Copy all the values in this key */ + for (i = 0; i < value_count && !ret; i++) + { + DWORD length = max_key_len, type, data_len = max_data_len; + + ret = RegEnumValueW(hkey_src, i, ptr_name, &length, NULL, &type, ptr, &data_len); + if (!ret) { + ret = SHSetValueW(hkey_dst, NULL, ptr_name, type, ptr, data_len); + } + } + + /* Free buffers if allocated */ + if (ptr_name != name) + heap_free(ptr_name); + if (ptr != buff) + heap_free(ptr); + + if (subkey && hkey_src) + RegCloseKey(hkey_src); + + return ret; +} + + +/************************************************************************* + * SHEnumKeyExA [SHCORE.@] + */ +LONG WINAPI SHEnumKeyExA(HKEY hkey, DWORD index, char *subkey, DWORD *length) +{ + TRACE("(%p, %d, %s, %p)\n", hkey, index, debugstr_a(subkey), length); + + return RegEnumKeyExA(hkey, index, subkey, length, NULL, NULL, NULL, NULL); +} + +/************************************************************************* + * SHEnumKeyExW [SHCORE.@] + */ +LONG WINAPI SHEnumKeyExW(HKEY hkey, DWORD index, WCHAR *subkey, DWORD *length) +{ + TRACE("(%p, %d, %s, %p)\n", hkey, index, debugstr_w(subkey), length); + + return RegEnumKeyExW(hkey, index, subkey, length, NULL, NULL, NULL, NULL); +} + +/************************************************************************* + * SHEnumValueA [SHCORE.@] + */ +LONG WINAPI SHEnumValueA(HKEY hkey, DWORD index, char *value, DWORD *length, DWORD *type, + void *data, DWORD *data_len) +{ + TRACE("(%p, %d, %s, %p, %p, %p, %p)\n", hkey, index, debugstr_a(value), length, type, data, data_len); + + return RegEnumValueA(hkey, index, value, length, NULL, type, data, data_len); +} + +/************************************************************************* + * SHEnumValueW [SHCORE.@] + */ +LONG WINAPI SHEnumValueW(HKEY hkey, DWORD index, WCHAR *value, DWORD *length, DWORD *type, + void *data, DWORD *data_len) +{ + TRACE("(%p, %d, %s, %p, %p, %p, %p)\n", hkey, index, debugstr_w(value), length, type, data, data_len); + + return RegEnumValueW(hkey, index, value, length, NULL, type, data, data_len); +} + +/************************************************************************* + * SHQueryValueExW [SHCORE.@] + */ +DWORD WINAPI SHQueryValueExW(HKEY hkey, const WCHAR *name, DWORD *reserved, DWORD *type, + void *buff, DWORD *buff_len) +{ + DWORD ret, value_type, data_len = 0; + + TRACE("(%p, %s, %p, %p, %p, %p)\n", hkey, debugstr_w(name), reserved, type, buff, buff_len); + + if (buff_len) + data_len = *buff_len; + + ret = RegQueryValueExW(hkey, name, reserved, &value_type, buff, &data_len); + if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA) + return ret; + + if (buff_len && value_type == REG_EXPAND_SZ) + { + DWORD length; + WCHAR *value; + + if (!buff || ret == ERROR_MORE_DATA) + { + length = data_len; + value = heap_alloc(length); + RegQueryValueExW(hkey, name, reserved, NULL, (BYTE *)value, &length); + length = ExpandEnvironmentStringsW(value, NULL, 0); + } + else + { + length = (strlenW(buff) + 1) * sizeof(WCHAR); + value = heap_alloc(length); + memcpy(value, buff, length); + length = ExpandEnvironmentStringsW(value, buff, *buff_len / sizeof(WCHAR)); + if (length > *buff_len) ret = ERROR_MORE_DATA; + } + data_len = max(data_len, length); + heap_free(value); + } + + if (type) + *type = value_type == REG_EXPAND_SZ ? REG_SZ : value_type; + if (buff_len) + *buff_len = data_len; + return ret; +} + +/************************************************************************* + * SHQueryValueExA [SHCORE.@] + */ +DWORD WINAPI SHQueryValueExA(HKEY hkey, const char *name, DWORD *reserved, DWORD *type, + void *buff, DWORD *buff_len) +{ + DWORD ret, value_type, data_len = 0; + + TRACE("(%p, %s, %p, %p, %p, %p)\n", hkey, debugstr_a(name), reserved, type, buff, buff_len); + + if (buff_len) + data_len = *buff_len; + + ret = RegQueryValueExA(hkey, name, reserved, &value_type, buff, &data_len); + if (ret != ERROR_SUCCESS && ret != ERROR_MORE_DATA) + return ret; + + if (buff_len && value_type == REG_EXPAND_SZ) + { + DWORD length; + char *value; + + if (!buff || ret == ERROR_MORE_DATA) + { + length = data_len; + value = heap_alloc(length); + RegQueryValueExA(hkey, name, reserved, NULL, (BYTE *)value, &length); + length = ExpandEnvironmentStringsA(value, NULL, 0); + } + else + { + length = strlen(buff) + 1; + value = heap_alloc(length); + memcpy(value, buff, length); + length = ExpandEnvironmentStringsA(value, buff, *buff_len); + if (length > *buff_len) ret = ERROR_MORE_DATA; + } + data_len = max(data_len, length); + heap_free(value); + } + + if (type) + *type = value_type == REG_EXPAND_SZ ? REG_SZ : value_type; + if (buff_len) + *buff_len = data_len; + return ret; +} + +/************************************************************************* + * SHGetValueA [SHCORE.@] + */ +DWORD WINAPI SHGetValueA(HKEY hkey, const char *subkey, const char *value, + DWORD *type, void *data, DWORD *data_len) +{ + HKEY hsubkey = 0; + DWORD ret = 0; + + TRACE("(%p, %s, %s, %p, %p, %p)\n", hkey, debugstr_a(subkey), debugstr_a(value), + type, data, data_len); + + if (subkey) + ret = RegOpenKeyExA(hkey, subkey, 0, KEY_QUERY_VALUE, &hsubkey); + + if (!ret) + { + ret = SHQueryValueExA(hsubkey ? hsubkey : hkey, value, 0, type, data, data_len); + if (subkey) + RegCloseKey(hsubkey); + } + + return ret; +} + +/************************************************************************* + * SHGetValueW [SHCORE.@] + */ +DWORD WINAPI SHGetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, + DWORD *type, void *data, DWORD *data_len) +{ + HKEY hsubkey = 0; + DWORD ret = 0; + + TRACE("(%p, %s, %s, %p, %p, %p)\n", hkey, debugstr_w(subkey), debugstr_w(value), + type, data, data_len); + + if (subkey) + ret = RegOpenKeyExW(hkey, subkey, 0, KEY_QUERY_VALUE, &hsubkey); + + if (!ret) + { + ret = SHQueryValueExW(hsubkey ? hsubkey : hkey, value, 0, type, data, data_len); + if (subkey) + RegCloseKey(hsubkey); + } + + return ret; +} + +/************************************************************************* + * SHRegGetIntW [SHCORE.280] + */ +int WINAPI SHRegGetIntW(HKEY hkey, const WCHAR *value, int default_value) +{ + WCHAR buff[32]; + DWORD buff_len; + + TRACE("(%p, %s, %d)\n", hkey, debugstr_w(value), default_value); + + buff[0] = 0; + buff_len = sizeof(buff); + if (SHQueryValueExW(hkey, value, 0, 0, buff, &buff_len)) + return default_value; + + if (*buff >= '0' && *buff <= '9') + return atoiW(buff); + + return default_value; +} + +/************************************************************************* + * SHRegGetPathA [SHCORE.@] + */ +DWORD WINAPI SHRegGetPathA(HKEY hkey, const char *subkey, const char *value, char *path, DWORD flags) +{ + DWORD length = MAX_PATH; + + TRACE("(%p, %s, %s, %p, %#x)\n", hkey, debugstr_a(subkey), debugstr_a(value), path, flags); + + return SHGetValueA(hkey, subkey, value, 0, path, &length); +} + +/************************************************************************* + * SHRegGetPathW [SHCORE.@] + */ +DWORD WINAPI SHRegGetPathW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, WCHAR *path, DWORD flags) +{ + DWORD length = MAX_PATH; + + TRACE("(%p, %s, %s, %p, %d)\n", hkey, debugstr_w(subkey), debugstr_w(value), path, flags); + + return SHGetValueW(hkey, subkey, value, 0, path, &length); +} + +/************************************************************************* + * SHSetValueW [SHCORE.@] + */ +DWORD WINAPI SHSetValueW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, DWORD type, + const void *data, DWORD data_len) +{ + DWORD ret = ERROR_SUCCESS, dummy; + HKEY hsubkey; + + TRACE("(%p, %s, %s, %d, %p, %d)\n", hkey, debugstr_w(subkey), debugstr_w(value), + type, data, data_len); + + if (subkey && *subkey) + ret = RegCreateKeyExW(hkey, subkey, 0, NULL, 0, KEY_SET_VALUE, NULL, &hsubkey, &dummy); + else + hsubkey = hkey; + + if (!ret) + { + ret = RegSetValueExW(hsubkey, value, 0, type, data, data_len); + if (hsubkey != hkey) + RegCloseKey(hsubkey); + } + + return ret; +} + +/************************************************************************* + * SHSetValueA [SHCORE.@] + */ +DWORD WINAPI SHSetValueA(HKEY hkey, const char *subkey, const char *value, + DWORD type, const void *data, DWORD data_len) +{ + DWORD ret = ERROR_SUCCESS, dummy; + HKEY hsubkey; + + TRACE("(%p, %s, %s, %d, %p, %d)\n", hkey, debugstr_a(subkey), debugstr_a(value), + type, data, data_len); + + if (subkey && *subkey) + ret = RegCreateKeyExA(hkey, subkey, 0, NULL, 0, KEY_SET_VALUE, NULL, &hsubkey, &dummy); + else + hsubkey = hkey; + + if (!ret) + { + ret = RegSetValueExA(hsubkey, value, 0, type, data, data_len); + if (hsubkey != hkey) + RegCloseKey(hsubkey); + } + + return ret; +} + +/************************************************************************* + * SHRegSetPathA [SHCORE.@] + */ +DWORD WINAPI SHRegSetPathA(HKEY hkey, const char *subkey, const char *value, const char *path, DWORD flags) +{ + FIXME("(%p, %s, %s, %p, %#x) - semi-stub\n", hkey, debugstr_a(subkey), + debugstr_a(value), debugstr_a(path), flags); + + /* FIXME: PathUnExpandEnvStringsA() */ + + return SHSetValueA(hkey, subkey, value, REG_SZ, path, lstrlenA(path)); +} + +/************************************************************************* + * SHRegSetPathW [SHCORE.@] + */ +DWORD WINAPI SHRegSetPathW(HKEY hkey, const WCHAR *subkey, const WCHAR *value, const WCHAR *path, DWORD flags) +{ + FIXME("(%p, %s, %s, %s, %#x) - semi-stub\n", hkey, debugstr_w(subkey), + debugstr_w(value), debugstr_w(path), flags); + + /* FIXME: PathUnExpandEnvStringsW(); */ + + return SHSetValueW(hkey, subkey, value, REG_SZ, path, lstrlenW(path)); +} + +/************************************************************************* + * SHQueryInfoKeyA [SHCORE.@] + */ +LONG WINAPI SHQueryInfoKeyA(HKEY hkey, DWORD *subkeys, DWORD *subkey_max, DWORD *values, DWORD *value_max) +{ + TRACE("(%p, %p, %p, %p, %p)\n", hkey, subkeys, subkey_max, values, value_max); + + return RegQueryInfoKeyA(hkey, NULL, NULL, NULL, subkeys, subkey_max, NULL, values, value_max, NULL, NULL, NULL); +} + +/************************************************************************* + * SHQueryInfoKeyW [SHCORE.@] + */ +LONG WINAPI SHQueryInfoKeyW(HKEY hkey, DWORD *subkeys, DWORD *subkey_max, DWORD *values, DWORD *value_max) +{ + TRACE("(%p, %p, %p, %p, %p)\n", hkey, subkeys, subkey_max, values, value_max); + + return RegQueryInfoKeyW(hkey, NULL, NULL, NULL, subkeys, subkey_max, NULL, values, value_max, NULL, NULL, NULL); +} diff --git a/dlls/shcore/shcore.spec b/dlls/shcore/shcore.spec index d6e48368ae..c0150cbc90 100644 --- a/dlls/shcore/shcore.spec +++ b/dlls/shcore/shcore.spec @@ -31,8 +31,8 @@ @ stub RevokeScaleChangeNotifications @ stdcall SHAnsiToAnsi(str ptr long) @ stdcall SHAnsiToUnicode(str ptr long) -@ stdcall SHCopyKeyA(long str long long) shlwapi.SHCopyKeyA -@ stdcall SHCopyKeyW(long wstr long long) shlwapi.SHCopyKeyW +@ stdcall SHCopyKeyA(long str long long) +@ stdcall SHCopyKeyW(long wstr long long) @ stdcall SHCreateMemStream(ptr long) @ stdcall SHCreateStreamOnFileA(str long ptr) @ stdcall SHCreateStreamOnFileEx(wstr long long long ptr ptr) @@ -46,33 +46,33 @@ @ stdcall SHDeleteKeyW(long wstr) @ stdcall SHDeleteValueA(long str str) @ stdcall SHDeleteValueW(long wstr wstr) -@ stdcall SHEnumKeyExA(long long str ptr) shlwapi.SHEnumKeyExA -@ stdcall SHEnumKeyExW(long long wstr ptr) shlwapi.SHEnumKeyExW -@ stdcall SHEnumValueA(long long str ptr ptr ptr ptr) shlwapi.SHEnumValueA -@ stdcall SHEnumValueW(long long wstr ptr ptr ptr ptr) shlwapi.SHEnumValueW +@ stdcall SHEnumKeyExA(long long str ptr) +@ stdcall SHEnumKeyExW(long long wstr ptr) +@ stdcall SHEnumValueA(long long str ptr ptr ptr ptr) +@ stdcall SHEnumValueW(long long wstr ptr ptr ptr ptr) @ stdcall SHGetThreadRef(ptr) -@ stdcall SHGetValueA( long str str ptr ptr ptr ) shlwapi.SHGetValueA -@ stdcall SHGetValueW( long wstr wstr ptr ptr ptr ) shlwapi.SHGetValueW +@ stdcall SHGetValueA(long str str ptr ptr ptr) +@ stdcall SHGetValueW(long wstr wstr ptr ptr ptr) @ stdcall SHOpenRegStream2A(long str str long) @ stdcall SHOpenRegStream2W(long wstr wstr long) @ stdcall SHOpenRegStreamA(long str str long) @ stdcall SHOpenRegStreamW(long wstr wstr long) -@ stdcall SHQueryInfoKeyA(long ptr ptr ptr ptr) shlwapi.SHQueryInfoKeyA -@ stdcall SHQueryInfoKeyW(long ptr ptr ptr ptr) shlwapi.SHQueryInfoKeyW -@ stdcall SHQueryValueExA(long str ptr ptr ptr ptr) shlwapi.SHQueryValueExA -@ stdcall SHQueryValueExW(long wstr ptr ptr ptr ptr) shlwapi.SHQueryValueExW +@ stdcall SHQueryInfoKeyA(long ptr ptr ptr ptr) +@ stdcall SHQueryInfoKeyW(long ptr ptr ptr ptr) +@ stdcall SHQueryValueExA(long str ptr ptr ptr ptr) +@ stdcall SHQueryValueExW(long wstr ptr ptr ptr ptr) @ stdcall SHRegDuplicateHKey(long) -@ stdcall SHRegGetIntW(ptr wstr long) shlwapi.SHRegGetIntW -@ stdcall SHRegGetPathA(long str str ptr long) shlwapi.SHRegGetPathA -@ stdcall SHRegGetPathW(long wstr wstr ptr long) shlwapi.SHRegGetPathW -@ stdcall SHRegGetValueA( long str str long ptr ptr ptr ) shlwapi.SHRegGetValueA -@ stdcall SHRegGetValueW( long wstr wstr long ptr ptr ptr ) shlwapi.SHRegGetValueW -@ stdcall SHRegSetPathA(long str str str long) shlwapi.SHRegSetPathA -@ stdcall SHRegSetPathW(long wstr wstr wstr long) shlwapi.SHRegSetPathW +@ stdcall SHRegGetIntW(ptr wstr long) +@ stdcall SHRegGetPathA(long str str ptr long) +@ stdcall SHRegGetPathW(long wstr wstr ptr long) +@ stdcall SHRegGetValueA(long str str long ptr ptr ptr) advapi32.RegGetValueA +@ stdcall SHRegGetValueW(long wstr wstr long ptr ptr ptr) advapi32.RegGetValueW +@ stdcall SHRegSetPathA(long str str str long) +@ stdcall SHRegSetPathW(long wstr wstr wstr long) @ stdcall SHReleaseThreadRef() @ stdcall SHSetThreadRef(ptr) -@ stdcall SHSetValueA(long str str long ptr long) shlwapi.SHSetValueA -@ stdcall SHSetValueW(long wstr wstr long ptr long) shlwapi.SHSetValueW +@ stdcall SHSetValueA(long str str long ptr long) +@ stdcall SHSetValueW(long wstr wstr long ptr long) @ stdcall SHStrDupA(str ptr) @ stdcall SHStrDupW(wstr ptr) @ stdcall SHUnicodeToAnsi(wstr ptr ptr) diff --git a/dlls/shcore/tests/shcore.c b/dlls/shcore/tests/shcore.c index e1af2a2edc..0738659f7c 100644 --- a/dlls/shcore/tests/shcore.c +++ b/dlls/shcore/tests/shcore.c @@ -23,6 +23,7 @@ #include <windows.h> #include "initguid.h" #include "objidl.h" +#include "shlwapi.h"
#include "wine/test.h"
@@ -35,6 +36,26 @@ static int (WINAPI *pSHAnsiToAnsi)(const char *, char *, int); static int (WINAPI *pSHUnicodeToUnicode)(const WCHAR *, WCHAR *, int); static HKEY (WINAPI *pSHRegDuplicateHKey)(HKEY); static DWORD (WINAPI *pSHDeleteKeyA)(HKEY, const char *); +static DWORD (WINAPI *pSHGetValueA)(HKEY, const char *, const char *, DWORD *, void *, DWORD *); +static LSTATUS (WINAPI *pSHRegGetValueA)(HKEY, const char *, const char *, SRRF, DWORD *, void *, DWORD *); +static DWORD (WINAPI *pSHQueryValueExA)(HKEY, const char *, DWORD *, DWORD *, void *buff, DWORD *buff_len); +static DWORD (WINAPI *pSHRegGetPathA)(HKEY, const char *, const char *, char *, DWORD); +static DWORD (WINAPI *pSHCopyKeyA)(HKEY, const char *, HKEY, DWORD); + +/* Keys used for testing */ +#define REG_TEST_KEY "Software\Wine\Test" +#define REG_CURRENT_VERSION "Software\Microsoft\Windows\CurrentVersion\explorer" + +static const char test_path1[] = "%LONGSYSTEMVAR%\subdir1"; +static const char test_path2[] = "%FOO%\subdir1"; + +static const char * test_envvar1 = "bar"; +static const char * test_envvar2 = "ImARatherLongButIndeedNeededString"; +static char test_exp_path1[MAX_PATH]; +static char test_exp_path2[MAX_PATH]; +static DWORD exp_len1; +static DWORD exp_len2; +static const char * initial_buffer ="0123456789";
static void init(HMODULE hshcore) { @@ -47,6 +68,11 @@ static void init(HMODULE hshcore) X(SHUnicodeToUnicode); X(SHRegDuplicateHKey); X(SHDeleteKeyA); + X(SHGetValueA); + X(SHRegGetValueA); + X(SHQueryValueExA); + X(SHRegGetPathA); + X(SHCopyKeyA); #undef X }
@@ -343,6 +369,308 @@ static void test_SHDeleteKey(void) ok(!ret, "Failed to delete a key, %d.\n", ret); }
+static HKEY create_test_entries(void) +{ + HKEY hKey; + DWORD ret; + DWORD nExpectedLen1, nExpectedLen2; + + SetEnvironmentVariableA("LONGSYSTEMVAR", test_envvar1); + SetEnvironmentVariableA("FOO", test_envvar2); + + ret = RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY, &hKey); + ok(!ret, "RegCreateKeyA failed, ret=%u\n", ret); + + if (hKey) + { + ok(!RegSetValueExA(hKey, "Test1", 0, REG_EXPAND_SZ, (BYTE *)test_path1, strlen(test_path1)+1), "RegSetValueExA failed\n"); + ok(!RegSetValueExA(hKey, "Test2", 0, REG_SZ, (BYTE *)test_path1, strlen(test_path1)+1), "RegSetValueExA failed\n"); + ok(!RegSetValueExA(hKey, "Test3", 0, REG_EXPAND_SZ, (BYTE *)test_path2, strlen(test_path2)+1), "RegSetValueExA failed\n"); + } + + exp_len1 = ExpandEnvironmentStringsA(test_path1, test_exp_path1, sizeof(test_exp_path1)); + exp_len2 = ExpandEnvironmentStringsA(test_path2, test_exp_path2, sizeof(test_exp_path2)); + + nExpectedLen1 = strlen(test_path1) - strlen("%LONGSYSTEMVAR%") + strlen(test_envvar1) + 1; + nExpectedLen2 = strlen(test_path2) - strlen("%FOO%") + strlen(test_envvar2) + 1; + + /* Make sure we carry on with correct values */ + exp_len1 = nExpectedLen1; + exp_len2 = nExpectedLen2; + + return hKey; +} + +/* delete key and all its subkeys */ +static DWORD delete_key( HKEY hkey, LPCSTR parent, LPCSTR keyname ) +{ + HKEY parentKey; + DWORD ret; + + RegCloseKey(hkey); + + /* open the parent of the key to close */ + ret = RegOpenKeyExA( HKEY_CURRENT_USER, parent, 0, KEY_ALL_ACCESS, &parentKey); + if (ret != ERROR_SUCCESS) + return ret; + + ret = pSHDeleteKeyA( parentKey, keyname ); + RegCloseKey(parentKey); + + return ret; +} + +static void test_SHGetValue(void) +{ + DWORD size; + DWORD type; + DWORD ret; + char buf[MAX_PATH]; + + HKEY hkey = create_test_entries(); + + strcpy(buf, initial_buffer); + size = MAX_PATH; + type = -1; + ret = pSHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", &type, buf, &size); + ok(!ret, "Failed to get value, ret %u.\n", ret); + + ok(!strcmp(test_exp_path1, buf), "Unexpected value %s.\n", buf); + ok(type == REG_SZ, "Unexpected value type %d.\n", type); + + strcpy(buf, initial_buffer); + size = MAX_PATH; + type = -1; + ret = pSHGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", &type, buf, &size); + ok(!ret, "Failed to get value, ret %u.\n", ret); + ok(!strcmp(test_path1, buf), "Unexpected value %s.\n", buf); + ok(type == REG_SZ, "Unexpected value type %d.\n", type); + + delete_key(hkey, "Software\Wine", "Test"); +} + +static void test_SHRegGetValue(void) +{ + LSTATUS ret; + DWORD size, type; + char data[MAX_PATH]; + + HKEY hkey = create_test_entries(); + + size = MAX_PATH; + ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_EXPAND_SZ, &type, data, &size); + ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%u\n", ret); + + size = MAX_PATH; + ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_SZ, &type, data, &size); + ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%u\n", ret); + ok(!strcmp(data, test_exp_path1), "data = %s, expected %s\n", data, test_exp_path1); + ok(type == REG_SZ, "type = %d, expected REG_SZ\n", type); + + size = MAX_PATH; + ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", SRRF_RT_REG_DWORD, &type, data, &size); + ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%u\n", ret); + + size = MAX_PATH; + ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_EXPAND_SZ, &type, data, &size); + ok(ret == ERROR_INVALID_PARAMETER, "SHRegGetValue failed, ret=%u\n", ret); + + size = MAX_PATH; + ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_SZ, &type, data, &size); + ok(ret == ERROR_SUCCESS, "SHRegGetValue failed, ret=%u\n", ret); + ok(!strcmp(data, test_path1), "data = %s, expected %s\n", data, test_path1); + ok(type == REG_SZ, "type = %d, expected REG_SZ\n", type); + + size = MAX_PATH; + ret = pSHRegGetValueA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test2", SRRF_RT_REG_QWORD, &type, data, &size); + ok(ret == ERROR_UNSUPPORTED_TYPE, "SHRegGetValue failed, ret=%u\n", ret); + + delete_key(hkey, "Software\Wine", "Test"); +} + +static void test_SHQueryValueEx(void) +{ + DWORD buffer_len1,buffer_len2; + DWORD ret, type, size; + char buf[MAX_PATH]; + HKEY hKey, testkey; + + testkey = create_test_entries(); + + ret = RegOpenKeyExA(HKEY_CURRENT_USER, REG_TEST_KEY, 0, KEY_QUERY_VALUE, &hKey); + ok(!ret, "Failed to open a key, ret %u.\n", ret); + + /****** SHQueryValueExA ******/ + + buffer_len1 = max(strlen(test_exp_path1)+1, strlen(test_path1)+1); + buffer_len2 = max(strlen(test_exp_path2)+1, strlen(test_path2)+1); + + /* + * Case 1.1 All arguments are NULL + */ + ret = pSHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, NULL); + ok(!ret, "Failed to query value, ret %u.\n", ret); + + /* + * Case 1.2 dwType is set + */ + type = -1; + ret = pSHQueryValueExA( hKey, "Test1", NULL, &type, NULL, NULL); + ok(!ret, "Failed to query value, ret %u.\n", ret); + ok(type == REG_SZ, "Expected REG_SZ, got (%u)\n", type); + + size = 6; + ret = pSHQueryValueExA( hKey, "Test1", NULL, NULL, NULL, &size); + ok(!ret, "Failed to query value, ret %u.\n", ret); + ok(size == buffer_len1, "Buffer sizes (%u) and (%u) are not equal\n", size, buffer_len1); + + /* + * Expanded > unexpanded + */ + size = 6; + ret = pSHQueryValueExA( hKey, "Test3", NULL, NULL, NULL, &size); + ok(!ret, "Failed to query value, ret %u.\n", ret); + ok(size >= buffer_len2, "Buffer size (%u) should be >= (%u)\n", size, buffer_len2); + + /* + * Case 1 string shrinks during expanding + */ + strcpy(buf, initial_buffer); + size = 6; + type = -1; + ret = pSHQueryValueExA( hKey, "Test1", NULL, &type, buf, &size); + ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got (%u)\n", ret); + ok(!strcmp(initial_buffer, buf), "Comparing (%s) with (%s) failed\n", buf, initial_buffer); + ok(size == buffer_len1, "Buffer sizes (%u) and (%u) are not equal\n", size, buffer_len1); + ok(type == REG_SZ, "Expected REG_SZ, got (%u)\n", type); + + /* + * string grows during expanding + * dwSize is smaller than the size of the unexpanded string + */ + strcpy(buf, initial_buffer); + size = 6; + type = -1; + ret = pSHQueryValueExA( hKey, "Test3", NULL, &type, buf, &size); + ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got (%u)\n", ret); + ok(!strcmp(initial_buffer, buf), "Comparing (%s) with (%s) failed\n", buf, initial_buffer); + ok(size >= buffer_len2, "Buffer size (%u) should be >= (%u)\n", size, buffer_len2); + ok(type == REG_SZ, "Expected REG_SZ, got (%u)\n", type); + + /* + * string grows during expanding + * dwSize is larger than the size of the unexpanded string, but + * smaller than the part before the backslash. If the unexpanded + * string fits into the buffer, it can get cut when expanded. + */ + strcpy(buf, initial_buffer); + size = strlen(test_envvar2) - 2; + type = -1; + ret = pSHQueryValueExA(hKey, "Test3", NULL, &type, buf, &size); + ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got (%u)\n", ret); + + todo_wine + { + ok(!strcmp("", buf), "Unexpanded string %s.\n", buf); + } + + ok(size >= buffer_len2, "Buffer size (%u) should be >= (%u)\n", size, buffer_len2); + ok(type == REG_SZ, "Expected REG_SZ, got (%u)\n", type); + + /* + * string grows during expanding + * dwSize is larger than the size of the part before the backslash, + * but smaller than the expanded string. If the unexpanded string fits + * into the buffer, it can get cut when expanded. + */ + strcpy(buf, initial_buffer); + size = exp_len2 - 4; + type = -1; + ret = pSHQueryValueExA( hKey, "Test3", NULL, &type, buf, &size); + ok(ret == ERROR_MORE_DATA, "Expected ERROR_MORE_DATA, got (%u)\n", ret); + + todo_wine + { + ok( (0 == strcmp("", buf)) || (0 == strcmp(test_envvar2, buf)), + "Expected empty or first part of the string "%s", got "%s"\n", test_envvar2, buf); + } + + ok(size >= buffer_len2, "Buffer size (%u) should be >= (%u)\n", size, buffer_len2); + ok(type == REG_SZ, "Expected REG_SZ, got (%u)\n", type); + + /* + * The buffer is NULL but the size is set + */ + strcpy(buf, initial_buffer); + size = 6; + type = -1; + ret = pSHQueryValueExA( hKey, "Test3", NULL, &type, NULL, &size); + ok(!ret, "Failed to query value, ret %u.\n", ret); + ok(size >= buffer_len2, "Buffer size (%u) should be >= (%u)\n", size, buffer_len2); + ok(type == REG_SZ, "Expected REG_SZ, got (%u)\n", type); + + RegCloseKey(hKey); + + delete_key(testkey, "Software\Wine", "Test"); +} + +static void test_SHRegGetPath(void) +{ + char buf[MAX_PATH]; + DWORD ret; + HKEY hkey; + + hkey = create_test_entries(); + + strcpy(buf, initial_buffer); + ret = pSHRegGetPathA(HKEY_CURRENT_USER, REG_TEST_KEY, "Test1", buf, 0); + ok(!ret, "Failed to get path, ret %u.\n", ret); + ok(!strcmp(test_exp_path1, buf), "Unexpected path %s.\n", buf); + + delete_key(hkey, "Software\Wine", "Test"); +} + +static void test_SHCopyKey(void) +{ + HKEY hKeySrc, hKeyDst; + DWORD ret; + + HKEY hkey = create_test_entries(); + + /* Delete existing destination sub keys */ + hKeyDst = NULL; + if (!RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\CopyDestination", &hKeyDst) && hKeyDst) + { + pSHDeleteKeyA(hKeyDst, NULL); + RegCloseKey(hKeyDst); + } + + hKeyDst = NULL; + ret = RegCreateKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\CopyDestination", &hKeyDst); + ok(!ret, "Failed to create a test key, ret %d.\n", ret); + + hKeySrc = NULL; + ret = RegOpenKeyA(HKEY_LOCAL_MACHINE, REG_CURRENT_VERSION, &hKeySrc); + ok(!ret, "Failed to open a test key, ret %d.\n", ret); + + ret = pSHCopyKeyA(hKeySrc, NULL, hKeyDst, 0); + ok(!ret, "Copy failed, ret=(%u)\n", ret); + + RegCloseKey(hKeySrc); + RegCloseKey(hKeyDst); + + /* Check we copied the sub keys, i.e. something that's on every windows system (including Wine) */ + hKeyDst = NULL; + ret = RegOpenKeyA(HKEY_CURRENT_USER, REG_TEST_KEY "\CopyDestination\Shell Folders", &hKeyDst); + ok(!ret, "Failed to open a test key, ret %d.\n", ret); + + /* And the we copied the values too */ + ok(!pSHQueryValueExA(hKeyDst, "Common AppData", NULL, NULL, NULL, NULL), "SHQueryValueExA failed\n"); + + RegCloseKey(hKeyDst); + delete_key( hkey, "Software\Wine", "Test" ); +} + START_TEST(shcore) { HMODULE hshcore = LoadLibraryA("shcore.dll"); @@ -362,4 +690,9 @@ START_TEST(shcore) test_SHUnicodeToUnicode(); test_SHRegDuplicateHKey(); test_SHDeleteKey(); + test_SHGetValue(); + test_SHRegGetValue(); + test_SHQueryValueEx(); + test_SHRegGetPath(); + test_SHCopyKey(); }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shcore/main.c | 120 ++++++++++++++++++++++++++++++++++++++++ dlls/shcore/shcore.spec | 2 +- 2 files changed, 121 insertions(+), 1 deletion(-)
diff --git a/dlls/shcore/main.c b/dlls/shcore/main.c index 45df1a8f45..a53a9849e8 100644 --- a/dlls/shcore/main.c +++ b/dlls/shcore/main.c @@ -2315,3 +2315,123 @@ LONG WINAPI SHQueryInfoKeyW(HKEY hkey, DWORD *subkeys, DWORD *subkey_max, DWORD
return RegQueryInfoKeyW(hkey, NULL, NULL, NULL, subkeys, subkey_max, NULL, values, value_max, NULL, NULL, NULL); } + +/************************************************************************* + * IsOS [SHCORE.@] + */ +BOOL WINAPI IsOS(DWORD feature) +{ + DWORD platform, majorv, minorv; + OSVERSIONINFOA osvi; + + osvi.dwOSVersionInfoSize = sizeof(OSVERSIONINFOA); + if (!GetVersionExA(&osvi)) + return FALSE; + + majorv = osvi.dwMajorVersion; + minorv = osvi.dwMinorVersion; + platform = osvi.dwPlatformId; + +#define ISOS_RETURN(x) \ + TRACE("(0x%x) ret=%d\n",feature,(x)); \ + return (x); + + switch(feature) { + case OS_WIN32SORGREATER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32s + || platform == VER_PLATFORM_WIN32_WINDOWS) + case OS_NT: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT) + case OS_WIN95ORGREATER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_WINDOWS) + case OS_NT4ORGREATER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 4) + case OS_WIN2000ORGREATER_ALT: + case OS_WIN2000ORGREATER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5) + case OS_WIN98ORGREATER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_WINDOWS && minorv >= 10) + case OS_WIN98_GOLD: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_WINDOWS && minorv == 10) + case OS_WIN2000PRO: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5) + case OS_WIN2000SERVER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1)) + case OS_WIN2000ADVSERVER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1)) + case OS_WIN2000DATACENTER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1)) + case OS_WIN2000TERMINAL: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && (minorv == 0 || minorv == 1)) + case OS_EMBEDDED: + FIXME("(OS_EMBEDDED) What should we return here?\n"); + return FALSE; + case OS_TERMINALCLIENT: + FIXME("(OS_TERMINALCLIENT) What should we return here?\n"); + return FALSE; + case OS_TERMINALREMOTEADMIN: + FIXME("(OS_TERMINALREMOTEADMIN) What should we return here?\n"); + return FALSE; + case OS_WIN95_GOLD: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_WINDOWS && minorv == 0) + case OS_MEORGREATER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_WINDOWS && minorv >= 90) + case OS_XPORGREATER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5 && minorv >= 1) + case OS_HOME: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5 && minorv >= 1) + case OS_PROFESSIONAL: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT) + case OS_DATACENTER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT) + case OS_ADVSERVER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 5) + case OS_SERVER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT) + case OS_TERMINALSERVER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT) + case OS_PERSONALTERMINALSERVER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && minorv >= 1 && majorv >= 5) + case OS_FASTUSERSWITCHING: + FIXME("(OS_FASTUSERSWITCHING) What should we return here?\n"); + return TRUE; + case OS_WELCOMELOGONUI: + FIXME("(OS_WELCOMELOGONUI) What should we return here?\n"); + return FALSE; + case OS_DOMAINMEMBER: + FIXME("(OS_DOMAINMEMBER) What should we return here?\n"); + return TRUE; + case OS_ANYSERVER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT) + case OS_WOW6432: + { + BOOL is_wow64; + IsWow64Process(GetCurrentProcess(), &is_wow64); + return is_wow64; + } + case OS_WEBSERVER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT) + case OS_SMALLBUSINESSSERVER: + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT) + case OS_TABLETPC: + FIXME("(OS_TABLETPC) What should we return here?\n"); + return FALSE; + case OS_SERVERADMINUI: + FIXME("(OS_SERVERADMINUI) What should we return here?\n"); + return FALSE; + case OS_MEDIACENTER: + FIXME("(OS_MEDIACENTER) What should we return here?\n"); + return FALSE; + case OS_APPLIANCE: + FIXME("(OS_APPLIANCE) What should we return here?\n"); + return FALSE; + case 0x25: /*OS_VISTAORGREATER*/ + ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT && majorv >= 6) + } + +#undef ISOS_RETURN + + WARN("(0x%x) unknown parameter\n", feature); + + return FALSE; +} diff --git a/dlls/shcore/shcore.spec b/dlls/shcore/shcore.spec index c0150cbc90..6ad1297989 100644 --- a/dlls/shcore/shcore.spec +++ b/dlls/shcore/shcore.spec @@ -25,7 +25,7 @@ @ stdcall IUnknown_QueryService(ptr ptr ptr ptr) @ stdcall IUnknown_Set(ptr ptr) @ stdcall IUnknown_SetSite(ptr ptr) -@ stdcall IsOS(long) shlwapi.IsOS +@ stdcall IsOS(long) @ stub RegisterScaleChangeEvent @ stub RegisterScaleChangeNotifications @ stub RevokeScaleChangeNotifications
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shcore/main.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/dlls/shcore/main.c b/dlls/shcore/main.c index a53a9849e8..1e84c9c300 100644 --- a/dlls/shcore/main.c +++ b/dlls/shcore/main.c @@ -966,6 +966,15 @@ static HRESULT WINAPI filestream_CopyTo(IStream *iface, IStream *dest, ULARGE_IN return hr; }
+static HRESULT WINAPI filestream_Commit(IStream *iface, DWORD flags) +{ + struct shstream *stream = impl_from_IStream(iface); + + TRACE("(%p, %#x)\n", stream, flags); + + return S_OK; +} + static HRESULT WINAPI filestream_Stat(IStream *iface, STATSTG *statstg, DWORD flags) { struct shstream *stream = impl_from_IStream(iface); @@ -1012,7 +1021,7 @@ static const IStreamVtbl filestreamvtbl = filestream_Seek, filestream_SetSize, filestream_CopyTo, - shstream_Commit, + filestream_Commit, shstream_Revert, shstream_LockRegion, shstream_UnlockRegion,
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shcore/main.c | 1 + dlls/shlwapi/istream.c | 497 -------------------------------------- dlls/shlwapi/shlwapi.spec | 6 +- 3 files changed, 4 insertions(+), 500 deletions(-)
diff --git a/dlls/shcore/main.c b/dlls/shcore/main.c index 1e84c9c300..d1c850dc64 100644 --- a/dlls/shcore/main.c +++ b/dlls/shcore/main.c @@ -1,4 +1,5 @@ /* + * Copyright 2002 Jon Griffiths * Copyright 2016 Sebastian Lackner * * This library is free software; you can redistribute it and/or diff --git a/dlls/shlwapi/istream.c b/dlls/shlwapi/istream.c index a77ed8ab1b..ba9874b75e 100644 --- a/dlls/shlwapi/istream.c +++ b/dlls/shlwapi/istream.c @@ -34,503 +34,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
-#define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f) -#define STGM_SHARE_MODE(stgm) ((stgm)&0x000f0) -#define STGM_CREATE_MODE(stgm) ((stgm)&0x0f000) - -/* Layout of ISHFileStream object */ -typedef struct -{ - IStream IStream_iface; - LONG ref; - HANDLE hFile; - DWORD dwMode; - LPOLESTR lpszPath; - DWORD type; - DWORD grfStateBits; -} ISHFileStream; - -static inline ISHFileStream *impl_from_IStream(IStream *iface) -{ - return CONTAINING_RECORD(iface, ISHFileStream, IStream_iface); -} - -/************************************************************************** -* IStream_fnQueryInterface -*/ -static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVOID *ppvObj) -{ - ISHFileStream *This = impl_from_IStream(iface); - - TRACE("(%p,%s,%p)\n", This, debugstr_guid(riid), ppvObj); - - *ppvObj = NULL; - - if(IsEqualIID(riid, &IID_IUnknown) || - IsEqualIID(riid, &IID_IStream)) - { - IStream_AddRef(iface); - *ppvObj = iface; - return S_OK; - } - return E_NOINTERFACE; -} - -/************************************************************************** -* IStream_fnAddRef -*/ -static ULONG WINAPI IStream_fnAddRef(IStream *iface) -{ - ISHFileStream *This = impl_from_IStream(iface); - ULONG refCount = InterlockedIncrement(&This->ref); - - TRACE("(%p)->(ref before=%u)\n",This, refCount - 1); - - return refCount; -} - -/************************************************************************** -* IStream_fnRelease -*/ -static ULONG WINAPI IStream_fnRelease(IStream *iface) -{ - ISHFileStream *This = impl_from_IStream(iface); - ULONG refCount = InterlockedDecrement(&This->ref); - - TRACE("(%p)->(ref before=%u)\n",This, refCount + 1); - - if (!refCount) - { - IStream_Commit(iface, 0); /* If ever buffered, this will be needed */ - LocalFree(This->lpszPath); - CloseHandle(This->hFile); - HeapFree(GetProcessHeap(), 0, This); - } - - return refCount; -} - -/************************************************************************** - * IStream_fnRead - */ -static HRESULT WINAPI IStream_fnRead(IStream *iface, void* pv, ULONG cb, ULONG* pcbRead) -{ - ISHFileStream *This = impl_from_IStream(iface); - DWORD dwRead = 0; - - TRACE("(%p,%p,%u,%p)\n", This, pv, cb, pcbRead); - - if (!ReadFile(This->hFile, pv, cb, &dwRead, NULL)) - { - WARN("error %d reading file\n", GetLastError()); - return S_FALSE; - } - if (pcbRead) - *pcbRead = dwRead; - return dwRead == cb ? S_OK : S_FALSE; -} - -/************************************************************************** - * IStream_fnWrite - */ -static HRESULT WINAPI IStream_fnWrite(IStream *iface, const void* pv, ULONG cb, ULONG* pcbWritten) -{ - ISHFileStream *This = impl_from_IStream(iface); - DWORD dwWritten = 0; - - TRACE("(%p,%p,%u,%p)\n", This, pv, cb, pcbWritten); - - switch (STGM_ACCESS_MODE(This->dwMode)) - { - case STGM_WRITE: - case STGM_READWRITE: - break; - default: - return STG_E_ACCESSDENIED; - } - - if (!WriteFile(This->hFile, pv, cb, &dwWritten, NULL)) - return HRESULT_FROM_WIN32(GetLastError()); - - if (pcbWritten) - *pcbWritten = dwWritten; - return S_OK; -} - -/************************************************************************** - * IStream_fnSeek - */ -static HRESULT WINAPI IStream_fnSeek(IStream *iface, LARGE_INTEGER dlibMove, - DWORD dwOrigin, ULARGE_INTEGER* pNewPos) -{ - ISHFileStream *This = impl_from_IStream(iface); - DWORD dwPos; - - TRACE("(%p,%s,%d,%p)\n", This, wine_dbgstr_longlong(dlibMove.QuadPart), dwOrigin, pNewPos); - - IStream_Commit(iface, 0); /* If ever buffered, this will be needed */ - dwPos = SetFilePointer(This->hFile, dlibMove.u.LowPart, NULL, dwOrigin); - if( dwPos == INVALID_SET_FILE_POINTER ) - return HRESULT_FROM_WIN32(GetLastError()); - - if (pNewPos) - { - pNewPos->u.HighPart = 0; - pNewPos->u.LowPart = dwPos; - } - return S_OK; -} - -/************************************************************************** - * IStream_fnSetSize - */ -static HRESULT WINAPI IStream_fnSetSize(IStream *iface, ULARGE_INTEGER libNewSize) -{ - ISHFileStream *This = impl_from_IStream(iface); - - TRACE("(%p,%s)\n", This, wine_dbgstr_longlong(libNewSize.QuadPart)); - - IStream_Commit(iface, 0); /* If ever buffered, this will be needed */ - if( ! SetFilePointer( This->hFile, libNewSize.QuadPart, NULL, FILE_BEGIN ) ) - return E_FAIL; - - if( ! SetEndOfFile( This->hFile ) ) - return E_FAIL; - - return S_OK; -} - -/************************************************************************** - * IStream_fnCopyTo - */ -static HRESULT WINAPI IStream_fnCopyTo(IStream *iface, IStream* pstm, ULARGE_INTEGER cb, - ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten) -{ - ISHFileStream *This = impl_from_IStream(iface); - char copyBuff[1024]; - ULONGLONG ulSize; - HRESULT hRet = S_OK; - - TRACE("(%p,%p,%s,%p,%p)\n", This, pstm, wine_dbgstr_longlong(cb.QuadPart), pcbRead, pcbWritten); - - if (pcbRead) - pcbRead->QuadPart = 0; - if (pcbWritten) - pcbWritten->QuadPart = 0; - - if (!pstm) - return S_OK; - - IStream_Commit(iface, 0); /* If ever buffered, this will be needed */ - - /* Copy data */ - ulSize = cb.QuadPart; - while (ulSize) - { - ULONG ulLeft, ulRead, ulWritten; - - ulLeft = ulSize > sizeof(copyBuff) ? sizeof(copyBuff) : ulSize; - - /* Read */ - hRet = IStream_Read(iface, copyBuff, ulLeft, &ulRead); - if (FAILED(hRet) || ulRead == 0) - break; - if (pcbRead) - pcbRead->QuadPart += ulRead; - - /* Write */ - hRet = IStream_Write(pstm, copyBuff, ulRead, &ulWritten); - if (pcbWritten) - pcbWritten->QuadPart += ulWritten; - if (FAILED(hRet) || ulWritten != ulLeft) - break; - - ulSize -= ulLeft; - } - return hRet; -} - -/************************************************************************** - * IStream_fnCommit - */ -static HRESULT WINAPI IStream_fnCommit(IStream *iface, DWORD grfCommitFlags) -{ - ISHFileStream *This = impl_from_IStream(iface); - - TRACE("(%p,%d)\n", This, grfCommitFlags); - /* Currently unbuffered: This function is not needed */ - return S_OK; -} - -/************************************************************************** - * IStream_fnRevert - */ -static HRESULT WINAPI IStream_fnRevert(IStream *iface) -{ - ISHFileStream *This = impl_from_IStream(iface); - - TRACE("(%p)\n", This); - return E_NOTIMPL; -} - -/************************************************************************** - * IStream_fnLockRegion - */ -static HRESULT WINAPI IStream_fnLockRegion(IStream *iface, ULARGE_INTEGER libOffset, - ULARGE_INTEGER cb, DWORD dwLockType) -{ - ISHFileStream *This = impl_from_IStream(iface); - TRACE("(%p,%s,%s,%d)\n", This, wine_dbgstr_longlong(libOffset.QuadPart), wine_dbgstr_longlong(cb.QuadPart), dwLockType); - return E_NOTIMPL; -} - -/************************************************************************** - * IStream_fnUnlockRegion - */ -static HRESULT WINAPI IStream_fnUnlockRegion(IStream *iface, ULARGE_INTEGER libOffset, - ULARGE_INTEGER cb, DWORD dwLockType) -{ - ISHFileStream *This = impl_from_IStream(iface); - TRACE("(%p,%s,%s,%d)\n", This, wine_dbgstr_longlong(libOffset.QuadPart), wine_dbgstr_longlong(cb.QuadPart), dwLockType); - return E_NOTIMPL; -} - -/************************************************************************* - * IStream_fnStat - */ -static HRESULT WINAPI IStream_fnStat(IStream *iface, STATSTG* lpStat, - DWORD grfStatFlag) -{ - ISHFileStream *This = impl_from_IStream(iface); - BY_HANDLE_FILE_INFORMATION fi; - - TRACE("(%p,%p,%d)\n", This, lpStat, grfStatFlag); - - if (!lpStat) - return STG_E_INVALIDPOINTER; - - memset(&fi, 0, sizeof(fi)); - GetFileInformationByHandle(This->hFile, &fi); - - if (grfStatFlag & STATFLAG_NONAME) - lpStat->pwcsName = NULL; - else - lpStat->pwcsName = StrDupW(This->lpszPath); - lpStat->type = This->type; - lpStat->cbSize.u.LowPart = fi.nFileSizeLow; - lpStat->cbSize.u.HighPart = fi.nFileSizeHigh; - lpStat->mtime = fi.ftLastWriteTime; - lpStat->ctime = fi.ftCreationTime; - lpStat->atime = fi.ftLastAccessTime; - lpStat->grfMode = This->dwMode; - lpStat->grfLocksSupported = 0; - memcpy(&lpStat->clsid, &IID_IStream, sizeof(CLSID)); - lpStat->grfStateBits = This->grfStateBits; - lpStat->reserved = 0; - - return S_OK; -} - -/************************************************************************* - * IStream_fnClone - */ -static HRESULT WINAPI IStream_fnClone(IStream *iface, IStream** ppstm) -{ - ISHFileStream *This = impl_from_IStream(iface); - - TRACE("(%p,%p)\n", This, ppstm); - if (ppstm) - *ppstm = NULL; - return E_NOTIMPL; -} - -static const IStreamVtbl SHLWAPI_fsVTable = -{ - IStream_fnQueryInterface, - IStream_fnAddRef, - IStream_fnRelease, - IStream_fnRead, - IStream_fnWrite, - IStream_fnSeek, - IStream_fnSetSize, - IStream_fnCopyTo, - IStream_fnCommit, - IStream_fnRevert, - IStream_fnLockRegion, - IStream_fnUnlockRegion, - IStream_fnStat, - IStream_fnClone -}; - -/************************************************************************** - * IStream_Create - * - * Internal helper: Create and initialise a new file stream object. - */ -static IStream *IStream_Create(LPCWSTR lpszPath, HANDLE hFile, DWORD dwMode) -{ - ISHFileStream *fileStream; - - fileStream = HeapAlloc(GetProcessHeap(), 0, sizeof(ISHFileStream)); - if (!fileStream) return NULL; - - fileStream->IStream_iface.lpVtbl = &SHLWAPI_fsVTable; - fileStream->ref = 1; - fileStream->hFile = hFile; - fileStream->dwMode = dwMode; - fileStream->lpszPath = StrDupW(lpszPath); - fileStream->type = 0; /* FIXME */ - fileStream->grfStateBits = 0; /* FIXME */ - - TRACE ("Returning %p\n", fileStream); - return &fileStream->IStream_iface; -} - -/************************************************************************* - * SHCreateStreamOnFileEx [SHLWAPI.@] - * - * Create a stream on a file. - * - * PARAMS - * lpszPath [I] Path of file to create stream on - * dwMode [I] Mode to create stream in - * dwAttributes [I] Attributes of the file - * bCreate [I] Whether to create the file if it doesn't exist - * lpTemplate [I] Reserved, must be NULL - * lppStream [O] Destination for created stream - * - * RETURNS - * Success: S_OK. lppStream contains the new stream object - * Failure: E_INVALIDARG if any parameter is invalid, or an HRESULT error code - * - * NOTES - * This function is available in Unicode only. - */ -HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode, - DWORD dwAttributes, BOOL bCreate, - IStream *lpTemplate, IStream **lppStream) -{ - DWORD dwAccess, dwShare, dwCreate; - HANDLE hFile; - - TRACE("(%s,%d,0x%08X,%d,%p,%p)\n", debugstr_w(lpszPath), dwMode, - dwAttributes, bCreate, lpTemplate, lppStream); - - if (!lpszPath || !lppStream || lpTemplate) - return E_INVALIDARG; - - *lppStream = NULL; - - /* Access */ - switch (STGM_ACCESS_MODE(dwMode)) - { - case STGM_WRITE: - case STGM_READWRITE: - dwAccess = GENERIC_READ|GENERIC_WRITE; - break; - case STGM_READ: - dwAccess = GENERIC_READ; - break; - default: - return E_INVALIDARG; - } - - /* Sharing */ - switch (STGM_SHARE_MODE(dwMode)) - { - case 0: - case STGM_SHARE_DENY_NONE: - dwShare = FILE_SHARE_READ|FILE_SHARE_WRITE; - break; - case STGM_SHARE_DENY_READ: - dwShare = FILE_SHARE_WRITE; - break; - case STGM_SHARE_DENY_WRITE: - dwShare = FILE_SHARE_READ; - break; - case STGM_SHARE_EXCLUSIVE: - dwShare = 0; - break; - default: - return E_INVALIDARG; - } - - switch(STGM_CREATE_MODE(dwMode)) - { - case STGM_FAILIFTHERE: - dwCreate = bCreate ? CREATE_NEW : OPEN_EXISTING; - break; - case STGM_CREATE: - dwCreate = CREATE_ALWAYS; - break; - default: - return E_INVALIDARG; - } - - /* Open HANDLE to file */ - hFile = CreateFileW(lpszPath, dwAccess, dwShare, NULL, dwCreate, - dwAttributes, 0); - - if(hFile == INVALID_HANDLE_VALUE) - return HRESULT_FROM_WIN32(GetLastError()); - - *lppStream = IStream_Create(lpszPath, hFile, dwMode); - - if(!*lppStream) - { - CloseHandle(hFile); - return E_OUTOFMEMORY; - } - return S_OK; -} - -/************************************************************************* - * SHCreateStreamOnFileW [SHLWAPI.@] - * - * See SHCreateStreamOnFileA. - */ -HRESULT WINAPI SHCreateStreamOnFileW(LPCWSTR lpszPath, DWORD dwMode, - IStream **lppStream) -{ - TRACE("(%s,%d,%p)\n", debugstr_w(lpszPath), dwMode, lppStream); - - if (!lpszPath || !lppStream) - return E_INVALIDARG; - - if ((dwMode & (STGM_CONVERT|STGM_DELETEONRELEASE|STGM_TRANSACTED)) != 0) - return E_INVALIDARG; - - return SHCreateStreamOnFileEx(lpszPath, dwMode, 0, FALSE, NULL, lppStream); -} - -/************************************************************************* - * SHCreateStreamOnFileA [SHLWAPI.@] - * - * Create a stream on a file. - * - * PARAMS - * lpszPath [I] Path of file to create stream on - * dwMode [I] Mode to create stream in - * lppStream [O] Destination for created IStream object - * - * RETURNS - * Success: S_OK. lppStream contains the new IStream object - * Failure: E_INVALIDARG if any parameter is invalid, or an HRESULT error code - */ -HRESULT WINAPI SHCreateStreamOnFileA(LPCSTR lpszPath, DWORD dwMode, - IStream **lppStream) -{ - WCHAR szPath[MAX_PATH]; - - TRACE("(%s,%d,%p)\n", debugstr_a(lpszPath), dwMode, lppStream); - - if (!lpszPath) - return HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND); - - MultiByteToWideChar(CP_ACP, 0, lpszPath, -1, szPath, MAX_PATH); - return SHCreateStreamOnFileW(szPath, dwMode, lppStream); -} - /************************************************************************* * @ [SHLWAPI.184] * diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index 134bb47177..843c62b21e 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -683,9 +683,9 @@ @ stdcall SHCopyKeyA(long str long long) @ stdcall SHCopyKeyW(long wstr long long) @ stdcall SHCreateShellPalette(long) -@ stdcall SHCreateStreamOnFileA(str long ptr) -@ stdcall SHCreateStreamOnFileEx(wstr long long long ptr ptr) -@ stdcall SHCreateStreamOnFileW(wstr long ptr) +@ stdcall SHCreateStreamOnFileA(str long ptr) shcore.SHCreateStreamOnFileA +@ stdcall SHCreateStreamOnFileEx(wstr long long long ptr ptr) shcore.SHCreateStreamOnFileEx +@ stdcall SHCreateStreamOnFileW(wstr long ptr) shcore.SHCreateStreamOnFileW @ stdcall SHCreateStreamWrapper(ptr ptr long ptr) @ stdcall SHCreateThreadRef(ptr ptr) @ stdcall SHDeleteEmptyKeyA(long ptr)
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/shlwapi/ordinal.c | 146 +++----------------------------------- dlls/shlwapi/shlwapi.spec | 10 +-- 2 files changed, 14 insertions(+), 142 deletions(-)
diff --git a/dlls/shlwapi/ordinal.c b/dlls/shlwapi/ordinal.c index 449b47b2f7..60e5761944 100644 --- a/dlls/shlwapi/ordinal.c +++ b/dlls/shlwapi/ordinal.c @@ -57,7 +57,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell); extern HINSTANCE shlwapi_hInstance; extern DWORD SHLWAPI_ThreadRef_index;
-HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*); +static HRESULT iunknown_query_service(IUnknown*,REFGUID,REFIID,LPVOID*); HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,DWORD); BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD);
@@ -299,7 +299,7 @@ HRESULT WINAPI RegisterDefaultAcceptHeaders(LPBC lpBC, IUnknown *lpUnknown)
TRACE("(%p, %p)\n", lpBC, lpUnknown);
- hr = IUnknown_QueryService(lpUnknown, &IID_IWebBrowserApp, &IID_IWebBrowserApp, (void**)&pBrowser); + hr = iunknown_query_service(lpUnknown, &IID_IWebBrowserApp, &IID_IWebBrowserApp, (void**)&pBrowser); if (FAILED(hr)) return hr;
@@ -1172,29 +1172,6 @@ HRESULT WINAPI ConnectToConnectionPoint(IUnknown* lpUnkSink, REFIID riid, BOOL f return hRet; }
-/************************************************************************* - * @ [SHLWAPI.169] - * - * Release an interface and zero a supplied pointer. - * - * PARAMS - * lpUnknown [I] Object to release - * - * RETURNS - * Nothing. - */ -void WINAPI IUnknown_AtomicRelease(IUnknown ** lpUnknown) -{ - TRACE("(%p)\n", lpUnknown); - - if(!lpUnknown || !*lpUnknown) return; - - TRACE("doing Release\n"); - - IUnknown_Release(*lpUnknown); - *lpUnknown = NULL; -} - /************************************************************************* * @ [SHLWAPI.170] * @@ -1342,44 +1319,6 @@ HRESULT WINAPI IUnknown_SetOwner(IUnknown *iface, IUnknown *pUnk) return hr; }
-/************************************************************************* - * @ [SHLWAPI.174] - * - * Call either IObjectWithSite_SetSite() or IInternetSecurityManager_SetSecuritySite() on - * an object. - * - */ -HRESULT WINAPI IUnknown_SetSite( - IUnknown *obj, /* [in] OLE object */ - IUnknown *site) /* [in] Site interface */ -{ - HRESULT hr; - IObjectWithSite *iobjwithsite; - IInternetSecurityManager *isecmgr; - - if (!obj) return E_FAIL; - - hr = IUnknown_QueryInterface(obj, &IID_IObjectWithSite, (LPVOID *)&iobjwithsite); - TRACE("IID_IObjectWithSite QI ret=%08x, %p\n", hr, iobjwithsite); - if (SUCCEEDED(hr)) - { - hr = IObjectWithSite_SetSite(iobjwithsite, site); - TRACE("done IObjectWithSite_SetSite ret=%08x\n", hr); - IObjectWithSite_Release(iobjwithsite); - } - else - { - hr = IUnknown_QueryInterface(obj, &IID_IInternetSecurityManager, (LPVOID *)&isecmgr); - TRACE("IID_IInternetSecurityManager QI ret=%08x, %p\n", hr, isecmgr); - if (FAILED(hr)) return hr; - - hr = IInternetSecurityManager_SetSecuritySite(isecmgr, (IInternetSecurityMgrSite *)site); - TRACE("done IInternetSecurityManager_SetSecuritySite ret=%08x\n", hr); - IInternetSecurityManager_Release(isecmgr); - } - return hr; -} - /************************************************************************* * @ [SHLWAPI.175] * @@ -1421,26 +1360,7 @@ HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID *clsid) return hr; }
-/************************************************************************* - * @ [SHLWAPI.176] - * - * Retrieve a Service Interface from an object. - * - * PARAMS - * lpUnknown [I] Object to get an IServiceProvider interface from - * sid [I] Service ID for IServiceProvider_QueryService() call - * riid [I] Function requested for QueryService call - * lppOut [O] Destination for the service interface pointer - * - * RETURNS - * Success: S_OK. lppOut contains an object providing the requested service - * Failure: An HRESULT error code - * - * NOTES - * lpUnknown is expected to support the IServiceProvider interface. - */ -HRESULT WINAPI IUnknown_QueryService(IUnknown* lpUnknown, REFGUID sid, REFIID riid, - LPVOID *lppOut) +static HRESULT iunknown_query_service(IUnknown* lpUnknown, REFGUID sid, REFIID riid, LPVOID *lppOut) { IServiceProvider* pService = NULL; HRESULT hRet; @@ -1500,7 +1420,7 @@ HRESULT WINAPI IUnknown_QueryServiceExec(IUnknown *lpUnknown, REFIID service, TRACE("%p %s %s %d %08x %p %p\n", lpUnknown, debugstr_guid(service), debugstr_guid(group), cmdId, cmdOpt, pIn, pOut);
- hr = IUnknown_QueryService(lpUnknown, service, &IID_IOleCommandTarget, (void**)&target); + hr = iunknown_query_service(lpUnknown, service, &IID_IOleCommandTarget, (void**)&target); if (hr == S_OK) { hr = IOleCommandTarget_Exec(target, group, cmdId, cmdOpt, pIn, pOut); @@ -1537,7 +1457,7 @@ HRESULT WINAPI IUnknown_ProfferService(IUnknown *lpUnknown, REFGUID service, ISe
TRACE("%p %s %p %p\n", lpUnknown, debugstr_guid(service), pService, pCookie);
- hr = IUnknown_QueryService(lpUnknown, &IID_IProfferService, &IID_IProfferService, (void**)&proffer); + hr = iunknown_query_service(lpUnknown, &IID_IProfferService, &IID_IProfferService, (void**)&proffer); if (hr == S_OK) { if (pService) @@ -1905,7 +1825,7 @@ HRESULT WINAPI IUnknown_HandleIRestrict(LPUNKNOWN lpUnknown, PVOID lpArg1,
if (lpUnknown && lpArg4) { - hRet = IUnknown_QueryService(lpUnknown, (REFGUID)service_id, + hRet = iunknown_query_service(lpUnknown, (REFGUID)service_id, (REFGUID)function_id, (void**)&lpUnkInner);
if (SUCCEEDED(hRet) && lpUnkInner) @@ -2115,32 +2035,6 @@ int WINAPI SHSearchMapInt(const int *lpKeys, const int *lpValues, int iLen, int return -1; /* Not found */ }
- -/************************************************************************* - * @ [SHLWAPI.199] - * - * Copy an interface pointer - * - * PARAMS - * lppDest [O] Destination for copy - * lpUnknown [I] Source for copy - * - * RETURNS - * Nothing. - */ -VOID WINAPI IUnknown_Set(IUnknown **lppDest, IUnknown *lpUnknown) -{ - TRACE("(%p,%p)\n", lppDest, lpUnknown); - - IUnknown_AtomicRelease(lppDest); - - if (lpUnknown) - { - IUnknown_AddRef(lpUnknown); - *lppDest = lpUnknown; - } -} - /************************************************************************* * @ [SHLWAPI.200] * @@ -2535,29 +2429,6 @@ LRESULT CALLBACK SHDefWindowProc(HWND hWnd, UINT uMessage, WPARAM wParam, LPARAM return DefWindowProcA(hWnd, uMessage, wParam, lParam); }
-/************************************************************************* - * @ [SHLWAPI.256] - */ -HRESULT WINAPI IUnknown_GetSite(LPUNKNOWN lpUnknown, REFIID iid, PVOID *lppSite) -{ - HRESULT hRet = E_INVALIDARG; - LPOBJECTWITHSITE lpSite = NULL; - - TRACE("(%p,%s,%p)\n", lpUnknown, debugstr_guid(iid), lppSite); - - if (lpUnknown && iid && lppSite) - { - hRet = IUnknown_QueryInterface(lpUnknown, &IID_IObjectWithSite, - (void**)&lpSite); - if (SUCCEEDED(hRet) && lpSite) - { - hRet = IObjectWithSite_GetSite(lpSite, iid, lppSite); - IObjectWithSite_Release(lpSite); - } - } - return hRet; -} - /************************************************************************* * @ [SHLWAPI.257] * @@ -2758,7 +2629,8 @@ VOID WINAPI SHWeakReleaseInterface(IUnknown *lpDest, IUnknown **lppUnknown) { /* Copy Reference*/ IUnknown_AddRef(lpDest); - IUnknown_AtomicRelease(lppUnknown); /* Release existing interface */ + IUnknown_Release(*lppUnknown); /* Release existing interface */ + *lppUnknown = NULL; } }
@@ -5174,7 +5046,7 @@ HRESULT WINAPI IUnknown_QueryServiceForWebBrowserApp(IUnknown* lpUnknown, REFGUID riid, LPVOID *lppOut) { FIXME("%p %s %p semi-STUB\n", lpUnknown, debugstr_guid(riid), lppOut); - return IUnknown_QueryService(lpUnknown,&IID_IWebBrowserApp,riid,lppOut); + return iunknown_query_service(lpUnknown,&IID_IWebBrowserApp,riid,lppOut); }
/************************************************************************** diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec index 843c62b21e..62ebb85f46 100644 --- a/dlls/shlwapi/shlwapi.spec +++ b/dlls/shlwapi/shlwapi.spec @@ -166,14 +166,14 @@ 166 stdcall -noname SHIsEmptyStream(ptr) 167 stdcall -noname SHSetParentHwnd(long ptr) 168 stdcall -ordinal ConnectToConnectionPoint(ptr ptr long ptr ptr ptr) -169 stdcall -ordinal IUnknown_AtomicRelease(long) +169 stdcall -ordinal IUnknown_AtomicRelease(ptr) shcore.IUnknown_AtomicRelease 170 stdcall -noname PathSkipLeadingSlashesA(str) 171 stdcall -noname SHIsSameObject(ptr ptr) 172 stdcall -ordinal IUnknown_GetWindow(ptr ptr) 173 stdcall -noname IUnknown_SetOwner(ptr ptr) -174 stdcall -ordinal IUnknown_SetSite(ptr ptr) +174 stdcall -ordinal IUnknown_SetSite(ptr ptr) shcore.IUnknown_SetSite 175 stdcall -noname IUnknown_GetClassID(ptr ptr) -176 stdcall -ordinal IUnknown_QueryService(ptr ptr ptr ptr) +176 stdcall -ordinal IUnknown_QueryService(ptr ptr ptr ptr) shcore.IUnknown_QueryService 177 stdcall -noname SHLoadMenuPopup(ptr wstr) 178 stdcall -noname SHPropagateMessage(ptr long long long long) 179 stdcall -noname SHMenuIndexFromID(long long) @@ -196,7 +196,7 @@ 196 stdcall -noname SHVerbExistsNA(str ptr ptr long) 197 stdcall -noname SHFillRectClr(long ptr long) 198 stdcall -noname SHSearchMapInt(ptr ptr long long) -199 stdcall -ordinal IUnknown_Set(ptr ptr) +199 stdcall -ordinal IUnknown_Set(ptr ptr) shcore.IUnknown_Set 200 stdcall -noname MayQSForward(ptr ptr ptr long ptr ptr) 201 stdcall -noname MayExecForward(ptr long ptr long long ptr ptr) 202 stdcall -noname IsQSForward(ptr long ptr) @@ -253,7 +253,7 @@ 253 stub -noname StopWatchExA 254 stub -noname StopWatchExW 255 stub -noname EventTraceHandler -256 stdcall -ordinal IUnknown_GetSite(ptr ptr ptr) +256 stdcall -ordinal IUnknown_GetSite(ptr ptr ptr) shcore.IUnknown_GetSite 257 stdcall -noname SHCreateWorkerWindowA(ptr ptr long long ptr long) 258 stub -noname SHRegisterWaitForSingleObject 259 stub -noname SHUnregisterWait