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