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
8d311c31
Commit
8d311c31
authored
Nov 16, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed calls to Wine internal functions.
parent
0e44f63c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
49 additions
and
112 deletions
+49
-112
crtdll.spec
dlls/crtdll/crtdll.spec
+3
-3
crtdll_main.c
dlls/crtdll/crtdll_main.c
+9
-31
dir.c
dlls/crtdll/dir.c
+17
-10
file.c
dlls/crtdll/file.c
+18
-27
spawn.c
dlls/crtdll/spawn.c
+2
-41
No files found.
dlls/crtdll/crtdll.spec
View file @
8d311c31
...
...
@@ -40,8 +40,8 @@ debug_channels (crtdll)
@ cdecl __iscsymf(long) CRTDLL___iscsymf
@ stub __mb_cur_max_dll
@ stub __pxcptinfoptrs
@
cdecl __threadhandle()
GetCurrentThread
@
cdecl __threadid()
GetCurrentThreadId
@
forward __threadhandle kernel32.
GetCurrentThread
@
forward __threadid kernel32.
GetCurrentThreadId
@ cdecl __toascii(long) CRTDLL___toascii
@ cdecl _abnormal_termination() CRTDLL__abnormal_termination
@ cdecl _access(str long) CRTDLL__access
...
...
@@ -467,7 +467,7 @@ debug_channels (crtdll)
@ cdecl sinh(double) sinh
@ varargs sprintf() sprintf
@ cdecl sqrt(double) sqrt
@ cdecl srand(long)
CRTDLL_
srand
@ cdecl srand(long) srand
@ varargs sscanf() sscanf
@ cdecl strcat(str str) strcat
@ cdecl strchr(str long) strchr
...
...
dlls/crtdll/crtdll_main.c
View file @
8d311c31
...
...
@@ -28,7 +28,6 @@ UB 000416:
#include <math.h>
#include <errno.h>
#include <stdlib.h>
#include "file.h"
#include "ntddk.h"
#include "wingdi.h"
#include "winuser.h"
...
...
@@ -258,16 +257,6 @@ INT __cdecl CRTDLL__setjmp(LPDWORD *jmpbuf)
/*********************************************************************
* srand (CRTDLL.460)
*/
void
__cdecl
CRTDLL_srand
(
DWORD
seed
)
{
/* FIXME: should of course be thread? process? local */
srand
(
seed
);
}
/*********************************************************************
* _beep (CRTDLL.045)
*
* Output a tone using the PC speaker.
...
...
@@ -301,10 +290,8 @@ INT __cdecl CRTDLL_rand()
*/
UINT
__cdecl
CRTDLL__rotl
(
UINT
x
,
INT
shift
)
{
unsigned
int
ret
=
(
x
>>
shift
)
|
(
x
>>
((
sizeof
(
x
))
-
shift
));
TRACE
(
"got 0x%08x rot %d ret 0x%08x
\n
"
,
x
,
shift
,
ret
);
return
ret
;
shift
&=
31
;
return
(
x
<<
shift
)
|
(
x
>>
(
32
-
shift
));
}
...
...
@@ -313,10 +300,8 @@ UINT __cdecl CRTDLL__rotl(UINT x,INT shift)
*/
DWORD
__cdecl
CRTDLL__lrotl
(
DWORD
x
,
INT
shift
)
{
unsigned
long
ret
=
(
x
>>
shift
)
|
(
x
>>
((
sizeof
(
x
))
-
shift
));
TRACE
(
"got 0x%08lx rot %d ret 0x%08lx
\n
"
,
x
,
shift
,
ret
);
return
ret
;
shift
&=
31
;
return
(
x
<<
shift
)
|
(
x
>>
(
32
-
shift
));
}
...
...
@@ -325,10 +310,8 @@ DWORD __cdecl CRTDLL__lrotl(DWORD x,INT shift)
*/
DWORD
__cdecl
CRTDLL__lrotr
(
DWORD
x
,
INT
shift
)
{
/* Depends on "long long" being 64 bit or greater */
unsigned
long
long
arg
=
x
;
unsigned
long
long
ret
=
(
arg
<<
32
|
(
x
&
0xFFFFFFFF
))
>>
(
shift
&
0x1f
);
return
ret
&
0xFFFFFFFF
;
shift
&=
0x1f
;
return
(
x
>>
shift
)
|
(
x
<<
(
32
-
shift
));
}
...
...
@@ -337,10 +320,8 @@ DWORD __cdecl CRTDLL__lrotr(DWORD x,INT shift)
*/
DWORD
__cdecl
CRTDLL__rotr
(
UINT
x
,
INT
shift
)
{
/* Depends on "long long" being 64 bit or greater */
unsigned
long
long
arg
=
x
;
unsigned
long
long
ret
=
(
arg
<<
32
|
(
x
&
0xFFFFFFFF
))
>>
(
shift
&
0x1f
);
return
ret
&
0xFFFFFFFF
;
shift
&=
0x1f
;
return
(
x
>>
shift
)
|
(
x
<<
(
32
-
shift
));
}
...
...
@@ -413,15 +394,12 @@ BOOL __cdecl CRTDLL__isctype(CHAR x,CHAR type)
*/
LPSTR
__cdecl
CRTDLL__fullpath
(
LPSTR
buf
,
LPCSTR
name
,
INT
size
)
{
DOS_FULL_NAME
full_name
;
if
(
!
buf
)
{
size
=
256
;
if
(
!
(
buf
=
CRTDLL_malloc
(
size
)))
return
NULL
;
}
if
(
!
DOSFS_GetFullName
(
name
,
FALSE
,
&
full_name
))
return
NULL
;
lstrcpynA
(
buf
,
full_name
.
short_name
,
size
);
if
(
!
GetFullPathNameA
(
name
,
size
,
buf
,
NULL
))
return
NULL
;
TRACE
(
"CRTDLL_fullpath got %s
\n
"
,
buf
);
return
buf
;
}
...
...
dlls/crtdll/dir.c
View file @
8d311c31
...
...
@@ -14,9 +14,8 @@
#include "crtdll.h"
#include <errno.h>
#include "
drive
.h"
#include "
ntddk
.h"
#include <time.h>
#include "file.h"
DEFAULT_DEBUG_CHANNEL
(
crtdll
);
...
...
@@ -24,7 +23,7 @@ DEFAULT_DEBUG_CHANNEL(crtdll);
static
void
__CRTDLL__fttofd
(
LPWIN32_FIND_DATAA
fd
,
find_t
*
ft
);
static
void
__CRTDLL__fttofd
(
LPWIN32_FIND_DATAA
fd
,
find_t
*
ft
)
{
static
DWORD
dummy
;
DWORD
dw
;
/* Tested with crtdll.dll Version 2.50.4170 (NT) from win98 SE:
* attrib 0x80 (FILE_ATTRIBUTE_NORMAL)is returned as 0.
...
...
@@ -34,9 +33,12 @@ static void __CRTDLL__fttofd(LPWIN32_FIND_DATAA fd, find_t* ft)
else
ft
->
attrib
=
fd
->
dwFileAttributes
;
ft
->
time_create
=
DOSFS_FileTimeToUnixTime
(
&
fd
->
ftCreationTime
,
&
dummy
);
ft
->
time_access
=
DOSFS_FileTimeToUnixTime
(
&
fd
->
ftLastAccessTime
,
&
dummy
);
ft
->
time_write
=
DOSFS_FileTimeToUnixTime
(
&
fd
->
ftLastWriteTime
,
&
dummy
);
RtlTimeToSecondsSince1970
(
&
fd
->
ftCreationTime
,
&
dw
);
ft
->
time_create
=
dw
;
RtlTimeToSecondsSince1970
(
&
fd
->
ftLastAccessTime
,
&
dw
);
ft
->
time_access
=
dw
;
RtlTimeToSecondsSince1970
(
&
fd
->
ftLastWriteTime
,
&
dw
);
ft
->
time_write
=
dw
;
ft
->
size
=
fd
->
nFileSizeLow
;
strcpy
(
ft
->
name
,
fd
->
cFileName
);
}
...
...
@@ -81,7 +83,9 @@ INT __cdecl CRTDLL__chdir(LPCSTR newdir)
*/
BOOL
__cdecl
CRTDLL__chdrive
(
INT
newdrive
)
{
if
(
!
DRIVE_SetCurrentDrive
(
newdrive
-
1
))
char
buffer
[
3
]
=
"A:"
;
buffer
[
0
]
+=
newdrive
-
1
;
if
(
!
SetCurrentDirectoryA
(
buffer
))
{
__CRTDLL__set_errno
(
GetLastError
());
if
(
newdrive
<=
0
)
...
...
@@ -233,7 +237,7 @@ CHAR* __cdecl CRTDLL__getdcwd(INT drive,LPSTR buf, INT size)
{
static
CHAR
*
dummy
;
if
(
!
drive
||
--
drive
==
DRIVE_GetCurrentD
rive
())
if
(
!
drive
||
drive
==
CRTDLL__getd
rive
())
return
CRTDLL__getcwd
(
buf
,
size
);
/* current */
else
{
...
...
@@ -241,7 +245,7 @@ CHAR* __cdecl CRTDLL__getdcwd(INT drive,LPSTR buf, INT size)
char
drivespec
[
4
]
=
{
'A'
,
':'
,
'\\'
,
0
};
int
dir_len
;
drivespec
[
0
]
+=
drive
;
drivespec
[
0
]
+=
drive
-
1
;
if
(
GetDriveTypeA
(
drivespec
)
<
DRIVE_REMOVABLE
)
{
CRTDLL_errno
=
EACCES
;
...
...
@@ -302,7 +306,10 @@ UINT __cdecl CRTDLL__getdiskfree(UINT disk, diskfree_t* d)
*/
INT
__cdecl
CRTDLL__getdrive
(
VOID
)
{
return
DRIVE_GetCurrentDrive
()
+
1
;
char
buffer
[
MAX_PATH
];
if
(
!
GetCurrentDirectoryA
(
sizeof
(
buffer
),
buffer
))
return
0
;
if
(
buffer
[
1
]
!=
':'
)
return
0
;
return
toupper
(
buffer
[
0
])
-
'A'
+
1
;
}
...
...
dlls/crtdll/file.c
View file @
8d311c31
...
...
@@ -39,9 +39,7 @@
#include <string.h>
#include <ctype.h>
#include <errno.h>
#include "drive.h"
#include "file.h"
#include "ntddk.h"
DEFAULT_DEBUG_CHANNEL
(
crtdll
);
...
...
@@ -470,7 +468,7 @@ CRTDLL_FILE* __cdecl CRTDLL__fsopen(LPCSTR path, LPCSTR mode, INT share)
*/
int
__cdecl
CRTDLL__fstat
(
int
fd
,
struct
_stat
*
buf
)
{
static
DWORD
dummy
;
DWORD
dw
;
BY_HANDLE_FILE_INFORMATION
hfi
;
HANDLE
hand
=
__CRTDLL__fdtoh
(
fd
);
...
...
@@ -496,9 +494,10 @@ int __cdecl CRTDLL__fstat(int fd, struct _stat* buf)
FIXME
(
":dwFileAttributes = %d, mode set to 0"
,
hfi
.
dwFileAttributes
);
buf
->
st_nlink
=
hfi
.
nNumberOfLinks
;
buf
->
st_size
=
hfi
.
nFileSizeLow
;
buf
->
st_atime
=
DOSFS_FileTimeToUnixTime
(
&
hfi
.
ftCreationTime
,
&
dummy
);
buf
->
st_mtime
=
DOSFS_FileTimeToUnixTime
(
&
hfi
.
ftLastAccessTime
,
&
dummy
);
buf
->
st_ctime
=
DOSFS_FileTimeToUnixTime
(
&
hfi
.
ftLastWriteTime
,
&
dummy
);
RtlTimeToSecondsSince1970
(
&
hfi
.
ftLastAccessTime
,
&
dw
);
buf
->
st_atime
=
dw
;
RtlTimeToSecondsSince1970
(
&
hfi
.
ftLastWriteTime
,
&
dw
);
buf
->
st_mtime
=
buf
->
st_ctime
=
dw
;
return
0
;
}
...
...
@@ -763,27 +762,18 @@ INT __cdecl CRTDLL__setmode(INT fd,INT mode)
*/
INT
__cdecl
CRTDLL__stat
(
const
char
*
path
,
struct
_stat
*
buf
)
{
static
DWORD
dummy
;
DOS_FULL_NAME
full_name
;
BY_HANDLE_FILE_INFORMATION
hfi
;
DWORD
dw
;
WIN32_FILE_ATTRIBUTE_DATA
hfi
;
unsigned
short
mode
=
CRTDLL_S_IREAD
;
int
plen
;
TRACE
(
":file (%s) buf(%p)
\n
"
,
path
,
buf
);
if
(
!
DOSFS_GetFullName
(
path
,
TRUE
,
&
full_name
))
{
TRACE
(
"failed-last error (%ld)
\n
"
,
GetLastError
());
__CRTDLL__set_errno
(
ERROR_FILE_NOT_FOUND
);
return
-
1
;
}
memset
(
&
hfi
,
0
,
sizeof
(
hfi
));
if
(
!
FILE_Stat
(
full_name
.
long_name
,
&
hfi
))
if
(
!
GetFileAttributesExA
(
path
,
GetFileExInfoStandard
,
&
hfi
))
{
TRACE
(
"failed-last error (%ld)
\n
"
,
GetLastError
());
__CRTDLL__set_errno
(
ERROR_FILE_NOT_FOUND
);
return
-
1
;
TRACE
(
"failed-last error (%ld)
\n
"
,
GetLastError
());
__CRTDLL__set_errno
(
ERROR_FILE_NOT_FOUND
);
return
-
1
;
}
memset
(
buf
,
0
,
sizeof
(
struct
_stat
));
...
...
@@ -792,7 +782,7 @@ INT __cdecl CRTDLL__stat(const char* path, struct _stat * buf)
if
(
isalpha
(
*
path
))
buf
->
st_dev
=
buf
->
st_rdev
=
toupper
(
*
path
-
'A'
);
/* drive num */
else
buf
->
st_dev
=
buf
->
st_rdev
=
DRIVE_GetCurrentDrive
()
;
buf
->
st_dev
=
buf
->
st_rdev
=
CRTDLL__getdrive
()
-
1
;
plen
=
strlen
(
path
);
...
...
@@ -817,11 +807,12 @@ INT __cdecl CRTDLL__stat(const char* path, struct _stat * buf)
mode
|=
CRTDLL_S_IWRITE
;
buf
->
st_mode
=
mode
;
buf
->
st_nlink
=
hfi
.
nNumberOfLinks
;
buf
->
st_nlink
=
1
;
buf
->
st_size
=
hfi
.
nFileSizeLow
;
buf
->
st_atime
=
DOSFS_FileTimeToUnixTime
(
&
hfi
.
ftCreationTime
,
&
dummy
);
buf
->
st_mtime
=
buf
->
st_ctime
=
DOSFS_FileTimeToUnixTime
(
&
hfi
.
ftLastWriteTime
,
&
dummy
);
RtlTimeToSecondsSince1970
(
&
hfi
.
ftLastAccessTime
,
&
dw
);
buf
->
st_atime
=
dw
;
RtlTimeToSecondsSince1970
(
&
hfi
.
ftLastWriteTime
,
&
dw
);
buf
->
st_mtime
=
buf
->
st_ctime
=
dw
;
TRACE
(
"
\n
%d %d %d %d %d %d
\n
"
,
buf
->
st_mode
,
buf
->
st_nlink
,
buf
->
st_size
,
buf
->
st_atime
,
buf
->
st_mtime
,
buf
->
st_ctime
);
return
0
;
...
...
dlls/crtdll/spawn.c
View file @
8d311c31
...
...
@@ -41,7 +41,6 @@
#include "crtdll.h"
#include <errno.h>
#include "process.h"
#include "options.h"
#include <stdlib.h>
...
...
@@ -182,44 +181,6 @@ HANDLE __cdecl CRTDLL__spawnve(INT flags, LPSTR name, LPSTR *argv, LPSTR *envv)
*/
INT
__cdecl
CRTDLL_system
(
LPSTR
x
)
{
#define SYSBUF_LENGTH 1500
char
buffer
[
SYSBUF_LENGTH
];
unsigned
char
*
y
=
x
;
unsigned
char
*
bp
;
int
i
;
strcpy
(
buffer
,
argv0
);
bp
=
buffer
+
strlen
(
buffer
);
*
bp
++
=
' '
;
*
bp
++
=
'"'
;
*
bp
++
=
0
;
i
=
strlen
(
buffer
)
+
strlen
(
x
)
+
2
;
/* Calculate needed buffer size to prevent overflow. */
while
(
*
y
)
{
if
(
*
y
==
'\\'
)
i
++
;
y
++
;
}
/* If buffer too short, exit. */
if
(
i
>
SYSBUF_LENGTH
)
{
TRACE
(
"_system buffer to small
\n
"
);
return
127
;
}
y
=
x
;
while
(
*
y
)
{
*
bp
=
*
y
;
bp
++
;
y
++
;
if
(
*
(
y
-
1
)
==
'\\'
)
*
bp
++
=
'\\'
;
}
/* Remove spaces from end of string. */
while
(
*
(
y
-
1
)
==
' '
)
{
bp
--
;
y
--
;
}
*
bp
++
=
'"'
;
*
bp
=
0
;
TRACE
(
"_system got '%s', executing '%s'
\n
"
,
x
,
buffer
);
return
system
(
buffer
);
/* FIXME: should probably launch cmd interpreter in COMSPEC */
return
__CRTDLL__spawn
(
_P_WAIT
,
NULL
,
x
,
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