2853
2854
hkey = pSHGetShellKey(SHKEY_Root_HKLM, WineTestW, FALSE);
2854
2855
ok(hkey == NULL, "hkey != NULL\n");
2857
hkey = pSHGetShellKey(SHKEY_Root_HKLM, NULL, FALSE);
2858
ok(hkey != NULL, "Can't open key\n");
2859
ok(SUCCEEDED(RegDeleteKeyW(hkey, WineTestW)), "Can't delete key\n");
2856
2862
hkey = pSHGetShellKey(SHKEY_Root_HKLM, WineTestW, TRUE);
2857
ok(hkey != NULL, "Can't create key\n");
2860
hkey = pSHGetShellKey(SHKEY_Root_HKLM, NULL, FALSE);
2861
ok(hkey != NULL, "Can't create key\n");
2862
ok(SUCCEEDED(RegDeleteKeyW(hkey, WineTestW)), "Can't delte key\n");
2863
if (!hkey && GetLastError() == ERROR_ACCESS_DENIED)
2865
skip("Not authorized to create keys\n");
2868
ok(hkey != NULL, "Can't create key\n");
2863
2869
RegCloseKey(hkey);
2865
2871
if (!pSKGetValueW || !pSKSetValueW || !pSKDeleteValueW || !pSKAllocValueW)
2943
2951
#undef MAKEFUNC
2954
static void test_SHSetParentHwnd(void)
2956
HWND hwnd, hwnd2, ret;
2959
if (!pSHSetParentHwnd)
2961
win_skip("SHSetParentHwnd not available\n");
2965
hwnd = CreateWindowA("Button", "", WS_VISIBLE, 0, 0, 10, 10, NULL, NULL, NULL, NULL);
2966
ok(hwnd != NULL, "got %p\n", hwnd);
2968
hwnd2 = CreateWindowA("Button", "", WS_VISIBLE | WS_CHILD, 0, 0, 10, 10, hwnd, NULL, NULL, NULL);
2969
ok(hwnd2 != NULL, "got %p\n", hwnd2);
2972
ret = pSHSetParentHwnd(NULL, NULL);
2973
ok(ret == NULL, "got %p\n", ret);
2975
/* set to no parent while already no parent present */
2976
ret = GetParent(hwnd);
2977
ok(ret == NULL, "got %p\n", ret);
2978
style = GetWindowLongA(hwnd, GWL_STYLE);
2979
ok((style & (WS_POPUP|WS_CHILD)) == 0, "got style 0x%08x\n", style);
2980
ret = pSHSetParentHwnd(hwnd, NULL);
2981
ok(ret == NULL, "got %p\n", ret);
2982
style = GetWindowLongA(hwnd, GWL_STYLE);
2983
ok((style & (WS_POPUP|WS_CHILD)) == 0, "got style 0x%08x\n", style);
2985
/* reset to null parent from not null */
2986
ret = GetParent(hwnd2);
2987
ok(ret == hwnd, "got %p\n", ret);
2988
style = GetWindowLongA(hwnd2, GWL_STYLE);
2989
ok((style & (WS_POPUP|WS_CHILD)) == WS_CHILD, "got style 0x%08x\n", style);
2990
ret = pSHSetParentHwnd(hwnd2, NULL);
2991
ok(ret == NULL, "got %p\n", ret);
2992
style = GetWindowLongA(hwnd2, GWL_STYLE);
2993
ok((style & (WS_POPUP|WS_CHILD)) == WS_POPUP, "got style 0x%08x\n", style);
2994
ret = GetParent(hwnd2);
2995
ok(ret == NULL, "got %p\n", ret);
2997
/* set parent back */
2998
style = GetWindowLongA(hwnd2, GWL_STYLE);
2999
SetWindowLongA(hwnd2, GWL_STYLE, style & ~(WS_CHILD|WS_POPUP));
3000
style = GetWindowLongA(hwnd2, GWL_STYLE);
3001
ok((style & (WS_CHILD|WS_POPUP)) == 0, "got 0x%08x\n", style);
3003
ret = pSHSetParentHwnd(hwnd2, hwnd);
3004
todo_wine ok(ret == NULL, "got %p\n", ret);
3006
style = GetWindowLongA(hwnd2, GWL_STYLE);
3007
ok((style & (WS_POPUP|WS_CHILD)) == WS_CHILD, "got style 0x%08x\n", style);
3008
ret = GetParent(hwnd2);
3009
ok(ret == hwnd, "got %p\n", ret);
3011
/* try to set same parent again */
3013
style = GetWindowLongA(hwnd2, GWL_STYLE);
3014
SetWindowLongA(hwnd2, GWL_STYLE, style | WS_POPUP);
3015
ret = pSHSetParentHwnd(hwnd2, hwnd);
3016
todo_wine ok(ret == NULL, "got %p\n", ret);
3017
style = GetWindowLongA(hwnd2, GWL_STYLE);
3018
ok((style & (WS_CHILD|WS_POPUP)) == WS_CHILD, "got 0x%08x\n", style);
3019
ret = GetParent(hwnd2);
3020
ok(ret == hwnd, "got %p\n", ret);
3022
/* without WS_POPUP */
3023
style = GetWindowLongA(hwnd2, GWL_STYLE);
3024
SetWindowLongA(hwnd2, GWL_STYLE, style | ~WS_POPUP);
3025
ret = pSHSetParentHwnd(hwnd2, hwnd);
3026
todo_wine ok(ret == hwnd, "got %p\n", ret);
3027
style = GetWindowLongA(hwnd2, GWL_STYLE);
3028
ok((style & (WS_CHILD|WS_POPUP)) == WS_CHILD, "got 0x%08x\n", style);
3029
ret = GetParent(hwnd2);
3030
ok(ret == hwnd, "got %p\n", ret);
3032
DestroyWindow(hwnd);
3033
DestroyWindow(hwnd2);
2946
3036
START_TEST(ordinal)
2948
3038
hShlwapi = GetModuleHandleA("shlwapi.dll");