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
4b43b4d5
Commit
4b43b4d5
authored
Nov 15, 2000
by
Jon Griffiths
Committed by
Alexandre Julliard
Nov 15, 2000
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
- Complete the implementation of heap functions
- Forward j0,j1,jn,y0,y1,yn math calls to libc - Add strnextc, pass text flag in creat, winapi_check fixes
parent
9308f640
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
143 additions
and
39 deletions
+143
-39
crtdll.h
dlls/crtdll/crtdll.h
+22
-0
crtdll.spec
dlls/crtdll/crtdll.spec
+8
-8
crtdll_main.c
dlls/crtdll/crtdll_main.c
+1
-29
file.c
dlls/crtdll/file.c
+3
-2
memory.c
dlls/crtdll/memory.c
+97
-0
string.c
dlls/crtdll/string.c
+11
-0
crtdll.api
tools/winapi_check/win32/crtdll.api
+1
-0
No files found.
dlls/crtdll/crtdll.h
View file @
4b43b4d5
...
...
@@ -61,6 +61,16 @@
/* windows.h RAND_MAX is smaller than normal RAND_MAX */
#define CRTDLL_RAND_MAX 0x7fff
/* heap function constants */
#define _HEAPEMPTY -1
#define _HEAPOK -2
#define _HEAPBADBEGIN -3
#define _HEAPBADNODE -4
#define _HEAPEND -5
#define _HEAPBADPTR -6
#define _FREEENTRY 0
#define _USEDENTRY 1
/* CRTDLL Globals */
extern
INT
CRTDLL_doserrno
;
extern
INT
CRTDLL_errno
;
...
...
@@ -153,6 +163,13 @@ struct complex
double
imaginary
;
};
typedef
struct
_heapinfo
{
int
*
_pentry
;
size_t
_size
;
int
_useflag
;
}
_HEAPINFO
;
typedef
VOID
(
*
sig_handler_type
)(
VOID
);
typedef
VOID
(
*
new_handler_type
)(
VOID
);
...
...
@@ -308,6 +325,10 @@ LPVOID __cdecl CRTDLL__lsearch( LPVOID match, LPVOID start, LPUINT array_size,
LPVOID
__cdecl
CRTDLL_new
(
DWORD
size
);
VOID
__cdecl
CRTDLL_delete
(
LPVOID
ptr
);
new_handler_type
__cdecl
CRTDLL_set_new_handler
(
new_handler_type
func
);
INT
__cdecl
CRTDLL__heapchk
(
VOID
);
INT
__cdecl
CRTDLL__heapmin
(
VOID
);
INT
__cdecl
CRTDLL__heapset
(
UINT
value
);
INT
__cdecl
CRTDLL__heapwalk
(
struct
_heapinfo
*
next
);
LPVOID
__cdecl
CRTDLL__expand
(
LPVOID
ptr
,
INT
size
);
LONG
__cdecl
CRTDLL__msize
(
LPVOID
mem
);
LPVOID
__cdecl
CRTDLL_calloc
(
DWORD
size
,
DWORD
count
);
...
...
@@ -323,6 +344,7 @@ INT __cdecl CRTDLL_system( LPSTR x );
LPSTR
__cdecl
CRTDLL__strdec
(
LPSTR
str1
,
LPSTR
str2
);
LPSTR
__cdecl
CRTDLL__strdup
(
LPCSTR
ptr
);
LPSTR
__cdecl
CRTDLL__strinc
(
LPSTR
str
);
UINT
__cdecl
CRTDLL__strnextc
(
LPCSTR
str
);
LPSTR
__cdecl
CRTDLL__strninc
(
LPSTR
str
,
INT
n
);
LPSTR
__cdecl
CRTDLL__strnset
(
LPSTR
str
,
INT
c
,
INT
len
);
LPSTR
__cdecl
CRTDLL__strrev
(
LPSTR
str
);
...
...
dlls/crtdll/crtdll.spec
View file @
4b43b4d5
...
...
@@ -137,10 +137,10 @@ debug_channels (crtdll)
@ stub _getsystime
@ stub _getw
@ cdecl _global_unwind2(ptr) CRTDLL__global_unwind2
@
stub
_heapchk
@
stub
_heapmin
@
stub
_heapset
@
stub
_heapwalk
@
cdecl _heapchk() CRTDLL_
_heapchk
@
cdecl _heapmin() CRTDLL_
_heapmin
@
cdecl _heapset(long) CRTDLL_
_heapset
@
cdecl _heapwalk(ptr) CRTDLL_
_heapwalk
@ cdecl _hypot(double double) hypot
@ cdecl _initterm(ptr ptr) CRTDLL__initterm
@ extern _iob __CRTDLL_iob
...
...
@@ -174,9 +174,9 @@ debug_channels (crtdll)
@ cdecl _isnan(double) CRTDLL__isnan
@ forward _itoa ntdll._itoa
@ cdecl _itow(long str long) CRTDLL__itow
@ cdecl _j0(double)
CRTDLL__
j0
@ cdecl _j1(double)
CRTDLL__
j1
@ cdecl _jn(long double)
CRTDLL__
jn
@ cdecl _j0(double) j0
@ cdecl _j1(double) j1
@ cdecl _jn(long double) jn
@ stub _kbhit
@ stub _lfind
@ cdecl _loaddll(str) CRTDLL__loaddll
...
...
@@ -299,7 +299,7 @@ debug_channels (crtdll)
@ cdecl _strinc(str) CRTDLL__strinc
@ forward _strlwr ntdll._strlwr
@ cdecl _strncnt(str long) CRTDLL__strncnt
@
stub
_strnextc
@
cdecl _strnextc(str) CRTDLL_
_strnextc
@ cdecl _strnicmp(str str long) strncasecmp
@ cdecl _strninc(str long) CRTDLL__strninc
@ cdecl _strnset(str long long) CRTDLL__strnset
...
...
dlls/crtdll/crtdll_main.c
View file @
4b43b4d5
...
...
@@ -545,7 +545,7 @@ LPINT __cdecl CRTDLL__errno( VOID )
/*********************************************************************
* _
doserrno
(CRTDLL.26)
* _
_doserrno
(CRTDLL.26)
*
* Return the address of the DOS errno (holding the last OS error).
*
...
...
@@ -1022,31 +1022,3 @@ INT __cdecl CRTDLL__isnan(double d)
*/
return
isnan
(
d
)
?
1
:
0
;
}
/*********************************************************************
* _j0 (CRTDLL.166)
*/
double
CRTDLL__j0
(
double
x
)
{
FIXME
(
":stub!
\n
"
);
return
x
;
}
/*********************************************************************
* _j1 (CRTDLL.167)
*/
double
CRTDLL__j1
(
double
x
)
{
FIXME
(
":stub!
\n
"
);
return
x
;
}
/*********************************************************************
* _jn (CRTDLL.168)
*/
double
CRTDLL__jn
(
LONG
x
,
double
y
)
{
FIXME
(
":stub!
\n
"
);
return
x
;
}
dlls/crtdll/file.c
View file @
4b43b4d5
...
...
@@ -278,13 +278,14 @@ INT __cdecl CRTDLL__commit(INT fd)
/*********************************************************************
* _creat
(CRTDLL.
66)
* _creat
(CRTDLL.0
66)
*
* Open a file, creating it if it is not present.
*/
INT
__cdecl
CTRDLL__creat
(
LPCSTR
path
,
INT
flags
)
{
return
CRTDLL__open
(
path
,
_O_CREAT
|
_O_WRONLY
|
_O_TRUNC
);
INT
usedFlags
=
(
flags
&
_O_TEXT
)
|
_O_CREAT
|
_O_WRONLY
|
_O_TRUNC
;
return
CRTDLL__open
(
path
,
usedFlags
);
}
...
...
dlls/crtdll/memory.c
View file @
4b43b4d5
...
...
@@ -8,6 +8,9 @@
*
* Implementation Notes:
* MT Safe.
* heapwalk from win does not work. This is most likely due to internal
* differences between wine and win (see memory/heap.c comments). This
* version works fine, however.
*/
#include "crtdll.h"
...
...
@@ -67,6 +70,100 @@ LPVOID __cdecl CRTDLL__expand(LPVOID ptr, INT size)
/*********************************************************************
* _heapchk (CRTDLL.130)
*
* Check the consistency of the process heap.
*/
INT
__cdecl
CRTDLL__heapchk
(
VOID
)
{
if
(
!
HeapValidate
(
GetProcessHeap
(),
0
,
NULL
))
{
__CRTDLL__set_errno
(
GetLastError
());
return
_HEAPBADNODE
;
}
return
_HEAPOK
;
}
/*********************************************************************
* _heapmin (CRTDLL.131)
*
* Minimise the size of the heap.
*/
INT
__cdecl
CRTDLL__heapmin
(
VOID
)
{
if
(
!
HeapCompact
(
GetProcessHeap
(),
0
))
{
if
(
GetLastError
()
!=
ERROR_CALL_NOT_IMPLEMENTED
)
__CRTDLL__set_errno
(
GetLastError
());
return
-
1
;
}
return
0
;
}
/*********************************************************************
* _heapset (CRTDLL.132)
*
* Fill free memory in the heap with a given value.
*/
INT
__cdecl
CRTDLL__heapset
(
UINT
value
)
{
INT
retVal
;
struct
_heapinfo
heap
;
memset
(
&
heap
,
0
,
sizeof
(
heap
)
);
while
((
retVal
=
CRTDLL__heapwalk
(
&
heap
))
==
_HEAPOK
)
{
if
(
heap
.
_useflag
==
_FREEENTRY
)
memset
(
heap
.
_pentry
,
value
,
heap
.
_size
);
}
return
retVal
==
_HEAPEND
?
_HEAPOK
:
retVal
;
}
/*********************************************************************
* _heapwalk (CRTDLL.133)
*
* Walk the heap block by block.
*/
INT
__cdecl
CRTDLL__heapwalk
(
struct
_heapinfo
*
next
)
{
PROCESS_HEAP_ENTRY
phe
;
phe
.
lpData
=
next
->
_pentry
;
phe
.
cbData
=
next
->
_size
;
phe
.
wFlags
=
next
->
_useflag
==
_USEDENTRY
?
PROCESS_HEAP_ENTRY_BUSY
:
0
;
if
(
phe
.
lpData
&&
phe
.
wFlags
&
PROCESS_HEAP_ENTRY_BUSY
&&
!
HeapValidate
(
GetProcessHeap
(),
0
,
phe
.
lpData
))
{
__CRTDLL__set_errno
(
GetLastError
());
return
_HEAPBADNODE
;
}
do
{
if
(
!
HeapWalk
(
GetProcessHeap
(),
&
phe
))
{
if
(
GetLastError
()
==
ERROR_NO_MORE_ITEMS
)
return
_HEAPEND
;
__CRTDLL__set_errno
(
GetLastError
());
if
(
!
phe
.
lpData
)
return
_HEAPBADBEGIN
;
return
_HEAPBADNODE
;
}
}
while
(
phe
.
wFlags
&
(
PROCESS_HEAP_REGION
|
PROCESS_HEAP_UNCOMMITTED_RANGE
));
next
->
_pentry
=
phe
.
lpData
;
next
->
_size
=
phe
.
cbData
;
next
->
_useflag
=
phe
.
wFlags
&
PROCESS_HEAP_ENTRY_BUSY
?
_USEDENTRY
:
_FREEENTRY
;
return
_HEAPOK
;
}
/*********************************************************************
* _msize (CRTDLL.234)
*
* Return the actual used size of an allocated block of memory.
...
...
dlls/crtdll/string.c
View file @
4b43b4d5
...
...
@@ -87,6 +87,17 @@ LPSTR __cdecl CRTDLL__strinc(LPSTR str)
/*********************************************************************
* _strnextc (CRTDLL.290)
*
* Return an unsigned int from a string.
*/
UINT
__cdecl
CRTDLL__strnextc
(
LPCSTR
str
)
{
return
(
UINT
)
*
str
;
}
/*********************************************************************
* _strninc (CRTDLL.292)
*
* Return a pointer to the 'n'th character in a string
...
...
tools/winapi_check/win32/crtdll.api
View file @
4b43b4d5
...
...
@@ -51,6 +51,7 @@ struct _stat *
struct win_stat *
struct _timeb *
time_t *
struct _heapinfo *
fpos_t *
diskfree_t *
unsigned char *
...
...
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