- Add defines for the NMTBHOTITEM flag word.
[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 #include <sys/time.h>
26 #include <sys/types.h>
27 #include "winbase.h"
28 #include "wine/windef16.h"  /* HFILE16 */
29
30 #define MAX_PATHNAME_LEN   1024
31
32 /* Definition of a full DOS file name */
33 typedef struct
34 {
35     char  long_name[MAX_PATHNAME_LEN];  /* Long pathname in Unix format */
36     char  short_name[MAX_PATHNAME_LEN]; /* Short pathname in DOS 8.3 format */
37     int   drive;
38 } DOS_FULL_NAME;
39
40 #define IS_END_OF_NAME(ch)  (!(ch) || ((ch) == '/') || ((ch) == '\\'))
41
42 /* DOS device descriptor */
43 typedef struct
44 {
45     char *name;
46     int flags;
47 } DOS_DEVICE;
48
49 /* overlapped private structure */
50 struct async_private;
51 typedef void (*async_handler)(struct async_private *ovp);
52 typedef struct async_private
53 {
54      LPOVERLAPPED  lpOverlapped;
55      HANDLE        handle;
56      HANDLE        event;
57      int           fd;
58      char         *buffer;
59      async_handler func;
60      int           count;
61      int           type;
62      LPOVERLAPPED_COMPLETION_ROUTINE completion_func;
63      struct async_private *next;
64      struct async_private *prev;
65 } async_private;
66
67 extern void WINAPI check_async_list(LPOVERLAPPED ov, DWORD status);
68 extern void finish_async(struct async_private *ovp, DWORD status);
69
70 /* locale-independent case conversion */
71 inline static char FILE_tolower( char c )
72 {
73     if (c >= 'A' && c <= 'Z') c += 32;
74     return c;
75 }
76 inline static char FILE_toupper( char c )
77 {
78     if (c >= 'a' && c <= 'z') c -= 32;
79     return c;
80 }
81
82 inline static int FILE_contains_path (LPCSTR name)
83 {
84     return ((*name && (name[1] == ':')) ||
85             strchr (name, '/') || strchr (name, '\\'));
86 }
87
88 /* files/file.c */
89 extern mode_t FILE_umask;
90 extern int FILE_strcasecmp( const char *str1, const char *str2 );
91 extern int FILE_strncasecmp( const char *str1, const char *str2, int len );
92 extern void FILE_SetDosError(void);
93 extern HANDLE FILE_DupUnixHandle( int fd, DWORD access, BOOL inherit );
94 extern int FILE_GetUnixHandle( HANDLE handle, DWORD access );
95 extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info );
96 extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 );
97 extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
98                                LPSECURITY_ATTRIBUTES sa, DWORD creation,
99                                DWORD attributes, HANDLE template, BOOL fail_read_only,
100                                UINT drive_type );
101 extern HANDLE FILE_CreateDevice( int client_id, DWORD access, LPSECURITY_ATTRIBUTES sa );
102 extern BOOL FILE_StartAsync(HANDLE handle, LPOVERLAPPED lpOverlapped, DWORD type, DWORD count, DWORD status);
103
104 extern LONG WINAPI WIN16_hread(HFILE16,SEGPTR,LONG);
105
106 /* files/directory.c */
107 extern int DIR_Init(void);
108 extern UINT DIR_GetWindowsUnixDir( LPSTR path, UINT count );
109 extern UINT DIR_GetSystemUnixDir( LPSTR path, UINT count );
110 extern DWORD DIR_SearchAlternatePath( LPCSTR dll_path, LPCSTR name, LPCSTR ext,
111                                       DWORD buflen, LPSTR buffer, LPSTR *lastpart);
112 extern DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
113                              DOS_FULL_NAME *full_name, BOOL win32 );
114
115 /* files/dos_fs.c */
116 extern void DOSFS_UnixTimeToFileTime( time_t unixtime, LPFILETIME ft,
117                                       DWORD remainder );
118 extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft, DWORD *remainder );
119 extern BOOL DOSFS_ToDosFCBFormat( LPCSTR name, LPSTR buffer );
120 extern const DOS_DEVICE *DOSFS_GetDevice( const char *name );
121 extern const DOS_DEVICE *DOSFS_GetDeviceByHandle( HFILE hFile );
122 extern HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa);
123 extern BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
124                                   INT long_len, LPSTR short_buf,
125                                   BOOL ignore_case );
126 extern BOOL DOSFS_GetFullName( LPCSTR name, BOOL check_last,
127                                  DOS_FULL_NAME *full );
128 extern int DOSFS_FindNext( const char *path, const char *short_mask,
129                            const char *long_mask, int drive, BYTE attr,
130                            int skip, WIN32_FIND_DATAA *entry );
131
132 /* win32/device.c */
133 extern HANDLE DEVICE_Open( LPCSTR filename, DWORD access, LPSECURITY_ATTRIBUTES sa );
134
135 /* ntdll/cdrom.c.c */
136 extern BOOL CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice, DWORD dwIoControlCode, 
137                                   LPVOID lpInBuffer, DWORD nInBufferSize, 
138                                   LPVOID lpOutBuffer, DWORD nOutBufferSize,
139                                   LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
140
141 #endif  /* __WINE_FILE_H */