Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
2a455ce0
Commit
2a455ce0
authored
Jun 27, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Move lstr* string functions to kernelbase.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
31083dba
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
149 additions
and
231 deletions
+149
-231
Makefile.in
dlls/kernel32/Makefile.in
+1
-1
kernel32.spec
dlls/kernel32/kernel32.spec
+12
-12
locale.c
dlls/kernel32/locale.c
+0
-96
string.c
dlls/kernel32/string.c
+0
-110
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+12
-12
string.c
dlls/kernelbase/string.c
+124
-0
No files found.
dlls/kernel32/Makefile.in
View file @
2a455ce0
EXTRADEFS
=
-D_KERNEL32_
-D_NORMALIZE_
MODULE
=
kernel32.dll
IMPORTLIB
=
kernel32
IMPORTS
=
winecrt0 ntdll
IMPORTS
=
winecrt0
kernelbase
ntdll
EXTRALIBS
=
$(COREFOUNDATION_LIBS)
$(POLL_LIBS)
$(RT_LIBS)
EXTRADLLFLAGS
=
-nodefaultlibs
-Wb
,-F,KERNEL32.dll
-Wl
,--image-base,0x7b400000
...
...
dlls/kernel32/kernel32.spec
View file @
2a455ce0
...
...
@@ -1651,21 +1651,21 @@
@ stdcall lstrcat(str str) lstrcatA
@ stdcall lstrcatA(str str)
@ stdcall lstrcatW(wstr wstr)
@ stdcall
lstrcmp(str str) lstrcmpA
@ stdcall lstrcmpA(str str)
@ stdcall lstrcmpW(wstr wstr)
@ stdcall
lstrcmpi(str str) lstrcmpiA
@ stdcall lstrcmpiA(str str)
@ stdcall lstrcmpiW(wstr wstr)
@ stdcall
-import lstrcmp(str str)
@ stdcall
-import
lstrcmpA(str str)
@ stdcall
-import
lstrcmpW(wstr wstr)
@ stdcall
-import lstrcmpi(str str)
@ stdcall
-import
lstrcmpiA(str str)
@ stdcall
-import
lstrcmpiW(wstr wstr)
@ stdcall lstrcpy(ptr str) lstrcpyA
@ stdcall lstrcpyA(ptr str)
@ stdcall lstrcpyW(ptr wstr)
@ stdcall
lstrcpyn(ptr str long) lstrcpynA
@ stdcall lstrcpynA(ptr str long)
@ stdcall lstrcpynW(ptr wstr long)
@ stdcall
lstrlen(str) lstrlenA
@ stdcall lstrlenA(str)
@ stdcall lstrlenW(wstr)
@ stdcall
-import lstrcpyn(ptr str long)
@ stdcall
-import
lstrcpynA(ptr str long)
@ stdcall
-import
lstrcpynW(ptr wstr long)
@ stdcall
-import lstrlen(str)
@ stdcall
-import
lstrlenA(str)
@ stdcall
-import
lstrlenW(wstr)
################################################################
# Wine internal extensions
...
...
dlls/kernel32/locale.c
View file @
2a455ce0
...
...
@@ -4062,102 +4062,6 @@ INT WINAPI CompareStringOrdinal(const WCHAR *str1, INT len1, const WCHAR *str2,
return
CSTR_EQUAL
;
}
/*************************************************************************
* lstrcmp (KERNEL32.@)
* lstrcmpA (KERNEL32.@)
*
* Compare two strings using the current thread locale.
*
* PARAMS
* str1 [I] First string to compare
* str2 [I] Second string to compare
*
* RETURNS
* Success: A number less than, equal to or greater than 0 depending on whether
* str1 is less than, equal to or greater than str2 respectively.
* Failure: FALSE. Use GetLastError() to determine the cause.
*/
int
WINAPI
lstrcmpA
(
LPCSTR
str1
,
LPCSTR
str2
)
{
int
ret
;
if
((
str1
==
NULL
)
&&
(
str2
==
NULL
))
return
0
;
if
(
str1
==
NULL
)
return
-
1
;
if
(
str2
==
NULL
)
return
1
;
ret
=
CompareStringA
(
GetThreadLocale
(),
LOCALE_USE_CP_ACP
,
str1
,
-
1
,
str2
,
-
1
);
if
(
ret
)
ret
-=
2
;
return
ret
;
}
/*************************************************************************
* lstrcmpi (KERNEL32.@)
* lstrcmpiA (KERNEL32.@)
*
* Compare two strings using the current thread locale, ignoring case.
*
* PARAMS
* str1 [I] First string to compare
* str2 [I] Second string to compare
*
* RETURNS
* Success: A number less than, equal to or greater than 0 depending on whether
* str2 is less than, equal to or greater than str1 respectively.
* Failure: FALSE. Use GetLastError() to determine the cause.
*/
int
WINAPI
lstrcmpiA
(
LPCSTR
str1
,
LPCSTR
str2
)
{
int
ret
;
if
((
str1
==
NULL
)
&&
(
str2
==
NULL
))
return
0
;
if
(
str1
==
NULL
)
return
-
1
;
if
(
str2
==
NULL
)
return
1
;
ret
=
CompareStringA
(
GetThreadLocale
(),
NORM_IGNORECASE
|
LOCALE_USE_CP_ACP
,
str1
,
-
1
,
str2
,
-
1
);
if
(
ret
)
ret
-=
2
;
return
ret
;
}
/*************************************************************************
* lstrcmpW (KERNEL32.@)
*
* See lstrcmpA.
*/
int
WINAPI
lstrcmpW
(
LPCWSTR
str1
,
LPCWSTR
str2
)
{
int
ret
;
if
((
str1
==
NULL
)
&&
(
str2
==
NULL
))
return
0
;
if
(
str1
==
NULL
)
return
-
1
;
if
(
str2
==
NULL
)
return
1
;
ret
=
CompareStringW
(
GetThreadLocale
(),
0
,
str1
,
-
1
,
str2
,
-
1
);
if
(
ret
)
ret
-=
2
;
return
ret
;
}
/*************************************************************************
* lstrcmpiW (KERNEL32.@)
*
* See lstrcmpiA.
*/
int
WINAPI
lstrcmpiW
(
LPCWSTR
str1
,
LPCWSTR
str2
)
{
int
ret
;
if
((
str1
==
NULL
)
&&
(
str2
==
NULL
))
return
0
;
if
(
str1
==
NULL
)
return
-
1
;
if
(
str2
==
NULL
)
return
1
;
ret
=
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
-
1
,
str2
,
-
1
);
if
(
ret
)
ret
-=
2
;
return
ret
;
}
/******************************************************************************
* LOCALE_Init
*/
...
...
dlls/kernel32/string.c
View file @
2a455ce0
...
...
@@ -111,113 +111,3 @@ LPWSTR WINAPI lstrcpyW( LPWSTR dst, LPCWSTR src )
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcpynA (KERNEL32.@)
* lstrcpyn (KERNEL32.@)
*
* Note: this function differs from the UNIX strncpy, it _always_ writes
* a terminating \0.
*
* Note: n is an INT but Windows treats it as unsigned, and will happily
* copy a gazillion chars if n is negative.
*/
LPSTR
WINAPI
lstrcpynA
(
LPSTR
dst
,
LPCSTR
src
,
INT
n
)
{
__TRY
{
LPSTR
d
=
dst
;
LPCSTR
s
=
src
;
UINT
count
=
n
;
while
((
count
>
1
)
&&
*
s
)
{
count
--
;
*
d
++
=
*
s
++
;
}
if
(
count
)
*
d
=
0
;
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcpynW (KERNEL32.@)
*
* Note: this function differs from the UNIX strncpy, it _always_ writes
* a terminating \0
*
* Note: n is an INT but Windows treats it as unsigned, and will happily
* copy a gazillion chars if n is negative.
*/
LPWSTR
WINAPI
lstrcpynW
(
LPWSTR
dst
,
LPCWSTR
src
,
INT
n
)
{
__TRY
{
LPWSTR
d
=
dst
;
LPCWSTR
s
=
src
;
UINT
count
=
n
;
while
((
count
>
1
)
&&
*
s
)
{
count
--
;
*
d
++
=
*
s
++
;
}
if
(
count
)
*
d
=
0
;
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrlenA (KERNEL32.@)
* lstrlen (KERNEL32.@)
*/
INT
WINAPI
lstrlenA
(
LPCSTR
str
)
{
INT
ret
;
__TRY
{
ret
=
strlen
(
str
);
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
__ENDTRY
return
ret
;
}
/***********************************************************************
* lstrlenW (KERNEL32.@)
*/
INT
WINAPI
lstrlenW
(
LPCWSTR
str
)
{
INT
ret
;
__TRY
{
ret
=
strlenW
(
str
);
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
__ENDTRY
return
ret
;
}
dlls/kernelbase/kernelbase.spec
View file @
2a455ce0
...
...
@@ -1756,17 +1756,17 @@
# @ stub exit
# @ stub hgets
# @ stub hwprintf
@ stdcall lstrcmp(str str)
kernel32.lstrcmp
@ stdcall lstrcmpA(str str)
kernel32.lstrcmpA
@ stdcall lstrcmpW(wstr wstr)
kernel32.lstrcmpW
@ stdcall lstrcmpi(str str)
kernel32.lstrcmpi
@ stdcall lstrcmpiA(str str)
kernel32.lstrcmpiA
@ stdcall lstrcmpiW(wstr wstr)
kernel32.lstrcmpiW
@ stdcall lstrcpyn(ptr str long)
kernel32.lstrcpyn
@ stdcall lstrcpynA(ptr str long)
kernel32.
lstrcpynA
@ stdcall lstrcpynW(ptr wstr long)
kernel32.
lstrcpynW
@ stdcall lstrlen(str)
kernel32.lstrlen
@ stdcall lstrlenA(str)
kernel32.
lstrlenA
@ stdcall lstrlenW(wstr)
kernel32.
lstrlenW
@ stdcall lstrcmp(str str)
lstrcmpA
@ stdcall lstrcmpA(str str)
@ stdcall lstrcmpW(wstr wstr)
@ stdcall lstrcmpi(str str)
lstrcmpiA
@ stdcall lstrcmpiA(str str)
@ stdcall lstrcmpiW(wstr wstr)
@ stdcall lstrcpyn(ptr str long)
KERNELBASE_lstrcpynA
@ stdcall lstrcpynA(ptr str long)
KERNELBASE_
lstrcpynA
@ stdcall lstrcpynW(ptr wstr long)
KERNELBASE_
lstrcpynW
@ stdcall lstrlen(str)
KERNELBASE_lstrlenA
@ stdcall lstrlenA(str)
KERNELBASE_
lstrlenA
@ stdcall lstrlenW(wstr)
KERNELBASE_
lstrlenW
# @ stub time
# @ stub wprintf
dlls/kernelbase/string.c
View file @
2a455ce0
...
...
@@ -65,6 +65,130 @@ static BOOL char_compare(WORD ch1, WORD ch2, DWORD flags)
return
CompareStringA
(
GetThreadLocale
(),
flags
,
str1
,
-
1
,
str2
,
-
1
)
-
CSTR_EQUAL
;
}
int
WINAPI
lstrcmpA
(
LPCSTR
str1
,
LPCSTR
str2
)
{
if
(
!
str1
&&
!
str2
)
return
0
;
if
(
!
str1
)
return
-
1
;
if
(
!
str2
)
return
1
;
return
CompareStringA
(
GetThreadLocale
(),
LOCALE_USE_CP_ACP
,
str1
,
-
1
,
str2
,
-
1
)
-
2
;
}
int
WINAPI
lstrcmpW
(
LPCWSTR
str1
,
LPCWSTR
str2
)
{
if
(
!
str1
&&
!
str2
)
return
0
;
if
(
!
str1
)
return
-
1
;
if
(
!
str2
)
return
1
;
return
CompareStringW
(
GetThreadLocale
(),
0
,
str1
,
-
1
,
str2
,
-
1
)
-
2
;
}
int
WINAPI
lstrcmpiA
(
LPCSTR
str1
,
LPCSTR
str2
)
{
if
(
!
str1
&&
!
str2
)
return
0
;
if
(
!
str1
)
return
-
1
;
if
(
!
str2
)
return
1
;
return
CompareStringA
(
GetThreadLocale
(),
NORM_IGNORECASE
|
LOCALE_USE_CP_ACP
,
str1
,
-
1
,
str2
,
-
1
)
-
2
;
}
int
WINAPI
lstrcmpiW
(
LPCWSTR
str1
,
LPCWSTR
str2
)
{
if
(
!
str1
&&
!
str2
)
return
0
;
if
(
!
str1
)
return
-
1
;
if
(
!
str2
)
return
1
;
return
CompareStringW
(
GetThreadLocale
(),
NORM_IGNORECASE
,
str1
,
-
1
,
str2
,
-
1
)
-
2
;
}
LPSTR
WINAPI
KERNELBASE_lstrcpynA
(
LPSTR
dst
,
LPCSTR
src
,
INT
n
)
{
/* Note: this function differs from the UNIX strncpy, it _always_ writes
* a terminating \0.
*
* Note: n is an INT but Windows treats it as unsigned, and will happily
* copy a gazillion chars if n is negative.
*/
__TRY
{
LPSTR
d
=
dst
;
LPCSTR
s
=
src
;
UINT
count
=
n
;
while
((
count
>
1
)
&&
*
s
)
{
count
--
;
*
d
++
=
*
s
++
;
}
if
(
count
)
*
d
=
0
;
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
__ENDTRY
return
dst
;
}
LPWSTR
WINAPI
KERNELBASE_lstrcpynW
(
LPWSTR
dst
,
LPCWSTR
src
,
INT
n
)
{
/* Note: this function differs from the UNIX strncpy, it _always_ writes
* a terminating \0
*
* Note: n is an INT but Windows treats it as unsigned, and will happily
* copy a gazillion chars if n is negative.
*/
__TRY
{
LPWSTR
d
=
dst
;
LPCWSTR
s
=
src
;
UINT
count
=
n
;
while
((
count
>
1
)
&&
*
s
)
{
count
--
;
*
d
++
=
*
s
++
;
}
if
(
count
)
*
d
=
0
;
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
__ENDTRY
return
dst
;
}
INT
WINAPI
KERNELBASE_lstrlenA
(
LPCSTR
str
)
{
INT
ret
;
__TRY
{
ret
=
strlen
(
str
);
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
__ENDTRY
return
ret
;
}
INT
WINAPI
KERNELBASE_lstrlenW
(
LPCWSTR
str
)
{
INT
ret
;
__TRY
{
ret
=
wcslen
(
str
);
}
__EXCEPT_PAGE_FAULT
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
0
;
}
__ENDTRY
return
ret
;
}
DWORD
WINAPI
StrCmpCA
(
const
char
*
str
,
const
char
*
cmp
)
{
return
lstrcmpA
(
str
,
cmp
);
...
...
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