Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
0d173e57
Commit
0d173e57
authored
Feb 28, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Store the Unix codepage in a Wine-specific environment variable.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5828d7c1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
23 deletions
+18
-23
locale.c
dlls/kernelbase/locale.c
+8
-6
locale.c
dlls/ntdll/locale.c
+0
-10
ntdll.spec
dlls/ntdll/ntdll.spec
+0
-3
env.c
dlls/ntdll/unix/env.c
+10
-4
No files found.
dlls/kernelbase/locale.c
View file @
0d173e57
...
...
@@ -42,8 +42,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(nls);
#define CALINFO_MAX_YEAR 2029
extern
UINT
CDECL
__wine_get_unix_codepage
(
void
);
extern
const
unsigned
int
collation_table
[]
DECLSPEC_HIDDEN
;
static
HANDLE
kernel32_handle
;
...
...
@@ -568,6 +566,7 @@ struct norm_table
};
static
NLSTABLEINFO
nls_info
;
static
UINT
unix_cp
=
CP_UTF8
;
static
UINT
mac_cp
=
10000
;
static
HKEY
intl_key
;
static
HKEY
nls_key
;
...
...
@@ -713,6 +712,9 @@ void init_locale(void)
SIZE_T
size
;
HKEY
hkey
;
if
(
GetEnvironmentVariableW
(
L"WINEUNIXCP"
,
bufferW
,
ARRAY_SIZE
(
bufferW
)
))
unix_cp
=
wcstoul
(
bufferW
,
NULL
,
10
);
kernel32_handle
=
GetModuleHandleW
(
L"kernel32.dll"
);
GetLocaleInfoW
(
LOCALE_SYSTEM_DEFAULT
,
LOCALE_IDEFAULTANSICODEPAGE
|
LOCALE_RETURN_NUMBER
,
...
...
@@ -5532,8 +5534,7 @@ INT WINAPI DECLSPEC_HOTPATCH MultiByteToWideChar( UINT codepage, DWORD flags, co
ret
=
mbstowcs_utf8
(
flags
,
src
,
srclen
,
dst
,
dstlen
);
break
;
case
CP_UNIXCP
:
codepage
=
__wine_get_unix_codepage
();
if
(
codepage
==
CP_UTF8
)
if
(
unix_cp
==
CP_UTF8
)
{
ret
=
mbstowcs_utf8
(
flags
,
src
,
srclen
,
dst
,
dstlen
);
#ifdef __APPLE__
/* work around broken Mac OS X filesystem that enforces decomposed Unicode */
...
...
@@ -5541,6 +5542,7 @@ INT WINAPI DECLSPEC_HOTPATCH MultiByteToWideChar( UINT codepage, DWORD flags, co
#endif
break
;
}
codepage
=
unix_cp
;
/* fall through */
default
:
ret
=
mbstowcs_codepage
(
codepage
,
flags
,
src
,
srclen
,
dst
,
dstlen
);
...
...
@@ -5829,13 +5831,13 @@ INT WINAPI DECLSPEC_HOTPATCH WideCharToMultiByte( UINT codepage, DWORD flags, LP
ret
=
wcstombs_utf8
(
flags
,
src
,
srclen
,
dst
,
dstlen
,
defchar
,
used
);
break
;
case
CP_UNIXCP
:
codepage
=
__wine_get_unix_codepage
();
if
(
codepage
==
CP_UTF8
)
if
(
unix_cp
==
CP_UTF8
)
{
if
(
used
)
*
used
=
FALSE
;
ret
=
wcstombs_utf8
(
flags
,
src
,
srclen
,
dst
,
dstlen
,
NULL
,
NULL
);
break
;
}
codepage
=
unix_cp
;
/* fall through */
default
:
ret
=
wcstombs_codepage
(
codepage
,
flags
,
src
,
srclen
,
dst
,
dstlen
,
defchar
,
used
);
...
...
dlls/ntdll/locale.c
View file @
0d173e57
...
...
@@ -652,16 +652,6 @@ int ntdll_wcstoumbs( const WCHAR *src, DWORD srclen, char *dst, DWORD dstlen, BO
}
/******************************************************************
* __wine_get_unix_codepage (NTDLL.@)
*/
UINT
CDECL
__wine_get_unix_codepage
(
void
)
{
if
(
!
unix_table
.
CodePage
)
return
CP_UTF8
;
return
unix_table
.
CodePage
;
}
static
NTSTATUS
get_dummy_preferred_ui_language
(
DWORD
flags
,
LANGID
lang
,
ULONG
*
count
,
WCHAR
*
buffer
,
ULONG
*
size
)
{
...
...
dlls/ntdll/ntdll.spec
View file @
0d173e57
...
...
@@ -1625,9 +1625,6 @@
@ cdecl -syscall wine_get_build_id()
@ cdecl -syscall wine_get_host_version(ptr ptr)
# Codepages
@ cdecl __wine_get_unix_codepage()
# Filesystem
@ cdecl -syscall wine_nt_to_unix_file_name(ptr ptr ptr long)
@ cdecl -syscall wine_unix_to_nt_file_name(str ptr ptr)
dlls/ntdll/unix/env.c
View file @
0d173e57
...
...
@@ -544,6 +544,7 @@ static BOOL is_dynamic_env_var( const char *var )
STARTS_WITH
(
var
,
"WINEBUILDDIR="
)
||
STARTS_WITH
(
var
,
"WINECONFIGDIR="
)
||
STARTS_WITH
(
var
,
"WINEDLLDIR"
)
||
STARTS_WITH
(
var
,
"WINEUNIXCP="
)
||
STARTS_WITH
(
var
,
"WINEUSERNAME="
)
||
STARTS_WITH
(
var
,
"WINEPRELOADRESERVE="
)
||
STARTS_WITH
(
var
,
"WINELOADERNOEXEC="
)
||
...
...
@@ -1194,9 +1195,9 @@ static WCHAR *get_dynamic_environment( SIZE_T *size )
SIZE_T
alloc
,
pos
=
0
;
WCHAR
*
buffer
;
DWORD
i
;
char
dlldi
r
[
22
];
char
st
r
[
22
];
alloc
=
20
*
7
;
/* 7
variable names */
alloc
=
20
*
8
;
/* 8
variable names */
if
(
data_dir
)
alloc
+=
strlen
(
data_dir
)
+
9
;
if
(
home_dir
)
alloc
+=
strlen
(
home_dir
)
+
9
;
if
(
build_dir
)
alloc
+=
strlen
(
build_dir
)
+
9
;
...
...
@@ -1212,11 +1213,16 @@ static WCHAR *get_dynamic_environment( SIZE_T *size )
if
(
config_dir
)
add_path_var
(
buffer
,
&
pos
,
"WINECONFIGDIR"
,
config_dir
);
for
(
i
=
0
;
dll_paths
[
i
];
i
++
)
{
sprintf
(
dlldi
r
,
"WINEDLLDIR%u"
,
i
);
add_path_var
(
buffer
,
&
pos
,
dlldi
r
,
dll_paths
[
i
]
);
sprintf
(
st
r
,
"WINEDLLDIR%u"
,
i
);
add_path_var
(
buffer
,
&
pos
,
st
r
,
dll_paths
[
i
]
);
}
if
(
user_name
)
append_envA
(
buffer
,
&
pos
,
"WINEUSERNAME"
,
user_name
);
if
(
overrides
)
append_envA
(
buffer
,
&
pos
,
"WINEDLLOVERRIDES"
,
overrides
);
if
(
unix_cp
.
data
)
{
sprintf
(
str
,
"%u"
,
unix_cp
.
data
[
1
]
);
append_envA
(
buffer
,
&
pos
,
"WINEUNIXCP"
,
str
);
}
assert
(
pos
<=
alloc
);
*
size
=
pos
*
sizeof
(
WCHAR
);
return
buffer
;
...
...
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