out = 0xfeedface;
rc = pSHPropertyBag_ReadLONG(NULL, szName1, &out);
- ok(rc == E_INVALIDARG || broken(rc == 0), "incorrect return %x\n",rc);
+ ok(rc == E_INVALIDARG || broken(rc == S_OK), "incorrect return %x\n",rc);
ok(out == 0xfeedface, "value should not have changed\n");
rc = pSHPropertyBag_ReadLONG(&pb->IPropertyBag_iface, NULL, &out);
- ok(rc == E_INVALIDARG || broken(rc == 0) || broken(rc == 1), "incorrect return %x\n",rc);
+ ok(rc == E_INVALIDARG || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %x\n",rc);
ok(out == 0xfeedface, "value should not have changed\n");
rc = pSHPropertyBag_ReadLONG(&pb->IPropertyBag_iface, szName1, NULL);
- ok(rc == E_INVALIDARG || broken(rc == 0) || broken(rc == 1), "incorrect return %x\n",rc);
+ ok(rc == E_INVALIDARG || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %x\n",rc);
rc = pSHPropertyBag_ReadLONG(&pb->IPropertyBag_iface, szName1, &out);
- ok(rc == DISP_E_BADVARTYPE || broken(rc == 0) || broken(rc == 1), "incorrect return %x\n",rc);
+ ok(rc == DISP_E_BADVARTYPE || broken(rc == S_OK) || broken(rc == S_FALSE), "incorrect return %x\n",rc);
ok(out == 0xfeedface || broken(out == 0xfeedfa00), "value should not have changed %x\n",out);
IUnknown_Release((IUnknown*)pb);
}
-
-
static void test_SHSetWindowBits(void)
{
HWND hwnd;
#include <shlwapi.h>
#include <wininet.h>
-static HRESULT (WINAPI *pPathIsValidCharA)(char,DWORD);
-static HRESULT (WINAPI *pPathIsValidCharW)(WCHAR,DWORD);
+static BOOL (WINAPI *pPathIsValidCharA)(char,DWORD);
+static BOOL (WINAPI *pPathIsValidCharW)(WCHAR,DWORD);
static LPWSTR (WINAPI *pPathCombineW)(LPWSTR, LPCWSTR, LPCWSTR);
static HRESULT (WINAPI *pPathCreateFromUrlA)(LPCSTR, LPSTR, LPDWORD, DWORD);
static HRESULT (WINAPI *pPathCreateFromUrlW)(LPCWSTR, LPWSTR, LPDWORD, DWORD);
}
}
+static void test_PathStripPathA(void)
+{
+ const char const_path[] = "test";
+ char path[] = "short//path\\file.txt";
+
+ PathStripPathA(path);
+ ok(!strcmp(path, "file.txt"), "path = %s\n", path);
+
+ /* following test should not crash */
+ /* LavView 2013 depends on that behaviour */
+ PathStripPathA((char*)const_path);
+}
+
START_TEST(path)
{
HMODULE hShlwapi = GetModuleHandleA("shlwapi.dll");
test_PathUnExpandEnvStrings();
test_PathIsRelativeA();
test_PathIsRelativeW();
+ test_PathStripPathA();
}
static DWORD (WINAPI *pSHRegGetPathA)(HKEY,LPCSTR,LPCSTR,LPSTR,DWORD);
static LSTATUS (WINAPI *pSHRegGetValueA)(HKEY,LPCSTR,LPCSTR,SRRF,LPDWORD,LPVOID,LPDWORD);
static LSTATUS (WINAPI *pSHRegCreateUSKeyW)(LPCWSTR,REGSAM,HUSKEY,PHUSKEY,DWORD);
+static LSTATUS (WINAPI *pSHRegOpenUSKeyW)(LPCWSTR,REGSAM,HUSKEY,PHUSKEY,BOOL);
+static LSTATUS (WINAPI *pSHRegCloseUSKey)(HUSKEY);
static const char sTestpath1[] = "%LONGSYSTEMVAR%\\subdir1";
static const char sTestpath2[] = "%FOO%\\subdir1";
ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
}
+static void test_SHRegCloseUSKey(void)
+{
+ static const WCHAR localW[] = {'S','o','f','t','w','a','r','e',0};
+ LONG ret;
+ HUSKEY key;
+
+ if (!pSHRegOpenUSKeyW || !pSHRegCloseUSKey)
+ {
+ win_skip("SHRegOpenUSKeyW or SHRegCloseUSKey not available\n");
+ return;
+ }
+
+ ret = pSHRegCloseUSKey(NULL);
+ ok(ret == ERROR_INVALID_PARAMETER, "got %d\n", ret);
+
+ ret = pSHRegOpenUSKeyW(localW, KEY_ALL_ACCESS, NULL, &key, FALSE);
+ ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+
+ ret = pSHRegCloseUSKey(key);
+ ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+
+ /* Test with limited rights, specially without KEY_SET_VALUE */
+ ret = pSHRegOpenUSKeyW(localW, KEY_QUERY_VALUE, NULL, &key, FALSE);
+ ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+
+ ret = pSHRegCloseUSKey(key);
+ ok(ret == ERROR_SUCCESS, "got %d\n", ret);
+}
+
START_TEST(shreg)
{
HKEY hkey = create_test_entries();
pSHRegGetPathA = (void*)GetProcAddress(hshlwapi,"SHRegGetPathA");
pSHRegGetValueA = (void*)GetProcAddress(hshlwapi,"SHRegGetValueA");
pSHRegCreateUSKeyW = (void*)GetProcAddress(hshlwapi, "SHRegCreateUSKeyW");
+ pSHRegOpenUSKeyW = (void*)GetProcAddress(hshlwapi, "SHRegOpenUSKeyW");
+ pSHRegCloseUSKey = (void*)GetProcAddress(hshlwapi, "SHRegCloseUSKey");
test_SHGetValue();
test_SHRegGetValue();
test_SHCopyKey();
test_SHDeleteKey();
test_SHRegCreateUSKeyW();
+ test_SHRegCloseUSKey();
delete_key( hkey, "Software\\Wine", "Test" );
}