EnglishРусский  

   ..

   arr.g

   arrstr.g

   arrustr.g

   buf.g

   console.g

   fcopy.g

   ffind.g

   file.g

   hash.g

   math.g

   process.g

   search.g

   stack.g

   stdlib.g

   str.g

   stradv.g

   strfile.g

   system.g

   ustr.g

   winimport.g

The project is closed! You can look at a new scripting language. It is available on GitHub.
Also, try our open source cross-platform automation software.

Ads

Installer and installation software
Commercial and Freeware installers.

source\lib\stdlib\winimport.g
  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         GetSystemTime( datetime )
201    uint GetTimeFormatA( uint, uint, datetime, uint, uint, int ) -> GetTimeFormat
202    uint IsDBCSLeadByte( byte )
203    
204    uint LoadLibraryA( uint ) -> LoadLibrary
205    uint LocalFileTimeToFileTime( filetime, filetime )
206    uint MoveFileA( uint, uint ) -> MoveFile
207    uint MoveFileExA( uint, uint, uint ) -> MoveFileEx
208    int  MulDiv( int, int, int )
209    int  MultiByteToWideChar( uint, uint, uint, int, uint, int )
210    uint ReadFile( uint, uint, uint, uint, uint )
211    uint RemoveDirectoryA( uint ) -> RemoveDirectory
212    uint SetCurrentDirectoryA( uint ) -> SetCurrentDirectory
213    uint SetFileAttributesA( uint, uint ) -> SetFileAttributes
214    uint SetFilePointer( uint, uint, uint, uint )
215    uint SetFileTime( uint, filetime, filetime, filetime )   
216    uint SystemTimeToFileTime( datetime, filetime )
217    uint WaitForSingleObject( uint, uint )
218    int  WideCharToMultiByte( uint, uint, uint, int, uint, int, uint, uint ) 
219    uint WriteFile( uint, uint, uint, uint, uint )
220    uint WritePrivateProfileStringA( uint, uint, uint, uint ) ->
221                                     WritePrivateProfileString
222 }
223 
224 define <export> {
225 // Значения при открытии окон
226    SW_HIDE = 0
227    SW_SHOWNORMAL = 1
228    SW_NORMAL = 1
229    SW_SHOWMINIMIZED = 2
230    SW_SHOWMAXIMIZED = 3
231    SW_MAXIMIZE = 3
232    SW_SHOWNOACTIVATE = 4
233    SW_SHOW = 5
234    SW_MINIMIZE = 6
235    SW_SHOWMINNOACTIVE = 7
236    SW_SHOWNA = 8
237    SW_RESTORE = 9
238    SW_SHOWDEFAULT = 10
239 }
240 
241 define 
242 {
243    LANG_NEUTRAL   = 0x00
244    LANG_ENGLISH   = 0x09
245    LANG_FRENCH    = 0x0c
246    LANG_GERMAN    = 0x07
247 
248    SUBLANG_NEUTRAL = 0x00
249    SUBLANG_DEFAULT = 0x01
250    SUBLANG_SYS_DEFAULT = 0x02
251    SUBLANG_ENGLISH_US  = 0x01
252    SUBLANG_FRENCH      = 0x01
253    SUBLANG_GERMAN      = 0x01
254    SORT_DEFAULT        = 0x0
255 
256    LOCALE_SMONTHNAME1 = 0x00000038
257    LOCALE_SABBREVDAYNAME1 = 0x00000031   // abbreviated name for Monday
258    LOCALE_IFIRSTDAYOFWEEK = 0x0000100C   // first day of week
259 }
260 
261 type SHELLEXECUTEINFO 
262 {
263     uint cbSize
264     uint fMask
265     uint hwnd
266     uint lpVerb
267     uint lpFile
268     uint lpParameters
269     uint lpDirectory
270     int  nShow
271     uint hInstApp
272     uint lpIDList
273     uint lpClass
274     uint hkeyClass
275     uint dwHotKey
276     uint hIcon
277     uint hProcess
278 }
279 
280 import "shell32.dll" {
281 	uint ShellExecuteA( uint, uint, uint, uint, uint, uint ) -> ShellExecute
282    uint ShellExecuteExA( SHELLEXECUTEINFO ) -> ShellExecuteEx
283 }
284 
285 import "user32.dll" {
286    uint CharLowerBuffA( uint, uint ) -> CharLowerBuff
287    uint CharUpperBuffA( uint, uint ) -> CharUpperBuff      
288 }
289