Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
M
mariadb
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
mariadb
Commits
32f8b3a3
Commit
32f8b3a3
authored
Jan 10, 2008
by
msvensson@pilot.mysql.com
Browse files
Options
Browse Files
Download
Plain Diff
Merge pilot.mysql.com:/data/msvensson/mysql/my51-mtr-bug33748
into pilot.mysql.com:/data/msvensson/mysql/mysql-5.1-mtr
parents
a7c70e49
76951b55
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
50 additions
and
69 deletions
+50
-69
mysys/my_init.c
mysys/my_init.c
+50
-69
No files found.
mysys/my_init.c
View file @
32f8b3a3
...
...
@@ -30,7 +30,6 @@
#endif
my_bool
have_tcpip
=
0
;
static
void
my_win_init
(
void
);
static
my_bool
win32_have_tcpip
(
void
);
static
my_bool
win32_init_tcp_ip
();
#else
#define my_win_init()
...
...
@@ -233,29 +232,6 @@ Voluntary context switches %ld, Involuntary context switches %ld\n",
#ifdef __WIN__
/*
This code is specially for running MySQL, but it should work in
other cases too.
Inizializzazione delle variabili d'ambiente per Win a 32 bit.
Vengono inserite nelle variabili d'ambiente (utilizzando cosi'
le funzioni getenv e putenv) i valori presenti nelle chiavi
del file di registro:
HKEY_LOCAL_MACHINE\software\MySQL
Se la kiave non esiste nonn inserisce nessun valore
*/
/* Crea la stringa d'ambiente */
void
setEnvString
(
char
*
ret
,
const
char
*
name
,
const
char
*
value
)
{
DBUG_ENTER
(
"setEnvString"
);
strxmov
(
ret
,
name
,
"="
,
value
,
NullS
);
DBUG_VOID_RETURN
;
}
/*
my_parameter_handler
...
...
@@ -305,17 +281,6 @@ int handle_rtc_failure(int err_type, const char *file, int line,
static
void
my_win_init
(
void
)
{
HKEY
hSoftMysql
;
DWORD
dimName
=
256
;
DWORD
dimData
=
1024
;
DWORD
dimNameValueBuffer
=
256
;
DWORD
dimDataValueBuffer
=
1024
;
DWORD
indexValue
=
0
;
long
retCodeEnumValue
;
char
NameValueBuffer
[
256
]
;
char
DataValueBuffer
[
1024
]
;
char
EnvString
[
1271
]
;
const
char
*
targetKey
=
"Software
\\
MySQL"
;
DBUG_ENTER
(
"my_win_init"
);
setlocale
(
LC_CTYPE
,
""
);
/* To get right sortorder */
...
...
@@ -343,42 +308,57 @@ static void my_win_init(void)
_tzset
();
/* apre la chiave HKEY_LOCAL_MACHINES\software\MySQL */
if
(
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,(
LPCTSTR
)
targetKey
,
0
,
KEY_READ
,
&
hSoftMysql
)
!=
ERROR_SUCCESS
)
DBUG_VOID_RETURN
;
{
/*
** Ne legge i valori e li inserisce nell'ambiente
** suppone che tutti i valori letti siano di tipo stringa + '\0'
** Legge il valore con indice 0 e lo scarta
Open HKEY_LOCAL_MACHINE\SOFTWARE\MySQL and set any strings found
there as environment variables
*/
retCodeEnumValue
=
RegEnumValue
(
hSoftMysql
,
indexValue
++
,
(
LPTSTR
)
NameValueBuffer
,
&
dimNameValueBuffer
,
NULL
,
NULL
,
(
LPBYTE
)
DataValueBuffer
,
&
dimDataValueBuffer
)
;
while
(
retCodeEnumValue
!=
ERROR_NO_MORE_ITEMS
)
HKEY
key_handle
;
if
(
RegOpenKeyEx
(
HKEY_LOCAL_MACHINE
,
(
LPCTSTR
)
"SOFTWARE
\\
MySQL"
,
0
,
KEY_READ
,
&
key_handle
)
==
ERROR_SUCCESS
)
{
LONG
ret
;
DWORD
index
=
0
;
DWORD
type
;
char
key_name
[
256
],
key_data
[
1024
];
size_t
key_name_len
=
sizeof
(
key_name
)
-
1
;
size_t
key_data_len
=
sizeof
(
key_data
)
-
1
;
while
((
ret
=
RegEnumValue
(
key_handle
,
index
++
,
key_name
,
&
key_name_len
,
NULL
,
&
type
,
(
LPBYTE
)
&
key_data
,
&
key_data_len
))
!=
ERROR_NO_MORE_ITEMS
)
{
char
*
my_env
;
/* Crea la stringa d'ambiente */
setEnvString
(
EnvString
,
NameValueBuffer
,
DataValueBuffer
)
;
char
env_string
[
sizeof
(
key_name
)
+
sizeof
(
key_data
)
+
2
];
/* Inserisce i dati come variabili d'ambiente */
my_env
=
strdup
(
EnvString
);
/* variable for putenv must be allocated ! */
putenv
(
my_env
)
;
if
(
ret
==
ERROR_MORE_DATA
)
{
/* Registry value larger than 'key_data', skip it */
DBUG_PRINT
(
"error"
,
(
"Skipped registry value that was too large"
));
}
else
if
(
ret
==
ERROR_SUCCESS
)
{
if
(
type
==
REG_SZ
)
{
strxmov
(
env_string
,
key_name
,
"="
,
key_data
,
NullS
);
dimNameValueBuffer
=
dimName
;
dimDataValueBuffer
=
dimData
;
/* variable for putenv must be allocated ! */
putenv
(
strdup
(
env_string
))
;
}
}
else
{
/* Unhandled error, break out of loop */
break
;
}
retCodeEnumValue
=
RegEnumValue
(
hSoftMysql
,
indexValue
++
,
NameValueBuffer
,
&
dimNameValueBuffer
,
NULL
,
NULL
,
(
LPBYTE
)
DataValueBuffer
,
&
dimDataValueBuffer
)
;
key_name_len
=
sizeof
(
key_name
)
-
1
;
key_data_len
=
sizeof
(
key_data
)
-
1
;
}
/* chiude la chiave */
RegCloseKey
(
hSoftMysql
)
;
RegCloseKey
(
key_handle
)
;
}
}
/* The following is used by time functions */
#define OFFSET_TO_EPOC ((__int64) 134774 * 24 * 60 * 60 * 1000 * 1000 * 10)
...
...
@@ -387,7 +367,8 @@ static void my_win_init(void)
FILETIME
ft
;
LARGE_INTEGER
li
,
t_cnt
;
DBUG_ASSERT
(
sizeof
(
LARGE_INTEGER
)
==
sizeof
(
query_performance_frequency
));
if
(
QueryPerformanceFrequency
((
LARGE_INTEGER
*
)
&
query_performance_frequency
))
if
(
QueryPerformanceFrequency
((
LARGE_INTEGER
*
)
&
query_performance_frequency
)
==
0
)
query_performance_frequency
=
0
;
else
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment