From: Torge Matthies openglfreak@googlemail.com
Signed-off-by: Torge Matthies openglfreak@googlemail.com --- dlls/advapi32/tests/registry.c | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
diff --git a/dlls/advapi32/tests/registry.c b/dlls/advapi32/tests/registry.c index 8bffefe8628..86784a16d5c 100644 --- a/dlls/advapi32/tests/registry.c +++ b/dlls/advapi32/tests/registry.c @@ -4955,6 +4955,39 @@ static void test_RegRenameKey(void) RegCloseKey(key); }
+static inline BOOL check_cs_number( const WCHAR *str ) +{ + if (str[0] < '0' || str[0] > '9' || str[1] < '0' || str[1] > '9' || str[2] < '0' || str[2] > '9') + return FALSE; + if (str[0] == '0' && str[1] == '0' && str[2] == '0') + return FALSE; + return TRUE; +} + +static void test_control_set_symlink(void) +{ + static const WCHAR target_pfxW[] = L"\REGISTRY\Machine\System\ControlSet"; + DWORD target_len, type, len, err; + BYTE buffer[1024]; + HKEY key; + + target_len = sizeof(target_pfxW) + 3 * sizeof(WCHAR); + + err = RegOpenKeyExA( HKEY_LOCAL_MACHINE, "System\CurrentControlSet", REG_OPTION_OPEN_LINK, KEY_QUERY_VALUE, &key ); + ok( err == ERROR_SUCCESS, "RegOpenKeyEx failed error %lu\n", err ); + len = sizeof(buffer); + err = RegQueryValueExA( key, "SymbolicLinkValue", NULL, &type, buffer, &len ); + todo_wine + ok( err == ERROR_SUCCESS, "RegQueryValueEx failed error %lu\n", err ); + todo_wine + ok( len == target_len - sizeof(WCHAR), "wrong len %lu\n", len ); + todo_wine + ok( !_wcsnicmp( (WCHAR*)buffer, target_pfxW, ARRAY_SIZE(target_pfxW) - 1 ) && + check_cs_number( (WCHAR*)buffer + ARRAY_SIZE(target_pfxW) - 1 ), + "wrong link target\n" ); + RegCloseKey( key ); +} + START_TEST(registry) { /* Load pointers for functions that are not available in all Windows versions */ @@ -4996,6 +5029,7 @@ START_TEST(registry) test_EnumDynamicTimeZoneInformation(); test_perflib_key(); test_RegRenameKey(); + test_control_set_symlink();
/* cleanup */ delete_key( hkey_main );