Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
wine
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sam Joan Roque-Worcel
wine
Commits
6ce25706
Commit
6ce25706
authored
24 years ago
by
Alexandre Julliard
Browse files
Options
Downloads
Patches
Plain Diff
Set ansi/oem/mac code pages from current locale.
parent
dccc070d
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dlls/kernel/kernel_main.c
+4
-0
4 additions, 0 deletions
dlls/kernel/kernel_main.c
memory/codepage.c
+49
-20
49 additions, 20 deletions
memory/codepage.c
with
53 additions
and
20 deletions
dlls/kernel/kernel_main.c
+
4
−
0
View file @
6ce25706
...
...
@@ -15,6 +15,7 @@
#include
"miscemu.h"
#include
"global.h"
extern
void
CODEPAGE_Init
(
void
);
/***********************************************************************
* KERNEL process initialisation routine
...
...
@@ -23,6 +24,9 @@ static BOOL process_attach(void)
{
HMODULE16
hModule
;
/* Setup codepage info */
CODEPAGE_Init
();
/* Initialize DOS memory */
if
(
!
DOSMEM_Init
(
0
))
return
FALSE
;
...
...
This diff is collapsed.
Click to expand it.
memory/codepage.c
+
49
−
20
View file @
6ce25706
...
...
@@ -6,6 +6,7 @@
#include
<assert.h>
#include
<stdio.h>
#include
<stdlib.h>
#include
"winbase.h"
#include
"winerror.h"
...
...
@@ -16,50 +17,75 @@
DEFAULT_DEBUG_CHANNEL
(
string
);
/* current code pages */
static
unsigned
int
ansi_cp
=
1252
;
/* Windows 3.1 ISO Latin */
static
unsigned
int
oem_cp
=
437
;
/* MS-DOS United States */
static
unsigned
int
mac_cp
=
10000
;
/* Mac Roman */
static
const
union
cptable
*
ansi_cptable
;
static
const
union
cptable
*
oem_cptable
;
static
const
union
cptable
*
mac_cptable
;
/* retrieve a code page table from the locale info */
static
const
union
cptable
*
get_locale_cp
(
LCID
lcid
,
LCTYPE
type
)
{
const
union
cptable
*
table
=
NULL
;
char
buf
[
32
];
if
(
GetLocaleInfoA
(
lcid
,
type
,
buf
,
sizeof
(
buf
)
))
table
=
cp_get_table
(
atoi
(
buf
)
);
return
table
;
}
/* setup default codepage info before we can get at the locale stuff */
static
void
init_codepages
(
void
)
{
ansi_cptable
=
cp_get_table
(
1252
);
oem_cptable
=
cp_get_table
(
437
);
mac_cptable
=
cp_get_table
(
10000
);
assert
(
ansi_cptable
);
assert
(
oem_cptable
);
assert
(
mac_cptable
);
}
/* find the table for a given codepage, handling CP_ACP etc. pseudo-codepages */
static
const
union
cptable
*
get_codepage_table
(
unsigned
int
codepage
)
{
const
union
cptable
*
ret
=
NULL
;
if
(
!
ansi_cptable
)
/* initialize them */
{
/* FIXME: should load from the registry */
ansi_cptable
=
cp_get_table
(
ansi_cp
);
oem_cptable
=
cp_get_table
(
oem_cp
);
mac_cptable
=
cp_get_table
(
mac_cp
);
assert
(
ansi_cptable
);
assert
(
oem_cptable
);
assert
(
mac_cptable
);
}
if
(
!
ansi_cptable
)
init_codepages
();
switch
(
codepage
)
{
case
CP_ACP
:
return
ansi_cptable
;
case
CP_OEMCP
:
return
oem_cptable
;
case
CP_MACCP
:
return
mac_cptable
;
case
CP_THREAD_ACP
:
return
ansi_cptable
;
/* FIXME */
case
CP_THREAD_ACP
:
return
get_locale_cp
(
GetThreadLocale
(),
LOCALE_IDEFAULTANSICODEPAGE
);
case
CP_UTF7
:
case
CP_UTF8
:
break
;
default:
if
(
codepage
==
ansi_cp
)
return
ansi_cptable
;
if
(
codepage
==
oem_cp
)
return
oem_cptable
;
if
(
codepage
==
mac_cp
)
return
mac_cptable
;
if
(
codepage
==
ansi_cp
table
->
info
.
codepage
)
return
ansi_cptable
;
if
(
codepage
==
oem_cp
table
->
info
.
codepage
)
return
oem_cptable
;
if
(
codepage
==
mac_cp
table
->
info
.
codepage
)
return
mac_cptable
;
ret
=
cp_get_table
(
codepage
);
break
;
}
return
ret
;
}
/* initialize default code pages from locale info */
/* FIXME: should be done in init_codepages, but it can't right now */
/* since it needs KERNEL32 to be loaded for the locale info. */
void
CODEPAGE_Init
(
void
)
{
const
union
cptable
*
table
;
LCID
lcid
=
GetUserDefaultLCID
();
if
(
!
ansi_cptable
)
init_codepages
();
/* just in case */
if
((
table
=
get_locale_cp
(
lcid
,
LOCALE_IDEFAULTANSICODEPAGE
)))
ansi_cptable
=
table
;
if
((
table
=
get_locale_cp
(
lcid
,
LOCALE_IDEFAULTMACCODEPAGE
)))
mac_cptable
=
table
;
if
((
table
=
get_locale_cp
(
lcid
,
LOCALE_IDEFAULTCODEPAGE
)))
oem_cptable
=
table
;
TRACE
(
"ansi=%03d oem=%03d mac=%03d
\n
"
,
ansi_cptable
->
info
.
codepage
,
oem_cptable
->
info
.
codepage
,
mac_cptable
->
info
.
codepage
);
}
/******************************************************************************
* GetACP (KERNEL32)
*
...
...
@@ -68,7 +94,8 @@ static const union cptable *get_codepage_table( unsigned int codepage )
*/
UINT
WINAPI
GetACP
(
void
)
{
return
ansi_cp
;
if
(
!
ansi_cptable
)
init_codepages
();
return
ansi_cptable
->
info
.
codepage
;
}
...
...
@@ -77,7 +104,8 @@ UINT WINAPI GetACP(void)
*/
UINT
WINAPI
GetOEMCP
(
void
)
{
return
oem_cp
;
if
(
!
oem_cptable
)
init_codepages
();
return
oem_cptable
->
info
.
codepage
;
}
...
...
@@ -105,6 +133,7 @@ BOOL WINAPI IsDBCSLeadByteEx( UINT codepage, BYTE testchar )
*/
BOOL
WINAPI
IsDBCSLeadByte
(
BYTE
testchar
)
{
if
(
!
ansi_cptable
)
init_codepages
();
return
is_dbcs_leadbyte
(
ansi_cptable
,
testchar
);
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment