mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 08:25:03 +00:00
[ODBCCP32] Sync with Wine Staging 4.0. CORE-15682
This commit is contained in:
parent
04ef5f7a85
commit
d34c33223c
2 changed files with 50 additions and 23 deletions
|
@ -29,7 +29,11 @@
|
||||||
#include "winbase.h"
|
#include "winbase.h"
|
||||||
#include "winreg.h"
|
#include "winreg.h"
|
||||||
#include "winnls.h"
|
#include "winnls.h"
|
||||||
|
#include "sqlext.h"
|
||||||
#include "wine/unicode.h"
|
#include "wine/unicode.h"
|
||||||
|
#ifdef __REACTOS__
|
||||||
|
#undef TRACE_ON
|
||||||
|
#endif
|
||||||
#include "wine/debug.h"
|
#include "wine/debug.h"
|
||||||
#include "wine/heap.h"
|
#include "wine/heap.h"
|
||||||
|
|
||||||
|
@ -71,7 +75,7 @@ static const WCHAR odbc_error_invalid_keyword[] = {'I','n','v','a','l','i','d','
|
||||||
/* Push an error onto the error stack, taking care of ranges etc. */
|
/* Push an error onto the error stack, taking care of ranges etc. */
|
||||||
static void push_error(int code, LPCWSTR msg)
|
static void push_error(int code, LPCWSTR msg)
|
||||||
{
|
{
|
||||||
if (num_errors < sizeof error_code/sizeof error_code[0])
|
if (num_errors < ARRAY_SIZE(error_code))
|
||||||
{
|
{
|
||||||
error_code[num_errors] = code;
|
error_code[num_errors] = code;
|
||||||
error_msg[num_errors] = msg;
|
error_msg[num_errors] = msg;
|
||||||
|
@ -259,20 +263,26 @@ static HMODULE load_config_driver(const WCHAR *driver)
|
||||||
if ((ret = RegOpenKeyW(hkey, driver, &hkeydriver)) == ERROR_SUCCESS)
|
if ((ret = RegOpenKeyW(hkey, driver, &hkeydriver)) == ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
ret = RegGetValueW(hkeydriver, NULL, reg_driver, RRF_RT_REG_SZ, &type, NULL, &size);
|
ret = RegGetValueW(hkeydriver, NULL, reg_driver, RRF_RT_REG_SZ, &type, NULL, &size);
|
||||||
if(ret == ERROR_MORE_DATA)
|
if(ret != ERROR_SUCCESS || type != REG_SZ)
|
||||||
{
|
{
|
||||||
filename = HeapAlloc(GetProcessHeap(), 0, size);
|
RegCloseKey(hkeydriver);
|
||||||
if(!filename)
|
RegCloseKey(hkey);
|
||||||
{
|
push_error(ODBC_ERROR_INVALID_DSN, odbc_error_invalid_dsn);
|
||||||
RegCloseKey(hkeydriver);
|
|
||||||
RegCloseKey(hkey);
|
|
||||||
push_error(ODBC_ERROR_OUT_OF_MEM, odbc_error_out_of_mem);
|
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
|
||||||
ret = RegGetValueW(hkeydriver, NULL, driver, RRF_RT_REG_SZ, &type, filename, &size);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filename = HeapAlloc(GetProcessHeap(), 0, size);
|
||||||
|
if(!filename)
|
||||||
|
{
|
||||||
|
RegCloseKey(hkeydriver);
|
||||||
|
RegCloseKey(hkey);
|
||||||
|
push_error(ODBC_ERROR_OUT_OF_MEM, odbc_error_out_of_mem);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ret = RegGetValueW(hkeydriver, NULL, reg_driver, RRF_RT_REG_SZ, &type, filename, &size);
|
||||||
|
|
||||||
RegCloseKey(hkeydriver);
|
RegCloseKey(hkeydriver);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +582,10 @@ BOOL WINAPI SQLGetInstalledDrivers(char *buf, WORD size, WORD *sizeout)
|
||||||
|
|
||||||
ret = SQLGetInstalledDriversW(wbuf, size, &written);
|
ret = SQLGetInstalledDriversW(wbuf, size, &written);
|
||||||
if (!ret)
|
if (!ret)
|
||||||
|
{
|
||||||
|
heap_free(wbuf);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
*sizeout = WideCharToMultiByte(CP_ACP, 0, wbuf, written, NULL, 0, NULL, NULL);
|
*sizeout = WideCharToMultiByte(CP_ACP, 0, wbuf, written, NULL, 0, NULL, NULL);
|
||||||
WideCharToMultiByte(CP_ACP, 0, wbuf, written, buf, size, NULL, NULL);
|
WideCharToMultiByte(CP_ACP, 0, wbuf, written, buf, size, NULL, NULL);
|
||||||
|
@ -1505,34 +1518,44 @@ BOOL WINAPI SQLSetConfigMode(UWORD wConfigMode)
|
||||||
|
|
||||||
BOOL WINAPI SQLValidDSNW(LPCWSTR lpszDSN)
|
BOOL WINAPI SQLValidDSNW(LPCWSTR lpszDSN)
|
||||||
{
|
{
|
||||||
|
static const WCHAR invalid[] = {'[',']','{','}','(',')',',',';','?','*','=','!','@','\\',0};
|
||||||
clear_errors();
|
clear_errors();
|
||||||
FIXME("%s\n", debugstr_w(lpszDSN));
|
TRACE("%s\n", debugstr_w(lpszDSN));
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
return FALSE;
|
if(strlenW(lpszDSN) > SQL_MAX_DSN_LENGTH || strpbrkW(lpszDSN, invalid) != NULL)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI SQLValidDSN(LPCSTR lpszDSN)
|
BOOL WINAPI SQLValidDSN(LPCSTR lpszDSN)
|
||||||
{
|
{
|
||||||
|
static const char *invalid = "[]{}(),;?*=!@\\";
|
||||||
clear_errors();
|
clear_errors();
|
||||||
FIXME("%s\n", debugstr_a(lpszDSN));
|
TRACE("%s\n", debugstr_a(lpszDSN));
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
|
||||||
return FALSE;
|
if(strlen(lpszDSN) > SQL_MAX_DSN_LENGTH || strpbrk(lpszDSN, invalid) != NULL)
|
||||||
|
{
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI SQLWriteDSNToIniW(LPCWSTR lpszDSN, LPCWSTR lpszDriver)
|
BOOL WINAPI SQLWriteDSNToIniW(LPCWSTR lpszDSN, LPCWSTR lpszDriver)
|
||||||
{
|
{
|
||||||
clear_errors();
|
clear_errors();
|
||||||
FIXME("%s %s\n", debugstr_w(lpszDSN), debugstr_w(lpszDriver));
|
FIXME("%s %s\n", debugstr_w(lpszDSN), debugstr_w(lpszDriver));
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
return TRUE;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI SQLWriteDSNToIni(LPCSTR lpszDSN, LPCSTR lpszDriver)
|
BOOL WINAPI SQLWriteDSNToIni(LPCSTR lpszDSN, LPCSTR lpszDriver)
|
||||||
{
|
{
|
||||||
clear_errors();
|
clear_errors();
|
||||||
FIXME("%s %s\n", debugstr_a(lpszDSN), debugstr_a(lpszDriver));
|
FIXME("%s %s\n", debugstr_a(lpszDSN), debugstr_a(lpszDriver));
|
||||||
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
|
return TRUE;
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
BOOL WINAPI SQLWriteFileDSNW(LPCWSTR lpszFileName, LPCWSTR lpszAppName,
|
BOOL WINAPI SQLWriteFileDSNW(LPCWSTR lpszFileName, LPCWSTR lpszAppName,
|
||||||
|
@ -1558,6 +1581,7 @@ BOOL WINAPI SQLWriteFileDSN(LPCSTR lpszFileName, LPCSTR lpszAppName,
|
||||||
BOOL WINAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection, LPCWSTR lpszEntry,
|
BOOL WINAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection, LPCWSTR lpszEntry,
|
||||||
LPCWSTR lpszString, LPCWSTR lpszFilename)
|
LPCWSTR lpszString, LPCWSTR lpszFilename)
|
||||||
{
|
{
|
||||||
|
static const WCHAR empty[] = {0};
|
||||||
LONG ret;
|
LONG ret;
|
||||||
HKEY hkey;
|
HKEY hkey;
|
||||||
|
|
||||||
|
@ -1581,7 +1605,10 @@ BOOL WINAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection, LPCWSTR lpszEntry
|
||||||
|
|
||||||
if ((ret = RegCreateKeyW(hkeyfilename, lpszSection, &hkey_section)) == ERROR_SUCCESS)
|
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);
|
RegCloseKey(hkey_section);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,7 @@ reactos/dll/win32/npptools # Synced to WineStaging-3.3
|
||||||
reactos/dll/win32/ntdsapi # Synced to WineStaging-3.9
|
reactos/dll/win32/ntdsapi # Synced to WineStaging-3.9
|
||||||
reactos/dll/win32/objsel # Synced to WineStaging-3.3
|
reactos/dll/win32/objsel # Synced to WineStaging-3.3
|
||||||
reactos/dll/win32/odbc32 # Synced to WineStaging-4.0. Depends on port of Linux ODBC.
|
reactos/dll/win32/odbc32 # Synced to WineStaging-4.0. Depends on port of Linux ODBC.
|
||||||
reactos/dll/win32/odbccp32 # Synced to WineStaging-3.9
|
reactos/dll/win32/odbccp32 # Synced to WineStaging-4.0
|
||||||
reactos/dll/win32/ole32 # Synced to WineStaging-3.9
|
reactos/dll/win32/ole32 # Synced to WineStaging-3.9
|
||||||
reactos/dll/win32/oleacc # Synced to WineStaging-3.3
|
reactos/dll/win32/oleacc # Synced to WineStaging-3.3
|
||||||
reactos/dll/win32/oleaut32 # Synced to WineStaging-3.3
|
reactos/dll/win32/oleaut32 # Synced to WineStaging-3.3
|
||||||
|
|
Loading…
Reference in a new issue