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
73dad192
Commit
73dad192
authored
Apr 01, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
krnl386: Avoid using toupperW().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
2ec33961
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
37 additions
and
44 deletions
+37
-44
file.c
dlls/krnl386.exe16/file.c
+6
-3
int21.c
dlls/krnl386.exe16/int21.c
+14
-9
relay.c
dlls/krnl386.exe16/relay.c
+17
-32
No files found.
dlls/krnl386.exe16/file.c
View file @
73dad192
...
...
@@ -461,10 +461,13 @@ LONG WINAPI _hwrite16( HFILE16 hFile, LPCSTR buffer, LONG count )
UINT
WINAPI
GetTempDrive
(
BYTE
ignored
)
{
WCHAR
buffer
[
MAX_PATH
];
BYTE
ret
;
BYTE
ret
=
'C'
;
if
(
GetTempPathW
(
MAX_PATH
,
buffer
))
ret
=
(
BYTE
)
toupperW
(
buffer
[
0
]);
else
ret
=
'C'
;
if
(
GetTempPathW
(
MAX_PATH
,
buffer
))
{
ret
=
buffer
[
0
];
if
(
ret
>=
'a'
&&
ret
<=
'z'
)
ret
+=
'A'
-
'a'
;
}
return
MAKELONG
(
ret
|
(
':'
<<
8
),
1
);
}
...
...
dlls/krnl386.exe16/int21.c
View file @
73dad192
...
...
@@ -264,6 +264,13 @@ typedef struct
static
int
brk_flag
;
static
BYTE
drive_number
(
WCHAR
letter
)
{
if
(
letter
>=
'A'
&&
letter
<=
'Z'
)
return
letter
-
'A'
;
if
(
letter
>=
'a'
&&
letter
<=
'z'
)
return
letter
-
'a'
;
return
MAX_DOS_DRIVES
;
}
/* Many calls translate a drive argument like this:
drive number (00h = default, 01h = A:, etc)
...
...
@@ -300,8 +307,7 @@ static BYTE INT21_GetCurrentDrive(void)
TRACE
(
"Failed to get current drive.
\n
"
);
return
MAX_DOS_DRIVES
;
}
return
toupperW
(
current_directory
[
0
]
)
-
'A'
;
return
drive_number
(
current_directory
[
0
]
);
}
...
...
@@ -636,7 +642,7 @@ static BOOL INT21_GetCurrentDirectory( CONTEXT *context, BOOL islong )
if
(
!
GetCurrentDirectoryW
(
MAX_PATH
,
pathW
))
return
FALSE
;
if
(
toupperW
(
pathW
[
0
])
-
'A'
!=
drive
||
pathW
[
1
]
!=
':'
)
if
(
drive_number
(
pathW
[
0
]
)
!=
drive
||
pathW
[
1
]
!=
':'
)
{
/* cwd is not on the requested drive, get the environment string instead */
...
...
@@ -765,7 +771,7 @@ static BOOL INT21_SetCurrentDirectory( CONTEXT *context )
result
=
SetEnvironmentVariableW
(
env_var
,
dirW
);
/* only set current directory if on the current drive */
if
(
result
&&
(
toupperW
(
dirW
[
0
])
-
'A'
==
drive
))
result
=
SetCurrentDirectoryW
(
dirW
);
if
(
result
&&
(
drive_number
(
dirW
[
0
]
)
==
drive
))
result
=
SetCurrentDirectoryW
(
dirW
);
return
result
;
}
...
...
@@ -3418,8 +3424,7 @@ static BOOL INT21_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer )
break
;
default:
if
(
strchrW
(
invalid_chars
,
*
p
))
return
FALSE
;
buffer
[
i
]
=
toupperW
(
*
p
);
p
++
;
buffer
[
i
]
=
*
p
++
;
break
;
}
}
...
...
@@ -3455,12 +3460,12 @@ static BOOL INT21_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer )
break
;
default:
if
(
strchrW
(
invalid_chars
,
*
p
))
return
FALSE
;
buffer
[
i
]
=
toupperW
(
*
p
);
p
++
;
buffer
[
i
]
=
*
p
++
;
break
;
}
}
buffer
[
11
]
=
'\0'
;
struprW
(
buffer
);
/* at most 3 character of the extension are processed
* is something behind this ?
...
...
@@ -3514,7 +3519,7 @@ static BOOL INT21_FindFirst( CONTEXT *context )
/* we must have a fully qualified file name in dta->fullPath
* (we could have a UNC path, but this would lead to some errors later on)
*/
dta
->
drive
=
toupperW
(
dta
->
fullPath
[
0
])
-
'A'
;
dta
->
drive
=
drive_number
(
dta
->
fullPath
[
0
]
)
;
dta
->
count
=
0
;
dta
->
search_attr
=
CL_reg
(
context
);
return
TRUE
;
...
...
dlls/krnl386.exe16/relay.c
View file @
73dad192
...
...
@@ -59,37 +59,22 @@ typedef struct {
}
RELAY_Stack16
;
static
const
WCHAR
**
debug_relay_excludelist
;
static
const
WCHAR
**
debug_relay_includelist
;
static
const
WCHAR
**
debug_snoop_excludelist
;
static
const
WCHAR
**
debug_snoop_includelist
;
static
const
char
**
debug_relay_excludelist
;
static
const
char
**
debug_relay_includelist
;
static
const
char
**
debug_snoop_excludelist
;
static
const
char
**
debug_snoop_includelist
;
/* compare an ASCII and a Unicode string without depending on the current codepage */
static
inline
int
strcmpiAW
(
const
char
*
strA
,
const
WCHAR
*
strW
)
{
while
(
*
strA
&&
(
toupperW
((
unsigned
char
)
*
strA
)
==
toupperW
(
*
strW
)))
{
strA
++
;
strW
++
;
}
return
toupperW
((
unsigned
char
)
*
strA
)
-
toupperW
(
*
strW
);
}
/* compare an ASCII and a Unicode string without depending on the current codepage */
static
inline
int
strncmpiAW
(
const
char
*
strA
,
const
WCHAR
*
strW
,
int
n
)
{
int
ret
=
0
;
for
(
;
n
>
0
;
n
--
,
strA
++
,
strW
++
)
if
((
ret
=
toupperW
((
unsigned
char
)
*
strA
)
-
toupperW
(
*
strW
))
||
!*
strA
)
break
;
return
ret
;
}
/***********************************************************************
* build_list
*
* Build a function list from a ';'-separated string.
*/
static
const
WCHAR
**
build_list
(
const
WCHAR
*
buffer
)
static
const
char
**
build_list
(
const
WCHAR
*
buffer
)
{
int
count
=
1
;
const
WCHAR
*
p
=
buffer
;
const
WCHAR
**
ret
;
const
char
**
ret
;
while
((
p
=
strchrW
(
p
,
';'
)))
{
...
...
@@ -98,17 +83,17 @@ static const WCHAR **build_list( const WCHAR *buffer )
}
/* allocate count+1 pointers, plus the space for a copy of the string */
if
((
ret
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
(
count
+
1
)
*
sizeof
(
WCHAR
*
)
+
(
strlenW
(
buffer
)
+
1
)
*
sizeof
(
WCHAR
)
)))
(
count
+
1
)
*
sizeof
(
char
*
)
+
(
strlenW
(
buffer
)
+
1
)
)))
{
WCHAR
*
str
=
(
WCHAR
*
)(
ret
+
count
+
1
);
WCHAR
*
p
=
str
;
char
*
str
=
(
char
*
)(
ret
+
count
+
1
);
char
*
p
=
str
;
strcpyW
(
str
,
buffer
);
while
((
*
str
++
=
*
buffer
++
)
);
count
=
0
;
for
(;;)
{
ret
[
count
++
]
=
p
;
if
(
!
(
p
=
strchr
W
(
p
,
';'
)))
break
;
if
(
!
(
p
=
strchr
(
p
,
';'
)))
break
;
*
p
++
=
0
;
}
ret
[
count
++
]
=
NULL
;
...
...
@@ -185,25 +170,25 @@ void RELAY16_InitDebugLists(void)
*
* Check if a given module and function is in the list.
*/
static
BOOL
check_list
(
const
char
*
module
,
int
ordinal
,
const
char
*
func
,
const
WCHAR
**
list
)
static
BOOL
check_list
(
const
char
*
module
,
int
ordinal
,
const
char
*
func
,
const
char
**
list
)
{
char
ord_str
[
10
];
sprintf
(
ord_str
,
"%d"
,
ordinal
);
for
(;
*
list
;
list
++
)
{
const
WCHAR
*
p
=
strrchrW
(
*
list
,
'.'
);
const
char
*
p
=
strrchr
(
*
list
,
'.'
);
if
(
p
&&
p
>
*
list
)
/* check module and function */
{
int
len
=
p
-
*
list
;
if
(
strncmpiAW
(
module
,
*
list
,
len
-
1
)
||
module
[
len
])
continue
;
if
(
_strnicmp
(
module
,
*
list
,
len
-
1
)
||
module
[
len
])
continue
;
if
(
p
[
1
]
==
'*'
&&
!
p
[
2
])
return
TRUE
;
if
(
!
strcmp
iAW
(
ord_str
,
p
+
1
))
return
TRUE
;
if
(
func
&&
!
strcmpiAW
(
func
,
p
+
1
))
return
TRUE
;
if
(
!
strcmp
(
ord_str
,
p
+
1
))
return
TRUE
;
if
(
func
&&
!
_strnicmp
(
func
,
p
+
1
,
-
1
))
return
TRUE
;
}
else
/* function only */
{
if
(
func
&&
!
strcmpiAW
(
func
,
*
list
))
return
TRUE
;
if
(
func
&&
!
_strnicmp
(
func
,
*
list
,
-
1
))
return
TRUE
;
}
}
return
FALSE
;
...
...
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