xref: /reactos/dll/win32/fmifs/compress.c (revision c2c66aff)
1*c2c66affSColin Finck /*
2*c2c66affSColin Finck  * COPYRIGHT:       See COPYING in the top level directory
3*c2c66affSColin Finck  * PROJECT:         File Management IFS Utility functions
4*c2c66affSColin Finck  * FILE:            reactos/dll/win32/fmifs/compress.c
5*c2c66affSColin Finck  * PURPOSE:         Volume compression
6*c2c66affSColin Finck  *
7*c2c66affSColin Finck  * PROGRAMMERS:     Emanuele Aliberti
8*c2c66affSColin Finck  */
9*c2c66affSColin Finck 
10*c2c66affSColin Finck #include "precomp.h"
11*c2c66affSColin Finck 
12*c2c66affSColin Finck /*
13*c2c66affSColin Finck  * @implemented
14*c2c66affSColin Finck  */
15*c2c66affSColin Finck BOOLEAN
16*c2c66affSColin Finck NTAPI
EnableVolumeCompression(IN PWCHAR DriveRoot,IN USHORT Compression)17*c2c66affSColin Finck EnableVolumeCompression(
18*c2c66affSColin Finck     IN PWCHAR DriveRoot,
19*c2c66affSColin Finck     IN USHORT Compression)
20*c2c66affSColin Finck {
21*c2c66affSColin Finck     HANDLE hFile;
22*c2c66affSColin Finck     DWORD RetBytes;
23*c2c66affSColin Finck     BOOL Ret;
24*c2c66affSColin Finck 
25*c2c66affSColin Finck     hFile = CreateFileW(DriveRoot,
26*c2c66affSColin Finck                         FILE_READ_DATA | FILE_WRITE_DATA,
27*c2c66affSColin Finck                         FILE_SHARE_READ | FILE_SHARE_WRITE,
28*c2c66affSColin Finck                         NULL,
29*c2c66affSColin Finck                         OPEN_EXISTING,
30*c2c66affSColin Finck                         FILE_FLAG_BACKUP_SEMANTICS,
31*c2c66affSColin Finck                         NULL);
32*c2c66affSColin Finck     if (hFile == INVALID_HANDLE_VALUE)
33*c2c66affSColin Finck         return FALSE;
34*c2c66affSColin Finck 
35*c2c66affSColin Finck     Ret = DeviceIoControl(hFile,
36*c2c66affSColin Finck                           FSCTL_SET_COMPRESSION,
37*c2c66affSColin Finck                           &Compression,
38*c2c66affSColin Finck                           sizeof(USHORT),
39*c2c66affSColin Finck                           NULL,
40*c2c66affSColin Finck                           0,
41*c2c66affSColin Finck                           &RetBytes,
42*c2c66affSColin Finck                           NULL);
43*c2c66affSColin Finck 
44*c2c66affSColin Finck     CloseHandle(hFile);
45*c2c66affSColin Finck 
46*c2c66affSColin Finck     return (Ret != 0);
47*c2c66affSColin Finck }
48*c2c66affSColin Finck 
49*c2c66affSColin Finck /* EOF */
50