ReactOS  0.4.13-dev-551-gf37fb1f
odbccp32.c File Reference
#include <assert.h>
#include <stdarg.h>
#include "windef.h"
#include "winbase.h"
#include "winreg.h"
#include "winnls.h"
#include "sqlext.h"
#include "wine/unicode.h"
#include "wine/debug.h"
#include "wine/heap.h"
#include "odbcinst.h"
Include dependency graph for odbccp32.c:

Go to the source code of this file.

Macros

#define COBJMACROS
 

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (odbc)
 
static void push_error (int code, LPCWSTR msg)
 
static void clear_errors (void)
 
static WCHARheap_strdupAtoW (const char *str)
 
BOOL WINAPI ODBCCPlApplet (LONG i, LONG j, LONG *p1, LONG *p2)
 
static LPWSTR SQLInstall_strdup_multi (LPCSTR str)
 
static LPWSTR SQLInstall_strdup (LPCSTR str)
 
static BOOL SQLInstall_narrow (int mode, LPSTR buffer, LPCWSTR str, WORD str_length, WORD buffer_length, WORD *returned_length)
 
BOOL WINAPI SQLConfigDataSourceW (HWND hwndParent, WORD fRequest, LPCWSTR lpszDriver, LPCWSTR lpszAttributes)
 
BOOL WINAPI SQLConfigDataSource (HWND hwndParent, WORD fRequest, LPCSTR lpszDriver, LPCSTR lpszAttributes)
 
static HMODULE load_config_driver (const WCHAR *driver)
 
static BOOL write_config_value (const WCHAR *driver, const WCHAR *args)
 
BOOL WINAPI SQLConfigDriverW (HWND hwnd, WORD request, LPCWSTR driver, LPCWSTR args, LPWSTR msg, WORD msgmax, WORD *msgout)
 
BOOL WINAPI SQLConfigDriver (HWND hwnd, WORD request, LPCSTR driver, LPCSTR args, LPSTR msg, WORD msgmax, WORD *msgout)
 
BOOL WINAPI SQLCreateDataSourceW (HWND hwnd, LPCWSTR lpszDS)
 
BOOL WINAPI SQLCreateDataSource (HWND hwnd, LPCSTR lpszDS)
 
BOOL WINAPI SQLGetAvailableDriversW (LPCWSTR lpszInfFile, LPWSTR lpszBuf, WORD cbBufMax, WORD *pcbBufOut)
 
BOOL WINAPI SQLGetAvailableDrivers (LPCSTR lpszInfFile, LPSTR lpszBuf, WORD cbBufMax, WORD *pcbBufOut)
 
BOOL WINAPI SQLGetConfigMode (UWORD *pwConfigMode)
 
BOOL WINAPI SQLGetInstalledDriversW (WCHAR *buf, WORD size, WORD *sizeout)
 
BOOL WINAPI SQLGetInstalledDrivers (char *buf, WORD size, WORD *sizeout)
 
static HKEY get_privateprofile_sectionkey (LPCWSTR section, LPCWSTR filename)
 
int WINAPI SQLGetPrivateProfileStringW (LPCWSTR section, LPCWSTR entry, LPCWSTR defvalue, LPWSTR buff, int buff_len, LPCWSTR filename)
 
int WINAPI SQLGetPrivateProfileString (LPCSTR section, LPCSTR entry, LPCSTR defvalue, LPSTR buff, int buff_len, LPCSTR filename)
 
BOOL WINAPI SQLGetTranslatorW (HWND hwndParent, LPWSTR lpszName, WORD cbNameMax, WORD *pcbNameOut, LPWSTR lpszPath, WORD cbPathMax, WORD *pcbPathOut, DWORD *pvOption)
 
BOOL WINAPI SQLGetTranslator (HWND hwndParent, LPSTR lpszName, WORD cbNameMax, WORD *pcbNameOut, LPSTR lpszPath, WORD cbPathMax, WORD *pcbPathOut, DWORD *pvOption)
 
BOOL WINAPI SQLInstallDriverW (LPCWSTR lpszInfFile, LPCWSTR lpszDriver, LPWSTR lpszPath, WORD cbPathMax, WORD *pcbPathOut)
 
BOOL WINAPI SQLInstallDriver (LPCSTR lpszInfFile, LPCSTR lpszDriver, LPSTR lpszPath, WORD cbPathMax, WORD *pcbPathOut)
 
static void write_registry_values (const WCHAR *regkey, const WCHAR *driver, const WCHAR *path_in, WCHAR *path, DWORD *usage_count)
 
