Skip to content

Commit 01f8c5d

Browse files
author
admin
committed
v5.6.3.5
1 parent 25ea099 commit 01f8c5d

File tree

148 files changed

+6630
-8286
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

148 files changed

+6630
-8286
lines changed

Bin/arm64/EaseFlt.sys

136 Bytes
Binary file not shown.

Bin/arm64/FilterAPI.dll

17 KB
Binary file not shown.

Bin/arm64/FilterAPI.lib

1.56 KB
Binary file not shown.

CommonObjects.dll

-22 KB
Binary file not shown.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
///////////////////////////////////////////////////////////////////////////////
2+
//
3+
// (C) Copyright 2015 EaseFilter Technologies Inc.
4+
// All Rights Reserved
5+
//
6+
// This software is part of a licensed software product and may
7+
// only be used or copied in accordance with the terms of that license.
8+
//
9+
///////////////////////////////////////////////////////////////////////////////
10+
11+
#ifndef __AES_ENCRYPTION_H__
12+
#define __AES_ENCRYPTION_H__
13+
14+
VOID
15+
EncryptionUnitTest();
16+
17+
BOOL
18+
EncryptionRequestHandler( IN PMESSAGE_SEND_DATA pSendMessage,IN OUT PMESSAGE_REPLY_DATA pReplyMessage );
19+
20+
#endif

Demo_Source_Code/CPlusPlusDemo/CPlusPlusDemo.cpp

Lines changed: 123 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@
2323
#include "FilterAPI.h"
2424
#include "WindowsService.h"
2525
#include "FilterControl.h"
26-
2726
#include <Sddl.h>
2827

28+
#include "TestData.h"
29+
2930
#define MAX_ERROR_MESSAGE_SIZE 1024
3031

3132
#define PrintMessage wprintf //ToDebugger
@@ -65,7 +66,8 @@ Return Value
6566
printf( " t ----- Driver UnitTest\n" );
6667
printf( " m ----- Start monitor filter.\n" );
6768
printf( " c ----- Start control filter.\n" );
68-
printf( " e ----- Start encryption filter driver test.\n" );
69+
printf( " d ----- Start DRM encryption filter driver test.\n" );
70+
printf(" e ----- Start encryption filter driver test.\n");
6971
printf( " p ----- Start process filter driver test.\n" );
7072
printf( " r ----- Start registry filter driver test.\n" );
7173
printf( "\n [FilterFolder]---- the folder mask which will be monitored.\n" );
@@ -75,6 +77,7 @@ Return Value
7577
printf( "EaseFltCPPDemo u ----- UnInstall Driver\r\n" );
7678
printf( "EaseFltCPPDemo t ----- Driver UnitTest\r\n" );
7779
printf( "EaseFltCPPDemo p * 16128 c:\\filterTest\\* 22554420----- run process filter driver: processFilterMask controlFlag fileFilterMask accessFlag.\r\n" );
80+
printf( "EaseFltCPPDemo d c:\\filterTest\\* notepad.exe;wordpade.xe ----- encrypt file with DRM data embedding, authorized process notepad and wordpad.\r\n");
7881
printf( "EaseFltCPPDemo e c:\\filterTest\\* ----- encrypt filter driver with default settings.\r\n" );
7982
printf( "EaseFltCPPDemo m c:\\filterTest\\* ----- monitor filter driver with default settings.\r\n" );
8083
printf( "EaseFltCPPDemo c c:\\filterTest\\* ----- control filter driver with default settings.\r\n" );
@@ -216,8 +219,8 @@ int _tmain(int argc, _TCHAR* argv[])
216219
FileFilterRule fileFilterRule(fileFilterMask);
217220
fileFilterRule.AccessFlag = accessFlag;
218221

219-
//block the new file cration/rename/delete/write in the filter driver
220-
/*fileFilterRule.AccessFlag = ALLOW_MAX_RIGHT_ACCESS & (~(ALLOW_OPEN_WITH_CREATE_OR_OVERWRITE_ACCESS|ALLOW_FILE_RENAME|ALLOW_FILE_DELETE|ALLOW_WRITE_ACCESS));*/
222+
//block the new file read/rename/delete/write in the filter driver
223+
//fileFilterRule.AccessFlag = ALLOW_MAX_RIGHT_ACCESS & (~(ALLOW_READ_ACCESS |ALLOW_FILE_RENAME|ALLOW_FILE_DELETE|ALLOW_WRITE_ACCESS));
221224

