1 /******************************************************************************
2 *
3 * Copyright (C) 2004-2007, The Gentee Group. All rights reserved.
4 * This file is part of the Gentee open source project - http://www.gentee.com.
5 *
6 * THIS FILE IS PROVIDED UNDER THE TERMS OF THE GENTEE LICENSE ("AGREEMENT").
7 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE CONSTITUTES RECIPIENTS
8 * ACCEPTANCE OF THE AGREEMENT.
9 *
10 * Author: Alexander Krivonogov ( gentee )
11 *
12 ******************************************************************************/
13
14 define <export>{
15 GENERIC_READ = 0x80000000
16 GENERIC_WRITE = 0x40000000
17
18 FILE_SHARE_READ = 0x00000001
19 FILE_SHARE_WRITE = 0x00000002
20 FILE_SHARE_RW = $FILE_SHARE_READ | $FILE_SHARE_WRITE
21
22 GENERIC_READ = 0x80000000
23 GENERIC_WRITE = 0x40000000
24 GENERIC_RW = $GENERIC_READ | $GENERIC_WRITE
25
26 CREATE_ALWAYS = 2
27 OPEN_EXISTING = 3
28 OPEN_ALWAYS = 4
29 //FILE_FLAG_WRITE_THROUGH = 0x80000000
30 INVALID_HANDLE_VALUE = 0xFFFFFFFF
31
32 /*-----------------------------------------------------------------------------
33 * Id: drivetypes D
34 *
35 * Summary: Values of drive types.
36 *
37 -----------------------------------------------------------------------------*/
38 DRIVE_UNKNOWN = 0 // Unknown type.
39 DRIVE_NO_ROOT_DIR = 1 // Invalid path to root.
40 DRIVE_REMOVABLE = 2 // Removable disk.
41 DRIVE_FIXED = 3 // Fixed disk.
42 DRIVE_REMOTE = 4 // Network disk.
43 DRIVE_CDROM = 5 // CD/DVD-ROM drive.
44 DRIVE_RAMDISK = 6 // RAM disk.
45
46 /*-----------------------------------------------------------------------------
47 * Id: fileattribs D
48 *
49 * Summary: File attributes.
50 *
51 -----------------------------------------------------------------------------*/
52 FILE_ATTRIBUTE_READONLY = 0x00000001 // Read-only.
53 FILE_ATTRIBUTE_HIDDEN = 0x00000002 // Hidden.
54 FILE_ATTRIBUTE_SYSTEM = 0x00000004 // System.
55 FILE_ATTRIBUTE_DIRECTORY = 0x00000010 // Directory.
56 FILE_ATTRIBUTE_ARCHIVE = 0x00000020 // Archive.
57 FILE_ATTRIBUTE_NORMAL = 0x00000080 // Normal.
58 FILE_ATTRIBUTE_TEMPORARY = 0x00000100 // Temporary.
59 FILE_ATTRIBUTE_COMPRESSED = 0x00000800 // Compressed.
60
61 /*-----------------------------------------------------------------------------
62 * Id: filesetmode D
63 *
64 * Summary: Set mode for file.setpos method.
65 *
66 -----------------------------------------------------------------------------*/
67 FILE_BEGIN = 0 // From the beginning of the file.
68 FILE_CURRENT = 1 // From the current position.
69 FILE_END = 2 // From the end of the file.
70
71 //-----------------------------------------------------------------------------
72
73 MAX_PATH = 260
74 }
75
76 define <export> {
77
78 // Флаги для CreateProcess
79 CREATE_DEFAULT_ERROR_MODE = 0x04000000
80 CREATE_NO_WINDOW = 0x08000000
81 NORMAL_PRIORITY_CLASS = 0x00000020
82
83 // Значение для WaitForSingleObject
84 INFINITE = 0xFFFFFFFF
85
86 /* TRUE = 1
87 FALSE = 0*/
88 }
89
90 /*-----------------------------------------------------------------------------
91 * Id: tdatetime T datetime
92 *
93 * Summary: The datetime structure. An object of the datetime type is used to
94 work with time. This type can contain information about date
95 and time.
96 *
97 -----------------------------------------------------------------------------*/
98
99 type datetime {
100 ushort year // Year.
101 ushort month // Month.
102 ushort dayofweek // Weekday. Counted from 0. 0 is Sunday, 1 is Monday...
103 ushort day // Day.
104 ushort hour // Hours.
105 ushort minute // Minutes.
106 ushort second // Seconds.
107 ushort msec // Milliseconds.
108 }
109
110 /*-----------------------------------------------------------------------------
111 ** Id: tfiletime T filetime
112 *
113 * Summary: The filetime structure. The filetime type is used to work with time
114 of files.
115 *
116 -----------------------------------------------------------------------------*/
117
118 type filetime {
119 uint lowdtime // Low uint value.
120 uint highdtime // High uint value.
121 }
122
123 //-----------------------------------------------------------------------------
124
125 type WIN32_FIND_DATA {
126 uint dwFileAttributes
127 filetime ftCreationTime
128 filetime ftLastAccessTime
129 filetime ftLastWriteTime
130 uint nFileSizeHigh
131 uint nFileSizeLow
132 uint dwReserved0
133 uint dwReserved1
134 reserved cFileName[ $MAX_PATH ]
135 reserved cAlternateFileName[ 14 ]
136 }
137
138 type PROCESS_INFORMATION {
139 uint hProcess
140 uint hThread
141 uint dwProcessId
142 uint dwThreadId
143 }
144
145 type STARTUPINFO {
146 uint cb
147 uint lpReserved
148 uint lpDesktop
149 uint lpTitle
150 uint dwX
151 uint dwY
152 uint dwXSize
153 uint dwYSize
154 uint dwXCountChars
155 uint dwYCountChars
156 uint dwFillAttribute
157 uint dwFlags
158 ushort wShowWindow
159 ushort cbReserved2
160 uint lpReserved2
161 uint hStdInput
162 uint hStdOutput
163 uint hStdError
164 }
165
166 import "kernel32.dll" {
167 uint CloseHandle( uint )
168 int CompareFileTime( filetime, filetime )
169 uint CompareStringW( uint, uint, uint, int, uint, int )
170 uint CopyFileA( uint, uint, uint ) -> CopyFile
171 uint CreateDirectoryA( uint, uint ) -> CreateDirectory
172 uint CreateFileA( uint, uint, uint, uint, uint, uint, uint ) -> CreateFile
173 uint CreateProcessA( uint, uint, uint, uint, uint, uint, uint,
174 uint, STARTUPINFO, PROCESS_INFORMATION ) -> CreateProcess
175 uint DeleteFileA( uint ) -> DeleteFile
176 ExitProcess( uint )
177 uint FileTimeToLocalFileTime( filetime, filetime )
178 uint FileTimeToSystemTime( filetime, datetime )
179 uint FindClose( uint )
180 uint FindFirstFileA( uint, WIN32_FIND_DATA ) -> FindFirstFile
181 uint FindNextFileA( uint, WIN32_FIND_DATA ) -> FindNextFile
182 uint FreeLibrary( uint )
183 uint GetCurrentDirectoryA( uint, uint ) -> GetCurrentDirectory
184 uint GetDateFormatA( uint, uint, datetime, uint, uint, int ) -> GetDateFormat
185 uint GetDriveTypeA( uint ) -> GetDriveType
186 uint GetExitCodeProcess( uint, uint )
187 uint GetFileAttributesA( uint ) -> GetFileAttributes
188 uint GetFileSize( uint, uint )
189 uint GetFileTime( uint, filetime, filetime, filetime )
190 uint GetFullPathNameA( uint, uint, uint, uint ) -> GetFullPathName
191 uint GetLastError()
192 uint GetLogicalDriveStringsA( uint, uint ) -> GetLogicalDriveStrings
193 uint GetLocaleInfoA( uint, uint, uint, int ) -> GetLocaleInfo
194 GetLocalTime( datetime )
195 uint GetModuleHandleA( uint ) -> GetModuleHandle
196 uint GetModuleFileNameA( uint, uint, uint ) -> GetModuleFileName
197 uint GetPrivateProfileStringA( uint, uint, uint, uint, uint, uint ) ->
198 GetPrivateProfileString
199 uint GetProcAddress( uint, uint )
200 uint GetTimeFormatA( uint, uint, datetime, uint, uint, int ) -> GetTimeFormat
201 uint IsDBCSLeadByte( byte )
202
203 uint LoadLibraryA( uint ) -> LoadLibrary
204 uint MoveFileA( uint, uint ) -> MoveFile
205 uint MoveFileExA( uint, uint, uint ) -> MoveFileEx
206 int MulDiv( int, int, int )
207 int MultiByteToWideChar( uint, uint, uint, int, uint, int )
208 uint ReadFile( uint, uint, uint, uint, uint )
209 uint RemoveDirectoryA( uint ) -> RemoveDirectory
210 uint SetCurrentDirectoryA( uint ) -> SetCurrentDirectory
211 uint SetFileAttributesA( uint, uint ) -> SetFileAttributes
212 uint SetFilePointer( uint, uint, uint, uint )
213 uint SetFileTime( uint, filetime, filetime, filetime )
214 uint SystemTimeToFileTime( datetime, filetime )
215 uint WaitForSingleObject( uint, uint )
216 int WideCharToMultiByte( uint, uint, uint, int, uint, int, uint, uint )
217 uint WriteFile( uint, uint, uint, uint, uint )
218 uint WritePrivateProfileStringA( uint, uint, uint, uint ) ->
219 WritePrivateProfileString
220 }
221
222 define <export> {
223 // Значения при открытии окон
224 SW_HIDE = 0
225 SW_SHOWNORMAL = 1
226 SW_NORMAL = 1
227 SW_SHOWMINIMIZED = 2
228 SW_SHOWMAXIMIZED = 3
229 SW_MAXIMIZE = 3
230 SW_SHOWNOACTIVATE = 4
231 SW_SHOW = 5
232 SW_MINIMIZE = 6
233 SW_SHOWMINNOACTIVE = 7
234 SW_SHOWNA = 8
235 SW_RESTORE = 9
236 SW_SHOWDEFAULT = 10
237 }
238
239 define
240 {
241 LANG_NEUTRAL = 0x00
242 LANG_ENGLISH = 0x09
243 LANG_FRENCH = 0x0c
244 LANG_GERMAN = 0x07
245
246 SUBLANG_NEUTRAL = 0x00
247 SUBLANG_DEFAULT = 0x01
248 SUBLANG_SYS_DEFAULT = 0x02
249 SUBLANG_ENGLISH_US = 0x01
250 SUBLANG_FRENCH = 0x01
251 SUBLANG_GERMAN = 0x01
252 SORT_DEFAULT = 0x0
253
254 LOCALE_SMONTHNAME1 = 0x00000038
255 LOCALE_SABBREVDAYNAME1 = 0x00000031 // abbreviated name for Monday
256 LOCALE_IFIRSTDAYOFWEEK = 0x0000100C // first day of week
257 }
258
259 import "shell32.dll" {
260 uint ShellExecuteA( uint, uint, uint, uint, uint, uint ) -> ShellExecute
261 }
262
263 import "user32.dll" {
264 uint CharLowerBuffA( uint, uint ) -> CharLowerBuff
265 uint CharUpperBuffA( uint, uint ) -> CharUpperBuff
266 }