Jump to content

FSCTL_SET_SPARSE


 Share

Recommended Posts

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.

Link to comment
Share on other sites

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.
Link to comment
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.

Link to comment
Share on other sites

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...