BOOL WINAPI SQLInstallDriverExW (LPCWSTR lpszDriver, LPCWSTR lpszPathIn, LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
 
BOOL WINAPI SQLInstallDriverEx (LPCSTR lpszDriver, LPCSTR lpszPathIn, LPSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
 
BOOL WINAPI SQLInstallDriverManagerW (LPWSTR lpszPath, WORD cbPathMax, WORD *pcbPathOut)
 
BOOL WINAPI SQLInstallDriverManager (LPSTR lpszPath, WORD cbPathMax, WORD *pcbPathOut)
 
BOOL WINAPI SQLInstallODBCW (HWND hwndParent, LPCWSTR lpszInfFile, LPCWSTR lpszSrcPath, LPCWSTR lpszDrivers)
 
BOOL WINAPI SQLInstallODBC (HWND hwndParent, LPCSTR lpszInfFile, LPCSTR lpszSrcPath, LPCSTR lpszDrivers)
 
SQLRETURN WINAPI SQLInstallerErrorW (WORD iError, DWORD *pfErrorCode, LPWSTR lpszErrorMsg, WORD cbErrorMsgMax, WORD *pcbErrorMsg)
 
SQLRETURN WINAPI SQLInstallerError (WORD iError, DWORD *pfErrorCode, LPSTR lpszErrorMsg, WORD cbErrorMsgMax, WORD *pcbErrorMsg)
 
BOOL WINAPI SQLInstallTranslatorExW (LPCWSTR lpszTranslator, LPCWSTR lpszPathIn, LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
 
BOOL WINAPI SQLInstallTranslatorEx (LPCSTR lpszTranslator, LPCSTR lpszPathIn, LPSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
 
BOOL WINAPI SQLInstallTranslator (LPCSTR lpszInfFile, LPCSTR lpszTranslator, LPCSTR lpszPathIn, LPSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
 
BOOL WINAPI SQLInstallTranslatorW (LPCWSTR lpszInfFile, LPCWSTR lpszTranslator, LPCWSTR lpszPathIn, LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
 
BOOL WINAPI SQLManageDataSources (HWND hwnd)
 
SQLRETURN WINAPI SQLPostInstallerErrorW (DWORD fErrorCode, LPCWSTR szErrorMsg)
 
SQLRETURN WINAPI SQLPostInstallerError (DWORD fErrorCode, LPCSTR szErrorMsg)
 
BOOL WINAPI SQLReadFileDSNW (LPCWSTR lpszFileName, LPCWSTR lpszAppName, LPCWSTR lpszKeyName, LPWSTR lpszString, WORD cbString, WORD *pcbString)
 
BOOL WINAPI SQLReadFileDSN (LPCSTR lpszFileName, LPCSTR lpszAppName, LPCSTR lpszKeyName, LPSTR lpszString, WORD cbString, WORD *pcbString)
 
BOOL WINAPI SQLRemoveDefaultDataSource (void)
 
BOOL WINAPI SQLRemoveDriverW (LPCWSTR drivername, BOOL remove_dsn, LPDWORD usage_count)
 
BOOL WINAPI SQLRemoveDriver (LPCSTR lpszDriver, BOOL fRemoveDSN, LPDWORD lpdwUsageCount)
 
BOOL WINAPI SQLRemoveDriverManager (LPDWORD pdwUsageCount)
 
BOOL WINAPI SQLRemoveDSNFromIniW (LPCWSTR lpszDSN)
 
BOOL WINAPI SQLRemoveDSNFromIni (LPCSTR lpszDSN)
 
BOOL WINAPI SQLRemoveTranslatorW (const WCHAR *translator, DWORD *usage_count)
 
BOOL WINAPI SQLRemoveTranslator (LPCSTR lpszTranslator, LPDWORD lpdwUsageCount)
 
BOOL WINAPI SQLSetConfigMode (UWORD wConfigMode)
 
BOOL WINAPI SQLValidDSNW (LPCWSTR lpszDSN)
 
BOOL WINAPI SQLValidDSN (LPCSTR lpszDSN)
 
BOOL WINAPI SQLWriteDSNToIniW (LPCWSTR lpszDSN, LPCWSTR lpszDriver)
 
BOOL WINAPI SQLWriteDSNToIni (LPCSTR lpszDSN, LPCSTR lpszDriver)
 
BOOL WINAPI SQLWriteFileDSNW (LPCWSTR lpszFileName, LPCWSTR lpszAppName, LPCWSTR lpszKeyName, LPCWSTR lpszString)
 
BOOL WINAPI SQLWriteFileDSN (LPCSTR lpszFileName, LPCSTR lpszAppName, LPCSTR lpszKeyName, LPCSTR lpszString)
 
BOOL WINAPI SQLWritePrivateProfileStringW (LPCWSTR lpszSection, LPCWSTR lpszEntry, LPCWSTR lpszString, LPCWSTR lpszFilename)
 
BOOL WINAPI SQLWritePrivateProfileString (LPCSTR lpszSection, LPCSTR lpszEntry, LPCSTR lpszString, LPCSTR lpszFilename)
 

Variables

static const WCHAR drivers_key [] = {'S','o','f','t','w','a','r','e','\\','O','D','B','C','\\','O','D','B','C','I','N','S','T','.','I','N','I','\\','O','D','B','C',' ','D','r','i','v','e','r','s',0}
 
static const WCHAR odbcW [] = {'S','o','f','t','w','a','r','e','\\','O','D','B','C',0}
 
static const WCHAR odbcini [] = {'S','o','f','t','w','a','r','e','\\','O','D','B','C','\\','O','D','B','C','I','N','S','T','.','I','N','I','\\',0}
 
static const WCHAR odbcdrivers [] = {'O','D','B','C',' ','D','r','i','v','e','r','s',0}
 
static const WCHAR odbctranslators [] = {'O','D','B','C',' ','T','r','a','n','s','l','a','t','o','r','s',0}
 
static UWORD config_mode = ODBC_BOTH_DSN
 
static int num_errors
 
static int error_code [8]
 
static const WCHARerror_msg [8]
 
static const WCHAR odbc_error_general_err [] = {'G','e','n','e','r','a','l',' ','e','r','r','o','r',0}
 
static const WCHAR odbc_error_invalid_buff_len [] = {'I','n','v','a','l','i','d',' ','b','u','f','f','e','r',' ','l','e','n','g','t','h',0}
 
static const WCHAR odbc_error_component_not_found [] = {'C','o','m','p','o','n','e','n','t',' ','n','o','t',' ','f','o','u','n','d',0}
 
static const WCHAR odbc_error_out_of_mem [] = {'O','u','t',' ','o','f',' ','m','e','m','o','r','y',0}
 
static const WCHAR odbc_error_invalid_param_sequence [] = {'I','n','v','a','l','i','d',' ','p','a','r','a','m','e','t','e','r',' ','s','e','q','u','e','n','c','e',0}
 
static const WCHAR odbc_error_invalid_param_string [] = {'I','n','v','a','l','i','d',' ','p','a','r','a','m','e','t','e','r',' ','s','t','r','i','n','g',0}
 
static const WCHAR odbc_error_invalid_dsn [] = {'I','n','v','a','l','i','d',' ','D','S','N',0}
 
static const WCHAR odbc_error_load_lib_failed [] = {'L','o','a','d',' ','L','i','b','r','a','r','y',' ','F','a','i','l','e','d',0}
 
static const WCHAR odbc_error_request_failed [] = {'R','e','q','u','e','s','t',' ','F','a','i','l','e','d',0}
 
static const WCHAR odbc_error_invalid_keyword [] = {'I','n','v','a','l','i','d',' ','k','e','y','w','o','r','d',' ','v','a','l','u','e',0}
 

Macro Definition Documentation

◆ COBJMACROS

#define COBJMACROS

Definition at line 26 of file odbccp32.c.

Function Documentation

◆ clear_errors()

◆ get_privateprofile_sectionkey()

static HKEY get_privateprofile_sectionkey ( LPCWSTR  section,
LPCWSTR  filename 
)
static

Definition at line 597 of file odbccp32.c.

598 {
599  HKEY hkey, hkeyfilename, hkeysection;
600  LONG ret;
601 
602  if (RegOpenKeyW(HKEY_CURRENT_USER, odbcW, &hkey))
603  return NULL;
604 
605  ret = RegOpenKeyW(hkey, filename, &hkeyfilename);
606  RegCloseKey(hkey);
607  if (ret)
608  return NULL;
609 
610  ret = RegOpenKeyW(hkeyfilename, section, &hkeysection);
611  RegCloseKey(hkeyfilename);
612 
613  return ret ? NULL : hkeysection;
614 }
#define HKEY_CURRENT_USER
Definition: winreg.h:11
Definition: parser.c:55
const char * filename
Definition: ioapi.h:135
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
smooth NULL
Definition: ftsmooth.c:416
int ret
static const WCHAR odbcW[]
Definition: odbccp32.c:46

Referenced by SQLGetPrivateProfileString(), and SQLGetPrivateProfileStringW().

◆ heap_strdupAtoW()

static WCHAR* heap_strdupAtoW ( const char str)
inlinestatic

Definition at line 92 of file odbccp32.c.

93 {
94  LPWSTR ret = NULL;
95 
96  if(str) {
97  DWORD len;
98 
99  len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0);
100  ret = heap_alloc(len*sizeof(WCHAR));
101  if(ret)
102  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len);
103  }
104 
105  return ret;
106 }
#define CP_ACP
Definition: compat.h:99
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SQLConfigDriver(), SQLGetPrivateProfileString(), and SQLWritePrivateProfileString().

◆ load_config_driver()

static HMODULE load_config_driver ( const WCHAR driver)
static

Definition at line 250 of file odbccp32.c.

251 {
252  static WCHAR reg_driver[] = {'d','r','i','v','e','r',0};
253  long ret;
254  HMODULE hmod;
255  WCHAR *filename = NULL;
256  DWORD size = 0, type;
257  HKEY hkey;
258 
260  {
261  HKEY hkeydriver;
262 
263  if ((ret = RegOpenKeyW(hkey, driver, &hkeydriver)) == ERROR_SUCCESS)
264  {
265  ret = RegGetValueW(hkeydriver, NULL, reg_driver, RRF_RT_REG_SZ, &type, NULL, &size);
266  if(ret != ERROR_SUCCESS || type != REG_SZ)
267  {
268  RegCloseKey(hkeydriver);
269  RegCloseKey(hkey);
271 
272  return NULL;
273  }
274 
276  if(!filename)
277  {
278  RegCloseKey(hkeydriver);
279  RegCloseKey(hkey);
281 
282  return NULL;
283  }
285 
286  RegCloseKey(hkeydriver);
287  }
288 
289  RegCloseKey(hkey);
290  }
291 
292  if(ret != ERROR_SUCCESS)
293  {
296  return NULL;
297  }
298 
301 
302  if(!hmod)
304 
305  return hmod;
306 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ODBC_ERROR_LOAD_LIB_FAILED
Definition: odbcinst.h:43
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define RRF_RT_REG_SZ
Definition: driver.c:575
static void push_error(int code, LPCWSTR msg)
Definition: odbccp32.c:76
const char * filename
Definition: ioapi.h:135
struct @1603::@1604 driver
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static const WCHAR odbcini[]
Definition: odbccp32.c:47
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define LoadLibraryW(x)
Definition: compat.h:404
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR odbc_error_out_of_mem[]
Definition: odbccp32.c:67
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
#define ODBC_ERROR_OUT_OF_MEM
Definition: odbcinst.h:51
#define ODBC_ERROR_INVALID_DSN
Definition: odbcinst.h:39
int ret
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
static const WCHAR odbc_error_invalid_dsn[]
Definition: odbccp32.c:70
static const WCHAR odbc_error_load_lib_failed[]
Definition: odbccp32.c:71
#define HeapFree(x, y, z)
Definition: compat.h:394
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by SQLConfigDriver(), and SQLConfigDriverW().

◆ ODBCCPlApplet()

BOOL WINAPI ODBCCPlApplet ( LONG  i,
LONG  j,
LONG p1,
LONG p2 
)

Definition at line 109 of file odbccp32.c.

110 {
111  clear_errors();
112  FIXME( "( %d %d %p %p) : stub!\n", i, j, p1, p2);
113  return FALSE;
114 }
static void clear_errors(void)
Definition: odbccp32.c:87
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
#define FIXME(fmt,...)
Definition: debug.h:110
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
Definition: glfuncs.h:250

◆ push_error()

static void push_error ( int  code,
LPCWSTR  msg 
)
static

Definition at line 76 of file odbccp32.c.

77 {
79  {
82  num_errors++;
83  }
84 }
static const WCHAR * error_msg[8]
Definition: odbccp32.c:63
static int num_errors
Definition: odbccp32.c:61
static int error_code[8]
Definition: odbccp32.c:62
int code
Definition: i386-dis.c:3591
#define ARRAY_SIZE(a)
Definition: main.h:24
#define msg(x)
Definition: auth_time.c:54

Referenced by load_config_driver(), SQLConfigDriver(), SQLConfigDriverW(), SQLGetInstalledDrivers(), SQLGetInstalledDriversW(), SQLRemoveTranslatorW(), SQLSetConfigMode(), SQLWritePrivateProfileStringW(), and write_config_value().

◆ SQLConfigDataSource()

BOOL WINAPI SQLConfigDataSource ( HWND  hwndParent,
WORD  fRequest,
LPCSTR  lpszDriver,
LPCSTR  lpszAttributes 
)

Definition at line 241 of file odbccp32.c.

243 {
244  FIXME("%p %d %s %s\n", hwndParent, fRequest, debugstr_a(lpszDriver),
245  debugstr_a(lpszAttributes));
246  clear_errors();
247  return TRUE;
248 }
#define TRUE
Definition: types.h:120
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
static HWND hwndParent
Definition: cryptui.c:300
#define debugstr_a
Definition: kernel32.h:31

◆ SQLConfigDataSourceW()

BOOL WINAPI SQLConfigDataSourceW ( HWND  hwndParent,
WORD  fRequest,
LPCWSTR  lpszDriver,
LPCWSTR  lpszAttributes 
)

Definition at line 226 of file odbccp32.c.

228 {
229  LPCWSTR p;
230 
231  clear_errors();
232  FIXME("%p %d %s %s\n", hwndParent, fRequest, debugstr_w(lpszDriver),
233  debugstr_w(lpszAttributes));
234 
235  for (p = lpszAttributes; *p; p += lstrlenW(p) + 1)
236  FIXME("%s\n", debugstr_w(p));
237 
238  return TRUE;
239 }
#define TRUE
Definition: types.h:120
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
static void clear_errors(void)
Definition: odbccp32.c:87
#define lstrlenW
Definition: compat.h:407
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static HWND hwndParent
Definition: cryptui.c:300
GLfloat GLfloat p
Definition: glext.h:8902

Referenced by ITERATE_InstallODBCDataSource(), and ITERATE_RemoveODBCDataSource().

◆ SQLConfigDriver()

BOOL WINAPI SQLConfigDriver ( HWND  hwnd,
WORD  request,
LPCSTR  driver,
LPCSTR  args,
LPSTR  msg,
WORD  msgmax,
WORD msgout 
)

Definition at line 398 of file odbccp32.c.

400 {
401  BOOL (WINAPI *pConfigDriverA)(HWND hwnd, WORD request, const char *driver, const char *args, const char *msg, WORD msgmax, WORD *msgout);
402  HMODULE hmod;
403  WCHAR *driverW;
404  BOOL funcret = FALSE;
405 
406  clear_errors();
407  TRACE("(%p %d %s %s %p %d %p)\n", hwnd, request, debugstr_a(driver),
408  debugstr_a(args), msg, msgmax, msgout);
409 
410  driverW = heap_strdupAtoW(driver);
411  if(!driverW)
412  {
414  return FALSE;
415  }
417  {
418  BOOL ret = FALSE;
419  WCHAR *argsW = heap_strdupAtoW(args);
420  if(argsW)
421  {
422  ret = write_config_value(driverW, argsW);
423  HeapFree(GetProcessHeap(), 0, argsW);
424  }
425  else
426  {
428  }
429 
430  HeapFree(GetProcessHeap(), 0, driverW);
431 
432  return ret;
433  }
434 
435  hmod = load_config_driver(driverW);
436  HeapFree(GetProcessHeap(), 0, driverW);
437  if(!hmod)
438  return FALSE;
439 
440  pConfigDriverA = (void*)GetProcAddress(hmod, "ConfigDriver");
441  if(pConfigDriverA)
442  funcret = pConfigDriverA(hwnd, request, driver, args, msg, msgmax, msgout);
443 
444  if(!funcret)
446 
447  FreeLibrary(hmod);
448 
449  return funcret;
450 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static BOOL write_config_value(const WCHAR *driver, const WCHAR *args)
Definition: odbccp32.c:308
static WCHAR * heap_strdupAtoW(const char *str)
Definition: odbccp32.c:92
static void clear_errors(void)
Definition: odbccp32.c:87
static void push_error(int code, LPCWSTR msg)
Definition: odbccp32.c:76
#define BOOL
Definition: nt_native.h:43
Definition: match.c:390
struct @1603::@1604 driver
unsigned int BOOL
Definition: ntddk_ex.h:94
#define ODBC_ERROR_REQUEST_FAILED
Definition: odbcinst.h:41
static const WCHAR odbc_error_out_of_mem[]
Definition: odbccp32.c:67
#define ODBC_CONFIG_DRIVER
Definition: odbcinst.h:23
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:405
static const WCHAR odbc_error_request_failed[]
Definition: odbccp32.c:72
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define WINAPI
Definition: msvc.h:8
unsigned short WORD
Definition: ntddk_ex.h:93
#define ODBC_ERROR_OUT_OF_MEM
Definition: odbcinst.h:51
static HMODULE load_config_driver(const WCHAR *driver)
Definition: odbccp32.c:250
int ret
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
Definition: tftpd.h:85
#define msg(x)
Definition: auth_time.c:54
#define GetProcAddress(x, y)
Definition: compat.h:410
#define args
Definition: format.c:66
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_SQLInstallDriverEx().

◆ SQLConfigDriverW()

BOOL WINAPI SQLConfigDriverW ( HWND  hwnd,
WORD  request,
LPCWSTR  driver,
LPCWSTR  args,
LPWSTR  msg,
WORD  msgmax,
WORD msgout 
)

Definition at line 366 of file odbccp32.c.

368 {
369  BOOL (WINAPI *pConfigDriverW)(HWND hwnd, WORD request, const WCHAR *driver, const WCHAR *args, const WCHAR *msg, WORD msgmax, WORD *msgout);
370  HMODULE hmod;
371  BOOL funcret = FALSE;
372 
373  clear_errors();
374  TRACE("(%p %d %s %s %p %d %p)\n", hwnd, request, debugstr_w(driver),
375  debugstr_w(args), msg, msgmax, msgout);
376 
378  {
379  return write_config_value(driver, args);
380  }
381 
383  if(!hmod)
384  return FALSE;
385 
386  pConfigDriverW = (void*)GetProcAddress(hmod, "ConfigDriverW");
387  if(pConfigDriverW)
388  funcret = pConfigDriverW(hwnd, request, driver, args, msg, msgmax, msgout);
389 
390  if(!funcret)
392 
393  FreeLibrary(hmod);
394 
395  return funcret;
396 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static BOOL write_config_value(const WCHAR *driver, const WCHAR *args)
Definition: odbccp32.c:308
static void clear_errors(void)
Definition: odbccp32.c:87
static void push_error(int code, LPCWSTR msg)
Definition: odbccp32.c:76
#define BOOL
Definition: nt_native.h:43
Definition: match.c:390
struct @1603::@1604 driver
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
#define ODBC_ERROR_REQUEST_FAILED
Definition: odbcinst.h:41
#define ODBC_CONFIG_DRIVER
Definition: odbcinst.h:23
#define TRACE(s)
Definition: solgame.cpp:4
#define FreeLibrary(x)
Definition: compat.h:405
static const WCHAR odbc_error_request_failed[]
Definition: odbccp32.c:72
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define WINAPI
Definition: msvc.h:8
unsigned short WORD
Definition: ntddk_ex.h:93
static HMODULE load_config_driver(const WCHAR *driver)
Definition: odbccp32.c:250
static PEXPLICIT_ACCESSW *static HMODULE hmod
Definition: security.c:141
Definition: tftpd.h:85
#define msg(x)
Definition: auth_time.c:54
#define GetProcAddress(x, y)
Definition: compat.h:410
#define args
Definition: format.c:66

◆ SQLCreateDataSource()

BOOL WINAPI SQLCreateDataSource ( HWND  hwnd,
LPCSTR  lpszDS 
)

Definition at line 460 of file odbccp32.c.

461 {
462  clear_errors();
463  FIXME("%p %s\n", hwnd, debugstr_a(lpszDS));
465  return FALSE;
466 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLCreateDataSourceW()

BOOL WINAPI SQLCreateDataSourceW ( HWND  hwnd,
LPCWSTR  lpszDS 
)

Definition at line 452 of file odbccp32.c.

453 {
454  clear_errors();
455  FIXME("%p %s\n", hwnd, debugstr_w(lpszDS));
457  return FALSE;
458 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLGetAvailableDrivers()

BOOL WINAPI SQLGetAvailableDrivers ( LPCSTR  lpszInfFile,
LPSTR  lpszBuf,
WORD  cbBufMax,
WORD pcbBufOut 
)

Definition at line 477 of file odbccp32.c.

479 {
480  clear_errors();
481  FIXME("%s %p %d %p\n", debugstr_a(lpszInfFile), lpszBuf, cbBufMax, pcbBufOut);
483  return FALSE;
484 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLGetAvailableDriversW()

BOOL WINAPI SQLGetAvailableDriversW ( LPCWSTR  lpszInfFile,
LPWSTR  lpszBuf,
WORD  cbBufMax,
WORD pcbBufOut 
)

Definition at line 468 of file odbccp32.c.

470 {
471  clear_errors();
472  FIXME("%s %p %d %p\n", debugstr_w(lpszInfFile), lpszBuf, cbBufMax, pcbBufOut);
474  return FALSE;
475 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLGetConfigMode()

BOOL WINAPI SQLGetConfigMode ( UWORD pwConfigMode)

Definition at line 486 of file odbccp32.c.

487 {
488  clear_errors();
489  TRACE("%p\n", pwConfigMode);
490  if (pwConfigMode)
491  *pwConfigMode = config_mode;
492  return TRUE;
493 }
static UWORD config_mode
Definition: odbccp32.c:55
#define TRUE
Definition: types.h:120
static void clear_errors(void)
Definition: odbccp32.c:87
#define TRACE(s)
Definition: solgame.cpp:4

Referenced by test_SQLConfigMode().

◆ SQLGetInstalledDrivers()

BOOL WINAPI SQLGetInstalledDrivers ( char buf,
WORD  size,
WORD sizeout 
)

Definition at line 562 of file odbccp32.c.

563 {
564  WORD written;
565  WCHAR *wbuf;
566  BOOL ret;
567 
568  TRACE("%p %d %p\n", buf, size, sizeout);
569 
570  if (!buf || !size)
571  {
573  return FALSE;
574  }
575 
576  wbuf = heap_alloc(size * sizeof(WCHAR));
577  if (!wbuf)
578  {
580  return FALSE;
581  }
582 
583  ret = SQLGetInstalledDriversW(wbuf, size, &written);
584  if (!ret)
585  {
586  heap_free(wbuf);
587  return FALSE;
588  }
589 
590  *sizeout = WideCharToMultiByte(CP_ACP, 0, wbuf, written, NULL, 0, NULL, NULL);
591  WideCharToMultiByte(CP_ACP, 0, wbuf, written, buf, size, NULL, NULL);
592 
593  heap_free(wbuf);
594  return TRUE;
595 }
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:101
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define CP_ACP
Definition: compat.h:99
static void push_error(int code, LPCWSTR msg)
Definition: odbccp32.c:76
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
BOOL WINAPI SQLGetInstalledDriversW(WCHAR *buf, WORD size, WORD *sizeout)
Definition: odbccp32.c:495
static const WCHAR odbc_error_invalid_buff_len[]
Definition: odbccp32.c:65
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR odbc_error_out_of_mem[]
Definition: odbccp32.c:67
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned short WORD
Definition: ntddk_ex.h:93
#define ODBC_ERROR_OUT_OF_MEM
Definition: odbcinst.h:51
int ret
#define ODBC_ERROR_INVALID_BUFF_LEN
Definition: odbcinst.h:32
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by test_SQLGetInstalledDrivers(), and test_SQLInstallerError().

◆ SQLGetInstalledDriversW()

BOOL WINAPI SQLGetInstalledDriversW ( WCHAR buf,
WORD  size,
WORD sizeout 
)

Definition at line 495 of file odbccp32.c.

496 {
497  WORD written = 0;
498  DWORD index = 0;
499  BOOL ret = TRUE;
500  DWORD valuelen;
501  WCHAR *value;
502  HKEY drivers;
503  DWORD len;
504  LONG res;
505 
506  clear_errors();
507 
508  TRACE("%p %d %p\n", buf, size, sizeout);
509 
510  if (!buf || !size)
511  {
513  return FALSE;
514  }
515 
517  if (res)
518  {
520  return FALSE;
521  }
522 
523  valuelen = 256;
524  value = heap_alloc(valuelen * sizeof(WCHAR));
525 
526  size--;
527 
528  while (1)
529  {
530  len = valuelen;
531  res = RegEnumValueW(drivers, index, value, &len, NULL, NULL, NULL, NULL);
532  while (res == ERROR_MORE_DATA)
533  {
534  value = heap_realloc(value, ++len * sizeof(WCHAR));
535  res = RegEnumValueW(drivers, index, value, &len, NULL, NULL, NULL, NULL);
536  }
537  if (res == ERROR_SUCCESS)
538  {
539  lstrcpynW(buf + written, value, size - written);
540  written += min(len + 1, size - written);
541  }
542  else if (res == ERROR_NO_MORE_ITEMS)
543  break;
544  else
545  {
547  ret = FALSE;
548  break;
549  }
550  index++;
551  }
552 
553  buf[written++] = 0;
554 
555  heap_free(value);
556  RegCloseKey(drivers);
557  if (sizeout)
558  *sizeout = written;
559  return ret;
560 }
#define TRUE
Definition: types.h:120
static const WCHAR odbc_error_general_err[]
Definition: odbccp32.c:64
#define ERROR_SUCCESS
Definition: deptool.c:10
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
static void clear_errors(void)
Definition: odbccp32.c:87
static void push_error(int code, LPCWSTR msg)
Definition: odbccp32.c:76
static void * heap_realloc(void *mem, size_t len)
Definition: appwiz.h:70
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define lstrcpynW
Definition: compat.h:397
static const WCHAR odbc_error_invalid_buff_len[]
Definition: odbccp32.c:65
#define ODBC_ERROR_GENERAL_ERR
Definition: odbcinst.h:31
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define ODBC_ERROR_COMPONENT_NOT_FOUND
Definition: odbcinst.h:36
static const WCHAR odbc_error_component_not_found[]
Definition: odbccp32.c:66
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned short WORD
Definition: ntddk_ex.h:93
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR drivers_key[]
Definition: odbccp32.c:45
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define ERROR_MORE_DATA
Definition: dderror.h:13
GLsizei const GLfloat * value
Definition: glext.h:6069
#define KEY_QUERY_VALUE
Definition: nt_native.h:1016
#define min(a, b)
Definition: monoChain.cc:55
GLuint res
Definition: glext.h:9613
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
Definition: reg.c:3366
#define ODBC_ERROR_INVALID_BUFF_LEN
Definition: odbcinst.h:32
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by SQLGetInstalledDrivers().

◆ SQLGetPrivateProfileString()

int WINAPI SQLGetPrivateProfileString ( LPCSTR  section,
LPCSTR  entry,
LPCSTR  defvalue,
LPSTR  buff,
int  buff_len,
LPCSTR  filename 
)

Definition at line 688 of file odbccp32.c.

690 {
691  WCHAR *sectionW, *filenameW;
692  BOOL usedefault = TRUE;
693  HKEY sectionkey;
694  LONG ret = 0;
695 
696  TRACE("%s %s %s %p %d %s\n", debugstr_a(section), debugstr_a(entry),
697  debugstr_a(defvalue), buff, buff_len, debugstr_a(filename));
698 
699  clear_errors();
700 
701  if (buff_len <= 0)
702  return 0;
703 
704  if (buff)
705  buff[0] = 0;
706 
707  if (!section || !defvalue || !buff)
708  return 0;
709 
710  sectionW = heap_strdupAtoW(section);
712 
713  sectionkey = get_privateprofile_sectionkey(sectionW, filenameW);
714 
715  heap_free(sectionW);
717 
718  if (sectionkey)
719  {
720  DWORD type, size;
721 
722  if (entry)
723  {
724  size = buff_len * sizeof(*buff);
725  if (RegGetValueA(sectionkey, NULL, entry, RRF_RT_REG_SZ, &type, buff, &size) == ERROR_SUCCESS)
726  {
727  usedefault = FALSE;
728  ret = (size / sizeof(*buff)) - 1;
729  }
730  }
731  else
732  {
733  char name[MAX_PATH] = {0};
734  DWORD index = 0;
735  DWORD namelen;
736 
737  usedefault = FALSE;
738 
739  memset(buff, 0, buff_len);
740 
741  namelen = sizeof(name);
742  while (RegEnumValueA(sectionkey, index, name, &namelen, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
743  {
744  if ((ret + namelen+1) > buff_len)
745  break;
746 
747  lstrcpyA(buff+ret, name);
748 
749  ret += namelen+1;
750  namelen = sizeof(name);
751  index++;
752  }
753  }
754 
755  RegCloseKey(sectionkey);
756  }
757  else
758  usedefault = entry != NULL;
759 
760  if (usedefault)
761  {
762  lstrcpynA(buff, defvalue, buff_len);
763  ret = strlen(buff);
764  }
765 
766  return ret;
767 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
static WCHAR * heap_strdupAtoW(const char *str)
Definition: odbccp32.c:92
static void clear_errors(void)
Definition: odbccp32.c:87
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define RRF_RT_REG_SZ
Definition: driver.c:575
Definition: parser.c:55
const char * filename
Definition: ioapi.h:135
GLint namelen
Definition: glext.h:7232
static const WCHAR filenameW[]
Definition: amstream.c:41
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
LSTATUS WINAPI RegGetValueA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:2071
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG WINAPI RegEnumValueA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpdwReserved, _Out_opt_ LPDWORD lpdwType, _Out_opt_ LPBYTE lpData, _Inout_opt_ LPDWORD lpcbData)
Definition: reg.c:2691
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
static HKEY get_privateprofile_sectionkey(LPCWSTR section, LPCWSTR filename)
Definition: odbccp32.c:597
unsigned long DWORD
Definition: ntddk_ex.h:95
LPSTR WINAPI lstrcpyA(LPSTR lpString1, LPCSTR lpString2)
Definition: lstring.c:100
int ret
uint32_t entry
Definition: isohybrid.c:63
#define lstrcpynA
Definition: compat.h:408
Definition: name.c:36
#define memset(x, y, z)
Definition: compat.h:39
static unsigned char buff[32768]
Definition: fatten.c:17
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by test_SQLGetPrivateProfileString().

◆ SQLGetPrivateProfileStringW()

int WINAPI SQLGetPrivateProfileStringW ( LPCWSTR  section,
LPCWSTR  entry,
LPCWSTR  defvalue,
LPWSTR  buff,
int  buff_len,
LPCWSTR  filename 
)

Definition at line 616 of file odbccp32.c.

618 {
619  BOOL usedefault = TRUE;
620  HKEY sectionkey;
621  LONG ret = 0;
622 
623  TRACE("%s %s %s %p %d %s\n", debugstr_w(section), debugstr_w(entry),
624  debugstr_w(defvalue), buff, buff_len, debugstr_w(filename));
625 
626  clear_errors();
627 
628  if (buff_len <= 0 || !section)
629  return 0;
630 
631  if(buff)
632  buff[0] = 0;
633 
634  if (!defvalue || !buff)
635  return 0;
636 
638  if (sectionkey)
639  {
640  DWORD type, size;
641 
642  if (entry)
643  {
644  size = buff_len * sizeof(*buff);
645  if (RegGetValueW(sectionkey, NULL, entry, RRF_RT_REG_SZ, &type, buff, &size) == ERROR_SUCCESS)
646  {
647  usedefault = FALSE;
648  ret = (size / sizeof(*buff)) - 1;
649  }
650  }
651  else
652  {
654  DWORD index = 0;
655  DWORD namelen;
656 
657  usedefault = FALSE;
658 
659  memset(buff, 0, buff_len);
660 
661  namelen = sizeof(name);
662  while (RegEnumValueW(sectionkey, index, name, &namelen, NULL, NULL, NULL, NULL) == ERROR_SUCCESS)
663  {
664  if ((ret + namelen+1) > buff_len)
665  break;
666 
667  lstrcpyW(buff+ret, name);
668  ret += namelen+1;
669  namelen = sizeof(name);
670  index++;
671  }
672  }
673 
674  RegCloseKey(sectionkey);
675  }
676  else
677  usedefault = entry != NULL;
678 
679  if (usedefault)
680  {
681  lstrcpynW(buff, defvalue, buff_len);
682  ret = lstrlenW(buff);
683  }
684 
685  return ret;
686 }
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1965
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
static void clear_errors(void)
Definition: odbccp32.c:87
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define RRF_RT_REG_SZ
Definition: driver.c:575
Definition: parser.c:55
const char * filename
Definition: ioapi.h:135
#define lstrlenW
Definition: compat.h:407
GLint namelen
Definition: glext.h:7232
#define lstrcpynW
Definition: compat.h:397
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
LONG WINAPI RegEnumValueW(_In_ HKEY hKey, _In_ DWORD index, _Out_ LPWSTR value, _Inout_ PDWORD val_count, _Reserved_ PDWORD reserved, _Out_opt_ PDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ PDWORD count)
Definition: reg.c:2853
smooth NULL
Definition: ftsmooth.c:416
GLuint index
Definition: glext.h:6031
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
static HKEY get_privateprofile_sectionkey(LPCWSTR section, LPCWSTR filename)
Definition: odbccp32.c:597
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
uint32_t entry
Definition: isohybrid.c:63
#define lstrcpyW
Definition: compat.h:406
Definition: name.c:36
#define memset(x, y, z)
Definition: compat.h:39
static unsigned char buff[32768]
Definition: fatten.c:17
GLuint const GLchar * name
Definition: glext.h:6031

Referenced by test_SQLGetPrivateProfileStringW().

◆ SQLGetTranslator()

BOOL WINAPI SQLGetTranslator ( HWND  hwndParent,
LPSTR  lpszName,
WORD  cbNameMax,
WORD pcbNameOut,
LPSTR  lpszPath,
WORD  cbPathMax,
WORD pcbPathOut,
DWORD pvOption 
)

Definition at line 780 of file odbccp32.c.

783 {
784  clear_errors();
785  FIXME("%p %s %d %p %p %d %p %p\n", hwndParent, debugstr_a(lpszName), cbNameMax,
786  pcbNameOut, lpszPath, cbPathMax, pcbPathOut, pvOption);
788  return FALSE;
789 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
static HWND hwndParent
Definition: cryptui.c:300
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLGetTranslatorW()

BOOL WINAPI SQLGetTranslatorW ( HWND  hwndParent,
LPWSTR  lpszName,
WORD  cbNameMax,
WORD pcbNameOut,
LPWSTR  lpszPath,
WORD  cbPathMax,
WORD pcbPathOut,
DWORD pvOption 
)

Definition at line 769 of file odbccp32.c.

772 {
773  clear_errors();
774  FIXME("%p %s %d %p %p %d %p %p\n", hwndParent, debugstr_w(lpszName), cbNameMax,
775  pcbNameOut, lpszPath, cbPathMax, pcbPathOut, pvOption);
777  return FALSE;
778 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static HWND hwndParent
Definition: cryptui.c:300
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLInstall_narrow()

static BOOL SQLInstall_narrow ( int  mode,
LPSTR  buffer,
LPCWSTR  str,
WORD  str_length,
WORD  buffer_length,
WORD returned_length 
)
static

Definition at line 174 of file odbccp32.c.

175 {
176  LPSTR pbuf; /* allows us to allocate a temporary buffer only if needed */
177  int len; /* Length of the converted list */
178  BOOL success = FALSE;
179  assert(mode == 1 || mode == 2);
180  assert(buffer_length);
181  len = WideCharToMultiByte(CP_ACP, 0, str, str_length, 0, 0, NULL, NULL);
182  if (len > 0)
183  {
184  if (len > buffer_length)
185  {
186  pbuf = HeapAlloc(GetProcessHeap(), 0, len);
187  }
188  else
189  {
190  pbuf = buffer;
191  }
192  len = WideCharToMultiByte(CP_ACP, 0, str, str_length, pbuf, len, NULL, NULL);
193  if (len > 0)
194  {
195  if (pbuf != buffer)
196  {
197  if (buffer_length > (mode - 1))
198  {
199  memcpy (buffer, pbuf, buffer_length-mode);
200  *(buffer+buffer_length-mode) = '\0';
201  }
202  *(buffer+buffer_length-1) = '\0';
203  }
204  if (returned_length)
205  {
206  *returned_length = pbuf == buffer ? len : buffer_length;
207  }
208  success = TRUE;
209  }
210  else
211  {
212  ERR("transferring wide to narrow\n");
213  }
214  if (pbuf != buffer)
215  {
217  }
218  }
219  else
220  {
221  ERR("measuring wide to narrow\n");
222  }
223  return success;
224 }
#define TRUE
Definition: types.h:120
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
#define assert(x)
Definition: debug.h:53
GLuint buffer
Definition: glext.h:5915
char * LPSTR
Definition: xmlstorage.h:182
unsigned int BOOL
Definition: ntddk_ex.h:94
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
Definition: pbuf.h:79
#define success(from, fromstr, to, tostr)
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
GLenum mode
Definition: glext.h:6217
#define ERR(fmt,...)
Definition: debug.h:109
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by SQLInstallerError().

◆ SQLInstall_strdup()

static LPWSTR SQLInstall_strdup ( LPCSTR  str)
static

Definition at line 136 of file odbccp32.c.

137 {
138  DWORD len;
139  LPWSTR ret = NULL;
140 
141  if (!str)
142  return ret;
143 
144  len = MultiByteToWideChar(CP_ACP, 0, str, -1, NULL, 0 );
145  ret = HeapAlloc(GetProcessHeap(), 0, len*sizeof(WCHAR));
146  MultiByteToWideChar(CP_ACP, 0, str, -1, ret, len );
147 
148  return ret;
149 }
#define CP_ACP
Definition: compat.h:99
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SQLInstallDriverEx(), SQLInstallTranslatorEx(), SQLRemoveDriver(), and SQLRemoveTranslator().

◆ SQLInstall_strdup_multi()

static LPWSTR SQLInstall_strdup_multi ( LPCSTR  str)
static

Definition at line 116 of file odbccp32.c.

117 {
118  LPCSTR p;
119  LPWSTR ret = NULL;
120  DWORD len;
121 
122  if (!str)
123  return ret;
124 
125  for (p = str; *p; p += lstrlenA(p) + 1)
126  ;
127 
128  len = MultiByteToWideChar(CP_ACP, 0, str, p - str, NULL, 0 );
129  ret = HeapAlloc(GetProcessHeap(), 0, (len+1)*sizeof(WCHAR));
131  ret[len] = 0;
132 
133  return ret;
134 }
#define CP_ACP
Definition: compat.h:99
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
GLenum GLsizei len
Definition: glext.h:6722
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
#define MultiByteToWideChar
Definition: compat.h:100
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SQLInstallDriverEx(), and SQLInstallTranslatorEx().

◆ SQLInstallDriver()

BOOL WINAPI SQLInstallDriver ( LPCSTR  lpszInfFile,
LPCSTR  lpszDriver,
LPSTR  lpszPath,
WORD  cbPathMax,
WORD pcbPathOut 
)

Definition at line 807 of file odbccp32.c.

809 {
810  DWORD usage;
811 
812  clear_errors();
813  TRACE("%s %s %p %d %p\n", debugstr_a(lpszInfFile),
814  debugstr_a(lpszDriver), lpszPath, cbPathMax, pcbPathOut);
815 
816  if (lpszInfFile)
817  return FALSE;
818 
819  return SQLInstallDriverEx(lpszDriver, NULL, lpszPath, cbPathMax,
820  pcbPathOut, ODBC_INSTALL_COMPLETE, &usage);
821 }
#define ODBC_INSTALL_COMPLETE
Definition: odbcinst.h:20
static void clear_errors(void)
Definition: odbccp32.c:87
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31
unsigned long DWORD
Definition: ntddk_ex.h:95
BOOL WINAPI SQLInstallDriverEx(LPCSTR lpszDriver, LPCSTR lpszPathIn, LPSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
Definition: odbccp32.c:956
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919

◆ SQLInstallDriverEx()

BOOL WINAPI SQLInstallDriverEx ( LPCSTR  lpszDriver,
LPCSTR  lpszPathIn,
LPSTR  lpszPathOut,
WORD  cbPathOutMax,
WORD pcbPathOut,
WORD  fRequest,
LPDWORD  lpdwUsageCount 
)

Definition at line 956 of file odbccp32.c.

959 {
960  LPWSTR driver, pathin;
961  WCHAR pathout[MAX_PATH];
962  BOOL ret;
963  WORD cbOut = 0;
964 
965  clear_errors();
966  TRACE("%s %s %p %d %p %d %p\n", debugstr_a(lpszDriver),
967  debugstr_a(lpszPathIn), lpszPathOut, cbPathOutMax, pcbPathOut,
968  fRequest, lpdwUsageCount);
969 
970  driver = SQLInstall_strdup_multi(lpszDriver);
971  pathin = SQLInstall_strdup(lpszPathIn);
972 
973  ret = SQLInstallDriverExW(driver, pathin, pathout, MAX_PATH, &cbOut,
974  fRequest, lpdwUsageCount);
975  if (ret)
976  {
977  int len = WideCharToMultiByte(CP_ACP, 0, pathout, -1, lpszPathOut,
978  0, NULL, NULL);
979  if (len)
980  {
981  if (pcbPathOut)
982  *pcbPathOut = len - 1;
983 
984  if (!lpszPathOut || cbPathOutMax < len)
985  {
986  ret = FALSE;
987  goto out;
988  }
989  len = WideCharToMultiByte(CP_ACP, 0, pathout, -1, lpszPathOut,
990  cbPathOutMax, NULL, NULL);
991  }
992  }
993 
994 out:
996  HeapFree(GetProcessHeap(), 0, pathin);
997  return ret;
998 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
static void clear_errors(void)
Definition: odbccp32.c:87
static LPWSTR SQLInstall_strdup(LPCSTR str)
Definition: odbccp32.c:136
struct @1603::@1604 driver
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
unsigned short WORD
Definition: ntddk_ex.h:93
static FILE * out
Definition: regtests2xml.c:44
int ret
GLenum GLsizei len
Definition: glext.h:6722
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
BOOL WINAPI SQLInstallDriverExW(LPCWSTR lpszDriver, LPCWSTR lpszPathIn, LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
Definition: odbccp32.c:929
static LPWSTR SQLInstall_strdup_multi(LPCSTR str)
Definition: odbccp32.c:116

Referenced by SQLInstallDriver(), test_SQLGetInstalledDrivers(), and test_SQLInstallDriverEx().

◆ SQLInstallDriverExW()

BOOL WINAPI SQLInstallDriverExW ( LPCWSTR  lpszDriver,
LPCWSTR  lpszPathIn,
LPWSTR  lpszPathOut,
WORD  cbPathOutMax,
WORD pcbPathOut,
WORD  fRequest,
LPDWORD  lpdwUsageCount 
)

Definition at line 929 of file odbccp32.c.

932 {
933  UINT len;
935 
936  clear_errors();
937  TRACE("%s %s %p %d %p %d %p\n", debugstr_w(lpszDriver),
938  debugstr_w(lpszPathIn), lpszPathOut, cbPathOutMax, pcbPathOut,
939  fRequest, lpdwUsageCount);
940 
941  write_registry_values(odbcdrivers, lpszDriver, lpszPathIn, path, lpdwUsageCount);
942 
943  len = lstrlenW(path);
944 
945  if (pcbPathOut)
946  *pcbPathOut = len;
947 
948  if (lpszPathOut && cbPathOutMax > len)
949  {
950  lstrcpyW(lpszPathOut, path);
951  return TRUE;
952  }
953  return FALSE;
954 }
#define TRUE
Definition: types.h:120
static void write_registry_values(const WCHAR *regkey, const WCHAR *driver, const WCHAR *path_in, WCHAR *path, DWORD *usage_count)
Definition: odbccp32.c:823
static void clear_errors(void)
Definition: odbccp32.c:87
#define lstrlenW
Definition: compat.h:407
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
GLenum GLsizei len
Definition: glext.h:6722
#define lstrcpyW
Definition: compat.h:406
Definition: services.c:325
unsigned int UINT
Definition: ndis.h:50
static const WCHAR odbcdrivers[]
Definition: odbccp32.c:48

Referenced by ITERATE_InstallODBCDriver(), SQLInstallDriverEx(), and SQLInstallDriverW().

◆ SQLInstallDriverManager()

BOOL WINAPI SQLInstallDriverManager ( LPSTR  lpszPath,
WORD  cbPathMax,
WORD pcbPathOut 
)

Definition at line 1026 of file odbccp32.c.

1028 {
1029  BOOL ret;
1030  WORD len, cbOut = 0;
1031  WCHAR path[MAX_PATH];
1032 
1033  TRACE("(%p %d %p)\n", lpszPath, cbPathMax, pcbPathOut);
1034 
1035  if (cbPathMax < MAX_PATH)
1036  return FALSE;
1037 
1038  clear_errors();
1039 
1041  if (ret)
1042  {
1043  len = WideCharToMultiByte(CP_ACP, 0, path, -1, lpszPath, 0,
1044  NULL, NULL);
1045  if (len)
1046  {
1047  if (pcbPathOut)
1048  *pcbPathOut = len - 1;
1049 
1050  if (!lpszPath || cbPathMax < len)
1051  return FALSE;
1052 
1053  len = WideCharToMultiByte(CP_ACP, 0, path, -1, lpszPath,
1054  cbPathMax, NULL, NULL);
1055  }
1056  }
1057  return ret;
1058 }
BOOL WINAPI SQLInstallDriverManagerW(LPWSTR lpszPath, WORD cbPathMax, WORD *pcbPathOut)
Definition: odbccp32.c:1000
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
static void clear_errors(void)
Definition: odbccp32.c:87
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned short WORD
Definition: ntddk_ex.h:93
int ret
GLenum GLsizei len
Definition: glext.h:6722
Definition: services.c:325

Referenced by test_SQLInstallDriverManager().

◆ SQLInstallDriverManagerW()

BOOL WINAPI SQLInstallDriverManagerW ( LPWSTR  lpszPath,
WORD  cbPathMax,
WORD pcbPathOut 
)

Definition at line 1000 of file odbccp32.c.

1002 {
1003  UINT len;
1004  WCHAR path[MAX_PATH];
1005 
1006  TRACE("(%p %d %p)\n", lpszPath, cbPathMax, pcbPathOut);
1007 
1008  if (cbPathMax < MAX_PATH)
1009  return FALSE;
1010 
1011  clear_errors();
1012 
1014 
1015  if (pcbPathOut)
1016  *pcbPathOut = len;
1017 
1018  if (lpszPath && cbPathMax > len)
1019  {
1020  lstrcpyW(lpszPath, path);
1021  return TRUE;
1022  }
1023  return FALSE;
1024 }
#define TRUE
Definition: types.h:120
static void clear_errors(void)
Definition: odbccp32.c:87
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
GLenum GLsizei len
Definition: glext.h:6722
#define lstrcpyW
Definition: compat.h:406
Definition: services.c:325
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2312
unsigned int UINT
Definition: ndis.h:50

Referenced by SQLInstallDriverManager().

◆ SQLInstallDriverW()

BOOL WINAPI SQLInstallDriverW ( LPCWSTR  lpszInfFile,
LPCWSTR  lpszDriver,
LPWSTR  lpszPath,
WORD  cbPathMax,
WORD pcbPathOut 
)

Definition at line 791 of file odbccp32.c.

793 {
794  DWORD usage;
795 
796  clear_errors();
797  TRACE("%s %s %p %d %p\n", debugstr_w(lpszInfFile),
798  debugstr_w(lpszDriver), lpszPath, cbPathMax, pcbPathOut);
799 
800  if (lpszInfFile)
801  return FALSE;
802 
803  return SQLInstallDriverExW(lpszDriver, NULL, lpszPath, cbPathMax,
804  pcbPathOut, ODBC_INSTALL_COMPLETE, &usage);
805 }
#define ODBC_INSTALL_COMPLETE
Definition: odbcinst.h:20
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
GLsizeiptr const GLvoid GLenum usage
Definition: glext.h:5919
BOOL WINAPI SQLInstallDriverExW(LPCWSTR lpszDriver, LPCWSTR lpszPathIn, LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
Definition: odbccp32.c:929

◆ SQLInstallerError()

SQLRETURN WINAPI SQLInstallerError ( WORD  iError,
DWORD pfErrorCode,
LPSTR  lpszErrorMsg,
WORD  cbErrorMsgMax,
WORD pcbErrorMsg 
)

Definition at line 1139 of file odbccp32.c.

1141 {
1142  SQLRETURN ret;
1143  LPWSTR wbuf;
1144  WORD cbwbuf;
1145  TRACE("%d %p %p %d %p\n", iError, pfErrorCode, lpszErrorMsg,
1146  cbErrorMsgMax, pcbErrorMsg);
1147 
1148  wbuf = 0;
1149  if (lpszErrorMsg && cbErrorMsgMax)
1150  {
1151  wbuf = HeapAlloc(GetProcessHeap(), 0, cbErrorMsgMax*sizeof(WCHAR));
1152  if (!wbuf)
1153  return SQL_ERROR;
1154  }
1155  ret = SQLInstallerErrorW(iError, pfErrorCode, wbuf, cbErrorMsgMax, &cbwbuf);
1156  if (wbuf)
1157  {
1158  WORD cbBuf = 0;
1159  SQLInstall_narrow(1, lpszErrorMsg, wbuf, cbwbuf+1, cbErrorMsgMax, &cbBuf);
1160  HeapFree(GetProcessHeap(), 0, wbuf);
1161  if (pcbErrorMsg)
1162  *pcbErrorMsg = cbBuf-1;
1163  }
1164  return ret;
1165 }
SQLSMALLINT SQLRETURN
Definition: sqltypes.h:38
#define SQL_ERROR
Definition: sql.h:68
SQLRETURN WINAPI SQLInstallerErrorW(WORD iError, DWORD *pfErrorCode, LPWSTR lpszErrorMsg, WORD cbErrorMsgMax, WORD *pcbErrorMsg)
Definition: odbccp32.c:1080
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned short WORD
Definition: ntddk_ex.h:93
int ret
static BOOL SQLInstall_narrow(int mode, LPSTR buffer, LPCWSTR str, WORD str_length, WORD buffer_length, WORD *returned_length)
Definition: odbccp32.c:174
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by check_error_(), and test_SQLInstallerError().

◆ SQLInstallerErrorW()

SQLRETURN WINAPI SQLInstallerErrorW ( WORD  iError,
DWORD pfErrorCode,
LPWSTR  lpszErrorMsg,
WORD  cbErrorMsgMax,
WORD pcbErrorMsg 
)

Definition at line 1080 of file odbccp32.c.

1082 {
1083  TRACE("%d %p %p %d %p\n", iError, pfErrorCode, lpszErrorMsg,
1084  cbErrorMsgMax, pcbErrorMsg);
1085 
1086  if (iError == 0)
1087  {
1088  return SQL_ERROR;
1089  }
1090  else if (iError <= num_errors)
1091  {
1092  BOOL truncated = FALSE;
1093  WORD len;
1094  LPCWSTR msg;
1095  iError--;
1096  if (pfErrorCode)
1097  *pfErrorCode = error_code[iError];
1098  msg = error_msg[iError];
1099  len = msg ? lstrlenW(msg) : 0;
1100  if (pcbErrorMsg)
1101  *pcbErrorMsg = len;
1102  len++;
1103  if (cbErrorMsgMax < len)
1104  {
1105  len = cbErrorMsgMax;
1106  truncated = TRUE;
1107  }
1108  if (lpszErrorMsg && len)
1109  {
1110  if (msg)
1111  {
1112  memcpy (lpszErrorMsg, msg, len * sizeof(WCHAR));
1113  }
1114  else
1115  {
1116  assert(len==1);
1117  *lpszErrorMsg = 0;
1118  }
1119  }
1120  else
1121  {
1122  /* Yes. If you pass a null pointer and a large length it is not an error! */
1123  truncated = TRUE;
1124  }
1125 
1126  return truncated ? SQL_SUCCESS_WITH_INFO : SQL_SUCCESS;
1127  }
1128 
1129  /* At least on Windows 2000 , the buffers are not altered in this case. However that is a little too dangerous a test for just now */
1130  if (pcbErrorMsg)
1131  *pcbErrorMsg = 0;
1132 
1133  if (lpszErrorMsg && cbErrorMsgMax > 0)
1134  *lpszErrorMsg = '\0';
1135 
1136  return SQL_NO_DATA;
1137 }
#define TRUE
Definition: types.h:120
static const WCHAR * error_msg[8]
Definition: odbccp32.c:63
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
#define SQL_NO_DATA
Definition: sql.h:315
#define assert(x)
Definition: debug.h:53
#define lstrlenW
Definition: compat.h:407
#define SQL_SUCCESS_WITH_INFO
Definition: sql.h:164
#define SQL_SUCCESS
Definition: sql.h:163
unsigned int BOOL
Definition: ntddk_ex.h:94
static int num_errors
Definition: odbccp32.c:61
static int error_code[8]
Definition: odbccp32.c:62
#define SQL_ERROR
Definition: sql.h:68
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned short WORD
Definition: ntddk_ex.h:93
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
#define msg(x)
Definition: auth_time.c:54

Referenced by SQLInstallerError(), test_SQLConfigMode(), test_SQLGetInstalledDrivers(), test_SQLInstallDriverEx(), test_SQLInstallDriverManager(), test_SQLInstallTranslatorEx(), and test_SQLWritePrivateProfileString().

◆ SQLInstallODBC()

BOOL WINAPI SQLInstallODBC ( HWND  hwndParent,
LPCSTR  lpszInfFile,
LPCSTR  lpszSrcPath,
LPCSTR  lpszDrivers 
)

Definition at line 1070 of file odbccp32.c.

1072 {
1073  clear_errors();
1074  FIXME("%p %s %s %s\n", hwndParent, debugstr_a(lpszInfFile),
1075  debugstr_a(lpszSrcPath), debugstr_a(lpszDrivers));
1077  return FALSE;
1078 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
static HWND hwndParent
Definition: cryptui.c:300
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLInstallODBCW()

BOOL WINAPI SQLInstallODBCW ( HWND  hwndParent,
LPCWSTR  lpszInfFile,
LPCWSTR  lpszSrcPath,
LPCWSTR  lpszDrivers 
)

Definition at line 1060 of file odbccp32.c.

1062 {
1063  clear_errors();
1064  FIXME("%p %s %s %s\n", hwndParent, debugstr_w(lpszInfFile),
1065  debugstr_w(lpszSrcPath), debugstr_w(lpszDrivers));
1067  return FALSE;
1068 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static HWND hwndParent
Definition: cryptui.c:300
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLInstallTranslator()

BOOL WINAPI SQLInstallTranslator ( LPCSTR  lpszInfFile,
LPCSTR  lpszTranslator,
LPCSTR  lpszPathIn,
LPSTR  lpszPathOut,
WORD  cbPathOutMax,
WORD pcbPathOut,
WORD  fRequest,
LPDWORD  lpdwUsageCount 
)

Definition at line 1242 of file odbccp32.c.

1245 {
1246  clear_errors();
1247  TRACE("%s %s %s %p %d %p %d %p\n", debugstr_a(lpszInfFile),
1248  debugstr_a(lpszTranslator), debugstr_a(lpszPathIn), lpszPathOut,
1249  cbPathOutMax, pcbPathOut, fRequest, lpdwUsageCount);
1250 
1251  if (lpszInfFile)
1252  return FALSE;
1253 
1254  return SQLInstallTranslatorEx(lpszTranslator, lpszPathIn, lpszPathOut,
1255  cbPathOutMax, pcbPathOut, fRequest, lpdwUsageCount);
1256 }
BOOL WINAPI SQLInstallTranslatorEx(LPCSTR lpszTranslator, LPCSTR lpszPathIn, LPSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
Definition: odbccp32.c:1194
static void clear_errors(void)
Definition: odbccp32.c:87
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

◆ SQLInstallTranslatorEx()

BOOL WINAPI SQLInstallTranslatorEx ( LPCSTR  lpszTranslator,
LPCSTR  lpszPathIn,
LPSTR  lpszPathOut,
WORD  cbPathOutMax,
WORD pcbPathOut,
WORD  fRequest,
LPDWORD  lpdwUsageCount 
)

Definition at line 1194 of file odbccp32.c.

1197 {
1198  LPCSTR p;
1199  LPWSTR translator, pathin;
1200  WCHAR pathout[MAX_PATH];
1201  BOOL ret;
1202  WORD cbOut = 0;
1203 
1204  clear_errors();
1205  TRACE("%s %s %p %d %p %d %p\n", debugstr_a(lpszTranslator),
1206  debugstr_a(lpszPathIn), lpszPathOut, cbPathOutMax, pcbPathOut,
1207  fRequest, lpdwUsageCount);
1208 
1209  for (p = lpszTranslator; *p; p += lstrlenA(p) + 1)
1210  TRACE("%s\n", debugstr_a(p));
1211 
1212  translator = SQLInstall_strdup_multi(lpszTranslator);
1213  pathin = SQLInstall_strdup(lpszPathIn);
1214 
1215  ret = SQLInstallTranslatorExW(translator, pathin, pathout, MAX_PATH,
1216  &cbOut, fRequest, lpdwUsageCount);
1217  if (ret)
1218  {
1219  int len = WideCharToMultiByte(CP_ACP, 0, pathout, -1, lpszPathOut,
1220  0, NULL, NULL);
1221  if (len)
1222  {
1223  if (pcbPathOut)
1224  *pcbPathOut = len - 1;
1225 
1226  if (!lpszPathOut || cbPathOutMax < len)
1227  {
1228  ret = FALSE;
1229  goto out;
1230  }
1231  len = WideCharToMultiByte(CP_ACP, 0, pathout, -1, lpszPathOut,
1232  cbPathOutMax, NULL, NULL);
1233  }
1234  }
1235 
1236 out:
1237  HeapFree(GetProcessHeap(), 0, translator);
1238  HeapFree(GetProcessHeap(), 0, pathin);
1239  return ret;
1240 }
#define WideCharToMultiByte
Definition: compat.h:101
#define CP_ACP
Definition: compat.h:99
BOOL WINAPI SQLInstallTranslatorExW(LPCWSTR lpszTranslator, LPCWSTR lpszPathIn, LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
Definition: odbccp32.c:1167
static void clear_errors(void)
Definition: odbccp32.c:87
static LPWSTR SQLInstall_strdup(LPCSTR str)
Definition: odbccp32.c:136
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
const char * LPCSTR
Definition: xmlstorage.h:183
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
#define MAX_PATH
Definition: compat.h:26
unsigned short WORD
Definition: ntddk_ex.h:93
static FILE * out
Definition: regtests2xml.c:44
int ret
GLenum GLsizei len
Definition: glext.h:6722
int WINAPI lstrlenA(LPCSTR lpString)
Definition: lstring.c:145
GLfloat GLfloat p
Definition: glext.h:8902
WCHAR * LPWSTR
Definition: xmlstorage.h:184
#define HeapFree(x, y, z)
Definition: compat.h:394
static LPWSTR SQLInstall_strdup_multi(LPCSTR str)
Definition: odbccp32.c:116

Referenced by SQLInstallTranslator(), and test_SQLInstallTranslatorEx().

◆ SQLInstallTranslatorExW()

BOOL WINAPI SQLInstallTranslatorExW ( LPCWSTR  lpszTranslator,
LPCWSTR  lpszPathIn,
LPWSTR  lpszPathOut,
WORD  cbPathOutMax,
WORD pcbPathOut,
WORD  fRequest,
LPDWORD  lpdwUsageCount 
)

Definition at line 1167 of file odbccp32.c.

1170 {
1171  UINT len;
1172  WCHAR path[MAX_PATH];
1173 
1174  clear_errors();
1175  TRACE("%s %s %p %d %p %d %p\n", debugstr_w(lpszTranslator),
1176  debugstr_w(lpszPathIn), lpszPathOut, cbPathOutMax, pcbPathOut,
1177  fRequest, lpdwUsageCount);
1178 
1179  write_registry_values(odbctranslators, lpszTranslator, lpszPathIn, path, lpdwUsageCount);
1180 
1181  len = lstrlenW(path);
1182 
1183  if (pcbPathOut)
1184  *pcbPathOut = len;
1185 
1186  if (lpszPathOut && cbPathOutMax > len)
1187  {
1188  lstrcpyW(lpszPathOut, path);
1189  return TRUE;
1190  }
1191  return FALSE;
1192 }
#define TRUE
Definition: types.h:120
static void write_registry_values(const WCHAR *regkey, const WCHAR *driver, const WCHAR *path_in, WCHAR *path, DWORD *usage_count)
Definition: odbccp32.c:823
static void clear_errors(void)
Definition: odbccp32.c:87
#define lstrlenW
Definition: compat.h:407
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
GLenum GLsizei len
Definition: glext.h:6722
#define lstrcpyW
Definition: compat.h:406
Definition: services.c:325
unsigned int UINT
Definition: ndis.h:50
static const WCHAR odbctranslators[]
Definition: odbccp32.c:49

Referenced by ITERATE_InstallODBCTranslator(), SQLInstallTranslatorEx(), and SQLInstallTranslatorW().

◆ SQLInstallTranslatorW()

BOOL WINAPI SQLInstallTranslatorW ( LPCWSTR  lpszInfFile,
LPCWSTR  lpszTranslator,
LPCWSTR  lpszPathIn,
LPWSTR  lpszPathOut,
WORD  cbPathOutMax,
WORD pcbPathOut,
WORD  fRequest,
LPDWORD  lpdwUsageCount 
)

Definition at line 1258 of file odbccp32.c.

1261 {
1262  clear_errors();
1263  TRACE("%s %s %s %p %d %p %d %p\n", debugstr_w(lpszInfFile),
1264  debugstr_w(lpszTranslator), debugstr_w(lpszPathIn), lpszPathOut,
1265  cbPathOutMax, pcbPathOut, fRequest, lpdwUsageCount);
1266 
1267  if (lpszInfFile)
1268  return FALSE;
1269 
1270  return SQLInstallTranslatorExW(lpszTranslator, lpszPathIn, lpszPathOut,
1271  cbPathOutMax, pcbPathOut, fRequest, lpdwUsageCount);
1272 }
BOOL WINAPI SQLInstallTranslatorExW(LPCWSTR lpszTranslator, LPCWSTR lpszPathIn, LPWSTR lpszPathOut, WORD cbPathOutMax, WORD *pcbPathOut, WORD fRequest, LPDWORD lpdwUsageCount)
Definition: odbccp32.c:1167
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4

◆ SQLManageDataSources()

BOOL WINAPI SQLManageDataSources ( HWND  hwnd)

Definition at line 1274 of file odbccp32.c.

1275 {
1276  clear_errors();
1277  FIXME("%p\n", hwnd);
1279  return FALSE;
1280 }
const DOCKBAR PVOID HWND HWND * hwnd
Definition: tooldock.h:22
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLPostInstallerError()

SQLRETURN WINAPI SQLPostInstallerError ( DWORD  fErrorCode,
LPCSTR  szErrorMsg 
)

Definition at line 1289 of file odbccp32.c.

1290 {
1291  FIXME("%u %s\n", fErrorCode, debugstr_a(szErrorMsg));
1293  return FALSE;
1294 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLPostInstallerErrorW()

SQLRETURN WINAPI SQLPostInstallerErrorW ( DWORD  fErrorCode,
LPCWSTR  szErrorMsg 
)

Definition at line 1282 of file odbccp32.c.

1283 {
1284  FIXME("%u %s\n", fErrorCode, debugstr_w(szErrorMsg));
1286  return FALSE;
1287 }
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLReadFileDSN()

BOOL WINAPI SQLReadFileDSN ( LPCSTR  lpszFileName,
LPCSTR  lpszAppName,
LPCSTR  lpszKeyName,
LPSTR  lpszString,
WORD  cbString,
WORD pcbString 
)

Definition at line 1307 of file odbccp32.c.

1310 {
1311  clear_errors();
1312  FIXME("%s %s %s %s %d %p\n", debugstr_a(lpszFileName), debugstr_a(lpszAppName),
1313  debugstr_a(lpszKeyName), debugstr_a(lpszString), cbString, pcbString);
1315  return FALSE;
1316 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLReadFileDSNW()

BOOL WINAPI SQLReadFileDSNW ( LPCWSTR  lpszFileName,
LPCWSTR  lpszAppName,
LPCWSTR  lpszKeyName,
LPWSTR  lpszString,
WORD  cbString,
WORD pcbString 
)

Definition at line 1296 of file odbccp32.c.

1299 {
1300  clear_errors();
1301  FIXME("%s %s %s %s %d %p\n", debugstr_w(lpszFileName), debugstr_w(lpszAppName),
1302  debugstr_w(lpszKeyName), debugstr_w(lpszString), cbString, pcbString);
1304  return FALSE;
1305 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLRemoveDefaultDataSource()

BOOL WINAPI SQLRemoveDefaultDataSource ( void  )

Definition at line 1318 of file odbccp32.c.

1319 {
1320  clear_errors();
1321  FIXME("\n");
1323  return FALSE;
1324 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLRemoveDriver()

BOOL WINAPI SQLRemoveDriver ( LPCSTR  lpszDriver,
BOOL  fRemoveDSN,
LPDWORD  lpdwUsageCount 
)

Definition at line 1381 of file odbccp32.c.

1383 {
1384  WCHAR *driver;
1385  BOOL ret;
1386 
1387  clear_errors();
1388  TRACE("%s %d %p\n", debugstr_a(lpszDriver), fRemoveDSN, lpdwUsageCount);
1389 
1390  driver = SQLInstall_strdup(lpszDriver);
1391 
1392  ret = SQLRemoveDriverW(driver, fRemoveDSN, lpdwUsageCount);
1393 
1395  return ret;
1396 }
static void clear_errors(void)
Definition: odbccp32.c:87
static LPWSTR SQLInstall_strdup(LPCSTR str)
Definition: odbccp32.c:136
struct @1603::@1604 driver
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
int ret
BOOL WINAPI SQLRemoveDriverW(LPCWSTR drivername, BOOL remove_dsn, LPDWORD usage_count)
Definition: odbccp32.c:1326
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_SQLGetInstalledDrivers(), and test_SQLInstallDriverEx().

◆ SQLRemoveDriverManager()

BOOL WINAPI SQLRemoveDriverManager ( LPDWORD  pdwUsageCount)

Definition at line 1398 of file odbccp32.c.

1399 {
1400  clear_errors();
1401  FIXME("%p\n", pdwUsageCount);
1402  if (pdwUsageCount) *pdwUsageCount = 1;
1403  return TRUE;
1404 }
#define TRUE
Definition: types.h:120
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110

◆ SQLRemoveDriverW()

BOOL WINAPI SQLRemoveDriverW ( LPCWSTR  drivername,
BOOL  remove_dsn,
LPDWORD  usage_count 
)

Definition at line 1326 of file odbccp32.c.

1327 {
1328  HKEY hkey;
1329  DWORD usagecount = 1;
1330 
1331  clear_errors();
1332  TRACE("%s %d %p\n", debugstr_w(drivername), remove_dsn, usage_count);
1333 
1335  {
1336  HKEY hkeydriver;
1337 
1338  if (RegOpenKeyW(hkey, drivername, &hkeydriver) == ERROR_SUCCESS)
1339  {
1340  DWORD size, type;
1341  DWORD count;
1342 
1343  size = sizeof(usagecount);
1344  RegGetValueA(hkeydriver, NULL, "UsageCount", RRF_RT_DWORD, &type, &usagecount, &size);
1345  TRACE("Usage count %d\n", usagecount);
1346  count = usagecount - 1;
1347  if (count)
1348  {
1349  if (RegSetValueExA(hkeydriver, "UsageCount", 0, REG_DWORD, (BYTE*)&count, sizeof(count)) != ERROR_SUCCESS)
1350  ERR("Failed to write registry UsageCount key\n");
1351  }
1352 
1353  RegCloseKey(hkeydriver);
1354  }
1355 
1356  if (usagecount)
1357  usagecount--;
1358 
1359  if (!usagecount)
1360  {
1361  if (RegDeleteKeyW(hkey, drivername) != ERROR_SUCCESS)
1362  ERR("Failed to delete registry key: %s\n", debugstr_w(drivername));
1363 
1364  if (RegOpenKeyW(hkey, odbcdrivers, &hkeydriver) == ERROR_SUCCESS)
1365  {
1366  if(RegDeleteValueW(hkeydriver, drivername) != ERROR_SUCCESS)
1367  ERR("Failed to delete registry value: %s\n", debugstr_w(drivername));
1368  RegCloseKey(hkeydriver);
1369  }
1370  }
1371 
1372  RegCloseKey(hkey);
1373  }
1374 
1375  if (usage_count)
1376  *usage_count = usagecount;
1377 
1378  return TRUE;
1379 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei count
Definition: gl.h:1545
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
static void clear_errors(void)
Definition: odbccp32.c:87
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static const WCHAR odbcini[]
Definition: odbccp32.c:47
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LSTATUS WINAPI RegGetValueA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:2071
#define RRF_RT_DWORD
Definition: driver.c:581
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
unsigned char BYTE
Definition: mem.h:68
#define ERR(fmt,...)
Definition: debug.h:109
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
static const WCHAR odbcdrivers[]
Definition: odbccp32.c:48
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
#define REG_DWORD
Definition: sdbapi.c:596
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by ITERATE_RemoveODBCDriver(), and SQLRemoveDriver().

◆ SQLRemoveDSNFromIni()

BOOL WINAPI SQLRemoveDSNFromIni ( LPCSTR  lpszDSN)

Definition at line 1414 of file odbccp32.c.

1415 {
1416  clear_errors();
1417  FIXME("%s\n", debugstr_a(lpszDSN));
1419  return FALSE;
1420 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLRemoveDSNFromIniW()

BOOL WINAPI SQLRemoveDSNFromIniW ( LPCWSTR  lpszDSN)

Definition at line 1406 of file odbccp32.c.

1407 {
1408  clear_errors();
1409  FIXME("%s\n", debugstr_w(lpszDSN));
1411  return FALSE;
1412 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLRemoveTranslator()

BOOL WINAPI SQLRemoveTranslator ( LPCSTR  lpszTranslator,
LPDWORD  lpdwUsageCount 
)

Definition at line 1487 of file odbccp32.c.

1488 {
1489  WCHAR *translator;
1490  BOOL ret;
1491 
1492  clear_errors();
1493  TRACE("%s %p\n", debugstr_a(lpszTranslator), lpdwUsageCount);
1494 
1495  translator = SQLInstall_strdup(lpszTranslator);
1496  ret = SQLRemoveTranslatorW(translator, lpdwUsageCount);
1497 
1498  HeapFree(GetProcessHeap(), 0, translator);
1499  return ret;
1500 }
static void clear_errors(void)
Definition: odbccp32.c:87
static LPWSTR SQLInstall_strdup(LPCSTR str)
Definition: odbccp32.c:136
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
#define GetProcessHeap()
Definition: compat.h:395
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define debugstr_a
Definition: kernel32.h:31
int ret
BOOL WINAPI SQLRemoveTranslatorW(const WCHAR *translator, DWORD *usage_count)
Definition: odbccp32.c:1422
#define HeapFree(x, y, z)
Definition: compat.h:394

Referenced by test_SQLInstallTranslatorEx().

◆ SQLRemoveTranslatorW()

BOOL WINAPI SQLRemoveTranslatorW ( const WCHAR translator,
DWORD usage_count 
)

Definition at line 1422 of file odbccp32.c.

1423 {
1424  HKEY hkey;
1425  DWORD usagecount = 1;
1426  BOOL ret = TRUE;
1427 
1428  clear_errors();
1429  TRACE("%s %p\n", debugstr_w(translator), usage_count);
1430 
1432  {
1433  HKEY hkeydriver;
1434 
1435  if (RegOpenKeyW(hkey, translator, &hkeydriver) == ERROR_SUCCESS)
1436  {
1437  DWORD size, type;
1438  DWORD count;
1439 
1440  size = sizeof(usagecount);
1441  RegGetValueA(hkeydriver, NULL, "UsageCount", RRF_RT_DWORD, &type, &usagecount, &size);
1442  TRACE("Usage count %d\n", usagecount);
1443  count = usagecount - 1;
1444  if (count)
1445  {
1446  if (RegSetValueExA(hkeydriver, "UsageCount", 0, REG_DWORD, (BYTE*)&count, sizeof(count)) != ERROR_SUCCESS)
1447  ERR("Failed to write registry UsageCount key\n");
1448  }
1449 
1450  RegCloseKey(hkeydriver);
1451  }
1452 
1453  if (usagecount)
1454  usagecount--;
1455 
1456  if (!usagecount)
1457  {
1458  if(RegDeleteKeyW(hkey, translator) != ERROR_SUCCESS)
1459  {
1461  WARN("Failed to delete registry key: %s\n", debugstr_w(translator));
1462  ret = FALSE;
1463  }
1464 
1465  if (ret && RegOpenKeyW(hkey, odbctranslators, &hkeydriver) == ERROR_SUCCESS)
1466  {
1467  if(RegDeleteValueW(hkeydriver, translator) != ERROR_SUCCESS)
1468  {
1470  WARN("Failed to delete registry key: %s\n", debugstr_w(translator));
1471  ret = FALSE;
1472  }
1473 
1474  RegCloseKey(hkeydriver);
1475  }
1476  }
1477 
1478  RegCloseKey(hkey);
1479  }
1480 
1481  if (ret && usage_count)
1482  *usage_count = usagecount;
1483 
1484  return ret;
1485 }
#define TRUE
Definition: types.h:120
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei count
Definition: gl.h:1545
#define WARN(fmt,...)
Definition: debug.h:111
LONG WINAPI RegDeleteKeyW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey)
Definition: reg.c:1237
static void clear_errors(void)
Definition: odbccp32.c:87
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static void push_error(int code, LPCWSTR msg)
Definition: odbccp32.c:76
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned int BOOL
Definition: ntddk_ex.h:94
static const WCHAR odbcini[]
Definition: odbccp32.c:47
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
#define ODBC_ERROR_COMPONENT_NOT_FOUND
Definition: odbcinst.h:36
static const WCHAR odbc_error_component_not_found[]
Definition: odbccp32.c:66
smooth NULL
Definition: ftsmooth.c:416
LSTATUS WINAPI RegGetValueA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:2071
#define RRF_RT_DWORD
Definition: driver.c:581
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
unsigned char BYTE
Definition: mem.h:68
#define ERR(fmt,...)
Definition: debug.h:109
LONG WINAPI RegDeleteValueW(HKEY hKey, LPCWSTR lpValueName)
Definition: reg.c:2355
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
#define REG_DWORD
Definition: sdbapi.c:596
static const WCHAR odbctranslators[]
Definition: odbccp32.c:49
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12

Referenced by ITERATE_RemoveODBCTranslator(), and SQLRemoveTranslator().

◆ SQLSetConfigMode()

BOOL WINAPI SQLSetConfigMode ( UWORD  wConfigMode)

Definition at line 1502 of file odbccp32.c.

1503 {
1504  clear_errors();
1505  TRACE("%u\n", wConfigMode);
1506 
1507  if (wConfigMode > ODBC_SYSTEM_DSN)
1508  {
1510  return FALSE;
1511  }
1512  else
1513  {
1514  config_mode = wConfigMode;
1515  return TRUE;
1516  }
1517 }
static UWORD config_mode
Definition: odbccp32.c:55
#define TRUE
Definition: types.h:120
static const WCHAR odbc_error_invalid_param_sequence[]
Definition: odbccp32.c:68
static void clear_errors(void)
Definition: odbccp32.c:87
static void push_error(int code, LPCWSTR msg)
Definition: odbccp32.c:76
#define TRACE(s)
Definition: solgame.cpp:4
#define ODBC_SYSTEM_DSN
Definition: odbcinst.h:30
#define ODBC_ERROR_INVALID_PARAM_SEQUENCE
Definition: odbcinst.h:44

Referenced by test_SQLConfigMode().

◆ SQLValidDSN()

BOOL WINAPI SQLValidDSN ( LPCSTR  lpszDSN)

Definition at line 1533 of file odbccp32.c.

1534 {
1535  static const char *invalid = "[]{}(),;?*=!@\\";
1536  clear_errors();
1537  TRACE("%s\n", debugstr_a(lpszDSN));
1538 
1539  if(strlen(lpszDSN) > SQL_MAX_DSN_LENGTH || strpbrk(lpszDSN, invalid) != NULL)
1540  {
1541  return FALSE;
1542  }
1543 
1544  return TRUE;
1545 }
static const WCHAR invalid[]
Definition: assoc.c:39
#define TRUE
Definition: types.h:120
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
char * strpbrk(const char *String, const char *Delimiters)
Definition: utclib.c:302
#define SQL_MAX_DSN_LENGTH
Definition: sqlext.h:320
static void clear_errors(void)
Definition: odbccp32.c:87
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
#define debugstr_a
Definition: kernel32.h:31

Referenced by test_SQLValidDSN().

◆ SQLValidDSNW()

BOOL WINAPI SQLValidDSNW ( LPCWSTR  lpszDSN)

Definition at line 1519 of file odbccp32.c.

1520 {
1521  static const WCHAR invalid[] = {'[',']','{','}','(',')',',',';','?','*','=','!','@','\\',0};
1522  clear_errors();
1523  TRACE("%s\n", debugstr_w(lpszDSN));
1524 
1525  if(strlenW(lpszDSN) > SQL_MAX_DSN_LENGTH || strpbrkW(lpszDSN, invalid) != NULL)
1526  {
1527  return FALSE;
1528  }
1529 
1530  return TRUE;
1531 }
static const WCHAR invalid[]
Definition: assoc.c:39
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define SQL_MAX_DSN_LENGTH
Definition: sqlext.h:320
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
WINE_UNICODE_INLINE WCHAR * strpbrkW(const WCHAR *str, const WCHAR *accept)
Definition: unicode.h:261

Referenced by test_SQLValidDSNW().

◆ SQLWriteDSNToIni()

BOOL WINAPI SQLWriteDSNToIni ( LPCSTR  lpszDSN,
LPCSTR  lpszDriver 
)

Definition at line 1554 of file odbccp32.c.

1555 {
1556  clear_errors();
1557  FIXME("%s %s\n", debugstr_a(lpszDSN), debugstr_a(lpszDriver));
1558  return TRUE;
1559 }
#define TRUE
Definition: types.h:120
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31

◆ SQLWriteDSNToIniW()

BOOL WINAPI SQLWriteDSNToIniW ( LPCWSTR  lpszDSN,
LPCWSTR  lpszDriver 
)

Definition at line 1547 of file odbccp32.c.

1548 {
1549  clear_errors();
1550  FIXME("%s %s\n", debugstr_w(lpszDSN), debugstr_w(lpszDriver));
1551  return TRUE;
1552 }
#define TRUE
Definition: types.h:120
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110

◆ SQLWriteFileDSN()

BOOL WINAPI SQLWriteFileDSN ( LPCSTR  lpszFileName,
LPCSTR  lpszAppName,
LPCSTR  lpszKeyName,
LPCSTR  lpszString 
)

Definition at line 1571 of file odbccp32.c.

1573 {
1574  clear_errors();
1575  FIXME("%s %s %s %s\n", debugstr_a(lpszFileName), debugstr_a(lpszAppName),
1576  debugstr_a(lpszKeyName), debugstr_a(lpszString));
1578  return FALSE;
1579 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_a
Definition: kernel32.h:31
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLWriteFileDSNW()

BOOL WINAPI SQLWriteFileDSNW ( LPCWSTR  lpszFileName,
LPCWSTR  lpszAppName,
LPCWSTR  lpszKeyName,
LPCWSTR  lpszString 
)

Definition at line 1561 of file odbccp32.c.

1563 {
1564  clear_errors();
1565  FIXME("%s %s %s %s\n", debugstr_w(lpszFileName), debugstr_w(lpszAppName),
1566  debugstr_w(lpszKeyName), debugstr_w(lpszString));
1568  return FALSE;
1569 }
static void clear_errors(void)
Definition: odbccp32.c:87
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define SetLastError(x)
Definition: compat.h:409
#define ERROR_CALL_NOT_IMPLEMENTED
Definition: compat.h:92

◆ SQLWritePrivateProfileString()

BOOL WINAPI SQLWritePrivateProfileString ( LPCSTR  lpszSection,
LPCSTR  lpszEntry,
LPCSTR  lpszString,
LPCSTR  lpszFilename 
)

Definition at line 1624 of file odbccp32.c.

1626 {
1627  BOOL ret;
1628  WCHAR *sect, *entry, *string, *file;
1629  clear_errors();
1630  TRACE("%s %s %s %s\n", lpszSection, lpszEntry, lpszString, lpszFilename);
1631 
1632  sect = heap_strdupAtoW(lpszSection);
1633  entry = heap_strdupAtoW(lpszEntry);
1634  string = heap_strdupAtoW(lpszString);
1635  file = heap_strdupAtoW(lpszFilename);
1636 
1637  ret = SQLWritePrivateProfileStringW(sect, entry, string, file);
1638 
1639  heap_free(sect);
1640  heap_free(entry);
1641  heap_free(string);
1642  heap_free(file);
1643 
1644  return ret;
1645 }
static WCHAR * heap_strdupAtoW(const char *str)
Definition: odbccp32.c:92
static void clear_errors(void)
Definition: odbccp32.c:87
unsigned int BOOL
Definition: ntddk_ex.h:94
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
const char file[]
Definition: icontest.c:11
int ret
uint32_t entry
Definition: isohybrid.c:63
char string[160]
Definition: util.h:11
BOOL WINAPI SQLWritePrivateProfileStringW(LPCWSTR lpszSection, LPCWSTR lpszEntry, LPCWSTR lpszString, LPCWSTR lpszFilename)
Definition: odbccp32.c:1581
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: fci.c:126

Referenced by test_SQLGetPrivateProfileString(), test_SQLGetPrivateProfileStringW(), and test_SQLWritePrivateProfileString().

◆ SQLWritePrivateProfileStringW()

BOOL WINAPI SQLWritePrivateProfileStringW ( LPCWSTR  lpszSection,
LPCWSTR  lpszEntry,
LPCWSTR  lpszString,
LPCWSTR  lpszFilename 
)

Definition at line 1581 of file odbccp32.c.

1583 {
1584  static const WCHAR empty[] = {0};
1585  LONG ret;
1586  HKEY hkey;
1587 
1588  clear_errors();
1589  TRACE("%s %s %s %s\n", debugstr_w(lpszSection), debugstr_w(lpszEntry),
1590  debugstr_w(lpszString), debugstr_w(lpszFilename));
1591 
1592  if(!lpszFilename || !*lpszFilename)
1593  {
1595  return FALSE;
1596  }
1597 
1599  {
1600  HKEY hkeyfilename;
1601 
1602  if ((ret = RegCreateKeyW(hkey, lpszFilename, &hkeyfilename)) == ERROR_SUCCESS)
1603  {
1604  HKEY hkey_section;
1605 
1606  if ((ret = RegCreateKeyW(hkeyfilename, lpszSection, &hkey_section)) == ERROR_SUCCESS)
1607  {
1608  if(lpszString)
1609  ret = RegSetValueExW(hkey_section, lpszEntry, 0, REG_SZ, (BYTE*)lpszString, (lstrlenW(lpszString)+1)*sizeof(WCHAR));
1610  else
1611  ret = RegSetValueExW(hkey_section, lpszEntry, 0, REG_SZ, (BYTE*)empty, sizeof(empty));
1612  RegCloseKey(hkey_section);
1613  }
1614 
1615  RegCloseKey(hkeyfilename);
1616  }
1617 
1618  RegCloseKey(hkey);
1619  }
1620 
1621  return ret == ERROR_SUCCESS;
1622 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static const WCHAR empty[]
Definition: main.c:49
#define HKEY_CURRENT_USER
Definition: winreg.h:11
static void clear_errors(void)
Definition: odbccp32.c:87
static void push_error(int code, LPCWSTR msg)
Definition: odbccp32.c:76
#define lstrlenW
Definition: compat.h:407
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define debugstr_w
Definition: kernel32.h:32
static const WCHAR odbc_error_invalid_param_string[]
Definition: odbccp32.c:69
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ODBC_ERROR_INVALID_STR
Definition: odbcinst.h:34
int ret
unsigned char BYTE
Definition: mem.h:68
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
#define REG_SZ
Definition: layer.c:22
static const WCHAR odbcW[]
Definition: odbccp32.c:46

Referenced by SQLWritePrivateProfileString().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( odbc  )

◆ write_config_value()

static BOOL write_config_value ( const WCHAR driver,
const WCHAR args 
)
static

Definition at line 308 of file odbccp32.c.

309 {
310  long ret;
311  HKEY hkey, hkeydriver;
312  WCHAR *name = NULL;
313 
314  if(!args)
315  return FALSE;
316 
318  {
319  if((ret = RegOpenKeyW(hkey, driver, &hkeydriver)) == ERROR_SUCCESS)
320  {
321  WCHAR *divider, *value;
322 
323  name = heap_alloc( (strlenW(args) + 1) * sizeof(WCHAR));
324  if(!name)
325  {
327  goto fail;
328  }
329  lstrcpyW(name, args);
330 
331  divider = strchrW(name,'=');
332  if(!divider)
333  {
335  goto fail;
336  }
337 
338  value = divider + 1;
339  *divider = '\0';
340 
341  TRACE("Write pair: %s = %s\n", debugstr_w(name), debugstr_w(value));
342  if(RegSetValueExW(hkeydriver, name, 0, REG_SZ, (BYTE*)value,
343  (strlenW(value)+1) * sizeof(WCHAR)) != ERROR_SUCCESS)
344  ERR("Failed to write registry installed key\n");
345  heap_free(name);
346 
347  RegCloseKey(hkeydriver);
348  }
349 
350  RegCloseKey(hkey);
351  }
352 
353  if(ret != ERROR_SUCCESS)
355 
356  return ret == ERROR_SUCCESS;
357 
358 fail:
359  RegCloseKey(hkeydriver);
360  RegCloseKey(hkey);
361  heap_free(name);
362 
363  return FALSE;
364 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define ERROR_SUCCESS
Definition: deptool.c:10
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
static void push_error(int code, LPCWSTR msg)
Definition: odbccp32.c:76
Definition: match.c:390
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
struct @1603::@1604 driver
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static const WCHAR odbcini[]
Definition: odbccp32.c:47
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:3296
#define debugstr_w
Definition: kernel32.h:32
#define ODBC_ERROR_COMPONENT_NOT_FOUND
Definition: odbcinst.h:36
#define ODBC_ERROR_INVALID_KEYWORD_VALUE
Definition: odbcinst.h:38
static const WCHAR odbc_error_component_not_found[]
Definition: odbccp32.c:66
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR odbc_error_out_of_mem[]
Definition: odbccp32.c:67
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define ODBC_ERROR_OUT_OF_MEM
Definition: odbcinst.h:51
int ret
unsigned char BYTE
Definition: mem.h:68
GLsizei const GLfloat * value
Definition: glext.h:6069
#define ERR(fmt,...)
Definition: debug.h:109
#define lstrcpyW
Definition: compat.h:406
Definition: name.c:36
static const WCHAR odbc_error_invalid_keyword[]
Definition: odbccp32.c:73
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by SQLConfigDriver(), and SQLConfigDriverW().

◆ write_registry_values()

static void write_registry_values ( const WCHAR regkey,
const WCHAR driver,
const WCHAR path_in,
WCHAR path,
DWORD usage_count 
)
static

Definition at line 823 of file odbccp32.c.

825 {
826  static const WCHAR installed[] = {'I','n','s','t','a','l','l','e','d',0};
827  static const WCHAR slash[] = {'\\', 0};
828  static const WCHAR driverW[] = {'D','r','i','v','e','r',0};
829  static const WCHAR setupW[] = {'S','e','t','u','p',0};
830  static const WCHAR translator[] = {'T','r','a','n','s','l','a','t','o','r',0};
831  HKEY hkey, hkeydriver;
832 
834  {
835  if (RegCreateKeyW(hkey, regkey, &hkeydriver) == ERROR_SUCCESS)
836  {
837  if(RegSetValueExW(hkeydriver, driver, 0, REG_SZ, (BYTE*)installed, sizeof(installed)) != ERROR_SUCCESS)
838  ERR("Failed to write registry installed key\n");
839 
840  RegCloseKey(hkeydriver);
841  }
842 
843  if (RegCreateKeyW(hkey, driver, &hkeydriver) == ERROR_SUCCESS)
844  {
845  WCHAR entry[1024];
846  const WCHAR *p;
847  DWORD usagecount = 0;
848  DWORD type, size;
849 
850  /* Skip name entry */
851  p = driver;
852  p += lstrlenW(p) + 1;
853 
854  if (!path_in)
856  else
857  lstrcpyW(path, path_in);
858 
859  /* Store Usage */
860  size = sizeof(usagecount);
861  RegGetValueA(hkeydriver, NULL, "UsageCount", RRF_RT_DWORD, &type, &usagecount, &size);
862  TRACE("Usage count %d\n", usagecount);
863 
864  for (; *p; p += lstrlenW(p) + 1)
865  {
866  WCHAR *divider = strchrW(p,'=');
867 
868  if (divider)
869  {
870  WCHAR *value;
871  int len;
872 
873  /* Write pair values to the registry. */
874  lstrcpynW(entry, p, divider - p + 1);
875 
876  divider++;
877  TRACE("Writing pair %s,%s\n", debugstr_w(entry), debugstr_w(divider));
878 
879  /* Driver, Setup, Translator entries use the system path unless a path is specified. */
880  if(lstrcmpiW(driverW, entry) == 0 || lstrcmpiW(setupW, entry) == 0 ||
881  lstrcmpiW(translator, entry) == 0)
882  {
883  len = lstrlenW(path) + lstrlenW(slash) + lstrlenW(divider) + 1;
884  value = heap_alloc(len * sizeof(WCHAR));
885  if(!value)
886  {
887  ERR("Out of memory\n");
888  return;
889  }
890 
891  lstrcpyW(value, path);
892  lstrcatW(value, slash);
893  lstrcatW(value, divider);
894  }
895  else
896  {
897  len = lstrlenW(divider) + 1;
898  value = heap_alloc(len * sizeof(WCHAR));
899  lstrcpyW(value, divider);
900  }
901 
902  if (RegSetValueExW(hkeydriver, entry, 0, REG_SZ, (BYTE*)value,
903  (lstrlenW(value)+1)*sizeof(WCHAR)) != ERROR_SUCCESS)
904  ERR("Failed to write registry data %s %s\n", debugstr_w(entry), debugstr_w(value));
905  heap_free(value);
906  }
907  else
908  {
909  ERR("No pair found. %s\n", debugstr_w(p));
910  break;
911  }
912  }
913 
914  /* Set Usage Count */
915  usagecount++;
916  if (RegSetValueExA(hkeydriver, "UsageCount", 0, REG_DWORD, (BYTE*)&usagecount, sizeof(usagecount)) != ERROR_SUCCESS)
917  ERR("Failed to write registry UsageCount key\n");
918 
919  if (usage_count)
920  *usage_count = usagecount;
921 
922  RegCloseKey(hkeydriver);
923  }
924 
925  RegCloseKey(hkey);
926  }
927 }
#define ERROR_SUCCESS
Definition: deptool.c:10
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define lstrlenW
Definition: compat.h:407
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define lstrcpynW
Definition: compat.h:397
int WINAPI lstrcmpiW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:194
struct @1603::@1604 driver
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
static const WCHAR odbcini[]
Definition: odbccp32.c:47
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
LSTATUS WINAPI RegGetValueA(HKEY hKey, LPCSTR pszSubKey, LPCSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:2071
#define RRF_RT_DWORD
Definition: driver.c:581
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
Definition: reg.c:4895
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
__wchar_t WCHAR
Definition: xmlstorage.h:180
#define MAX_PATH
Definition: compat.h:26
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t entry
Definition: isohybrid.c:63
GLenum GLsizei len
Definition: glext.h:6722
unsigned char BYTE
Definition: mem.h:68
LONG WINAPI RegCreateKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
Definition: reg.c:1199
GLsizei const GLfloat * value
Definition: glext.h:6069
#define ERR(fmt,...)
Definition: debug.h:109
#define lstrcpyW
Definition: compat.h:406
Definition: services.c:325
UINT WINAPI GetSystemDirectoryW(OUT LPWSTR lpBuffer, IN UINT uSize)
Definition: path.c:2312
LPWSTR WINAPI lstrcatW(LPWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:274
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812
GLfloat GLfloat p
Definition: glext.h:8902
#define REG_DWORD
Definition: sdbapi.c:596
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define REG_SZ
Definition: layer.c:22

Referenced by SQLInstallDriverExW(), and SQLInstallTranslatorExW().

Variable Documentation

◆ config_mode

UWORD config_mode = ODBC_BOTH_DSN
static

Definition at line 55 of file odbccp32.c.

Referenced by SQLGetConfigMode(), SQLSetConfigMode(), and test_SQLConfigMode().

◆ drivers_key

const WCHAR drivers_key[] = {'S','o','f','t','w','a','r','e','\\','O','D','B','C','\\','O','D','B','C','I','N','S','T','.','I','N','I','\\','O','D','B','C',' ','D','r','i','v','e','r','s',0}
static

Definition at line 45 of file odbccp32.c.

Referenced by LoadRegistryMMEDrivers(), and SQLGetInstalledDriversW().

◆ error_code

◆ error_msg

◆ num_errors

◆ odbc_error_component_not_found

const WCHAR odbc_error_component_not_found[] = {'C','o','m','p','o','n','e','n','t',' ','n','o','t',' ','f','o','u','n','d',0}
static

Definition at line 66 of file odbccp32.c.

Referenced by SQLGetInstalledDriversW(), SQLRemoveTranslatorW(), and write_config_value().

◆ odbc_error_general_err

const WCHAR odbc_error_general_err[] = {'G','e','n','e','r','a','l',' ','e','r','r','o','r',0}
static

Definition at line 64 of file odbccp32.c.

Referenced by SQLGetInstalledDriversW().

◆ odbc_error_invalid_buff_len

const WCHAR odbc_error_invalid_buff_len[] = {'I','n','v','a','l','i','d',' ','b','u','f','f','e','r',' ','l','e','n','g','t','h',0}
static

Definition at line 65 of file odbccp32.c.

Referenced by SQLGetInstalledDrivers(), and SQLGetInstalledDriversW().

◆ odbc_error_invalid_dsn

const WCHAR odbc_error_invalid_dsn[] = {'I','n','v','a','l','i','d',' ','D','S','N',0}
static

Definition at line 70 of file odbccp32.c.

Referenced by load_config_driver().

◆ odbc_error_invalid_keyword

const WCHAR odbc_error_invalid_keyword[] = {'I','n','v','a','l','i','d',' ','k','e','y','w','o','r','d',' ','v','a','l','u','e',0}
static

Definition at line 73 of file odbccp32.c.

Referenced by write_config_value().

◆ odbc_error_invalid_param_sequence

const WCHAR odbc_error_invalid_param_sequence[] = {'I','n','v','a','l','i','d',' ','p','a','r','a','m','e','t','e','r',' ','s','e','q','u','e','n','c','e',0}
static

Definition at line 68 of file odbccp32.c.

Referenced by SQLSetConfigMode().

◆ odbc_error_invalid_param_string

const WCHAR odbc_error_invalid_param_string[] = {'I','n','v','a','l','i','d',' ','p','a','r','a','m','e','t','e','r',' ','s','t','r','i','n','g',0}
static

Definition at line 69 of file odbccp32.c.

Referenced by SQLWritePrivateProfileStringW().

◆ odbc_error_load_lib_failed

const WCHAR odbc_error_load_lib_failed[] = {'L','o','a','d',' ','L','i','b','r','a','r','y',' ','F','a','i','l','e','d',0}
static

Definition at line 71 of file odbccp32.c.

Referenced by load_config_driver().

◆ odbc_error_out_of_mem

const WCHAR odbc_error_out_of_mem[] = {'O','u','t',' ','o','f',' ','m','e','m','o','r','y',0}
static

◆ odbc_error_request_failed

const WCHAR odbc_error_request_failed[] = {'R','e','q','u','e','s','t',' ','F','a','i','l','e','d',0}
static

Definition at line 72 of file odbccp32.c.

Referenced by SQLConfigDriver(), and SQLConfigDriverW().

◆ odbcdrivers

const WCHAR odbcdrivers[] = {'O','D','B','C',' ','D','r','i','v','e','r','s',0}
static

Definition at line 48 of file odbccp32.c.

Referenced by SQLInstallDriverExW(), and SQLRemoveDriverW().

◆ odbcini

const WCHAR odbcini[] = {'S','o','f','t','w','a','r','e','\\','O','D','B','C','\\','O','D','B','C','I','N','S','T','.','I','N','I','\\',0}
static

◆ odbctranslators

const WCHAR odbctranslators[] = {'O','D','B','C',' ','T','r','a','n','s','l','a','t','o','r','s',0}
static

Definition at line 49 of file odbccp32.c.

Referenced by SQLInstallTranslatorExW(), and SQLRemoveTranslatorW().

◆ odbcW

const WCHAR odbcW[] = {'S','o','f','t','w','a','r','e','\\','O','D','B','C',0}
static

Definition at line 46 of file odbccp32.c.

Referenced by get_privateprofile_sectionkey(), and SQLWritePrivateProfileStringW().