Commit 5eb8894e authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

odbccp32: Avoid using RegQueryInfoKey() in SQLGetInstalledDrivers().

parent 737bbbec
...@@ -510,15 +510,20 @@ BOOL WINAPI SQLGetInstalledDriversW(WCHAR *buf, WORD size, WORD *sizeout) ...@@ -510,15 +510,20 @@ BOOL WINAPI SQLGetInstalledDriversW(WCHAR *buf, WORD size, WORD *sizeout)
return FALSE; return FALSE;
} }
RegQueryInfoKeyW(drivers, 0, 0, 0, 0, 0, 0, 0, &valuelen, 0, 0, 0); valuelen = 256;
value = heap_alloc(++valuelen * sizeof(WCHAR)); value = heap_alloc(valuelen * sizeof(WCHAR));
size--; size--;
while (1) while (1)
{ {
len = valuelen; len = valuelen;
res = RegEnumValueW(drivers, index++, value, &len, NULL, NULL, NULL, NULL); res = RegEnumValueW(drivers, index, value, &len, NULL, NULL, NULL, NULL);
while (res == ERROR_MORE_DATA)
{
value = heap_realloc(value, ++len * sizeof(WCHAR));
res = RegEnumValueW(drivers, index, value, &len, NULL, NULL, NULL, NULL);
}
if (res == ERROR_SUCCESS) if (res == ERROR_SUCCESS)
{ {
lstrcpynW(buf + written, value, size - written); lstrcpynW(buf + written, value, size - written);
...@@ -532,6 +537,7 @@ BOOL WINAPI SQLGetInstalledDriversW(WCHAR *buf, WORD size, WORD *sizeout) ...@@ -532,6 +537,7 @@ BOOL WINAPI SQLGetInstalledDriversW(WCHAR *buf, WORD size, WORD *sizeout)
ret = FALSE; ret = FALSE;
break; break;
} }
index++;
} }
buf[written++] = 0; buf[written++] = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment