xref: /reactos/dll/win32/fmifs/compress.c (revision 65ce1461)
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 NTAPI
16 EnableVolumeCompression(
17 	IN PWCHAR DriveRoot,
18 	IN USHORT Compression)
19 {
20 	HANDLE hFile;
21 	DWORD RetBytes;
22 	BOOL Ret;
23 
24 	hFile = CreateFileW(
25 		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 
33 	if (hFile == INVALID_HANDLE_VALUE)
34 		return FALSE;
35 
36 	Ret = DeviceIoControl(
37 		hFile,
38 		FSCTL_SET_COMPRESSION,
39 		&Compression,
40 		sizeof(USHORT),
41 		NULL,
42 		0,
43 		&RetBytes,
44 		NULL);
45 
46 	CloseHandle(hFile);
47 
48 	return (Ret != 0);
49 }
50 
51 /* EOF */
52