Use the right buffer size in SYSPARAMS_Load instead of some random
[wine] / include / file.h
1 /*
2  * File handling declarations
3  *
4  * Copyright 1996 Alexandre Julliard
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19  */
20
21 #ifndef __WINE_FILE_H
22 #define __WINE_FILE_H
23
24 #include <time.h> /* time_t */
25 #ifdef HAVE_SYS_TIME_H
26 # include <sys/time.h>
27 #endif
28 #include <sys/types.h>
29 #include "winbase.h"
30 #include "wine/windef16.h"  /* HFILE16 */
31
32 #define MAX_PATHNAME_LEN   1024
33
34 /* Definition of a full DOS file name */
35 typedef struct
36 {
37     char  long_name[MAX_PATHNAME_LEN];  /* Long pathname in Unix format */
38     WCHAR short_name[MAX_PATHNAME_LEN]; /* Short pathname in DOS 8.3 format */
39     int   drive;
40 } DOS_FULL_NAME;
41
42 #define IS_END_OF_NAME(ch)  (!(ch) || ((ch) == '/') || ((ch) == '\\'))
43
44 /* DOS device descriptor */
45 typedef struct
46 {
47     const WCHAR name[9];
48     int flags;
49     UINT codepage;
50 } DOS_DEVICE;
51
52 /* locale-independent case conversion */
53 inline static char FILE_tolower( char c )
54 {
55     if (c >= 'A' && c <= 'Z') c += 32;
56     return c;
57 }
58 inline static char FILE_toupper( char c )
59 {
60     if (c >= 'a' && c <= 'z') c -= 32;
61     return c;
62 }
63
64 inline static int FILE_contains_path (LPCSTR name)
65 {
66     return ((*name && (name[1] == ':')) ||
67             strchr (name, '/') || strchr (name, '\\'));
68 }
69
70 /* files/file.c */
71 extern mode_t FILE_umask;
72 extern int FILE_strcasecmp( const char *str1, const char *str2 );
73 extern int FILE_strncasecmp( const char *str1, const char *str2, int len );
74 extern void FILE_SetDosError(void);
75 extern int FILE_GetUnixHandle( HANDLE handle, DWORD access );
76 extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info, BOOL *is_symlink );
77 extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 );
78 extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
79                                LPSECURITY_ATTRIBUTES sa, DWORD creation,
80                                DWORD attributes, HANDLE template, BOOL fail_read_only,
81                                UINT drive_type );
82 extern HANDLE FILE_CreateDevice( int client_id, DWORD access, LPSECURITY_ATTRIBUTES sa );
83
84 extern LONG WINAPI WIN16_hread(HFILE16,SEGPTR,LONG);
85
86 /* files/directory.c */
87 extern int DIR_Init(void);
88 extern UINT DIR_GetWindowsUnixDir( LPSTR path, UINT count );
89 extern UINT DIR_GetSystemUnixDir( LPSTR path, UINT count );
90 extern DWORD DIR_SearchAlternatePath( LPCSTR dll_path, LPCSTR name, LPCSTR ext,
91                                       DWORD buflen, LPSTR buffer, LPSTR *lastpart);
92 extern DWORD DIR_SearchPath( LPCWSTR path, LPCWSTR name, LPCWSTR ext,
93                              DOS_FULL_NAME *full_name, BOOL win32 );
94
95 /* files/dos_fs.c */
96 extern void DOSFS_UnixTimeToFileTime( time_t unixtime, LPFILETIME ft,
97                                       DWORD remainder );
98 extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft, DWORD *remainder );
99 extern BOOL DOSFS_ToDosFCBFormat( LPCWSTR name, LPWSTR buffer );
100 extern const DOS_DEVICE *DOSFS_GetDevice( LPCWSTR name );
101 extern const DOS_DEVICE *DOSFS_GetDeviceByHandle( HANDLE hFile );
102 extern HANDLE DOSFS_OpenDevice( LPCWSTR name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa);
103 extern BOOL DOSFS_FindUnixName( const DOS_FULL_NAME *path, LPCWSTR name, char *long_buf,
104                                 INT long_len, LPWSTR short_buf, BOOL ignore_case );
105 extern BOOL DOSFS_GetFullName( LPCWSTR name, BOOL check_last,
106                                  DOS_FULL_NAME *full );
107 extern int DOSFS_FindNext( const char *path, const char *short_mask,
108                            const char *long_mask, int drive, BYTE attr,
109                            int skip, WIN32_FIND_DATAA *entry );
110
111 /* profile.c */
112 extern void PROFILE_UsageWineIni(void);
113 extern int PROFILE_GetWineIniString( LPCWSTR section, LPCWSTR key_name,
114                                      LPCWSTR def, LPWSTR buffer, int len );
115 extern int PROFILE_GetWineIniBool( LPCWSTR section, LPCWSTR key_name, int def );
116
117 /* win32/device.c */
118 extern HANDLE DEVICE_Open( LPCWSTR filename, DWORD access, LPSECURITY_ATTRIBUTES sa );
119
120 /* ntdll/cdrom.c.c */
121 extern BOOL CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice, DWORD dwIoControlCode,
122                                   LPVOID lpInBuffer, DWORD nInBufferSize,
123                                   LPVOID lpOutBuffer, DWORD nOutBufferSize,
124                                   LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
125
126 #endif  /* __WINE_FILE_H */