EnglishРусский  

   ..

   winfolders.g

Данный проект закрыт! Создан новый скриптовый язык с тем же именем. Всё доступно на GitHub.
Также попробуйте нашу open source кроссплатформенную программу для создания и управления скриптами.

Реклама

Инсталлятор CreateInstall
Бесплатные и коммерческие инсталляторы

source\lib\windows\winfolders.g
  1 /*<winfolders>   
  2    <copyright year = 2006>
  3       <company = 'Gentee, Inc.'  url = 'http://www.gentee.com'  email = info@gentee.com >
  4       <author = 'Alexey Krivonogov'> 
  5       <file>
  6       </>
  7    </>
  8    <desc>
  9    </>
 10 </>*/
 11 
 12 import "kernel32.dll"
 13 {
 14 //   uint GetDiskFreeSpaceExA( uint, uint, uint, uint ) -> GetDiskFreeSpaceEx 
 15    uint GetSystemDirectoryA( uint, uint ) -> GetSystemDirectory
 16    uint GetTempPathA( uint, uint ) -> GetTempPath
 17    uint GetWindowsDirectoryA( uint, uint ) -> GetWindowsDirectory
 18 }
 19 
 20 import "shell32.dll"
 21 {
 22    uint SHGetSpecialFolderLocation( uint, uint, uint ) 
 23    uint SHGetPathFromIDListW( uint, uint ) -> SHGetPathFromIDList
 24 }
 25 
 26 import "ole32.dll" {
 27 uint CoTaskMemAlloc( uint )
 28      CoTaskMemFree( uint )
 29 }
 30 
 31 define <export> 
 32 {  
 33    WINFLD_SIZE = 512  // Reserved size for folders
 34    // values for idfolder parameter of the function winfolder
 35    WINFLD_WIN = 0xFF00    // Windows directory
 36    WINFLD_SYS             // System directory
 37    WINFLD_TEMP            // Temporary directory
 38    WINFLD_QLAUNCH         // Quick Launch folder          
 39    WINFLD_SENDTO     = 0x0009  // "Sendto" folder
 40    WINFLD_MYMUSIC    = 0x000D  // "My Music" folder
 41    WINFLD_MYVIDEO    = 0x000E  // "My Videos" folder
 42    WINFLD_APPDATA    = 0x001a   // Application Data
 43    WINFLD_LOCALAPPDATA = 0x001c   // Application Data
 44    WINFLD_COMAPPDATA = 0x0023
 45    WINFLD_DESKTOP    = 0x0010   // Desktop folder
 46    WINFLD_COMDESKTOP = 0x0019   // Desktop folder
 47    WINFLD_PROGFILES  = 0x0026   // Program Files directory
 48    WINFLD_MYPICTURES = 0x0027   // "My Pictures" folder   
 49    WINFLD_COMPROGFILES = 0x002b // Common Program Files directory
 50    WINFLD_PROGGROUP    = 0x0002 // Start -> Programs folder
 51    WINFLD_COMPROGGROUP = 0x0017
 52    WINFLD_START        = 0x000b // Start menu folde
 53    WINFLD_COMSTART     = 0x0016
 54    WINFLD_STARTUP      = 0x0007 // StartUp folder
 55    WINFLD_COMSTARTUP   = 0x0018
 56    WINFLD_FONT         = 0x0014 // Fonts folder
 57    WINFLD_DOCS       = 0x0005  // My Documents folder
 58    WINFLD_COMDOCS    = 0x002e
 59    WINFLD_COMMUSIC   = 0x0035  // All Users\My Music
 60    WINFLD_COMPICTURES = 0x0036 // All Users\My Pictures
 61    WINFLD_COMVIDEO    = 0x0037 // All Users\My Video
 62    WINFLD_IEFAV      = 0x0006  // Internet Explorer Favorite folder
 63    WINFLD_COMIEFAV   = 0x001f
 64    WINFLD_COOKIES    = 0x0021
 65    WINFLD_HISTORY    = 0x0022
 66    WINFLD_DRIVES     =  0x0011 // My Computer
 67    WINFLD_NETWORK    =  0x0012 // Network Neighborhood (My Network Places)
 68 }
 69 
 70 func str winfolder( uint idfolder, str result )
 71 {
 72    uint ptr
 73    uint qlaunch 
 74    
 75    result.clear()
 76    result.reserve( $WINFLD_SIZE )
 77    ptr = result.ptr()
 78    
 79    if idfolder == $WINFLD_WIN : GetWindowsDirectory( ptr, $WINFLD_SIZE )
 80    elif idfolder == $WINFLD_SYS : GetSystemDirectory( ptr, $WINFLD_SIZE )
 81    elif idfolder == $WINFLD_TEMP : GetTempPath( $WINFLD_SIZE, ptr )
 82    else 
 83    {
 84       uint  ids 
 85       
 86       if idfolder == $WINFLD_QLAUNCH
 87       {
 88          idfolder = $WINFLD_APPDATA
 89          qlaunch = 1 
 90       }  
 91       if !SHGetSpecialFolderLocation( 0, idfolder, &ids )
 92       {
 93          ustr uptr
 94          
 95          uptr.reserve( 1024 )
 96 //         ptr = uptr.ptr()
 97          SHGetPathFromIDList( ids, uptr.ptr() )
 98          uptr.setlenptr()
 99          result = uptr
100          CoTaskMemFree( ids )//imalloc_free( ids )      
101       } 
102    }
103    result.setlenptr().fdelslash()
104    if qlaunch : result.faddname( $"Microsoft\Internet Explorer\Quick Launch" )
105    return result   
106 }
107 /*
108 func long getdisksize( str path, uint ptotal )
109 {
110    long result
111    
112    if !GetProcAddress( GetModuleHandle( "kernel32.dll".ptr() ),
113                          "GetDiskFreeSpaceExA".ptr())
114    {
115       return 0L
116    }
117    GetDiskFreeSpaceEx( path.ptr(), &result, ptotal, 0 )
118    
119    return result   
120 }
121 */
Редактировать