Andreik Posted July 27, 2010 Share 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. Link to comment Share on other sites More sharing options...
FuryCell Posted July 27, 2010 Share 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. Link to comment Share on other sites More sharing options...
Andreik Posted July 27, 2010 Author Share 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. Link to comment Share on other sites More sharing options...
KaFu Posted July 27, 2010 Share 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-22H2 - 64bit - German, AutoIt Version: 3.3.16.1, AutoIt Editor: SciTE, Website: https://funk.eu AMT - Auto-Movie-Thumbnailer (2022-Nov-26) BIC - Batch-Image-Cropper (2023-Apr-01) COP - Color Picker (2009-May-21) DCS - Dynamic Cursor Selector (2024-Feb-16) 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 (2023-Jun-03) - THE file info and duplicates search tool SSD - Set Sound Device (2017-Sep-16) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now