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
65e7196f
Commit
65e7196f
authored
Sep 16, 2003
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved most kernel string functions to dlls/kernel.
parent
0f170015
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
213 additions
and
211 deletions
+213
-211
string.c
dlls/kernel/string.c
+208
-0
path.c
dlls/ntdll/path.c
+1
-1
dos_fs.c
files/dos_fs.c
+4
-4
string.c
memory/string.c
+0
-206
No files found.
dlls/kernel/string.c
View file @
65e7196f
/*
* Kernel string functions
*
* Copyright 1993 Yngvi Sigurjonsson
* Copyright 1996 Alexandre Julliard
* Copyright 2001 Dmitry Timoshkov for CodeWeavers
*
* This library is free software; you can redistribute it and/or
...
...
@@ -24,12 +26,24 @@
#include "windef.h"
#include "winbase.h"
#include "excpt.h"
#include "wine/winbase16.h"
#include "wine/unicode.h"
#include "wine/exception.h"
static
INT
(
WINAPI
*
pLoadStringA
)(
HINSTANCE
,
UINT
,
LPSTR
,
INT
);
static
INT
(
WINAPI
*
pwvsprintfA
)(
LPSTR
,
LPCSTR
,
va_list
);
/* filter for page-fault exceptions */
static
WINE_EXCEPTION_FILTER
(
page_fault
)
{
if
(
GetExceptionCode
()
==
EXCEPTION_ACCESS_VIOLATION
)
return
EXCEPTION_EXECUTE_HANDLER
;
return
EXCEPTION_CONTINUE_SEARCH
;
}
/***********************************************************************
* Helper for k32 family functions
*/
...
...
@@ -131,6 +145,200 @@ INT WINAPIV k32wsprintfA(LPSTR buffer, LPCSTR spec, ...)
}
/***********************************************************************
* hmemcpy (KERNEL.348)
*/
void
WINAPI
hmemcpy16
(
LPVOID
dst
,
LPCVOID
src
,
LONG
count
)
{
memcpy
(
dst
,
src
,
count
);
}
/***********************************************************************
* lstrcat (KERNEL.89)
*/
SEGPTR
WINAPI
lstrcat16
(
SEGPTR
dst
,
LPCSTR
src
)
{
/* Windows does not check for NULL pointers here, so we don't either */
strcat
(
MapSL
(
dst
),
src
);
return
dst
;
}
/***********************************************************************
* lstrcat (KERNEL32.@)
* lstrcatA (KERNEL32.@)
*/
LPSTR
WINAPI
lstrcatA
(
LPSTR
dst
,
LPCSTR
src
)
{
__TRY
{
strcat
(
dst
,
src
);
}
__EXCEPT
(
page_fault
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcatW (KERNEL32.@)
*/
LPWSTR
WINAPI
lstrcatW
(
LPWSTR
dst
,
LPCWSTR
src
)
{
__TRY
{
strcatW
(
dst
,
src
);
}
__EXCEPT
(
page_fault
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcatn (KERNEL.352)
*/
SEGPTR
WINAPI
lstrcatn16
(
SEGPTR
dst
,
LPCSTR
src
,
INT16
n
)
{
LPSTR
p
=
MapSL
(
dst
);
LPSTR
start
=
p
;
while
(
*
p
)
p
++
;
if
((
n
-=
(
p
-
start
))
<=
0
)
return
dst
;
lstrcpynA
(
p
,
src
,
n
);
return
dst
;
}
/***********************************************************************
* lstrcpy (KERNEL.88)
*/
SEGPTR
WINAPI
lstrcpy16
(
SEGPTR
dst
,
LPCSTR
src
)
{
if
(
!
lstrcpyA
(
MapSL
(
dst
),
src
))
dst
=
0
;
return
dst
;
}
/***********************************************************************
* lstrcpy (KERNEL32.@)
* lstrcpyA (KERNEL32.@)
*/
LPSTR
WINAPI
lstrcpyA
(
LPSTR
dst
,
LPCSTR
src
)
{
__TRY
{
/* this is how Windows does it */
memmove
(
dst
,
src
,
strlen
(
src
)
+
1
);
}
__EXCEPT
(
page_fault
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcpyW (KERNEL32.@)
*/
LPWSTR
WINAPI
lstrcpyW
(
LPWSTR
dst
,
LPCWSTR
src
)
{
__TRY
{
strcpyW
(
dst
,
src
);
}
__EXCEPT
(
page_fault
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcpyn (KERNEL.353)
*/
SEGPTR
WINAPI
lstrcpyn16
(
SEGPTR
dst
,
LPCSTR
src
,
INT16
n
)
{
lstrcpynA
(
MapSL
(
dst
),
src
,
n
);
return
dst
;
}
/***********************************************************************
* lstrlen (KERNEL.90)
*/
INT16
WINAPI
lstrlen16
(
LPCSTR
str
)
{
return
(
INT16
)
lstrlenA
(
str
);
}
/***********************************************************************
* lstrlen (KERNEL32.@)
* lstrlenA (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
;
}
/***********************************************************************
* UnicodeToAnsi (KERNEL.434)
*/
INT16
WINAPI
UnicodeToAnsi16
(
LPCWSTR
src
,
LPSTR
dst
,
INT16
codepage
)
{
if
(
codepage
==
-
1
)
codepage
=
CP_ACP
;
return
WideCharToMultiByte
(
codepage
,
0
,
src
,
-
1
,
dst
,
0x7fffffff
,
NULL
,
NULL
);
}
/***************************************************************************
*
* Win 2.x string functions now moved to USER
...
...
dlls/ntdll/path.c
View file @
65e7196f
...
...
@@ -231,7 +231,7 @@ BOOLEAN WINAPI RtlDosPathNameToNtPathName_U(PWSTR dos_path,
ntpath
->
Length
=
strlenW
(
ntpath
->
Buffer
)
*
sizeof
(
WCHAR
);
if
(
file_part
&&
*
file_part
)
*
file_part
=
ntpath
->
Buffer
+
ntpath
->
Length
/
sizeof
(
WCHAR
)
-
l
strlenW
(
*
file_part
);
*
file_part
=
ntpath
->
Buffer
+
ntpath
->
Length
/
sizeof
(
WCHAR
)
-
strlenW
(
*
file_part
);
/* FIXME: cd filling */
...
...
files/dos_fs.c
View file @
65e7196f
...
...
@@ -2415,7 +2415,7 @@ DWORD WINAPI QueryDosDeviceW(LPCWSTR devname,LPWSTR target,DWORD bufsize)
for
(
i
=
0
;
(
i
<
(
sizeof
(
devices
)
/
sizeof
(
devices
[
0
])));
i
++
)
{
DWORD
len
=
strlenW
(
devices
[
i
]);
if
(
target
&&
(
bufsize
>=
ret
+
len
+
2
))
{
l
strcpyW
(
target
+
ret
,
devices
[
i
]);
strcpyW
(
target
+
ret
,
devices
[
i
]);
ret
+=
len
+
1
;
}
else
{
/* in this case WinXP returns 0 */
...
...
@@ -2474,9 +2474,9 @@ DWORD WINAPI QueryDosDeviceW(LPCWSTR devname,LPWSTR target,DWORD bufsize)
ret
=
strlenW
(
pDev
)
+
strlenW
(
pName
)
+
numsiz
+
2
;
if
(
ret
>
bufsize
)
ret
=
0
;
if
(
target
&&
ret
)
{
l
strcpyW
(
target
,
pDev
);
l
strcatW
(
target
,
pName
);
if
(
pNum
)
l
strcatW
(
target
,
pNum
);
strcpyW
(
target
,
pDev
);
strcatW
(
target
,
pName
);
if
(
pNum
)
strcatW
(
target
,
pNum
);
target
[
ret
-
1
]
=
0
;
}
return
ret
;
...
...
memory/string.c
View file @
65e7196f
...
...
@@ -36,150 +36,6 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
string
);
/* filter for page-fault exceptions */
static
WINE_EXCEPTION_FILTER
(
page_fault
)
{
if
(
GetExceptionCode
()
==
EXCEPTION_ACCESS_VIOLATION
)
return
EXCEPTION_EXECUTE_HANDLER
;
return
EXCEPTION_CONTINUE_SEARCH
;
}
/***********************************************************************
* hmemcpy (KERNEL.348)
*/
void
WINAPI
hmemcpy16
(
LPVOID
dst
,
LPCVOID
src
,
LONG
count
)
{
memcpy
(
dst
,
src
,
count
);
}
/***********************************************************************
* lstrcat (KERNEL.89)
*/
SEGPTR
WINAPI
lstrcat16
(
SEGPTR
dst
,
LPCSTR
src
)
{
/* Windows does not check for NULL pointers here, so we don't either */
strcat
(
MapSL
(
dst
),
src
);
return
dst
;
}
/***********************************************************************
* lstrcat (KERNEL32.@)
* lstrcatA (KERNEL32.@)
*/
LPSTR
WINAPI
lstrcatA
(
LPSTR
dst
,
LPCSTR
src
)
{
__TRY
{
strcat
(
dst
,
src
);
}
__EXCEPT
(
page_fault
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcatW (KERNEL32.@)
*/
LPWSTR
WINAPI
lstrcatW
(
LPWSTR
dst
,
LPCWSTR
src
)
{
__TRY
{
strcatW
(
dst
,
src
);
}
__EXCEPT
(
page_fault
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcatn (KERNEL.352)
*/
SEGPTR
WINAPI
lstrcatn16
(
SEGPTR
dst
,
LPCSTR
src
,
INT16
n
)
{
LPSTR
p
=
MapSL
(
dst
);
LPSTR
start
=
p
;
while
(
*
p
)
p
++
;
if
((
n
-=
(
p
-
start
))
<=
0
)
return
dst
;
lstrcpynA
(
p
,
src
,
n
);
return
dst
;
}
/***********************************************************************
* lstrcpy (KERNEL.88)
*/
SEGPTR
WINAPI
lstrcpy16
(
SEGPTR
dst
,
LPCSTR
src
)
{
if
(
!
lstrcpyA
(
MapSL
(
dst
),
src
))
dst
=
0
;
return
dst
;
}
/***********************************************************************
* lstrcpy (KERNEL32.@)
* lstrcpyA (KERNEL32.@)
*/
LPSTR
WINAPI
lstrcpyA
(
LPSTR
dst
,
LPCSTR
src
)
{
__TRY
{
/* this is how Windows does it */
memmove
(
dst
,
src
,
strlen
(
src
)
+
1
);
}
__EXCEPT
(
page_fault
)
{
ERR
(
"(%p, %p): page fault occurred ! Caused by bug ?
\n
"
,
dst
,
src
);
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcpyW (KERNEL32.@)
*/
LPWSTR
WINAPI
lstrcpyW
(
LPWSTR
dst
,
LPCWSTR
src
)
{
__TRY
{
strcpyW
(
dst
,
src
);
}
__EXCEPT
(
page_fault
)
{
SetLastError
(
ERROR_INVALID_PARAMETER
);
return
NULL
;
}
__ENDTRY
return
dst
;
}
/***********************************************************************
* lstrcpyn (KERNEL.353)
*/
SEGPTR
WINAPI
lstrcpyn16
(
SEGPTR
dst
,
LPCSTR
src
,
INT16
n
)
{
lstrcpynA
(
MapSL
(
dst
),
src
,
n
);
return
dst
;
}
/***********************************************************************
* lstrcpyn (KERNEL32.@)
* lstrcpynA (KERNEL32.@)
...
...
@@ -247,65 +103,3 @@ LPWSTR WINAPI lstrcpynW( LPWSTR dst, LPCWSTR src, INT n )
if
(
count
)
*
p
=
0
;
return
dst
;
}
/***********************************************************************
* lstrlen (KERNEL.90)
*/
INT16
WINAPI
lstrlen16
(
LPCSTR
str
)
{
return
(
INT16
)
lstrlenA
(
str
);
}
/***********************************************************************
* lstrlen (KERNEL32.@)
* lstrlenA (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
;
}
/***********************************************************************
* UnicodeToAnsi (KERNEL.434)
*/
INT16
WINAPI
UnicodeToAnsi16
(
LPCWSTR
src
,
LPSTR
dst
,
INT16
codepage
)
{
if
(
codepage
==
-
1
)
codepage
=
CP_ACP
;
return
WideCharToMultiByte
(
codepage
,
0
,
src
,
-
1
,
dst
,
0x7fffffff
,
NULL
,
NULL
);
}
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