Removed some unnecessary definitions from file.h.

Got rid of drive.h.
This commit is contained in:
Alexandre Julliard 2004-03-09 23:51:02 +00:00
parent 615373c587
commit 8045ad5c0e
14 changed files with 77 additions and 152 deletions

View file

@ -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"
@ -126,6 +125,34 @@ inline static void patch_code_segment( void *code_segment )
}
/***********************************************************************
* 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
*
@ -144,9 +171,9 @@ static const BUILTIN16_DESCRIPTOR *find_dll_descr( const char *dllname )
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 @@ WORD NE_GetOrdinal( HMODULE16 hModule, const char *name )
/* 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 @@ static HINSTANCE16 MODULE_LoadModule16( LPCSTR libname, BOOL implicit, BOOL lib_
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 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
/* 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 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
* '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 @@ HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
loadedfn--;
}
/* case insensitive compare ... */
if (!FILE_strcasecmp(loadedfn, s))
if (!NE_strcasecmp(loadedfn, s))
return hModule;
}
return 0;
@ -1943,7 +1970,7 @@ static HMODULE16 NE_GetModuleByFilename( LPCSTR name )
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 @@ static HMODULE16 NE_GetModuleByFilename( LPCSTR name )
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;
}

View file

@ -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"

View file

@ -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"

View file

@ -48,7 +48,6 @@
#include "wine/unicode.h"
#include "wine/winbase16.h"
#include "kernel_private.h"
#include "file.h"
#include "wine/debug.h"

View file

@ -37,7 +37,6 @@
#include "winuser.h"
#include "wine/winbase16.h"
#include "drive.h"
#include "file.h"
#include "module.h"
#include "winternl.h"

View file

@ -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"

View file

@ -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 @@ static BOOL INT21_CreateTempFile( CONTEXT86 *context )
* '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 @@ static BOOL INT21_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer )
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 @@ static BOOL INT21_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer )
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 @@ static BOOL INT21_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer )
* 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;

View file

@ -45,7 +45,6 @@
#include "winreg.h"
#include "winternl.h"
#include "wine/unicode.h"
#include "drive.h"
#include "file.h"
#include "wine/debug.h"
@ -341,26 +340,6 @@ UINT WINAPI GetTempPathW( UINT count, LPWSTR path )
}
/***********************************************************************
* 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:

View file

@ -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 @@ typedef struct
#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 @@ static int DOSFS_ValidDOSName( LPCWSTR name )
* 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;

View file

@ -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 @@ static const WCHAR DRIVE_Types[][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;

View file

@ -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"
@ -112,34 +111,6 @@ void FILE_ConvertOFMode( INT mode, DWORD *access, DWORD *sharing )
}
/***********************************************************************
* 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
*

View file

@ -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"

View file

@ -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 */

View file

@ -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 @@ typedef struct
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 @@ extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
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 );