222225
fileFilterRule.BooleanConfig = ENABLE_MONITOR_EVENT_BUFFER;
223226
fileFilterRule.FileChangeEventFilter = FILE_WAS_CREATED|FILE_WAS_WRITTEN|FILE_WAS_RENAMED|FILE_WAS_DELETED|FILE_WAS_READ;
@@ -244,8 +247,8 @@ int _tmain(int argc, _TCHAR* argv[])
244247
fileFilterRule.ControlFileIOEventFilter = ioCallbackClass;
245248

246249
//You can allow/block the file rename/delete in the callback handler by register PRE_RENAME_FILE|PRE_DELETE_FILE.
247-
//ULONGLONG preIOCallbackClass = PRE_RENAME_FILE|PRE_DELETE_FILE;
248-
//fileFilterRule.ControlFileIOEventFilter = preIOCallbackClass;
250+
/*ULONGLONG preIOCallbackClass = PRE_RENAME_FILE | PRE_DELETE_FILE;
251+
fileFilterRule.ControlFileIOEventFilter = preIOCallbackClass;*/
249252

250253
//disable the file being renamed, deleted and written access rights.
251254
ULONG processAccessRights = accessFlag & (~(ALLOW_FILE_RENAME|ALLOW_FILE_DELETE|ALLOW_WRITE_ACCESS));
@@ -263,8 +266,7 @@ int _tmain(int argc, _TCHAR* argv[])
263266

264267
//you can get the block message notification by the access flag with below setting.
265268
//set global boolean config
266-
ULONG globalBooleanConfig = ENABLE_SEND_DENIED_EVENT;
267-
filterControl->globalBooleanConfig = globalBooleanConfig;
269+
filterControl->globalBooleanConfig |= ENABLE_SEND_DENIED_EVENT;
268270

