32-bit clipboard support.
[wine/multimedia.git] / include / file.h
blobe7ab5a88b93a3ab1ad038ca90cb0d77cb23faacb
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>
11 #include "windows.h"
12 #include "k32obj.h"
14 #define MAX_PATHNAME_LEN 1024
16 /* The file object */
17 typedef struct
19 K32OBJ header;
20 int unix_handle;
21 int mode;
22 char *unix_name;
23 DWORD type; /* Type for win32 apps */
24 DWORD pos; /* workaround to emulate weird DOS error handling */
25 } FILE_OBJECT;
27 /* Definition of a full DOS file name */
28 typedef struct
30 char long_name[MAX_PATHNAME_LEN]; /* Long pathname in Unix format */
31 char short_name[MAX_PATHNAME_LEN]; /* Short pathname in DOS 8.3 format */
32 int drive;
33 } DOS_FULL_NAME;
35 #define IS_END_OF_NAME(ch) (!(ch) || ((ch) == '/') || ((ch) == '\\'))
37 /* DOS device descriptor */
38 typedef struct
40 char *name;
41 int flags;
42 } DOS_DEVICE;
44 /* Macros to convert 16 bit to 32 bit file handles and back */
45 /* LZW handles are exempt as if not, could go below 0x400 */
46 #define HFILE16_TO_HFILE32(handle) \
47 (((handle)==0) ? GetStdHandle(STD_INPUT_HANDLE) : \
48 ((handle)==1) ? GetStdHandle(STD_OUTPUT_HANDLE) : \
49 ((handle)==2) ? GetStdHandle(STD_ERROR_HANDLE) : \
50 ((handle)==3) ? GetStdHandle(STD_ERROR_HANDLE) : \
51 ((handle)==4) ? GetStdHandle(STD_ERROR_HANDLE) : \
52 ((handle)>=0x400) ? handle : \
53 (handle)-5)
55 #define HFILE32_TO_HFILE16(handle) ({ HFILE32 hnd=handle; \
56 ((hnd==HFILE_ERROR32) ? HFILE_ERROR16 : \
57 ((hnd)>=0x400) ? hnd : \
58 (HFILE16)hnd+5); })
61 /* files/file.c */
62 extern FILE_OBJECT *FILE_GetFile( HFILE32 handle );
63 extern void FILE_ReleaseFile( FILE_OBJECT *file );
64 extern HFILE32 FILE_Alloc( FILE_OBJECT **file );
65 extern void FILE_SetDosError(void);
66 extern HFILE32 FILE_DupUnixHandle( int fd );
67 extern BOOL32 FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info );
68 extern HFILE32 FILE_Dup( HFILE32 hFile );
69 extern HFILE32 FILE_Dup2( HFILE32 hFile1, HFILE32 hFile2 );
70 extern HFILE32 FILE_Open( LPCSTR path, INT32 mode ,INT32 sharemode);
71 extern HFILE32 FILE_OpenUnixFile( LPCSTR path, INT32 mode );
72 extern BOOL32 FILE_SetFileType( HFILE32 hFile, DWORD type );
73 extern LPVOID FILE_mmap( HFILE32 hFile, LPVOID start,
74 DWORD size_high, DWORD size_low,
75 DWORD offset_high, DWORD offset_low,
76 int prot, int flags );
77 extern LPVOID FILE_dommap( FILE_OBJECT *file, LPVOID start,
78 DWORD size_high, DWORD size_low,
79 DWORD offset_high, DWORD offset_low,
80 int prot, int flags );
81 extern int FILE_munmap( LPVOID start, DWORD size_high, DWORD size_low );
82 extern HFILE32 _lcreat_uniq( LPCSTR path, INT32 attr );
84 /* files/directory.c */
85 extern int DIR_Init(void);
86 extern UINT32 DIR_GetWindowsUnixDir( LPSTR path, UINT32 count );
87 extern UINT32 DIR_GetSystemUnixDir( LPSTR path, UINT32 count );
88 extern DWORD DIR_SearchPath( LPCSTR path, LPCSTR name, LPCSTR ext,
89 DOS_FULL_NAME *full_name, BOOL32 win32 );
91 /* files/dos_fs.c */
92 extern void DOSFS_UnixTimeToFileTime( time_t unixtime, LPFILETIME ft,
93 DWORD remainder );
94 extern time_t DOSFS_FileTimeToUnixTime( const FILETIME *ft, DWORD *remainder );
95 extern BOOL32 DOSFS_ToDosFCBFormat( LPCSTR name, LPSTR buffer );
96 extern const DOS_DEVICE *DOSFS_GetDevice( const char *name );
97 extern HFILE32 DOSFS_OpenDevice( const char *name, INT32 mode );
98 extern BOOL32 DOSFS_FindUnixName( LPCSTR path, LPCSTR name, LPSTR long_buf,
99 INT32 long_len, LPSTR short_buf,
100 BOOL32 ignore_case );
101 extern BOOL32 DOSFS_GetFullName( LPCSTR name, BOOL32 check_last,
102 DOS_FULL_NAME *full );
103 extern int DOSFS_FindNext( const char *path, const char *short_mask,
104 const char *long_mask, int drive, BYTE attr,
105 int skip, WIN32_FIND_DATA32A *entry );
107 #endif /* __WINE_FILE_H */