Commit 410610b5 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

odbccp32: Handle NULL parameter in SQLWritePrivateProfileStringW.

parent d94de38f
......@@ -1561,6 +1561,7 @@ BOOL WINAPI SQLWriteFileDSN(LPCSTR lpszFileName, LPCSTR lpszAppName,
BOOL WINAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection, LPCWSTR lpszEntry,
LPCWSTR lpszString, LPCWSTR lpszFilename)
{
static const WCHAR empty[] = {0};
LONG ret;
HKEY hkey;
......@@ -1584,7 +1585,10 @@ BOOL WINAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection, LPCWSTR lpszEntry
if ((ret = RegCreateKeyW(hkeyfilename, lpszSection, &hkey_section)) == ERROR_SUCCESS)
{
ret = RegSetValueExW(hkey_section, lpszEntry, 0, REG_SZ, (BYTE*)lpszString, (lstrlenW(lpszString)+1)*sizeof(WCHAR));
if(lpszString)
ret = RegSetValueExW(hkey_section, lpszEntry, 0, REG_SZ, (BYTE*)lpszString, (lstrlenW(lpszString)+1)*sizeof(WCHAR));
else
ret = RegSetValueExW(hkey_section, lpszEntry, 0, REG_SZ, (BYTE*)empty, sizeof(empty));
RegCloseKey(hkey_section);
}
......
......@@ -171,6 +171,9 @@ static void test_SQLWritePrivateProfileString(void)
{
HKEY hkey;
ret = SQLWritePrivateProfileString("wineodbc", "testing" , NULL, "odbc.ini");
ok(ret, "SQLWritePrivateProfileString failed\n");
reg_ret = RegOpenKeyExW(HKEY_CURRENT_USER, odbc_key, 0, KEY_READ, &hkey);
ok(reg_ret == ERROR_SUCCESS, "RegOpenKeyExW failed\n");
if(reg_ret == ERROR_SUCCESS)
......
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