Andreik 66 Posted July 27, 2010 (edited) How can I translate this code in AutoIt. I know that is an API _WinAPI_CreateFile() and DeviceIoControl can be called from kernel32.dll but I cannot find this constant or what it is FSCTL_SET_SPARSE. Any help is welcome. int _tmain(int argc, _TCHAR* argv[]) { HANDLE h = CreateFile("Test.txt", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, NULL); DWORD dw; DeviceIoControl(h, FSCTL_SET_SPARSE, NULL, 0, NULL, 0, &dw, NULL); LONG lDist = 4095; SetFilePointer(h, 0, &lDist, FILE_BEGIN); SetEndOfFile(h); CloseHandle(h); return 0; } Edited July 27, 2010 by Andreik When the words fail... music speaks Share this post Link to post Share on other sites
FuryCell 3 Posted July 27, 2010 (edited) Not positive if this is what you need but after several google searches I found this page. http://www.techreplies.com/development-resources-58/sparse-files-deviceiocontrol-379393/ Public Const FSCTL_SET_SPARSE = &H900C4 So in AutoIt I assume this would be Const $FSCTL_SET_SPARSE =0x900C4 Edited July 27, 2010 by FuryCell HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Share this post Link to post Share on other sites
Andreik 66 Posted July 27, 2010 ^Thanks for answer. Can you translate DllCall function DeviceIoControl. I get an fatal error when I call it. Am I missing something? Dim $TEMP $RESULT = DllCall("kernel32.dll","int","DeviceIoControl","hwnd",$FILE,"dword",0x900C4,"ptr",0,"dword",0,"ptr",0,"dword",0,"dword",$TEMP,"ptr",0) When the words fail... music speaks Share this post Link to post Share on other sites
KaFu 295 Posted July 27, 2010 (edited) _WinAPI_DeviceIoControl is part of Yashieds excellent WinAPIEx UDF.Edit: Additionally take a look at this MSDN article for the dll structure definition expected by the function. Edited July 27, 2010 by KaFu OS: Win10-1909 - 64bit - German, AutoIt Version: 3.3.14.5, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2019-Dec-21) BIC - Batch-Image-Cropper (2019-Dec-11) COP - Color Picker (2009-May-21) HMW - Hide my Windows (2018-Sep-16) HRC - HotKey Resolution Changer (2012-May-16) ICU - Icon Configuration Utility (2018-Sep-16) SMF - Search my Files (2019-Dec-07) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Share this post Link to post Share on other sites