Fix compilation errors on FreeBSD.
[wine/dibdrv.git] / include / file.h
blob815501efb04a0d54230f4e5defec0aa179b4678c
1 /*
2 * File handling declarations
4 * Copyright 1996 Alexandre Julliard
5 */
7 #ifndef __WINE_FILE_H
8 #define __WINE_FILE_H
10 #include <time.h> /* time_t */
11 #include <sys/time.h>
12 #include "winbase.h"
13 #include "wine/windef16.h" /* HFILE16 */
15 #define MAX_PATHNAME_LEN 1024
17 /* Definition of a full DOS file name */
18 typedef struct
20 char long_name[MAX_PATHNAME_LEN]; /* Long pathname in Unix format */
21 char short_name[MAX_PATHNAME_LEN]; /* Short pathname in DOS 8.3 format */
22 int drive;
23 } DOS_FULL_NAME;
25 #define IS_END_OF_NAME(ch) (!(ch) || ((ch) == '/') || ((ch) == '\\'))
27 /* DOS device descriptor */
28 typedef struct
30 char *name;
31 int flags;
32 } DOS_DEVICE;
34 /* overlapped private structure */
35 struct async_private;
36 typedef void (*async_handler)(struct async_private *ovp);
37 typedef struct async_private
39 LPOVERLAPPED lpOverlapped;
40 HANDLE handle;
41 int fd;
42 char *buffer;
43 async_handler func;
44 int count;
45 int type;
46 LPOVERLAPPED_COMPLETION_ROUTINE completion_func;
47 struct async_private *next;
48 struct async_private *prev;
49 } async_private;
51 extern void WINAPI check_async_list(LPOVERLAPPED ov, DWORD status);
52 extern void finish_async(struct async_private *ovp, DWORD status);
54 /* locale-independent case conversion */
55 inline static char FILE_tolower( char c )
57 if (c >= 'A' && c <= 'Z') c += 32;
58 return c;
60 inline static char FILE_toupper( char c )
62 if (c >= 'a' && c <= 'z') c -= 32;
63 return c;
66 inline static int FILE_contains_path (LPCSTR name)
68 return ((*name && (name[1] == ':')) ||
69 strchr (name, '/') || strchr (name, '\\'));
72 /* files/file.c */
73 extern int FILE_strcasecmp( const char *str1, const char *str2 );
74 extern int FILE_strncasecmp( const char *str1, const char *str2, int len );
75 extern void FILE_SetDosError(void);
76 extern HANDLE FILE_DupUnixHandle( int fd, DWORD access, BOOL inherit );
77 extern int FILE_GetUnixHandle( HANDLE handle, DWORD access );
78 extern BOOL FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info );
79 extern HFILE16 FILE_Dup2( HFILE16 hFile1, HFILE16 hFile2 );
80 extern HANDLE FILE_CreateFile( LPCSTR filename, DWORD access, DWORD sharing,
81 LPSECURITY_ATTRIBUTES sa, DWORD creation,
82 DWORD attributes, HANDLE template, BOOL fail_read_only,
83 UINT drive_type );
84 extern HANDLE FILE_CreateDevice( int client_id, DWORD access, LPSECURITY_ATTRIBUTES sa );
85 extern BOOL FILE_StartAsync(HANDLE handle, LPOVERLAPPED lpOverlapped, DWORD type, DWORD count, DWORD status);
87 extern LONG WINAPI WIN16_hread(HFILE16,SEGPTR,LONG);
89 /* files/directory.c */
90 extern int DIR_Init(void);
91 extern UINT DIR_GetWindowsUnixDir( LPSTR path, UINT count );
92 extern UINT DIR_GetSystemUnixDir( LPSTR path, UINT count );
93 extern DWORD DIR_SearchAlternatePath( LPCSTR dll_path, LPCSTR name, LPCSTR ext,
94 DWORD buflen, LPSTR buffer, LPSTR *lastpart);
95 extern DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
96 DOS_FULL_NAME *full_name, BOOL win32 );
98 /* files/dos_fs.c */
99 extern void DOSFS_UnixTimeToFileTime( time_t unixtime, LPFILETIME ft,
100 DWORD remainder );
101 extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft, DWORD *remainder );
102 extern BOOL DOSFS_ToDosFCBFormat( LPCSTR name, LPSTR buffer );
103 extern const DOS_DEVICE *DOSFS_GetDevice( const char *name );
104 extern const DOS_DEVICE *DOSFS_GetDeviceByHandle( HFILE hFile );
105 extern HANDLE DOSFS_OpenDevice( const char *name, DWORD access, DWORD attributes, LPSECURITY_ATTRIBUTES sa);
106 extern BOOL DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
107 INT long_len, LPSTR short_buf,
108 BOOL ignore_case );
109 extern BOOL DOSFS_GetFullName( LPCSTR name, BOOL check_last,
110 DOS_FULL_NAME *full );
111 extern int DOSFS_FindNext( const char *path, const char *short_mask,
112 const char *long_mask, int drive, BYTE attr,
113 int skip, WIN32_FIND_DATAA *entry );
115 /* win32/device.c */
116 extern HANDLE DEVICE_Open( LPCSTR filename, DWORD access, LPSECURITY_ATTRIBUTES sa );
118 /* ntdll/cdrom.c.c */
119 extern BOOL CDROM_DeviceIoControl(DWORD clientID, HANDLE hDevice, DWORD dwIoControlCode,
120 LPVOID lpInBuffer, DWORD nInBufferSize,
121 LPVOID lpOutBuffer, DWORD nOutBufferSize,
122 LPDWORD lpBytesReturned, LPOVERLAPPED lpOverlapped);
124 #endif /* __WINE_FILE_H */