누락된 파일 COMMIT
This commit is contained in:
parent
0b54b6e7d0
commit
c2ba523c24
|
|
@ -0,0 +1,575 @@
|
||||||
|
unit Bs1FltCtrl;
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Windows, SysUtils, Classes;
|
||||||
|
|
||||||
|
const
|
||||||
|
PG_PID_UNDEFINED = 0;
|
||||||
|
PG_PID_ALLOW = 1;
|
||||||
|
PG_PID_BLACK = 8;
|
||||||
|
|
||||||
|
PG_PATH_UNDEFINED = 0;
|
||||||
|
PG_PATH_ALLOW = 1;
|
||||||
|
PG_PATH_WHITE = 2;
|
||||||
|
PG_PATH_BLACK = 4;
|
||||||
|
PG_PATH_NOTIFY = 8;
|
||||||
|
PG_PATH_GRAY = 16;
|
||||||
|
// PG_PATH_ALL = (PG_PATH_ALLOW|PG_PATH_WHITE|PG_PATH_BLACK|PG_PATH_NOTIFY)
|
||||||
|
|
||||||
|
PG_FILE_UNDEFINED = 0;
|
||||||
|
PG_FILE_ALLOW = 1;
|
||||||
|
|
||||||
|
BS1FLT_ERR_NOT_LOADED = DWORD($FFFFFFFF);
|
||||||
|
|
||||||
|
LOG_CONNECT = $1;
|
||||||
|
LOG_DISCONNECT = $2;
|
||||||
|
LOG_POLICY = $4;
|
||||||
|
LOG_DEBUG_ = $8;
|
||||||
|
LOG_PROCESS = $10;
|
||||||
|
LOG_PROCESS_PROTECT = $20;
|
||||||
|
LOG_PROCESS_MONITOR = $40;
|
||||||
|
LOG_PROCESS_BLOCK = $80;
|
||||||
|
LOG_ALL = $FF;
|
||||||
|
|
||||||
|
type
|
||||||
|
{ Device States }
|
||||||
|
TDeviceState = (
|
||||||
|
dsEnable = 0,
|
||||||
|
dsDisable,
|
||||||
|
dsReadOnly
|
||||||
|
);
|
||||||
|
|
||||||
|
TLogState = (
|
||||||
|
lsNoneUse = 0,
|
||||||
|
lsUse
|
||||||
|
);
|
||||||
|
|
||||||
|
{ Device Types }
|
||||||
|
TDeviceType = (
|
||||||
|
BDC_UNKNOWN_DEV = 0,
|
||||||
|
BDC_CDROM = 1,
|
||||||
|
BDC_FLOOPY = 2,
|
||||||
|
BDC_USB_DISK = 3,
|
||||||
|
BDC_LOCAL_DISK = 4,
|
||||||
|
BDC_NETWORKDRIVEOUT = 5,
|
||||||
|
BDC_EXTERNALHDD = 6,
|
||||||
|
BDC_NETWORKDRIVEIN = 7,
|
||||||
|
BDC_NETWORKSHAREOUT = 8,
|
||||||
|
BDC_USB = 9,
|
||||||
|
BDC_USB_NET = 10,
|
||||||
|
BDC_USB_HID = 11,
|
||||||
|
BDC_1394 = 12,
|
||||||
|
BDC_SERIAL = 13,
|
||||||
|
BDC_PARALLEL = 14,
|
||||||
|
BDC_PCMCIA = 15,
|
||||||
|
BDC_PCMCIA_NET = 16,
|
||||||
|
BDC_IRDA = 17,
|
||||||
|
BDC_MODEM = 18,
|
||||||
|
BDC_BLUETOOTH = 19,
|
||||||
|
BDC_BLUETOOTH_FILE = 20,
|
||||||
|
BDC_WIBRO = 21,
|
||||||
|
BDC_TLOGIN = 22,
|
||||||
|
BDC_ACTIVE_SYNC = 23,
|
||||||
|
BDC_WIRELESS = 24,
|
||||||
|
BDC_LGMODEM = 25,
|
||||||
|
BDC_TETHERING = 26,
|
||||||
|
BDC_SDCARD = 27,
|
||||||
|
BDC_PORTABLE_STORAGE = 28,
|
||||||
|
BDC_WEBCAM = 29,
|
||||||
|
BDC_MTP = 30,
|
||||||
|
BDC_MAX_DEVICE_TYPE = 31
|
||||||
|
);
|
||||||
|
|
||||||
|
TBs1FltCallback = function(Context: Pointer): DWORD; stdcall;
|
||||||
|
|
||||||
|
TfpCleanup = function(): DWORD; stdcall;
|
||||||
|
TfpInit = function(lpcPath: PWideChar; logcb: TBs1FltCallback; opencb: TBs1FltCallback): DWORD; stdcall;
|
||||||
|
TfpSetPath = function(ulType: DWORD; lpcwPath: PWideChar): DWORD; stdcall;
|
||||||
|
TfpDelPath = function(ulType: DWORD; lpcwPath: PWideChar): DWORD; stdcall;
|
||||||
|
TfpBegin = function(bIsBegin: DWORD): DWORD; stdcall;
|
||||||
|
TfpSetPid = function(dwType: DWORD; dwPid: DWORD): DWORD; stdcall;
|
||||||
|
TfpDelPid = function(dwPid: DWORD): DWORD; stdcall;
|
||||||
|
TfpDebug = function(flag: ULONG): DWORD; stdcall;
|
||||||
|
TfpSetProcessPath = function(dwType: DWORD; lpcwPath: PWideChar): DWORD; stdcall;
|
||||||
|
TfpDelProcessPath = function(dwType: DWORD; lpcwPath: PWideChar): DWORD; stdcall;
|
||||||
|
TfpFolderProtectControl = function(bIsProtect: DWORD): DWORD; stdcall;
|
||||||
|
TfpStartShareWatch = function(bIsWatch: DWORD): DWORD; stdcall;
|
||||||
|
TfpSetFileName = function(dwType: DWORD; lpcwPath: PWideChar): DWORD; stdcall;
|
||||||
|
TfpDeleteFile = function(path: PWideChar): DWORD; stdcall;
|
||||||
|
TfpTerminateProcess = function(pid: DWORD): DWORD; stdcall;
|
||||||
|
TfpSetHook = function(dwType: DWORD; enable: DWORD): DWORD; stdcall;
|
||||||
|
TfpSetPolicy = function(device_type: DWORD; state: DWORD; islog: DWORD): DWORD; stdcall;
|
||||||
|
|
||||||
|
TfpProcessProtect = function(enable: DWORD): DWORD; stdcall;
|
||||||
|
TfpSetProcessProtectName = function(name: PWideChar): DWORD; stdcall;
|
||||||
|
TfpDelProcessProtectName = function(name: PWideChar): DWORD; stdcall;
|
||||||
|
TfpSetProcessProtectId = function(pid: DWORD): DWORD; stdcall;
|
||||||
|
TfpDelProcessProtectId = function(pid: DWORD): DWORD; stdcall;
|
||||||
|
|
||||||
|
TfpSetRegProtect = function(enable: DWORD): DWORD; stdcall;
|
||||||
|
TfpSetRegProtectName = function(regkey: PWideChar): DWORD; stdcall;
|
||||||
|
TfpDelRegProtectName = function(regkey: PWideChar): DWORD; stdcall;
|
||||||
|
|
||||||
|
TfpBs1fltSetDeviceProtect = function(enable: DWORD): DWORD; stdcall;
|
||||||
|
TfpBs1fltSetUsbException = function(vid: PWideChar; pid: PWideChar; productrevisionlevel: PWideChar; vendorspecific: PWideChar): DWORD; stdcall;
|
||||||
|
TfpBs1fltSetUsbPortException= function(vid: DWORD; pid: DWORD; bcddevice: DWORD; serial: LPCWSTR): DWORD; stdcall;
|
||||||
|
TfpBs1fltDelUsbPortException= function(vid: DWORD; pid: DWORD; bcddevice: DWORD; serial: LPCWSTR): DWORD; stdcall;
|
||||||
|
TfpBs1fltDelUsbException = function(vid: PWideChar; pid: PWideChar; productrevisionlevel: PWideChar; vendorspecific: PWideChar): DWORD; stdcall;
|
||||||
|
TfpBs1fltClearUsbException = function(): DWORD; stdcall;
|
||||||
|
TfpBs1fltSetLogType = function(logtype: DWORD): DWORD; stdcall;
|
||||||
|
TfpBs1fltProcessCreate = function(enable : DWORD ): DWORD; stdcall;
|
||||||
|
TfpBs1fltSetProcessCreateBlockRule = function(name: LPCWSTR; cmd: LPCWSTR; parentName: LPCWSTR ): DWORD; stdcall;
|
||||||
|
TfpBs1fltClearProcessCreateBlockRule = function():DWORD; stdcall;
|
||||||
|
|
||||||
|
TfBs1fltClearUsbPortException = function() : DWORD; stdcall;
|
||||||
|
TfBs1fltOpen = function() : DWORD; stdcall;
|
||||||
|
{ TBs1fltControl Class }
|
||||||
|
TBs1fltControl = class
|
||||||
|
private
|
||||||
|
FHandle: HMODULE;
|
||||||
|
FCurrentPath: string;
|
||||||
|
FIsLoaded: Boolean;
|
||||||
|
|
||||||
|
FBs1FltCleanup: TfpCleanup;
|
||||||
|
FBs1FltInit: TfpInit;
|
||||||
|
FBs1FltSetPath: TfpSetPath;
|
||||||
|
FBs1FltDelPath: TfpDelPath;
|
||||||
|
FBs1FltBegin: TfpBegin;
|
||||||
|
FBs1FltSetPid: TfpSetPid;
|
||||||
|
FBs1FltDelPid: TfpDelPid;
|
||||||
|
FBs1FltDebug: TfpDebug;
|
||||||
|
FBs1FltSetProcessPath: TfpSetProcessPath;
|
||||||
|
FBs1FltDelProcessPath: TfpDelProcessPath;
|
||||||
|
FBs1FltFolderProtectControl: TfpFolderProtectControl;
|
||||||
|
FBs1FltStartShareWatch: TfpStartShareWatch;
|
||||||
|
FBs1FltSetFileName: TfpSetFileName;
|
||||||
|
FBs1FltDeleteFile: TfpDeleteFile;
|
||||||
|
FBs1FltTerminateProcess: TfpTerminateProcess;
|
||||||
|
FBs1FltSetHook: TfpSetHook;
|
||||||
|
FBs1FltSetPolicy: TfpSetPolicy;
|
||||||
|
FBs1FltProcessProtect: TfpProcessProtect;
|
||||||
|
FBs1FltSetProcessProtectName: TfpSetProcessProtectName;
|
||||||
|
FBs1FltDelProcessProtectName: TfpDelProcessProtectName;
|
||||||
|
FBs1FltSetProcessProtectId: TfpSetProcessProtectId;
|
||||||
|
FBs1FltDelProcessProtectId: TfpDelProcessProtectId;
|
||||||
|
FBs1FltSetRegProtect: TfpSetRegProtect;
|
||||||
|
FBs1FltSetRegProtectName: TfpSetRegProtectName;
|
||||||
|
FBs1FltDelRegProtectName: TfpDelRegProtectName;
|
||||||
|
FBs1fltSetDeviceProtect: TfpBs1fltSetDeviceProtect;
|
||||||
|
FBs1fltSetUsbException: TfpBs1fltSetUsbException;
|
||||||
|
FBs1fltSetUsbPortException: TfpBs1fltSetUsbPortException;
|
||||||
|
FBs1fltDelUsbPortException: TfpBs1fltDelUsbPortException;
|
||||||
|
|
||||||
|
FBs1fltDelUsbException: TfpBs1fltDelUsbException;
|
||||||
|
FBs1fltClearUsbException: TfpBs1fltClearUsbException;
|
||||||
|
FBs1fltSetLogType: TfpBs1fltSetLogType;
|
||||||
|
|
||||||
|
FBs1fltProcessCreate: TfpBs1fltProcessCreate;
|
||||||
|
FBs1fltSetProcessCreateBlockRule: TfpBs1fltSetProcessCreateBlockRule;
|
||||||
|
FBs1fltClearProcessCreateBlockRule: TfpBs1fltClearProcessCreateBlockRule;
|
||||||
|
|
||||||
|
FBs1fltClearUsbPortException: TfBs1fltClearUsbPortException;
|
||||||
|
FBs1fltOpen: TfBs1fltOpen;
|
||||||
|
|
||||||
|
function LoadFunc(var ProcPtr: Pointer; Ordinal: Integer): Boolean;
|
||||||
|
procedure UnloadDll;
|
||||||
|
|
||||||
|
public
|
||||||
|
constructor Create;
|
||||||
|
destructor Destroy; override;
|
||||||
|
|
||||||
|
function InitDriver(const Path: string; LogCallback: TBs1FltCallback): DWORD;
|
||||||
|
property IsLoaded: Boolean read FIsLoaded;
|
||||||
|
|
||||||
|
function Cleanup: DWORD;
|
||||||
|
function SetPath(ulType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
function DelPath(ulType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
function SetProcessPath(dwType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
function SetFileName(dwType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
function BeginControl(bIsBegin: DWORD): DWORD;
|
||||||
|
function SetPid(dwType: DWORD; dwPid: DWORD): DWORD;
|
||||||
|
function DelPid(dwPid: DWORD): DWORD;
|
||||||
|
function FolderProtectControl(bIsProtect: DWORD): DWORD;
|
||||||
|
function StartShareWatch(bIsWatch: DWORD): DWORD;
|
||||||
|
function Debug(flag: ULONG): DWORD;
|
||||||
|
function DeleteFile(path: PWideChar): DWORD;
|
||||||
|
function TerminateProcess(pid: DWORD): DWORD;
|
||||||
|
function DelProcessPath(dwType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
function SetHook(dwType: DWORD; enable: DWORD): DWORD;
|
||||||
|
function SetPolicy(device_type: DWORD; state: DWORD; islog: DWORD): DWORD;
|
||||||
|
|
||||||
|
function ProcessProtect(enable: DWORD): DWORD;
|
||||||
|
function SetProcessProtectName(name: PWideChar): DWORD;
|
||||||
|
function DelProcessProtectName(name: PWideChar): DWORD;
|
||||||
|
function SetProcessProtectId(pid: DWORD): DWORD;
|
||||||
|
function DelProcessProtectId(pid: DWORD): DWORD;
|
||||||
|
|
||||||
|
function SetRegProtect(enable: DWORD): DWORD;
|
||||||
|
function SetRegProtectName(regkey: PWideChar): DWORD;
|
||||||
|
function DelRegProtectName(regkey: PWideChar): DWORD;
|
||||||
|
|
||||||
|
function SetDeviceProtect(enable: DWORD): DWORD;
|
||||||
|
function SetUsbException(vid: PWideChar; pid: PWideChar; productrevisionlevel: PWideChar; vendorspecific: PWideChar): DWORD;
|
||||||
|
function SetUsbPortException(vid: DWORD; pid: DWORD; bcddevice: DWORD; serial: LPCWSTR): DWORD;
|
||||||
|
function DelUsbPortException(vid: DWORD; pid: DWORD; bcddevice: DWORD; serial: LPCWSTR): DWORD;
|
||||||
|
|
||||||
|
function DelUsbException(vid: PWideChar; pid: PWideChar; productrevisionlevel: PWideChar; vendorspecific: PWideChar): DWORD;
|
||||||
|
function ClearUsbException(): DWORD;
|
||||||
|
function SetLogType(logtype: DWORD): DWORD;
|
||||||
|
//프로세스 생성 감지 기능 ON/OFF
|
||||||
|
function ProcessCreate(enable: DWORD): DWORD;
|
||||||
|
//프로세스 생성 차단 정책 설정
|
||||||
|
function SetProcessCreateBlockRule(name, cmd, parentName: LPCWSTR): DWORD;
|
||||||
|
//프로세스 생성 차단 정책 초기화
|
||||||
|
function ClearProcessCreateBlockRule: DWORD;
|
||||||
|
|
||||||
|
function ClearUsbPortException: DWORD;
|
||||||
|
function Open: DWORD;
|
||||||
|
|
||||||
|
end;
|
||||||
|
var
|
||||||
|
gBs1fltControl: TBs1fltControl = nil;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
const
|
||||||
|
ORD_Cleanup = 1;
|
||||||
|
ORD_Init = 2;
|
||||||
|
ORD_SetPath = 3;
|
||||||
|
ORD_DelPath = 4;
|
||||||
|
ORD_Begin = 5;
|
||||||
|
ORD_SetPid = 6;
|
||||||
|
ORD_DelPid = 7;
|
||||||
|
ORD_Debug = 8;
|
||||||
|
ORD_SetProcessPath = 9;
|
||||||
|
ORD_DelProcessPath = 10;
|
||||||
|
ORD_FolderProtectControl = 11;
|
||||||
|
ORD_StartShareWatch = 12;
|
||||||
|
ORD_SetFileName = 13;
|
||||||
|
ORD_DeleteFile = 14;
|
||||||
|
ORD_TerminateProcess = 15;
|
||||||
|
ORD_SetHook = 16;
|
||||||
|
ORD_SetPolicy = 17;
|
||||||
|
ORD_ProcessProtect = 18;
|
||||||
|
ORD_SetProcessProtectName = 19;
|
||||||
|
ORD_DelProcessProtectName = 20;
|
||||||
|
ORD_SetProcessProtectId = 21;
|
||||||
|
ORD_DelProcessProtectId = 22;
|
||||||
|
ORD_SetRegProtect = 23;
|
||||||
|
ORD_SetRegProtectName = 24;
|
||||||
|
ORD_DelRegProtectName = 25;
|
||||||
|
ORD_SetDeviceProtect = 26;
|
||||||
|
ORD_SetUsbException = 27;
|
||||||
|
ORD_SetUsbPortException = 28;
|
||||||
|
ORD_DelUsbPortException = 29;
|
||||||
|
ORD_DelUsbException = 30;
|
||||||
|
ORD_ClearUsbException = 31;
|
||||||
|
ORD_SetLogType = 32;
|
||||||
|
|
||||||
|
ORD_ProcessCreate = 33;
|
||||||
|
ORD_SetProcessCreateBlockRule = 34;
|
||||||
|
ORD_ClearProcessCreateBlockRule = 35;
|
||||||
|
ORD_ClearUsbPortException = 36;
|
||||||
|
ORD_Open = 37;
|
||||||
|
{ TBs1fltControl }
|
||||||
|
|
||||||
|
constructor TBs1fltControl.Create;
|
||||||
|
begin
|
||||||
|
inherited Create;
|
||||||
|
ASSERT(gBs1fltControl = nil);
|
||||||
|
gBs1fltControl := Self;
|
||||||
|
FHandle := 0;
|
||||||
|
FIsLoaded := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
destructor TBs1fltControl.Destroy;
|
||||||
|
begin
|
||||||
|
UnloadDll;
|
||||||
|
gBs1fltControl := nil;
|
||||||
|
inherited Destroy;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TBs1fltControl.UnloadDll;
|
||||||
|
begin
|
||||||
|
if FHandle <> 0 then
|
||||||
|
begin
|
||||||
|
FreeLibrary(FHandle);
|
||||||
|
FHandle := 0;
|
||||||
|
end;
|
||||||
|
FIsLoaded := False;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.LoadFunc(var ProcPtr: Pointer; Ordinal: Integer): Boolean;
|
||||||
|
begin
|
||||||
|
if FHandle = 0 then
|
||||||
|
begin
|
||||||
|
ProcPtr := nil;
|
||||||
|
Result := False;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
ProcPtr := GetProcAddress(FHandle, PAnsiChar(UIntPtr(Ordinal)));
|
||||||
|
Result := Assigned(ProcPtr);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.InitDriver(const Path: string; LogCallback: TBs1FltCallback): DWORD;
|
||||||
|
var
|
||||||
|
DllPath: string;
|
||||||
|
AllLoaded: Boolean;
|
||||||
|
begin
|
||||||
|
UnloadDll;
|
||||||
|
FCurrentPath := Path;
|
||||||
|
DllPath := IncludeTrailingPathDelimiter(Path) + 'bs1fltctrl.dll';
|
||||||
|
|
||||||
|
FHandle := LoadLibraryW(PWideChar(DllPath));
|
||||||
|
if FHandle = 0 then
|
||||||
|
begin
|
||||||
|
Result := 1;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
AllLoaded := True;
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltCleanup, ORD_Cleanup);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltInit, ORD_Init);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetPath, ORD_SetPath);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltDelPath, ORD_DelPath);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltBegin, ORD_Begin);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetPid, ORD_SetPid);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltDelPid, ORD_DelPid);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltDebug, ORD_Debug);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetProcessPath, ORD_SetProcessPath);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltDelProcessPath, ORD_DelProcessPath);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltFolderProtectControl, ORD_FolderProtectControl);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltStartShareWatch, ORD_StartShareWatch);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetFileName, ORD_SetFileName);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltDeleteFile, ORD_DeleteFile);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltTerminateProcess, ORD_TerminateProcess);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetHook, ORD_SetHook);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetPolicy, ORD_SetPolicy);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltProcessProtect, ORD_ProcessProtect);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetProcessProtectName, ORD_SetProcessProtectName);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltDelProcessProtectName, ORD_DelProcessProtectName);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetProcessProtectId, ORD_SetProcessProtectId);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltDelProcessProtectId, ORD_DelProcessProtectId);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetRegProtect, ORD_SetRegProtect);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltSetRegProtectName, ORD_SetRegProtectName);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1FltDelRegProtectName, ORD_DelRegProtectName);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltSetDeviceProtect, ORD_SetDeviceProtect);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltSetUsbException, ORD_SetUsbException);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltSetUsbPortException, ORD_SetUsbPortException);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltDelUsbPortException, ORD_DelUsbPortException);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltDelUsbException, ORD_DelUsbException);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltClearUsbException, ORD_ClearUsbException);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltSetLogType, ORD_SetLogType);
|
||||||
|
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltProcessCreate, ORD_ProcessCreate);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltSetProcessCreateBlockRule, ORD_SetProcessCreateBlockRule);
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltClearProcessCreateBlockRule, ORD_ClearProcessCreateBlockRule);
|
||||||
|
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltClearUsbPortException, ORD_ClearUsbPortException);
|
||||||
|
OutputDebugString(PChar(Format('[MGKIM] FBs1fltClearUsbPortException .. state : %d', [DWORD(AllLoaded)])));
|
||||||
|
AllLoaded := AllLoaded and LoadFunc(@FBs1fltOpen, ORD_Open);
|
||||||
|
OutputDebugString(PChar(Format('[MGKIM] FBs1fltOpen .. state : %d', [DWORD(AllLoaded)])));
|
||||||
|
|
||||||
|
if not AllLoaded then
|
||||||
|
begin
|
||||||
|
UnloadDll;
|
||||||
|
Result := 2;
|
||||||
|
Exit;
|
||||||
|
end;
|
||||||
|
|
||||||
|
FIsLoaded := True;
|
||||||
|
|
||||||
|
Result := FBs1FltInit(PWideChar(Path), LogCallback, nil);
|
||||||
|
if Result = 0 then
|
||||||
|
begin
|
||||||
|
FBs1FltSetPid(PG_PID_ALLOW, GetCurrentProcessId());
|
||||||
|
SetLogTYpe(LOG_CONNECT or LOG_POLICY );
|
||||||
|
//or LOG_PROCESS_MONITOR
|
||||||
|
// SetLogTYpe(LOG_DISCONNECT);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
function TBs1fltControl.Cleanup: DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltCleanup) then Result := FBs1FltCleanup() else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetPath(ulType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetPath) then Result := FBs1FltSetPath(ulType, lpcwPath) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.DelPath(ulType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltDelPath) then Result := FBs1FltDelPath(ulType, lpcwPath) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetProcessPath(dwType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetProcessPath) then Result := FBs1FltSetProcessPath(dwType, lpcwPath) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetFileName(dwType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetFileName) then Result := FBs1FltSetFileName(dwType, lpcwPath) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.BeginControl(bIsBegin: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltBegin) then Result := FBs1FltBegin(bIsBegin) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetPid(dwType: DWORD; dwPid: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetPid) then Result := FBs1FltSetPid(dwType, dwPid) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.DelPid(dwPid: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltDelPid) then Result := FBs1FltDelPid(dwPid) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.FolderProtectControl(bIsProtect: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltFolderProtectControl) then Result := FBs1FltFolderProtectControl(bIsProtect) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.StartShareWatch(bIsWatch: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltStartShareWatch) then Result := FBs1FltStartShareWatch(bIsWatch) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.Debug(flag: ULONG): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltDebug) then Result := FBs1FltDebug(flag) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.DeleteFile(path: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltDeleteFile) then Result := FBs1FltDeleteFile(path) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.TerminateProcess(pid: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltTerminateProcess) then Result := FBs1FltTerminateProcess(pid) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.DelProcessPath(dwType: DWORD; lpcwPath: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltDelProcessPath) then Result := FBs1FltDelProcessPath(dwType, lpcwPath) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetHook(dwType: DWORD; enable: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetHook) then Result := FBs1FltSetHook(dwType, enable) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetPolicy(device_type: DWORD; state: DWORD; islog: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetPolicy) then Result := FBs1FltSetPolicy(device_type, state, islog) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.ProcessProtect(enable: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltProcessProtect) then Result := FBs1FltProcessProtect(enable) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetProcessProtectName(name: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetProcessProtectName) then Result := FBs1FltSetProcessProtectName(name) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.DelProcessProtectName(name: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltDelProcessProtectName) then Result := FBs1FltDelProcessProtectName(name) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetProcessProtectId(pid: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetProcessProtectId) then Result := FBs1FltSetProcessProtectId(pid) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.DelProcessProtectId(pid: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltDelProcessProtectId) then Result := FBs1FltDelProcessProtectId(pid) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetRegProtect(enable: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetRegProtect) then Result := FBs1FltSetRegProtect(enable) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetRegProtectName(regkey: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltSetRegProtectName) then Result := FBs1FltSetRegProtectName(regkey) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.DelRegProtectName(regkey: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1FltDelRegProtectName) then Result := FBs1FltDelRegProtectName(regkey) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetDeviceProtect(enable: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltSetDeviceProtect) then Result := FBs1fltSetDeviceProtect(enable) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetUsbException(vid: PWideChar; pid: PWideChar; productrevisionlevel: PWideChar; vendorspecific: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltSetUsbException) then Result := FBs1fltSetUsbException(vid, pid, productrevisionlevel, vendorspecific) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetUsbPortException(vid: DWORD; pid: DWORD; bcddevice: DWORD; serial: LPCWSTR): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltSetUsbPortException) then Result := FBs1fltSetUsbPortException(vid, pid, bcddevice, serial) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.DelUsbPortException(vid: DWORD; pid: DWORD; bcddevice: DWORD; serial: LPCWSTR): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltDelUsbPortException) then Result := FBs1fltDelUsbPortException(vid, pid, bcddevice, serial) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.DelUsbException(vid: PWideChar; pid: PWideChar; productrevisionlevel: PWideChar; vendorspecific: PWideChar): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltDelUsbException) then Result := FBs1fltDelUsbException(vid, pid, productrevisionlevel, vendorspecific) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.ClearUsbException(): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltClearUsbException) then Result := FBs1fltClearUsbException() else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetLogType(logtype: DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltSetLogType) then Result := FBs1fltSetLogType(logtype) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.ProcessCreate(enable : DWORD): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltProcessCreate) then Result := FBs1fltProcessCreate(enable) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.SetProcessCreateBlockRule(name: LPCWSTR; cmd: LPCWSTR; parentName: LPCWSTR): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltSetProcessCreateBlockRule) then Result := FBs1fltSetProcessCreateBlockRule(name, cmd, parentName) else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.ClearProcessCreateBlockRule(): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltClearProcessCreateBlockRule) then Result := FBs1fltClearProcessCreateBlockRule() else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.ClearUsbPortException(): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltClearUsbPortException) then Result := FBs1fltClearUsbPortException() else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TBs1fltControl.Open(): DWORD;
|
||||||
|
begin
|
||||||
|
if Assigned(FBs1fltOpen) then Result := FBs1fltOpen() else Result := BS1FLT_ERR_NOT_LOADED;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
Loading…
Reference in New Issue