Removed some unnecessary definitions from file.h.
Got rid of drive.h.
diff --git a/dlls/kernel/ne_module.c b/dlls/kernel/ne_module.c
index e386904..21fd4fe 100644
--- a/dlls/kernel/ne_module.c
+++ b/dlls/kernel/ne_module.c
@@ -40,7 +40,6 @@
#include "wownt32.h"
#include "module.h"
#include "toolhelp.h"
-#include "file.h"
#include "builtin16.h"
#include "stackframe.h"
#include "excpt.h"
@@ -127,6 +126,34 @@
/***********************************************************************
+ * NE_strcasecmp
+ *
+ * locale-independent case conversion for module lookups
+ */
+static int NE_strcasecmp( const char *str1, const char *str2 )
+{
+ int ret = 0;
+ for ( ; ; str1++, str2++)
+ if ((ret = RtlUpperChar(*str1) - RtlUpperChar(*str2)) || !*str1) break;
+ return ret;
+}
+
+
+/***********************************************************************
+ * NE_strncasecmp
+ *
+ * locale-independent case conversion for module lookups
+ */
+static int NE_strncasecmp( const char *str1, const char *str2, int len )
+{
+ int ret = 0;
+ for ( ; len > 0; len--, str1++, str2++)
+ if ((ret = RtlUpperChar(*str1) - RtlUpperChar(*str2)) || !*str1) break;
+ return ret;
+}
+
+
+/***********************************************************************
* find_dll_descr
*
* Find a descriptor in the list
@@ -144,9 +171,9 @@
BYTE *name_table = (BYTE *)pModule + pModule->name_table;
/* check the dll file name */
- if (!FILE_strcasecmp( pOfs->szPathName, dllname )) return descr;
+ if (!NE_strcasecmp( pOfs->szPathName, dllname )) return descr;
/* check the dll module name (without extension) */
- if (!FILE_strncasecmp( dllname, name_table+1, *name_table ) &&
+ if (!NE_strncasecmp( dllname, name_table+1, *name_table ) &&
!strcmp( dllname + *name_table, ".dll" ))
return descr;
}
@@ -410,7 +437,7 @@
/* Now copy and uppercase the string */
strcpy( buffer, name );
- for (cpnt = buffer; *cpnt; cpnt++) *cpnt = FILE_toupper(*cpnt);
+ for (cpnt = buffer; *cpnt; cpnt++) *cpnt = RtlUpperChar(*cpnt);
len = cpnt - buffer;
/* First search the resident names */
@@ -1143,7 +1170,7 @@
strcpy( dllname, basename );
p = strrchr( dllname, '.' );
if (!p) strcat( dllname, ".dll" );
- for (p = dllname; *p; p++) *p = FILE_tolower(*p);
+ for (p = dllname; *p; p++) if (*p >= 'A' && *p <= 'Z') *p += 32;
if (!(descr = find_dll_descr( dllname )))
{
@@ -1577,7 +1604,7 @@
/* If uppercased 'name' matches exactly the module name of a module:
* Return its handle
*/
- for (s = tmpstr; *s; s++) *s = FILE_toupper(*s);
+ for (s = tmpstr; *s; s++) *s = RtlUpperChar(*s);
for (hModule = hFirstModule; hModule ; hModule = pModule->next)
{
@@ -1592,7 +1619,7 @@
* 'i' compare is just a quickfix until the loader handles that
* correctly. -MM 990705
*/
- if ((*name_table == len) && !FILE_strncasecmp(tmpstr, name_table+1, len))
+ if ((*name_table == len) && !NE_strncasecmp(tmpstr, name_table+1, len))
return hModule;
}
@@ -1631,7 +1658,7 @@
loadedfn--;
}
/* case insensitive compare ... */
- if (!FILE_strcasecmp(loadedfn, s))
+ if (!NE_strcasecmp(loadedfn, s))
return hModule;
}
return 0;
@@ -1943,7 +1970,7 @@
loadedfn--;
}
/* case insensitive compare ... */
- if (!FILE_strcasecmp(loadedfn, s))
+ if (!NE_strcasecmp(loadedfn, s))
return hModule;
}
/* If basename (without ext) matches the module name of a module:
@@ -1960,7 +1987,7 @@
if (pModule->flags & NE_FFLAGS_WIN32) continue;
name_table = (BYTE *)pModule + pModule->name_table;
- if ((*name_table == len) && !FILE_strncasecmp(s, name_table+1, len))
+ if ((*name_table == len) && !NE_strncasecmp(s, name_table+1, len))
return hModule;
}
diff --git a/dlls/kernel/ne_segment.c b/dlls/kernel/ne_segment.c
index aae639b..d1848d4 100644
--- a/dlls/kernel/ne_segment.c
+++ b/dlls/kernel/ne_segment.c
@@ -37,7 +37,6 @@
#include "wownt32.h"
#include "wine/library.h"
#include "kernel_private.h"
-#include "file.h"
#include "module.h"
#include "stackframe.h"
#include "builtin16.h"
diff --git a/dlls/kernel/process.c b/dlls/kernel/process.c
index 475a3ad..75e12b1 100644
--- a/dlls/kernel/process.c
+++ b/dlls/kernel/process.c
@@ -27,12 +27,16 @@
#include <locale.h>
#include <signal.h>
#include <stdio.h>
+#include <time.h>
+#ifdef HAVE_SYS_TIME_H
+# include <sys/time.h>
+#endif
+#include <sys/types.h>
#include "wine/winbase16.h"
#include "wine/winuser16.h"
#include "ntstatus.h"
#include "thread.h"
-#include "drive.h"
#include "file.h"
#include "module.h"
#include "options.h"
diff --git a/dlls/kernel/sync.c b/dlls/kernel/sync.c
index dc36eec..b3f1049 100644
--- a/dlls/kernel/sync.c
+++ b/dlls/kernel/sync.c
@@ -48,7 +48,6 @@
#include "wine/unicode.h"
#include "wine/winbase16.h"
#include "kernel_private.h"
-#include "file.h"
#include "wine/debug.h"
diff --git a/dlls/kernel/task.c b/dlls/kernel/task.c
index eff6b97..99599c8 100644
--- a/dlls/kernel/task.c
+++ b/dlls/kernel/task.c
@@ -37,7 +37,6 @@
#include "winuser.h"
#include "wine/winbase16.h"
-#include "drive.h"
#include "file.h"
#include "module.h"
#include "winternl.h"
diff --git a/dlls/kernel/time.c b/dlls/kernel/time.c
index 4b0028a..44170ba 100644
--- a/dlls/kernel/time.c
+++ b/dlls/kernel/time.c
@@ -24,7 +24,9 @@
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
+#include <stdarg.h>
#include <stdlib.h>
+#include <time.h>
#ifdef HAVE_SYS_TIME_H
# include <sys/time.h>
#endif
@@ -34,8 +36,10 @@
#define NONAMELESSUNION
#define NONAMELESSSTRUCT
+#include "windef.h"
+#include "winbase.h"
+#include "winreg.h"
#include "ntstatus.h"
-#include "file.h"
#include "winternl.h"
#include "winerror.h"
#include "winnls.h"
diff --git a/dlls/winedos/int21.c b/dlls/winedos/int21.c
index 8d78685..4d907b7 100644
--- a/dlls/winedos/int21.c
+++ b/dlls/winedos/int21.c
@@ -39,7 +39,6 @@
#include "winternl.h"
#include "wine/winbase16.h"
#include "dosexe.h"
-#include "file.h"
#include "winerror.h"
#include "winuser.h"
#include "wine/unicode.h"
@@ -3548,10 +3547,9 @@
* 'buffer' must be at least 12 characters long.
*/
/* Chars we don't want to see in DOS file names */
-#define INVALID_DOS_CHARS "*?<>|\"+=,;[] \345"
static BOOL INT21_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer )
{
- static const char invalid_chars[] = INVALID_DOS_CHARS;
+ static const WCHAR invalid_chars[] = {'*','?','<','>','|','\\','"','+','=',',',';','[',']',' ','\345',0};
LPCWSTR p = name;
int i;
@@ -3587,7 +3585,7 @@
buffer[i] = '?';
break;
default:
- if (*p < 256 && strchr( invalid_chars, (char)*p )) return FALSE;
+ if (strchrW( invalid_chars, *p )) return FALSE;
buffer[i] = toupperW(*p);
p++;
break;
@@ -3624,7 +3622,7 @@
buffer[i] = '?';
break;
default:
- if (*p < 256 && strchr( invalid_chars, (char)*p )) return FALSE;
+ if (strchrW( invalid_chars, *p )) return FALSE;
buffer[i] = toupperW(*p);
p++;
break;
@@ -3636,7 +3634,7 @@
* is something behind this ?
*/
while (*p == '*' || *p == ' ') p++; /* skip wildcards and spaces */
- return IS_END_OF_NAME(*p);
+ return (!*p || (*p == '/') || (*p == '\\'));
}
static HANDLE INT21_FindHandle;
diff --git a/files/directory.c b/files/directory.c
index a8a12e3..7f9d1fa 100644
--- a/files/directory.c
+++ b/files/directory.c
@@ -45,7 +45,6 @@
#include "winreg.h"
#include "winternl.h"
#include "wine/unicode.h"
-#include "drive.h"
#include "file.h"
#include "wine/debug.h"
@@ -342,26 +341,6 @@
/***********************************************************************
- * DIR_GetWindowsUnixDir
- */
-UINT DIR_GetWindowsUnixDir( LPSTR path, UINT count )
-{
- if (path) lstrcpynA( path, DIR_Windows.long_name, count );
- return strlen( DIR_Windows.long_name );
-}
-
-
-/***********************************************************************
- * DIR_GetSystemUnixDir
- */
-UINT DIR_GetSystemUnixDir( LPSTR path, UINT count )
-{
- if (path) lstrcpynA( path, DIR_System.long_name, count );
- return strlen( DIR_System.long_name );
-}
-
-
-/***********************************************************************
* GetTempDrive (KERNEL.92)
* A closer look at krnl386.exe shows what the SDK doesn't mention:
*
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 4b45fed..22198a4 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -55,8 +55,8 @@
#include "wine/unicode.h"
#include "wine/winbase16.h"
-#include "drive.h"
#include "file.h"
+#include "winreg.h"
#include "winternl.h"
#include "wine/server.h"
#include "wine/exception.h"
@@ -93,6 +93,7 @@
#endif /* linux */
#define IS_OPTION_TRUE(ch) ((ch) == 'y' || (ch) == 'Y' || (ch) == 't' || (ch) == 'T' || (ch) == '1')
+#define IS_END_OF_NAME(ch) (!(ch) || ((ch) == '/') || ((ch) == '\\'))
/* Chars we don't want to see in DOS file names */
#define INVALID_DOS_CHARS "*?<>|\"+=,;[] \345"
@@ -224,7 +225,7 @@
* Return FALSE if the name is not a valid DOS name.
* 'buffer' must be at least 12 characters long.
*/
-BOOL DOSFS_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer )
+static BOOL DOSFS_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer )
{
static const char invalid_chars[] = INVALID_DOS_CHARS;
LPCWSTR p = name;
diff --git a/files/drive.c b/files/drive.c
index 93e2a7c..014d9f3 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -55,7 +55,6 @@
#include "winioctl.h"
#include "ntddstor.h"
#include "ntddcdrm.h"
-#include "drive.h"
#include "file.h"
#include "wine/unicode.h"
#include "wine/library.h"
@@ -89,6 +88,8 @@
{'r','a','m','d','i','s','k',0} /* DRIVE_RAMDISK */
};
+#define MAX_DOS_DRIVES 26
+
static DOSDRIVE DOSDrives[MAX_DOS_DRIVES];
static int DRIVE_CurDrive = -1;
diff --git a/files/file.c b/files/file.c
index 4bb6e63..8b04671 100644
--- a/files/file.c
+++ b/files/file.c
@@ -67,7 +67,6 @@
#include "wine/winbase16.h"
#include "wine/server.h"
-#include "drive.h"
#include "file.h"
#include "wincon.h"
#include "kernel_private.h"
@@ -113,34 +112,6 @@
/***********************************************************************
- * FILE_strcasecmp
- *
- * locale-independent case conversion for file I/O
- */
-int FILE_strcasecmp( const char *str1, const char *str2 )
-{
- int ret = 0;
- for ( ; ; str1++, str2++)
- if ((ret = FILE_toupper(*str1) - FILE_toupper(*str2)) || !*str1) break;
- return ret;
-}
-
-
-/***********************************************************************
- * FILE_strncasecmp
- *
- * locale-independent case conversion for file I/O
- */
-int FILE_strncasecmp( const char *str1, const char *str2, int len )
-{
- int ret = 0;
- for ( ; len > 0; len--, str1++, str2++)
- if ((ret = FILE_toupper(*str1) - FILE_toupper(*str2)) || !*str1) break;
- return ret;
-}
-
-
-/***********************************************************************
* FILE_SetDosError
*
* Set the DOS error code from errno.
diff --git a/files/smb.c b/files/smb.c
index 91b3db2..2875fc1 100644
--- a/files/smb.c
+++ b/files/smb.c
@@ -108,10 +108,10 @@
#include "windef.h"
#include "winbase.h"
#include "winnls.h"
-#include "file.h"
-
-#include "smb.h"
+#include "winreg.h"
#include "winternl.h"
+#include "file.h"
+#include "smb.h"
#include "wine/server.h"
#include "wine/debug.h"
diff --git a/include/drive.h b/include/drive.h
deleted file mode 100644
index 8538a36..0000000
--- a/include/drive.h
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * DOS drive handling declarations
- *
- * Copyright 1995 Alexandre Julliard
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- */
-
-#ifndef __WINE_DRIVE_H
-#define __WINE_DRIVE_H
-
-#include <windef.h>
-
-#define MAX_DOS_DRIVES 26
-
-/* Drive flags */
-
-#define DRIVE_FAIL_READ_ONLY 0x0001 /* Fail opening read-only files for writing */
-
-extern int DRIVE_Init(void);
-extern int DRIVE_IsValid( int drive );
-extern int DRIVE_GetCurrentDrive(void);
-extern int DRIVE_SetCurrentDrive( int drive );
-extern int DRIVE_FindDriveRoot( const char **path );
-extern int DRIVE_FindDriveRootW( LPCWSTR *path );
-extern const char * DRIVE_GetRoot( int drive );
-extern LPCWSTR DRIVE_GetDosCwd( int drive );
-extern const char * DRIVE_GetUnixCwd( int drive );
-extern const char * DRIVE_GetDevice( int drive );
-extern UINT DRIVE_GetFlags( int drive );
-extern int DRIVE_Chdir( int drive, LPCWSTR path );
-extern WCHAR *DRIVE_BuildEnv(void);
-
-#endif /* __WINE_DRIVE_H */
diff --git a/include/file.h b/include/file.h
index 3600b41..32166b7 100644
--- a/include/file.h
+++ b/include/file.h
@@ -22,16 +22,8 @@
#define __WINE_FILE_H
#include <stdarg.h>
-#include <time.h> /* time_t */
-#ifdef HAVE_SYS_TIME_H
-# include <sys/time.h>
-#endif
-#include <sys/types.h>
#include <windef.h>
#include <winbase.h>
-#include <wine/windef16.h> /* HFILE16 */
-#include <winreg.h>
-#include <winternl.h>
#define MAX_PATHNAME_LEN 1024
@@ -43,24 +35,8 @@
int drive;
} DOS_FULL_NAME;
-#define IS_END_OF_NAME(ch) (!(ch) || ((ch) == '/') || ((ch) == '\\'))
-
-/* locale-independent case conversion */
-inline static char FILE_tolower( char c )
-{
- if (c >= 'A' && c <= 'Z') c += 32;
- return c;
-}
-inline static char FILE_toupper( char c )
-{
- if (c >= 'a' && c <= 'z') c -= 32;
- return c;
-}
-
/* files/file.c */
extern mode_t FILE_umask;
-extern int FILE_strcasecmp( const char *str1, const char *str2 );
-extern int FILE_strncasecmp( const char *str1, const char *str2, int len );
extern void FILE_SetDosError(void);
extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_symlink );
extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
@@ -68,23 +44,36 @@
DWORD attributes, HANDLE template, BOOL fail_read_only,
UINT drive_type );
-extern LONG WINAPI WIN16_hread(HFILE16,SEGPTR,LONG);
-
/* files/directory.c */
extern int DIR_Init(void);
-extern UINT DIR_GetWindowsUnixDir( LPSTR path, UINT count );
-extern UINT DIR_GetSystemUnixDir( LPSTR path, UINT count );
extern DWORD DIR_SearchPath( LPCWSTR path, LPCWSTR name, LPCWSTR ext,
DOS_FULL_NAME *full_name, BOOL win32 );
/* files/dos_fs.c */
-extern BOOL DOSFS_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer );
extern HANDLE DOSFS_OpenDevice( LPCWSTR name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa);
extern BOOL DOSFS_FindUnixName( const DOS_FULL_NAME *path, LPCWSTR name, char *long_buf,
INT long_len, LPWSTR short_buf );
extern BOOL DOSFS_GetFullName( LPCWSTR name, BOOL check_last,
DOS_FULL_NAME *full );
+/* drive.c */
+
+#define DRIVE_FAIL_READ_ONLY 0x0001 /* Fail opening read-only files for writing */
+
+extern int DRIVE_Init(void);
+extern int DRIVE_IsValid( int drive );
+extern int DRIVE_GetCurrentDrive(void);
+extern int DRIVE_SetCurrentDrive( int drive );
+extern int DRIVE_FindDriveRoot( const char **path );
+extern int DRIVE_FindDriveRootW( LPCWSTR *path );
+extern const char * DRIVE_GetRoot( int drive );
+extern LPCWSTR DRIVE_GetDosCwd( int drive );
+extern const char * DRIVE_GetUnixCwd( int drive );
+extern const char * DRIVE_GetDevice( int drive );
+extern UINT DRIVE_GetFlags( int drive );
+extern int DRIVE_Chdir( int drive, LPCWSTR path );
+extern WCHAR *DRIVE_BuildEnv(void);
+
/* vxd.c */
extern HANDLE VXD_Open( LPCWSTR filename, DWORD access, LPSECURITY_ATTRIBUTES sa );