Make ZipSharp work on Windows
[mono.git] / mcs / class / WindowsBase / ZipSharp / IOFunctions.cs
1 // IOFunctions.cs created with MonoDevelop
2 // User: alan at 14:43 20/10/2008
3 //
4 // To change standard headers go to Edit->Preferences->Coding->Standard Headers
5 //
6
7 using System;
8 using System.Runtime.InteropServices;
9
10 namespace zipsharp
11 {
12         // this matches a native 'enum', don't modify
13         enum Append
14         {
15                 Create = 0,
16                 CreateAfter = 1,
17                 AddInZip = 2
18         }
19         
20         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
21         internal delegate IntPtr OpenFileFunc (IntPtr opaque, string filename, int mode);
22
23         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
24         internal delegate /* uLong */ uint ReadFileFunc32 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* uLong */ uint size);
25
26         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
27         internal delegate /* uLong */ uint WriteFileFunc32 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* uLong */ uint size);
28
29         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
30         internal delegate /* long */ int TellFileFunc32 (IntPtr opaque, IntPtr stream);
31
32         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
33         internal delegate /* long */ int SeekFileFunc32 (IntPtr opaque, IntPtr stream, /* uLong */ uint offset, int origin);
34
35         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
36         internal delegate /* uLong */ ulong ReadFileFunc64 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* uLong */ ulong size);
37
38         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
39         internal delegate /* uLong */ ulong WriteFileFunc64 (IntPtr opaque, IntPtr stream, IntPtr buffer, /* uLong */ ulong size);
40
41         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
42         internal delegate /* long */ long TellFileFunc64 (IntPtr opaque, IntPtr stream);
43
44         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
45         internal delegate /* long */ long SeekFileFunc64 (IntPtr opaque, IntPtr stream, /* uLong */ ulong offset, int origin);
46
47         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
48         internal delegate int CloseFileFunc (IntPtr opaque, IntPtr stream);
49
50         [UnmanagedFunctionPointerAttribute (CallingConvention.Cdecl)]
51         internal delegate int TestErrorFileFunc (IntPtr opaque, IntPtr stream);
52
53         [StructLayout (LayoutKind.Sequential)]
54         internal struct ZlibFileFuncDef32
55         {
56                 [MarshalAs (UnmanagedType.FunctionPtr)] public OpenFileFunc      zopen_file;
57                 [MarshalAs (UnmanagedType.FunctionPtr)] public ReadFileFunc32    zread_file;
58                 [MarshalAs (UnmanagedType.FunctionPtr)] public WriteFileFunc32   zwrite_file;
59                 [MarshalAs (UnmanagedType.FunctionPtr)] public TellFileFunc32    ztell_file;
60                 [MarshalAs (UnmanagedType.FunctionPtr)] public SeekFileFunc32    zseek_file;
61                 [MarshalAs (UnmanagedType.FunctionPtr)] public CloseFileFunc     zclose_file;
62                 [MarshalAs (UnmanagedType.FunctionPtr)] public TestErrorFileFunc zerror_file;
63                 public IntPtr            opaque;
64         }
65
66         [StructLayout (LayoutKind.Sequential)]
67         internal struct ZlibFileFuncDef64
68         {
69                 [MarshalAs (UnmanagedType.FunctionPtr)] public OpenFileFunc      zopen_file;
70                 [MarshalAs (UnmanagedType.FunctionPtr)] public ReadFileFunc64    zread_file;
71                 [MarshalAs (UnmanagedType.FunctionPtr)] public WriteFileFunc64   zwrite_file;
72                 [MarshalAs (UnmanagedType.FunctionPtr)] public TellFileFunc64    ztell_file;
73                 [MarshalAs (UnmanagedType.FunctionPtr)] public SeekFileFunc64    zseek_file;
74                 [MarshalAs (UnmanagedType.FunctionPtr)] public CloseFileFunc     zclose_file;
75                 [MarshalAs (UnmanagedType.FunctionPtr)] public TestErrorFileFunc zerror_file;
76                 public IntPtr            opaque;
77         }
78 }