269271
if (!filterControl->StartFilter(filterType, threadCount, connectionTimeout, registerKey))
270272
{
@@ -290,6 +292,64 @@ int _tmain(int argc, _TCHAR* argv[])
290292

291293
break;
292294

295+
}
296+
case 'd': //DRM encryption filter driver test
297+
{
298+
299+
UnInstallDriver();
300+
Sleep(2000);
301+
302+
ret = InstallDriver();
303+
if (!ret)
304+
{
305+
PrintLastErrorMessage(L"InstallDriver failed.");
306+
break;
307+
}
308+
309+
WCHAR* fileFilterMask = L"c:\\test\\*";
310+
311+
if (argc >= 3)
312+
{
313+
fileFilterMask = argv[2];
314+
}
315+
316+
if (argc >= 4)
317+
{
318+
SetAuthorizedProcess(argv[3]);
319+
}
320+
321+
//by default all users/processes will get the decrypted data
322+
//it meant by default all users/processes are in whitelist
323+
ULONG accessFlag = (ALLOW_MAX_RIGHT_ACCESS | ENABLE_FILE_ENCRYPTION_RULE);
324+
325+
filterType = FILE_SYSTEM_ENCRYPTION | FILE_SYSTEM_CONTROL | FILE_SYSTEM_PROCESS;
326+
327+
FileFilterRule fileFilterRule(fileFilterMask);
328+
fileFilterRule.AccessFlag = accessFlag;
329+
330+
//if we enable the encryption key from service, you can authorize the decryption for every file
331+
//in the callback function OnFilterRequestEncryptKey, with this flag enabled.
332+
fileFilterRule.BooleanConfig |= REQUEST_ENCRYPT_KEY_IV_AND_TAGDATA_FROM_SERVICE;
333+
334+
//Add the FILE_ATTRIBUTE_ENCRYPTED to the encrypted file. The attribute will be kept if you copy&paste to another folder
335+
//even the file was not encrypted anymore by Windows explorer.
336+
//fileFilterRule.BooleanConfig |= ENABLE_SET_FILE_ATTRIBUTE_ENCRYPTED;
337+
338+
filterControl->AddFileFilter(fileFilterRule);
339+
340+
if (!filterControl->StartFilter(filterType, threadCount, connectionTimeout, registerKey))
341+
{
342+
break;
343+
}
344+
345+
_tprintf(_T("\n\nStart DRM Encryption for folder %ws,\r\nThe new created file will be encrypted, the encrypted file can be decrypted automatically in this folder\
346+
.\r\n Press any key to stop the filter driver.\n"),fileFilterMask);
347+
348+
system("pause");
349+
getchar();
350+
351+
break;
352+
293353
}
294354
case 'e': //encryption filter driver test
295355
{
@@ -319,7 +379,7 @@ int _tmain(int argc, _TCHAR* argv[])
319379
//it meant by default all users/processes are in whitelist
320380
//ULONG accessFlag = (ALLOW_MAX_RIGHT_ACCESS | ENABLE_FILE_ENCRYPTION_RULE);
321381

322-
filterType = FILE_SYSTEM_ENCRYPTION | FILE_SYSTEM_PROCESS;
382+
filterType = FILE_SYSTEM_ENCRYPTION | FILE_SYSTEM_CONTROL | FILE_SYSTEM_PROCESS;
323383

324384
FileFilterRule fileFilterRule(fileFilterMask);
325385
fileFilterRule.AccessFlag = accessFlag;
@@ -328,6 +388,10 @@ int _tmain(int argc, _TCHAR* argv[])
328388
//in the callback function OnFilterRequestEncryptKey, with this flag enabled, you don't need to set the encryption key.
329389
//fileFilterRule.BooleanConfig |= REQUEST_ENCRYPT_KEY_IV_AND_TAGDATA_FROM_SERVICE;
330390

391+
//Add the FILE_ATTRIBUTE_ENCRYPTED to the encrypted file. The attribute will be kept if you copy&paste to another folder
392+
//even the file was not encrypted anymore by Windows explorer.
393+
//fileFilterRule.BooleanConfig |= ENABLE_SET_FILE_ATTRIBUTE_ENCRYPTED;
394+
331395
//if you have a master key, you can set it here, or if you want to get the encryption key from the callback function then don't set the key here.
332396
//256 bit,32bytes encryption key
333397
unsigned char key[] = { 0x60,0x3d,0xeb,0x10,0x15,0xca,0x71,0xbe,0x2b,0x73,0xae,0xf0,0x85,0x7d,0x77,0x81,0x1f,0x35,0x2c,0x07,0x3b,0x61,0x08,0xd7,0x2d,0x98,0x10,0xa3,0x09,0x14,0xdf,0xf4 };
@@ -338,32 +402,77 @@ int _tmain(int argc, _TCHAR* argv[])
338402

339403
//set the blacklist of the process, if the default filter rule is whitelist to all users/processes.
340404
//ULONG rawEncryptionRights = ALLOW_MAX_RIGHT_ACCESS & (~ALLOW_READ_ENCRYPTED_FILES);
341-
//fileFilterRule.AddAccessRightsToProcessName(L"explorer.exe", rawEncryptionRights);
405+
//fileFilterRule.AddAccessRightsToProcessName(L"explorer.exe", rawEncryptionRights,NULL,NULL);
342406

343407
//set the whitelist for the user "AzureAD\\Alice"
344408
//fileFilterRule.AddAccessRightsToUserName(L"AzureAD\\Alice", ALLOW_MAX_RIGHT_ACCESS);
345409

346410
//set the whitelist for the process "wordpad.exe"
347-
fileFilterRule.AddAccessRightsToProcessName(L"wordpad.exe", ALLOW_MAX_RIGHT_ACCESS);
411+
fileFilterRule.AddAccessRightsToProcessName(L"wordpad.exe", ALLOW_MAX_RIGHT_ACCESS, NULL, NULL);
348412

349413
//set the whitelist for the process "notepad.exe"
350-
fileFilterRule.AddAccessRightsToProcessName(L"notepad.exe", ALLOW_MAX_RIGHT_ACCESS);
414+
fileFilterRule.AddAccessRightsToProcessName(L"notepad.exe", ALLOW_MAX_RIGHT_ACCESS, NULL, NULL);
351415

352416
filterControl->AddFileFilter(fileFilterRule);
353-
417+
354418
if (!filterControl->StartFilter(filterType, threadCount, connectionTimeout, registerKey))
355419
{
356420
break;
357421
}
358422

359423
_tprintf(_T("\n\nStart Encryption for folder %ws,\r\nThe new created file will be encrypted, the encrypted file can be decrypted automatically in this folder\
360-
.\r\n Press any key to stop the filter driver.\n"),fileFilterMask);
424+
.\r\n Press any key to stop the filter driver.\n"), fileFilterMask);
361425

362426
system("pause");
363427
getchar();
364428

365429
break;
366430

431+
}
432+
case 'l': //reparse file filter driver test
433+
{
434+
435+
UnInstallDriver();
436+
Sleep(2000);
437+
438+
ret = InstallDriver();
439+
if (!ret)
440+
{
441+
PrintLastErrorMessage(L"InstallDriver failed.");
442+
return 1;
443+
}
444+
445+
_tprintf(_T("Start reparse filter driver test. press any key to stop.\n\n"));
446+
447+
filterType = FILE_SYSTEM_REGISTRY;
448+
449+
WCHAR* fileFilterMask = L"c:\\test\\*";
450+
451+
if (argc >= 3)
452+
{
453+
fileFilterMask = argv[2];
454+
}
455+
456+
ULONG accessFlag = (ALLOW_MAX_RIGHT_ACCESS | ENABLE_REPARSE_FILE_OPEN);
457+
filterType = FILE_SYSTEM_REPARSE;
458+
459+
FileFilterRule fileFilterRule(fileFilterMask);
460+
fileFilterRule.AccessFlag = accessFlag;
461+
462+
filterControl->AddFileFilter(fileFilterRule);
463+
464+
if (!filterControl->StartFilter(filterType, threadCount, connectionTimeout, registerKey))
465+
{
466+
break;
467+
}
468+
469+
_tprintf(_T("\n\nStart reparse file filter for folder %ws,\r\nThe new created file will be embedded with tag data.\
470+
.\r\n Press any key to stop the filter driver.\n"), fileFilterMask);
471+
472+
getchar();
473+
474+
break;
475+
367476
}
368477
case 'p': //process filter driver test
369478
{

Demo_Source_Code/CPlusPlusDemo/CPlusPlusDemo.rc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
//
88
// Generated from the TEXTINCLUDE 2 resource.
99
//
10-
#include<windows.h>
10+
#include "windows.h"
1111

1212
/////////////////////////////////////////////////////////////////////////////
1313
#undef APSTUDIO_READONLY_SYMBOLS
@@ -29,8 +29,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_ENGLISH_US
2929
//
3030

3131
VS_VERSION_INFO VERSIONINFO
32-
FILEVERSION 5,2,1,1
33-
PRODUCTVERSION 5,2,2,1
32+
FILEVERSION 5,1,5,2
33+
PRODUCTVERSION 5,1,5,2
3434
FILEFLAGSMASK 0x17L
3535
#ifdef _DEBUG
3636
FILEFLAGS 0x1L
@@ -46,12 +46,12 @@ BEGIN
4646
BLOCK "100904b0"
4747
BEGIN
4848
VALUE "FileDescription", "Filter Driver SDK Demo Application"
49-
VALUE "FileVersion", "5, 2, 2, 1"
49+
VALUE "FileVersion", "5, 2, 3, 2"
5050
VALUE "InternalName", "EaseFltCppDemo"
51-
VALUE "LegalCopyright", "Copyright (C) 2022"
51+
VALUE "LegalCopyright", "Copyright (C) 2023"
5252
VALUE "OriginalFilename", "EaseFltCppDemo.exe"
5353
VALUE "ProductName", "EaseFltCppDemo Application"
54-
VALUE "ProductVersion", "5, 2, 2, 1"
54+
VALUE "ProductVersion", "5,2,3, 2"
5555
END
5656
END
5757
BLOCK "VarFileInfo"

0 commit comments

Comments
 (0)