Sign in to follow this  
Followers 0
Andreik

FSCTL_SET_SPARSE

4 posts in this topic

#1 ·  Posted (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 by Andreik

When the words fail... music speaks

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 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

^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

#4 ·  Posted (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 by KaFu

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0