Tocsg.Module

This commit is contained in:
mgkim 2025-12-30 16:08:54 +09:00
parent 7c31171391
commit 58a4e1d98d
839 changed files with 312040 additions and 0 deletions

View File

@ -0,0 +1,17 @@
program AipMdHelper;
uses
Vcl.Forms,
DAmhMain in 'DAmhMain.pas' {DlgAmhMain},
ThdAipMdHelper in 'ThdAipMdHelper.pas';
{$R *.res}
begin
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgAmhMain, DlgAmhMain);
Application.Run;
end.

View File

@ -0,0 +1,972 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{A35CE934-9D50-4FF3-AA8C-5314F018D28E}</ProjectGuid>
<ProjectVersion>19.5</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
<MainSource>AipMdHelper.dpr</MainSource>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\_OUT_Object\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>.\OUT_$(Config) - $(Platform)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<SanitizedProjectName>AipMdHelper</SanitizedProjectName>
<VerInfo_Locale>1042</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UsePackage>vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;FFmpegRtl_DXT4;appanalytics;IndyProtocols;vclx;adxBuildD28;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;FFmpegVcl_DXT4;emsedge;bindcompfmx;hclcore_xe104;DBXFirebirdDriver;htmlreports_xe104;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;PKIECtrl24;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;PowerPDFDR;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;AbbreviaVCLD;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;htmlcomp_xe104;FireDACMongoDBDriver;IndySystem;PngComponentsD;FireDACTDataDriver;vcldb;ibxbindings;VirtualTreesR;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;htmledit_xe104;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;htmleditcore_xe104;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;adxolBuildD28;vclib;fmxobj;bindcompvclsmp;FMXTee;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>..\kkuProject.manifest</Manifest_File>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_UsePackage>vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;FFmpegRtl_DXT4;appanalytics;IndyProtocols;vclx;adxBuildD28;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;FFmpegVcl_DXT4;emsedge;bindcompfmx;DBXFirebirdDriver;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;PKIECtrl24;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;PowerPDFDR;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;AbbreviaVCLD;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;PngComponentsD;FireDACTDataDriver;vcldb;ibxbindings;VirtualTreesR;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;adxolBuildD28;vclib;fmxobj;bindcompvclsmp;FMXTee;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<DCC_RemoteDebug>true</DCC_RemoteDebug>
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
<DCC_RangeChecking>true</DCC_RangeChecking>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_RemoteDebug>false</DCC_RemoteDebug>
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="DAmhMain.pas">
<Form>DlgAmhMain</Form>
<FormType>dfm</FormType>
</DCCReference>
<DCCReference Include="ThdAipMdHelper.pas"/>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType>Application</Borland.ProjectType>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">AipMdHelper.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment Version="4">
<DeployFile LocalName="OUT_Debug - Win32\AipMdHelper.exe" Configuration="Debug" Class="ProjectOutput"/>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClasses">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>64</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>classes</RemoteDir>
<Operation>64</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidFileProvider">
<Platform Name="Android">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiv7aFile">
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput_Android32">
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStylesV21">
<Platform Name="Android">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_Colors">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon192">
<Platform Name="Android">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon24">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_Strings">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyModule">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="Android64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iOS_AppStore1024">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_AppIcon152">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_AppIcon167">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_LaunchDark2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Notification40">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Setting58">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_SpotLight80">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_AppIcon120">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_AppIcon180">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch3x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_LaunchDark2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_LaunchDark3x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Notification40">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Notification60">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Setting58">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Setting87">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Spotlight120">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Spotlight80">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSEntitlements">
<Platform Name="iOSDevice32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSInfoPList">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSLaunchScreen">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen</RemoteDir>
<Operation>64</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen</RemoteDir>
<Operation>64</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXDebug">
<Platform Name="OSX64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXEntitlements">
<Platform Name="OSX32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXInfoPList">
<Platform Name="OSX32">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
</Platform>
<Platform Name="Linux64">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOutput_Android32">
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectUWPManifest">
<Platform Name="Win32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo150">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo44">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimARM64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
</Deployment>
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>

View File

@ -0,0 +1,118 @@
object DlgAmhMain: TDlgAmhMain
Left = 0
Top = 0
Caption = 'AipMdHelper'
ClientHeight = 272
ClientWidth = 498
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poScreenCenter
TextHeight = 15
object pnTop: TPanel
Left = 0
Top = 0
Width = 498
Height = 137
Align = alTop
BevelOuter = bvNone
TabOrder = 0
object Label1: TLabel
Left = 16
Top = 24
Width = 78
Height = 15
Caption = 'AIP '#47784#46280' '#44221#47196' :'
end
object Label2: TLabel
Left = 16
Top = 61
Width = 57
Height = 15
Caption = #45824#49345' '#54260#45908' :'
end
object edAipPath: TEdit
Left = 100
Top = 21
Width = 277
Height = 23
TabOrder = 0
Text =
'C:\taskToCSG\Tocsg.Module\BSOne-AIP-Decrypt\bin\x64\Release\BSOn' +
'e-AIP-Decrypt.exe'
end
object edTargetDir: TEdit
Left = 100
Top = 58
Width = 277
Height = 23
TabOrder = 1
Text = 'C:\Users\kkuzil\Desktop\'#44060#51064#51221#48372' '#53580#49828#53944' '#54028#51068' - ENC\'
end
object btnEnc: TButton
Left = 48
Top = 96
Width = 75
Height = 25
Caption = #50516#54840#54868
TabOrder = 2
OnClick = btnEncClick
end
object btnDec: TButton
Left = 129
Top = 96
Width = 75
Height = 25
Caption = #48373#54840#54868
TabOrder = 3
OnClick = btnDecClick
end
object btnEncCnt: TButton
Left = 224
Top = 98
Width = 97
Height = 25
Caption = #50516#54840#54868' '#52852#50868#53944
TabOrder = 4
OnClick = btnEncCntClick
end
object btnExtrLabel: TButton
Left = 400
Top = 74
Width = 75
Height = 25
Caption = #47112#51060#48660' '#52628#52636
TabOrder = 5
OnClick = btnExtrLabelClick
end
object btnSetLabel: TButton
Left = 400
Top = 104
Width = 75
Height = 25
Caption = #47112#51060#48660' '#52628#44032
TabOrder = 6
OnClick = btnSetLabelClick
end
object btnLabelChk: TButton
Left = 400
Top = 24
Width = 75
Height = 25
Caption = #47112#51060#48660' '#54869#51064
TabOrder = 7
OnClick = btnLabelChkClick
end
end
object mmLog: TMemo
Left = 0
Top = 137
Width = 498
Height = 135
Align = alClient
TabOrder = 1
end
end

View File

@ -0,0 +1,497 @@
unit DAmhMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TDlgAmhMain = class(TForm)
pnTop: TPanel;
Label1: TLabel;
Label2: TLabel;
edAipPath: TEdit;
edTargetDir: TEdit;
mmLog: TMemo;
btnEnc: TButton;
btnDec: TButton;
btnEncCnt: TButton;
btnExtrLabel: TButton;
btnSetLabel: TButton;
btnLabelChk: TButton;
procedure btnEncClick(Sender: TObject);
procedure btnDecClick(Sender: TObject);
procedure btnEncCntClick(Sender: TObject);
procedure btnExtrLabelClick(Sender: TObject);
procedure btnSetLabelClick(Sender: TObject);
procedure btnLabelChkClick(Sender: TObject);
private
{ Private declarations }
function FindAipMdWnd: HWND;
function SendData(h: HWND; dwCmd: DWORD; const sData: String): LONGLONG;
public
{ Public declarations }
end;
var
DlgAmhMain: TDlgAmhMain;
implementation
uses
Tocsg.Files, Tocsg.Safe, Tocsg.Path, Tocsg.Shell, Tocsg.Process,
Tocsg.DateTime, Tocsg.WndUtil, superobject, Tocsg.Registry;
{$R *.dfm}
procedure TDlgAmhMain.btnEncClick(Sender: TObject);
var
FileList: TStringList;
i, nCnt, n: Integer;
sTaskDir,
sMdPath, sSrcPath, sDestPath: String;
dtBegin: TDateTime;
O: ISuperObject;
begin
edAipPath.Text := Trim(edAipPath.Text);
edTargetDir.Text := Trim(edTargetDir.Text);
if edAipPath.Text = '' then
begin
MessageBox(Handle, PChar('AIP 모듈 경로를 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edAipPath.SetFocus;
exit;
end;
sMdPath := edAipPath.Text;
if not FileExists(sMdPath) then
begin
MessageBox(Handle, PChar('AIP 모듈이 존재하지 않습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edAipPath.SetFocus;
exit;
end;
if edTargetDir.Text = '' then
begin
MessageBox(Handle, PChar('대상 폴더를 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edTargetDir.SetFocus;
exit;
end;
sTaskDir := GetRunExePathDir + 'Task\';
if not ForceDirectories(sTaskDir) then
begin
MessageBox(Handle, PChar('작업 폴더를 생성하는 중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
Guard(FileList, TStringList.Create);
ExtrFilesPathFromDir(edTargetDir.Text, FileList);
var h: HWND := FindAipMdWnd;
dtBegin := Now;
nCnt := 0;
for i := 0 to FileList.Count - 1 do
begin
sSrcPath := FileList[i];
if not FileExists(sSrcPath) then
continue;
sDestPath := sTaskDir + ExtractFileName(sSrcPath);
O := SO;
O.S['src'] := sSrcPath;
O.S['dst'] := sDestPath;
if h <> 0 then
begin
n := SendData(h, 1, O.AsString);
if (n = 10) and FileExists(sDestPath) then
begin
DeleteFile(sSrcPath);
MoveFile_wait(sDestPath, sSrcPath);
Inc(nCnt);
end;
end;
// ExecuteAppWaitUntilTerminate(sMdPath, Format('-e "%s" "%s"', [sSrcPath, sDestPath]), SW_HIDE, 30000);
// if FileExists(sDestPath) then
// begin
// DeleteFile(sSrcPath);
// MoveFile_wait(sDestPath, sSrcPath);
// Inc(nCnt);
// end;
end;
ShowMessage(Format('성공 : %d, 소요시간 : %s', [nCnt, ConvSecBetweenToProgTime(dtBegin, Now)]));
end;
procedure TDlgAmhMain.btnEncCntClick(Sender: TObject);
var
FileList: TStringList;
i, nCnt, n: Integer;
sTaskDir,
sMdPath, sSrcPath, sDestPath: String;
dtBegin: TDateTime;
O: ISuperObject;
begin
edAipPath.Text := Trim(edAipPath.Text);
edTargetDir.Text := Trim(edTargetDir.Text);
if edAipPath.Text = '' then
begin
MessageBox(Handle, PChar('AIP 모듈 경로를 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edAipPath.SetFocus;
exit;
end;
sMdPath := edAipPath.Text;
if not FileExists(sMdPath) then
begin
MessageBox(Handle, PChar('AIP 모듈이 존재하지 않습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edAipPath.SetFocus;
exit;
end;
if edTargetDir.Text = '' then
begin
MessageBox(Handle, PChar('대상 폴더를 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edTargetDir.SetFocus;
exit;
end;
sTaskDir := GetRunExePathDir + 'Task\';
if not ForceDirectories(sTaskDir) then
begin
MessageBox(Handle, PChar('작업 폴더를 생성하는 중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
Guard(FileList, TStringList.Create);
ExtrFilesPathFromDir(edTargetDir.Text, FileList);
var h: HWND := FindAipMdWnd;
dtBegin := Now;
nCnt := 0;
for i := 0 to FileList.Count - 1 do
begin
sSrcPath := FileList[i];
if not FileExists(sSrcPath) then
continue;
sDestPath := sTaskDir + ExtractFileName(sSrcPath);
O := SO;
O.S['src'] := sSrcPath;
O.S['dst'] := sDestPath;
if h <> 0 then
begin
n := SendData(h, 3, O.AsString);
if n = 10 then
Inc(nCnt);
end;
// ExecuteAppWaitUntilTerminate(sMdPath, Format('"%s" "%s"', [sSrcPath, sDestPath]), SW_HIDE, 30000);
// if FileExists(sDestPath) then
// begin
// DeleteFile(sSrcPath);
// MoveFile_wait(sDestPath, sSrcPath);
// Inc(nCnt);
// end;
end;
ShowMessage(Format('성공 : %d, 소요시간 : %s', [nCnt, ConvSecBetweenToProgTime(dtBegin, Now)]));
end;
procedure TDlgAmhMain.btnExtrLabelClick(Sender: TObject);
var
dtBegin: TDateTime;
O: ISuperObject;
sPath,
sTaskDir: String;
n: Integer;
begin
sTaskDir := GetRunExePathDir + 'Task\';
if not ForceDirectories(sTaskDir) then
begin
MessageBox(Handle, PChar('작업 폴더를 생성하는 중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
var h: HWND := FindAipMdWnd;
dtBegin := Now;
if h <> 0 then
begin
O := SO;
sPath := sTaskDir + 'LabelList.txt';
O.S['src'] := sPath;
O.S['dst'] := sPath + '.tmp';
n := SendData(h, 0, O.AsString);
if (n = 10) and FileExists(sPath) then
begin
mmLog.Lines.LoadFromFile(sPath, TEncoding.UTF8);
DeleteFile(sPath);
end;
end;
ShowMessage(Format('소요시간 : %s', [ConvSecBetweenToProgTime(dtBegin, Now)]));
end;
procedure TDlgAmhMain.btnLabelChkClick(Sender: TObject);
const
REG_TEST = 'SOFTWARE\eCrmHomeEdition';
var
dtBegin: TDateTime;
O: ISuperObject;
sTaskDir: String;
n: Integer;
begin
// sTaskDir := GetRunExePathDir + 'Task\';
// if not ForceDirectories(sTaskDir) then
// begin
// MessageBox(Handle, PChar('작업 폴더를 생성하는 중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
// exit;
// end;
// SetRegValueString(HKEY_LOCAL_MACHINE, REG_TEST, 'TEST', 'TEST', true);
// mmLog.Lines.Add(GetRegValueAsString(HKEY_LOCAL_MACHINE, 'SOFTWARE\eCrmHomeEdition', 'TEST', true));
// exit;
edTargetDir.Text := Trim(edTargetDir.Text);
var h: HWND := FindWindow(nil, 'BSOne-AIP-T140713');
dtBegin := Now;
if h <> 0 then
begin
O := SO;
O.S['src'] := edTargetDir.Text;
O.S['dst'] := edTargetDir.Text + '.tmp';
O.S['ssid'] := GetRegRecentUserSid;
n := SendData(h, 4, O.AsString);
if n = 10 then
begin
mmLog.Lines.Add(GetRegValueAsString(HKEY_CURRENT_USER, 'SOFTWARE\eCrmHomeEdition', 'ALabel'));
// DelRegValue(HKEY_CURRENT_USER, 'SOFTWARE\eCrmHomeEdition', 'ALabel');
end else
mmLog.Lines.Add('실패');
end else
mmLog.Lines.Add('실패2');
ShowMessage(Format('소요시간 : %s', [ConvSecBetweenToProgTime(dtBegin, Now)]));
end;
procedure TDlgAmhMain.btnSetLabelClick(Sender: TObject);
var
FileList: TStringList;
i, nCnt, n: Integer;
sTaskDir,
sMdPath, sSrcPath, sDestPath: String;
dtBegin: TDateTime;
O: ISuperObject;
begin
edAipPath.Text := Trim(edAipPath.Text);
edTargetDir.Text := Trim(edTargetDir.Text);
if edAipPath.Text = '' then
begin
MessageBox(Handle, PChar('AIP 모듈 경로를 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edAipPath.SetFocus;
exit;
end;
sMdPath := edAipPath.Text;
if not FileExists(sMdPath) then
begin
MessageBox(Handle, PChar('AIP 모듈이 존재하지 않습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edAipPath.SetFocus;
exit;
end;
if edTargetDir.Text = '' then
begin
MessageBox(Handle, PChar('대상 폴더를 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edTargetDir.SetFocus;
exit;
end;
sTaskDir := GetRunExePathDir + 'Task\';
if not ForceDirectories(sTaskDir) then
begin
MessageBox(Handle, PChar('작업 폴더를 생성하는 중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
Guard(FileList, TStringList.Create);
ExtrFilesPathFromDir(edTargetDir.Text, FileList);
var h: HWND := FindAipMdWnd;
dtBegin := Now;
nCnt := 0;
for i := 0 to FileList.Count - 1 do
begin
sSrcPath := FileList[i];
if not FileExists(sSrcPath) then
continue;
sDestPath := sTaskDir + ExtractFileName(sSrcPath);
O := SO;
O.S['src'] := sSrcPath;
O.S['dst'] := sDestPath;
O.S['lid'] := '9877e059-3e04-4eba-ad87-888eb0c7e9ba';
if h <> 0 then
begin
n := SendData(h, 5, O.AsString);
if (n = 10) and FileExists(sDestPath) then
begin
DeleteFile(sSrcPath);
MoveFile_wait(sDestPath, sSrcPath);
Inc(nCnt);
end;
end;
// ExecuteAppWaitUntilTerminate(sMdPath, Format('"%s" "%s"', [sSrcPath, sDestPath]), SW_HIDE, 30000);
// if FileExists(sDestPath) then
// begin
// DeleteFile(sSrcPath);
// MoveFile_wait(sDestPath, sSrcPath);
// Inc(nCnt);
// end;
end;
ShowMessage(Format('성공 : %d, 소요시간 : %s', [nCnt, ConvSecBetweenToProgTime(dtBegin, Now)]));
end;
function TDlgAmhMain.FindAipMdWnd: HWND;
var
nTO: Integer;
sPName: String;
begin
nTO := 0;
Result := FindWindow(nil, 'BSOne-AIP-T140713');
if Result = 0 then
begin
sPName := ExtractFileName(edAipPath.Text);
while Result = 0 do
begin
if nTO > 300 then
exit;
if GetProcessPidByName(sPName) = 0 then
begin
if not FileExists(edAipPath.Text) then
exit;
ExecutePath_hide(edAipPath.Text, '-r');
Sleep(500);
end;
Result := FindWindow(nil, 'BSOne-AIP-T140713');
Sleep(200);
end;
if Result = 0 then
TerminateProcessByName(sPName);
end;
end;
function TDlgAmhMain.SendData(h: HWND; dwCmd: DWORD; const sData: String): LONGLONG;
var
CopyData: TCopyDataStruct;
begin
CopyData.dwData := dwCmd;
CopyData.cbData := (Length(sData) + 1) * 2;
CopyData.lpData := PChar(sData);
Result := SendMessage(h, WM_COPYDATA, 0, NativeInt(@CopyData));
end;
procedure TDlgAmhMain.btnDecClick(Sender: TObject);
var
FileList: TStringList;
i, nCnt, n: Integer;
sTaskDir,
sMdPath, sSrcPath, sDestPath: String;
dtBegin: TDateTime;
O: ISuperObject;
begin
edAipPath.Text := Trim(edAipPath.Text);
edTargetDir.Text := Trim(edTargetDir.Text);
if edAipPath.Text = '' then
begin
MessageBox(Handle, PChar('AIP 모듈 경로를 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edAipPath.SetFocus;
exit;
end;
sMdPath := edAipPath.Text;
if not FileExists(sMdPath) then
begin
MessageBox(Handle, PChar('AIP 모듈이 존재하지 않습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edAipPath.SetFocus;
exit;
end;
if edTargetDir.Text = '' then
begin
MessageBox(Handle, PChar('대상 폴더를 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edTargetDir.SetFocus;
exit;
end;
sTaskDir := GetRunExePathDir + 'Task\';
if not ForceDirectories(sTaskDir) then
begin
MessageBox(Handle, PChar('작업 폴더를 생성하는 중 오류가 발생했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
Guard(FileList, TStringList.Create);
ExtrFilesPathFromDir(edTargetDir.Text, FileList);
var h: HWND := FindAipMdWnd;
dtBegin := Now;
nCnt := 0;
for i := 0 to FileList.Count - 1 do
begin
sSrcPath := FileList[i];
if not FileExists(sSrcPath) then
continue;
sDestPath := sTaskDir + ExtractFileName(sSrcPath);
O := SO;
O.S['src'] := sSrcPath;
O.S['dst'] := sDestPath;
if h <> 0 then
begin
n := SendData(h, 2, O.AsString);
if (n = 10) and FileExists(sDestPath) then
begin
DeleteFile(sSrcPath);
MoveFile_wait(sDestPath, sSrcPath);
Inc(nCnt);
end;
end;
// ExecuteAppWaitUntilTerminate(sMdPath, Format('"%s" "%s"', [sSrcPath, sDestPath]), SW_HIDE, 30000);
// if FileExists(sDestPath) then
// begin
// DeleteFile(sSrcPath);
// MoveFile_wait(sDestPath, sSrcPath);
// Inc(nCnt);
// end;
end;
ShowMessage(Format('성공 : %d, 소요시간 : %s', [nCnt, ConvSecBetweenToProgTime(dtBegin, Now)]));
end;
end.

View File

@ -0,0 +1,44 @@
{*******************************************************}
{ }
{ ThdAipMdHelper }
{ }
{ Copyright (C) 2023 kku }
{ }
{*******************************************************}
unit ThdAipMdHelper;
interface
uses
Tocsg.Thread, System.SysUtils, System.Classes, Winapi.Windows;
type
TThdAipMdHelper = class(TTgThread)
protected
procedure Execute; override;
public
Constructor Create;
Destructor Destroy; override;
end;
implementation
{ TThdAipMdHelper }
Constructor TThdAipMdHelper.Create;
begin
Inherited Create;
end;
Destructor TThdAipMdHelper.Destroy;
begin
Inherited;
end;
procedure TThdAipMdHelper.Execute;
begin
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,144 @@
{*******************************************************}
{ }
{ ApiHookEtc }
{ }
{ Copyright (C) 2023 kku }
{ }
{*******************************************************}
unit ApiHookEtc;
interface
uses
Winapi.Windows, Winapi.ShellAPI;
type
TFun_DragQueryFileA = function(Drop: HDROP; FileIndex: UINT; FileName: LPSTR; cb: UINT): UINT; stdcall;
TFun_DragQueryFileW = function(Drop: HDROP; FileIndex: UINT; FileName: LPWSTR; cb: UINT): UINT; stdcall;
TFun_DragQueryPoint = function(Drop: HDROP; var Point: TPoint): BOOL; stdcall;
function DragQueryFileAHook(Drop: HDROP; FileIndex: UINT; FileName: LPSTR; cb: UINT): UINT; stdcall;
function DragQueryFileWHook(Drop: HDROP; FileIndex: UINT; FileName: LPWSTR; cb: UINT): UINT; stdcall;
function DragQueryPointHook(Drop: HDROP; var Point: TPoint): BOOL; stdcall;
var
ozDragQueryFileA: TFun_DragQueryFileA = nil;
ozDragQueryFileW: TFun_DragQueryFileW = nil;
ozDragQueryPoint: TFun_DragQueryPoint = nil;
implementation
function DragQueryFileAHook(Drop: HDROP; FileIndex: UINT; FileName: LPSTR; cb: UINT): UINT; stdcall;
begin
{
if (_AppHook <> nil) and _AppHook.Active then
begin
// _AppHook.Log('DragQueryFileAHook()');
// 차단
if (_AppHook.RcvWnd <> 0) and
(FileIndex = DWORD(-1)) then
// (FileIndex <> DWORD(-1)) and (FileName <> nil) then
begin
Result := 0; //ozDragQueryFileA(Drop, FileIndex, FileName, cb);
var i, nCnt, nLen: Integer;
nCnt := ozDragQueryFileA(Drop, DWORD(-1), nil, 0);
if nCnt > 0 then
begin
var FList: TStringList;
Guard(FList, TStringList.Create);
FList.Add(_AppHook.ModuleName);
if _AppHook.hProcWnd_ <> 0 then
FList.Add(GetWindowCaption(_AppHook.hProcWnd_))
else
FList.Add('');
var sPath: AnsiString;
for i := 0 to nCnt - 1 do
begin
nLen := ozDragQueryFileA(Drop, i, nil, 0) + 1;
SetLength(sPath, nLen);
ozDragQueryFileA(Drop, i, PAnsiChar(sPath), nLen);
// if FileExists(sPath) then
begin
SetLength(sPath, nLen - 1); // 끝에 #0 제거
FList.Add(sPath);
end;
end;
if FList.Count > 1 then
begin
FList.SaveToFile(ExtractFilePath(_AppHook.sLogPath_) + TXT_DROPINFO, TEncoding.UTF8);
PostMessage(_AppHook.RcvWnd, WM_CATCH_DROPFILES, 0, 0);
end;
end;
end;
// Result := 0;
end else
}
Result := ozDragQueryFileA(Drop, FileIndex, FileName, cb);
end;
function DragQueryFileWHook(Drop: HDROP; FileIndex: UINT; FileName: LPWSTR; cb: UINT): UINT; stdcall;
begin
{
if (_AppHook <> nil) and _AppHook.Active then
begin
// _AppHook.Log('DragQueryFileAHook()');
// 차단
if (_AppHook.RcvWnd <> 0) and
(FileIndex = DWORD(-1)) then
// (FileIndex <> DWORD(-1)) and (FileName <> nil) then
begin
Result := 0; //ozDragQueryFileA(Drop, FileIndex, FileName, cb);
var i, nCnt, nLen: Integer;
nCnt := ozDragQueryFileW(Drop, DWORD(-1), nil, 0);
if nCnt > 0 then
begin
var FList: TStringList;
Guard(FList, TStringList.Create);
FList.Add(_AppHook.ModuleName);
if _AppHook.hProcWnd_ <> 0 then
FList.Add(GetWindowCaption(_AppHook.hProcWnd_))
else
FList.Add('');
var sPath: String;
for i := 0 to nCnt - 1 do
begin
nLen := ozDragQueryFileW(Drop, i, nil, 0) + 1;
SetLength(sPath, nLen);
ozDragQueryFileW(Drop, i, PChar(sPath), nLen);
// if FileExists(sPath) then
begin
SetLength(sPath, nLen - 1); // 끝에 #0 제거
FList.Add(sPath);
end;
end;
if FList.Count > 1 then
begin
FList.SaveToFile(ExtractFilePath(_AppHook.sLogPath_) + '$DrpFle.txt', TEncoding.UTF8);
PostMessage(_AppHook.RcvWnd, WM_CATCH_DROPFILES, 0, 0);
end;
end;
end;
end else
}
Result := ozDragQueryFileW(Drop, FileIndex, FileName, cb);
end;
function DragQueryPointHook(Drop: HDROP; var Point: TPoint): BOOL; stdcall;
begin
{
if (_AppHook <> nil) and _AppHook.Active then
Result := FALSE
else
}
ozDragQueryPoint(Drop, Point);
end;
end.

View File

@ -0,0 +1,437 @@
{*******************************************************}
{ }
{ ApiHookExplorer }
{ }
{ Copyright (C) 2025 kku }
{ }
{*******************************************************}
unit ApiHookExplorer;
interface
uses
Winapi.Windows, System.SysUtils, Winapi.ActiveX, Tocsg.Thread, Winapi.ShlObj;
type
TFileOpProgressSink = class(TInterfacedObject, IFileOperationProgressSink)
public
function StartOperations: HRESULT; stdcall;
function FinishOperations(hrResult: HRESULT): HRESULT; stdcall;
function PreRenameItem(dwFlags: DWORD; const psiItem: IShellItem; pszNewName: LPCWSTR): HResult; stdcall;
function PostRenameItem(dwFlags: DWORD; const psiItem: IShellItem;
pszNewName: LPCWSTR; hrRename: HResult; const psiNewlyCreated: IShellItem): HResult; stdcall;
function PreMoveItem(dwFlags: DWORD; const psiItem: IShellItem;
const psiDestinationFolder: IShellItem; pszNewName: LPCWSTR): HResult; stdcall;
function PostMoveItem(dwFlags: DWORD; const psiItem: IShellItem;
const psiDestinationFolder: IShellItem; pszNewName: LPCWSTR; hrMove: HResult; const psiNewlyCreated: IShellItem): HResult; stdcall;
function PreCopyItem(dwFlags: DWORD; const psiItem: IShellItem;
const psiDestinationFolder: IShellItem; pszNewName: LPCWSTR): HResult; stdcall;
function PostCopyItem(dwFlags: DWORD; const psiItem: IShellItem;
const psiDestinationFolder: IShellItem; pszNewName: LPCWSTR;
hrCopy: HResult; const psiNewlyCreated: IShellItem): HResult; stdcall;
function PreDeleteItem(dwFlags: DWORD; const psiItem: IShellItem): HResult; stdcall;
function PostDeleteItem(dwFlags: DWORD; const psiItem: IShellItem; hrDelete: HResult;
const psiNewlyCreated: IShellItem): HResult; stdcall;
function PreNewItem(dwFlags: DWORD; const psiDestinationFolder: IShellItem;
pszNewName: LPCWSTR): HResult; stdcall;
function PostNewItem(dwFlags: DWORD; const psiDestinationFolder: IShellItem;
pszNewName: LPCWSTR; pszTemplateName: LPCWSTR; dwFileAttributes: DWORD;
hrNew: HResult; const psiNewItem: IShellItem): HResult; stdcall;
function UpdateProgress(iWorkTotal, iWorkSoFar: UINT): HRESULT; stdcall;
function ResetTimer: HRESULT; stdcall;
function PauseTimer: HRESULT; stdcall;
function ResumeTimer: HRESULT; stdcall;
end;
TPerformOperations = function(iFO: IFileOperation): HRESULT; stdcall;
TThdFoHookInit = class(TTgThread)
protected
procedure Execute; override;
public
Constructor Create;
end;
function PerformOperationsHook(iFO: IFileOperation): HRESULT; stdcall;
procedure InstallFileOperationHooks;
procedure UninstallFileOperationHooks;
implementation
uses
{$IFDEF _BS1HP_}
BS1Hook, DefineHelper, superobject,
{$ELSE}
AppHook,
{$ENDIF}
DDetours;
type
TEvtType = (etCreate, etCopy, etMove, etDelete, etRename);
var
_ozCoCreateInstance: Pointer = nil;
_FndPerformOperations: TPerformOperations = nil;
_OzPerformOperations: TPerformOperations = nil;
procedure InstallFileOperationHooks;
begin
if @_OzPerformOperations = nil then
TThdFoHookInit.Create;
end;
procedure UninstallFileOperationHooks;
begin
if @_OzPerformOperations <> nil then
begin
InterceptRemove(@_OzPerformOperations);
@_OzPerformOperations := nil;
end;
end;
procedure Dbg(sLog: String);
begin
if gAppHook <> nil then
gAppHook.Log(sLog);
end;
function PerformOperationsHook(iFO: IFileOperation): HRESULT; stdcall;
var
FoSink: IFileOperationProgressSink;
dwCookie: DWORD;
hr: HRESULT;
bAdviseOk: Boolean;
begin
if (@_OzPerformOperations = nil) then
begin
Result := E_POINTER;
exit;
end;
bAdviseOk := false;
FoSink := TFileOpProgressSink.Create as IFileOperationProgressSink;
if FoSink <> nil then
begin
dwCookie := 0;
hr := iFO.Advise(FoSink, dwCookie);
bAdviseOk := SUCCEEDED(hr);
if not bAdviseOk then
dwCookie := 0;
try
Result := _OzPerformOperations(iFO);
finally
if bAdviseOk and (dwCookie <> 0) then
begin
try
iFO.Unadvise(dwCookie);
except
//
end;
end;
FoSink := nil;
end;
end else
Result := _OzPerformOperations(iFO);
end;
{ TThdFoHookInit }
Constructor TThdFoHookInit.Create;
begin
Inherited Create;
FreeOnTerminate := true;
StartThread;
end;
function GetInterfaceMethod(Intf: Pointer; dwMethodIdx: Cardinal): Pointer;
var
pp: PPointer;
begin
pp := PPointer(Intf)^;
Result := PPointer(NativeUInt(pp) + dwMethodIdx * SizeOf(Pointer))^;
end;
procedure TThdFoHookInit.Execute;
var
hr: HRESULT;
iFO: IFileOperation;
begin
hr := CoInitializeEx(nil, COINIT_APARTMENTTHREADED or COINIT_DISABLE_OLE1DDE);
if FAILED(hr) then
begin
Dbg('Fail .. CoInitializeEx() .. 초기화 실패');
exit;
end;
try
while not Terminated and not GetWorkStop do
begin
Sleep(1000);
iFO := nil;
hr := CoCreateInstance(CLSID_FileOperation, nil, CLSCTX_ALL, IID_IFileOperation, iFO);
if FAILED(hr) then
begin
Dbg('Fail .. CoCreateInstance() .. IFileOperation 객체 생성 실패');
exit;
end;
Dbg('CoCreateInstance() .. OK');
if (iFO <> nil) and (@_FndPerformOperations = nil) then
begin
var hTx: THandle := BeginTransaction;
try
@_FndPerformOperations := GetInterfaceMethod(iFO, 21);
if (@_FndPerformOperations <> nil) then
begin
@_OzPerformOperations := InterceptCreate(@_FndPerformOperations, @PerformOperationsHook);
if (@_OzPerformOperations <> nil) then
Dbg('PerformOperations() .. OK')
else
Dbg('PerformOperations() .. Fail');
end else
Dbg('FndPerformOperations() .. Fail');
finally
EndTransaction(hTx);
end;
break;
end;
end;
finally
CoUninitialize;
end;
end;
function ShellItemPath(psi: IUnknown): string;
var
si: IShellItem;
psz: LPWSTR;
hr: HRESULT;
begin
Result := '';
if (psi <> nil) and Supports(psi, IShellItem, si) then
begin
psz := nil;
hr := si.GetDisplayName(SIGDN_FILESYSPATH, psz);
if Succeeded(hr) and (psz <> nil) then
begin
Result := psz;
CoTaskMemFree(psz);
end;
end;
end;
function IsUNCPath(sPath: string): Boolean;
var
sChk: String;
begin
Result := false;
if Length(sPath) >= 2 then
begin
sChk := UpperCase(sPath);
if Pos('\APPDATA\ROAMING\MICROSOFT\WINDOWS\NETWORK SHORTCUTS\', sChk) > 0 then
begin
Result := true;
exit;
end;
if sChk[1] = 'C' then
exit;
if sChk[2] = ':' then
begin
// if gAppHook <> nil then
// begin
// Result := gAppHook.Helper.IsNetPath(sChk[1] + ':\');
// if Result then
// exit;
// end else
case GetDriveType(PChar(sChk[1] + ':\')) of
DRIVE_REMOTE,
DRIVE_NO_ROOT_DIR :
begin
Result := true;
exit;
end;
end;
end;
Result := (sChk[1] = '\') and (sChk[2] = '\');
end;
end;
function ProcMon(evt: TEvtType; const sSrcPath, sDstDir: String; sFName: String): HRESULT;
begin
Result := S_OK;
if (gAppHook <> nil) and (gAppHook.Helper.CtrlOpt.ShFileCrMon.nKind <> 0) then
begin
var sDstPath: String;
var bBlock: Boolean;
if sFName = '' then
sFName := ExtractFileName(sSrcPath);
sDstPath := IncludeTrailingPathDelimiter(sDstDir) + sFName;
if IsUNCPath(sDstPath) then
begin
bBlock := gAppHook.Helper.CtrlOpt.ShFileCrMon.nKind = 2;
if bBlock and (gAppHook.Helper.FoExpList.Count > 0) then
begin
var sChk: String := UpperCase(sDstPath);
var i: Integer;
for i := 0 to gAppHook.Helper.FoExpList.Count - 1 do
begin
if Pos(gAppHook.Helper.FoExpList[i], sChk) > 0 then
begin
bBlock := false;
break;
end;
end;
end;
{$IFDEF _BS1HP_}
var O: ISuperObject := SO;
O.S['S'] := sSrcPath;
O.S['D'] := sDstPath;
O.I['E'] := Integer(evt);
O.B['B'] := bBlock;
O.B['N'] := true; // 네트워크 파일?
SendCopyData(gAppHook.Helper.CtrlOpt.hRcvWnd, HPCMD_FILE_OPERATION_NOTI, O.AsJSon);
{$ENDIF}
if bBlock then
Result := E_ACCESSDENIED;
end;
end;
end;
{ IFileOperationProgressSink }
function TFileOpProgressSink.StartOperations: HRESULT; stdcall;
begin
Dbg('StartOperations');
Result := S_OK;
end;
function TFileOpProgressSink.FinishOperations(hrResult: HRESULT): HRESULT; stdcall;
begin
Dbg(Format('FinishOperations hr=0x%x', [hrResult]));
Result := S_OK;
end;
function TFileOpProgressSink.PreRenameItem(dwFlags: DWORD; const psiItem: IShellItem; pszNewName: LPCWSTR): HResult; stdcall;
var
sSrcPath: string;
begin
sSrcPath := ShellItemPath(psiItem);
Dbg(Format('PreRenameItem: %s -> %s', [sSrcPath, pszNewName]));
Result := S_OK;
end;
function TFileOpProgressSink.PostRenameItem(dwFlags: DWORD; const psiItem: IShellItem;
pszNewName: LPCWSTR; hrRename: HResult; const psiNewlyCreated: IShellItem): HResult; stdcall;
begin
Dbg(Format('PostRenameItem hr=0x%x', [hrRename]));
Result := S_OK;
end;
function TFileOpProgressSink.PreMoveItem(dwFlags: DWORD; const psiItem: IShellItem;
const psiDestinationFolder: IShellItem; pszNewName: LPCWSTR): HResult; stdcall;
var
sSrcPath, sDstDir: string;
begin
sSrcPath := ShellItemPath(psiItem);
sDstDir := ShellItemPath(psiDestinationFolder);
Dbg(Format('PreMoveItem: %s -> %s\%s', [sSrcPath, sDstDir, pszNewName]));
Result := ProcMon(etMove, sSrcPath, sDstDir, pszNewName);
end;
function TFileOpProgressSink.PostMoveItem(dwFlags: DWORD; const psiItem: IShellItem;
const psiDestinationFolder: IShellItem; pszNewName: LPCWSTR; hrMove: HResult; const psiNewlyCreated: IShellItem): HResult; stdcall;
begin
Dbg(Format('PostMoveItem hr=0x%x', [hrMove]));
Result := S_OK;
end;
function TFileOpProgressSink.PreCopyItem(dwFlags: DWORD; const psiItem: IShellItem;
const psiDestinationFolder: IShellItem; pszNewName: LPCWSTR): HResult; stdcall;
var
sSrcPath, sDstDir: string;
begin
sSrcPath := ShellItemPath(psiItem);
sDstDir := ShellItemPath(psiDestinationFolder);
Dbg(Format('PreCopyItem: %s -> %s\%s', [sSrcPath, sDstDir, pszNewName]));
Result := ProcMon(etCopy, sSrcPath, sDstDir, pszNewName);
end;
function TFileOpProgressSink.PostCopyItem(dwFlags: DWORD; const psiItem: IShellItem;
const psiDestinationFolder: IShellItem; pszNewName: LPCWSTR;
hrCopy: HResult; const psiNewlyCreated: IShellItem): HResult; stdcall;
begin
Dbg(Format('PostCopyItem hr=0x%x', [hrCopy]));
Result := S_OK;
end;
function TFileOpProgressSink.PreDeleteItem(dwFlags: DWORD; const psiItem: IShellItem): HResult; stdcall;
var
sSrcPath: String;
begin
sSrcPath := ShellItemPath(psiItem);
Dbg('PreDeleteItem: ' + sSrcPath);
Result := S_OK; // MaybeBlock(boDelete, sSrcPath, '', '');
end;
function TFileOpProgressSink.PostDeleteItem(dwFlags: DWORD; const psiItem: IShellItem; hrDelete: HResult;
const psiNewlyCreated: IShellItem): HResult; stdcall;
begin
Dbg(Format('PostDeleteItem hr=0x%x', [hrDelete]));
Result := S_OK;
end;
function TFileOpProgressSink.PreNewItem(dwFlags: DWORD; const psiDestinationFolder: IShellItem;
pszNewName: LPCWSTR): HResult; stdcall;
var
sDstDir: string;
begin
sDstDir := ShellItemPath(psiDestinationFolder);
Dbg(Format('PreNewItem: %s\%s', [sDstDir, pszNewName]));
Result := ProcMon(etCreate, '', sDstDir, pszNewName);
end;
function TFileOpProgressSink.PostNewItem(dwFlags: DWORD; const psiDestinationFolder: IShellItem;
pszNewName: LPCWSTR; pszTemplateName: LPCWSTR; dwFileAttributes: DWORD;
hrNew: HResult; const psiNewItem: IShellItem): HResult; stdcall;
begin
Dbg(Format('PostNewItem hr=0x%x', [hrNew]));
Result := S_OK;
end;
function TFileOpProgressSink.UpdateProgress(iWorkTotal, iWorkSoFar: UINT): HRESULT; stdcall;
begin
Result := S_OK;
end;
function TFileOpProgressSink.ResetTimer: HRESULT; stdcall;
begin
Result := S_OK;
end;
function TFileOpProgressSink.PauseTimer: HRESULT; stdcall;
begin
Result := S_OK;
end;
function TFileOpProgressSink.ResumeTimer: HRESULT; stdcall;
begin
Result := S_OK;
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,77 @@
{*******************************************************}
{ }
{ ApiHookNet }
{ }
{ Copyright (C) 2023 kku }
{ }
{*******************************************************}
unit ApiHookNet;
interface
uses
Winapi.Windows, EM.Dnsapi, System.SysUtils;
const
DNS_ERROR_RCODE_YXDOMAIN = $232E;
type
TFun_DnsQuery_A = function(lpstrName: LPSTR; wType: WORD; fOptions: DWORD; aipServers: PDWORD;
var ppQueryResultsSet: PDWORD; pReserved:pdword): DWORD; stdcall;
TFun_DnsQuery_UTF8 = function(lpstrName: LPSTR; wType: WORD; fOptions: DWORD; aipServers: PDWORD;
var ppQueryResultsSet: PDWORD; pReserved:pdword): DWORD; stdcall;
TFun_DnsQuery_W = function(lpstrName: LPWSTR; wType: WORD; fOptions: DWORD; aipServers: PDWORD;
var ppQueryResultsSet: PDWORD; pReserved:pdword): DWORD; stdcall;
TFun_DnsQueryEx = function(pQueryRequest: PDnsQueryRequest; pQueryResults, pCancelHandle: Pointer): DWORD; stdcall;
var
ozDnsQuery_A: TFun_DnsQuery_A = nil;
ozDnsQuery_UTF8: TFun_DnsQuery_UTF8 = nil;
ozDnsQuery_W: TFun_DnsQuery_W = nil;
ozDnsQueryEx: TFun_DnsQueryEx = nil;
implementation
function CheckBlockDomain(sDomain: String): Boolean;
begin
// _AppHook.Log('CheckBlockDomain() ..');
Result := Pos('google', LowerCase(sDomain)) > 0;
end;
function DnsQuery_AHook(lpstrName: LPSTR; wType: WORD; fOptions: DWORD; aipServers: PDWORD;
var ppQueryResultsSet: PDWORD; pReserved:pdword): DWORD; stdcall;
begin
if CheckBlockDomain(StrPas(lpstrName)) then
Result := DNS_ERROR_RCODE_YXDOMAIN
else
Result := ozDnsQuery_A(lpstrName, wType, fOptions, aipServers, ppQueryResultsSet, pReserved);
end;
function DnsQuery_UTF8Hook(lpstrName: LPSTR; wType: WORD; fOptions: DWORD; aipServers: PDWORD;
var ppQueryResultsSet: PDWORD; pReserved:pdword): DWORD; stdcall;
begin
if CheckBlockDomain(StrPas(lpstrName)) then
Result := DNS_ERROR_RCODE_YXDOMAIN
else
Result := ozDnsQuery_UTF8(lpstrName, wType, fOptions, aipServers, ppQueryResultsSet, pReserved);
end;
function DnsQuery_WHook(lpstrName: LPWSTR; wType: WORD; fOptions: DWORD; aipServers: PDWORD;
var ppQueryResultsSet: PDWORD; pReserved:pdword): DWORD; stdcall;
begin
if CheckBlockDomain(StrPas(lpstrName)) then
Result := DNS_ERROR_RCODE_YXDOMAIN
else
Result := ozDnsQuery_W(lpstrName, wType, fOptions, aipServers, ppQueryResultsSet, pReserved);
end;
function DnsQueryExHook(pQueryRequest: PDnsQueryRequest; pQueryResults, pCancelHandle: Pointer): DWORD; stdcall;
begin
if CheckBlockDomain(StrPas(pQueryRequest.sQueryName)) then
Result := ERROR_INVALID_PARAMETER
else
Result := ozDnsQueryEx(pQueryRequest, pQueryResults, pCancelHandle);
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,51 @@
library AppCtrl;
uses
System.SysUtils,
Winapi.Windows,
System.Classes,
AppHook in 'AppHook.pas',
AppHookClient in 'AppHookClient.pas',
Define in 'Define.pas',
ApiHookFile in 'ApiHookFile.pas',
Tocsg.DRM.Encrypt in '..\..\TocsgDRM\LIB_Common\Tocsg.DRM.Encrypt.pas',
ApiHookEtc in 'ApiHookEtc.pas',
ApiHookNet in 'ApiHookNet.pas',
ApiHookDraw in 'ApiHookDraw.pas',
ApiHookPrint in 'ApiHookPrint.pas',
Condition in '..\..\..\eCrmHE\LIB_Common\Condition.pas',
GlobalDefine in '..\..\..\eCrmHE\LIB_Common\GlobalDefine.pas',
ProcessWM in 'ProcessWM.pas',
AppCtrlDefine in '..\LIB_Common\AppCtrlDefine.pas',
ApiHookExplorer in 'ApiHookExplorer.pas';
{$R *.res}
var
AppHook: TAppHook = nil;
procedure DLLEntryPoint(dwReason: DWORD);
begin
case dwReason of
DLL_PROCESS_ATTACH :
begin
AppHook := TAppHook.Create;
end;
DLL_PROCESS_DETACH :
begin
try
if Assigned(AppHook) then
FreeAndNil(AppHook);
except
//
end;
end;
end;
end;
begin
DllProc := @DLLEntryPoint;
DLLEntryPoint(DLL_PROCESS_ATTACH);
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,626 @@
{*******************************************************}
{ }
{ AppHook }
{ }
{ Copyright (C) 2022 kku }
{ }
{*******************************************************}
unit AppHook;
interface
//{$DEFINE USE_BOXAPP}
uses
System.SysUtils, System.Classes, Tocsg.DllEntry, Tocsg.CommonData,
GlobalDefine, Winapi.Windows, Winapi.Messages, Tocsg.Trace,
WinAPI.Foundation.Collections, System.Generics.Collections,
AppHookClient, AppCtrlDefine, System.SyncObjs;
type
TAppHook = class(TTgDllEntry)
private
CS_: TCriticalSection;
hProcWnd_: HWND;
Trace_: TTgTrace;
dtCreate_: TDateTime;
Client_: TAppHookClient;
ProcList_: TList<PPointer>;
Helper_: TAppCtrlHelper;
RFileList_: TStringList;
// 프린트 마스킹
PrtMaskList_: TStringList;
procedure OnBeforeLog(Sender: TObject);
procedure OnAfterLog(Sender: TObject);
procedure AddInterceptAPI(var aProcDest: Pointer; aProcSrc, aProcHook: Pointer; sProcName: String);
procedure InitDrmProcess;
procedure Lock;
procedure Unlock;
public
// 전역 옵션
_bLogProcessing,
_bInternalOpen: Boolean;
sLogPath_: String;
_hMTP: THandle;
_sMtpDev,
_sMtpRecentFile: String;
_dwMtpTick: DWORD; // MTP 인지하고 연속 차단을 위한 타임아웃 24_0604 16:19:01 kku
Constructor Create;
Destructor Destroy; override;
procedure DoInterceptRemove;
procedure OnAppDisconnected(aSener: TObject);
procedure AddCreateFile(hFile: THandle; sPath: String);
function HasCreateFile(hFile: THandle): Boolean;
procedure DelCloseFile(hFile: THandle);
function GetRFilePath(sFName: String): String;
procedure Log(sLog: String); overload;
procedure Log(const sFormat: string; const Args: array of const); overload;
procedure SendText(sData: String);
procedure ProcessAppCtrlOpt(aOpt: TAppCtrlOpt);
property Helper: TAppCtrlHelper read Helper_;
property PrtMaskList: TStringList read PrtMaskList_;
end;
var
gAppHook: TAppHook = nil;
implementation
uses
{$IFDEF USE_BOXAPP}
BoxedAppSDK_Static,
{$ENDIF}
DDetours, Tocsg.Safe, Vcl.Forms,
Tocsg.Exception, System.DateUtils, Tocsg.Packet, ApiHookFile, ApiHookPrint,
ApiHookDraw, Tocsg.Strings, Winapi.WinSpool, ApiHookExplorer;
{ TAppHook }
Constructor TAppHook.Create;
procedure GetStartTime;
var
ftCreate,
ftExit,
ftKernel,
ftUser: TFileTime;
nDosTime: Integer;
begin
dtCreate_ := 0;
GetProcessTimes(GetCurrentProcess, ftCreate, ftExit, ftKernel, ftUser);
if FileTimeToLocalFileTime(ftCreate, ftCreate) then
if FileTimeToDosDateTime(ftCreate, LongRec(nDosTime).Hi, LongRec(nDosTime).Lo) then
dtCreate_ := FileDateToDateTime(nDosTime);
end;
begin
Inherited Create;
ASSERT(gAppHook = nil);
gAppHook := Self;
CS_ := TCriticalSection.Create;
hProcWnd_ := 0;
Trace_ := nil;
_hMTP := 0;
_sMtpDev := '';
_dwMtpTick := 0;
_sMtpRecentFile := '';
_bLogProcessing := false;
_bInternalOpen := false;
PrtMaskList_ := TStringList.Create;
GetStartTime;
RFileList_ := TStringList.Create;
RFileList_.CaseSensitive := false;
{$IFDEF DEBUG} // 이거 켜면 DLL 해제 시 떨어지지 않는다 23_0315 11:09:49 kku
{$IFDEF WIN64}
sLogPath_ := 'C:\taskToCSG\Tocsg.Module\AppCtrl\OUT_Debug - Win64\AppCtrl_d.log';
{$ELSE}
sLogPath_ := 'C:\taskToCSG\Tocsg.Module\AppCtrl\OUT_Debug - Win32\AppCtrl32_d.log';
// sLogPath_ := 'C:\AppCtrl\AppCtrl32_d.log';
{$ENDIF}
ForceDirectories(ExtractFilePath(sLogPath_));
// if FileExists(sLogPath_) then
// DeleteFile(PChar(sLogPath_));
Trace_ := TTgTrace.Create(ExtractFilePath(sLogPath_), ExtractFileName(sLogPath_));
Trace_.Level := 99;
Trace_.OnBeforeLog := OnBeforeLog;
Trace_.OnAfterLog := OnAfterLog;
Trace_.LoadHead := ModuleName + ' > ';
{$ENDIF}
ProcList_ := TList<PPointer>.Create;
Helper_ := TAppCtrlHelper.Create(ModulePath);
// if Helper_.IsDrmSupport then
// InitDrmProcess;
Client_ := TAppHookClient.Create;
Client_.OnDisconnected := OnAppDisconnected;
Client_.TryReconnect := true;
Client_.ModulePath := ModulePath;
if not Client_.ActiveNp('NpAppCtrl', false) then
begin
Log('Fail .. ActiveNp()');
exit;
end;
if not Client_.ConnectNp then
begin
Log('Fail .. Connection');
exit;
end;
// var Send: ISendPacket;
// Send := TTgPacket.Create(ACC_TEST_LOG);
// Send.S['Msg'] := ModuleName + ' > 방가방가';
// Client_.SendPacket(Send);
end;
Destructor TAppHook.Destroy;
begin
Log('Destroy()');
if Client_ <> nil then
FreeAndNil(Client_);
//
DoInterceptRemove;
UninstallFileOperationHooks;
if Trace_ <> nil then
FreeAndNil(Trace_);
FreeAndNil(Helper_);
FreeAndNil(ProcList_);
FreeAndNil(RFileList_);
FreeAndNil(PrtMaskList_);
Inherited;
FreeAndNil(CS_);
end;
procedure TAppHook.InitDrmProcess;
{$IFDEF USE_BOXAPP}
var
bLoadBx: Boolean;
Label
LB_LoadBx;
{$ENDIF}
begin
Log('InitDrmProcess() ..');
{$IFDEF USE_BOXAPP}
// if bUseBoxedApp_ then
begin
try
bLoadBx := false;
LB_LoadBx :
try
// Init BoxedApp SDK
BoxedAppSDK_SetContext('21f2f010-06e4-465f-af8f-cde6a3752c39');
BoxedAppSDK_Init;
// Allow injection BoxedApp engine into child processes
// BoxedAppSDK_EnableOption(DEF_BOXEDAPPSDK_OPTION__EMBED_BOXEDAPP_IN_CHILD_PROCESSES, TRUE);
// BoxedAppSDK_EnableOption(DEF_BOXEDAPPSDK_OPTION__HIDE_VIRTUAL_FILES_FROM_FILE_DIALOG, TRUE);
// BoxedAppSDK_EnableOption(DEF_BOXEDAPPSDK_OPTION__ALL_CHANGES_ARE_VIRTUAL, TRUE);
bLoadBx := true;
except
Log('Fail .. BoxedAppSDK');
end;
if not bLoadBx then
begin
Sleep(10);
goto LB_LoadBx;
end;
except
Log('Fail .. UseBoxedAppSDK');
end;
end;
{$ENDIF}
AddInterceptAPI(@ozCreateFileA, @CreateFileA, @CreateFileAHook, 'CreateFileA');
AddInterceptAPI(@ozCreateFileW, @CreateFileW, @CreateFileWHook, 'CreateFileW');
AddInterceptAPI(@ozCloseHandle, @CloseHandle, @CloseHandleHook, 'CloseHandle');
end;
procedure TAppHook.Lock;
begin
CS_.Acquire;
end;
procedure TAppHook.Unlock;
begin
CS_.Release;
end;
procedure TAppHook.AddInterceptAPI(var aProcDest: Pointer; aProcSrc, aProcHook: Pointer; sProcName: String);
begin
if aProcDest = nil then
begin
aProcDest := InterceptCreate(aProcSrc, aProcHook);
if aProcDest <> nil then
begin
Log(Format('>>> InterceptCreate() - %s <<<', [sProcName]));
ProcList_.Add(@aProcDest);
end else
Log(Format('>>> Fail .. InterceptCreate() - %s <<<', [sProcName]));
end;
end;
procedure TAppHook.DoInterceptRemove;
procedure RemoveAPI(var aProc: Pointer); inline;
begin
if aProc <> nil then
begin
InterceptRemove(aProc);
aProc := nil;
end;
end;
var
i: Integer;
begin
Log('DoInterceptRemove()');
for i := 0 to ProcList_.Count - 1 do
RemoveAPI(ProcList_[i]^);
ProcList_.Clear;
end;
procedure TAppHook.OnAppDisconnected(aSener: TObject);
var
CtrlOpt: TAppCtrlOpt;
begin
ZeroMemory(@CtrlOpt, SizeOf(CtrlOpt));
Helper_.CtrlOpt := CtrlOpt;
end;
procedure TAppHook.AddCreateFile(hFile: THandle; sPath: String);
begin
try
// Lock;
try
if RFileList_.IndexOf(sPath) = -1 then
RFileList_.AddObject(sPath, TObject(hFile));
finally
// Unlock;
end;
except
// ..
end;
end;
function TAppHook.HasCreateFile(hFile: THandle): Boolean;
var
i: Integer;
begin
Result := false;
try
Lock;
try
for i := 0 to RFileList_.Count - 1 do
if hFile = THandle(RFileList_.Objects[i]) then
begin
Result := true;
exit;
end;
finally
Unlock;
end;
except
// ..
end;
end;
procedure TAppHook.DelCloseFile(hFile: THandle);
var
i: Integer;
begin
try
Lock;
try
for i := 0 to RFileList_.Count - 1 do
if hFile = THandle(RFileList_.Objects[i]) then
begin
RFileList_.Delete(i);
exit;
end;
finally
Unlock;
end;
except
// ..
end;
end;
function TAppHook.GetRFilePath(sFName: String): String;
var
i: Integer;
begin
Result := '';
try
sFName := UpperCase(sFName);
Lock;
try
for i := 0 to RFileList_.Count - 1 do
if Pos(UpperCase(ExtractFileName(RFileList_[i])), sFName) > 0 then
begin
Result := RFileList_[i];
exit;
end;
finally
Unlock;
end;
except
// ..
end;
end;
procedure TAppHook.OnBeforeLog(Sender: TObject);
begin
_bLogProcessing := true;
end;
procedure TAppHook.OnAfterLog(Sender: TObject);
begin
_bLogProcessing := false;
end;
procedure TAppHook.Log(sLog: String);
begin
if Trace_ <> nil then
begin
_bLogProcessing := true;
Trace_.T('(%s) %s', [ModuleName, sLog]);
_bLogProcessing := false;
end;
end;
procedure TAppHook.Log(const sFormat: string; const Args: array of const);
var
str: String;
begin
FmtStr(str, sFormat, Args);
Log(str);
end;
procedure TAppHook.SendText(sData: String);
var
Send: ISendpacket;
begin
Send := TTgPacket.Create(ACC_TEST_LOG);
Send.S['Msg'] := ModuleName + ' > ' + sData;
Client_.SendPacket(Send);
end;
procedure TAppHook.ProcessAppCtrlOpt(aOpt: TAppCtrlOpt);
begin
try
if CompareText('explorer.exe', ModuleName) = 0 then
begin
InstallFileOperationHooks;
exit;
end;
// DoInterceptRemove;
{$IFDEF DEBUG}
Helper_.bEndDocProc_ := CompareText('excel.exe', ModuleName) <> 0;
{$ENDIF}
if aOpt.hCltWnd <> 0 then
SetWindowDisplayAffinity(aOpt.hCltWnd, 1);
if aOpt.sDrmPass <> '' then
aOpt.sDrmPass := DecText(aOpt.sDrmPass);
Helper_.CtrlOpt := aOpt;
// Helper_.bEndDocProc_ := true; // 엑셀에서 이렇게 하면 워터마크가 뒤로 밀리는 문제가 있음..23_0410 15:52:34 kku
if (aOpt.FileUseBlock <> fubNone) or gAppHook.Helper.CtrlOpt.bMtpWB then
begin
AddInterceptAPI(@ozCreateFileA, @CreateFileA, @CreateFileAHook, 'CreateFileA');
AddInterceptAPI(@ozCreateFileW, @CreateFileW, @CreateFileWHook, 'CreateFileW');
{$IFDEF DEBUG}
// 사용하지 않음 24_0122 14:14:59 kku
// AddInterceptAPI(@ozCloseHandle, @CloseHandle, @CloseHandleHook, 'CloseHandle');
// AddInterceptAPI(@ozReadFile, @ReadFile, @ReadFileHook, 'ReadFile');
// AddInterceptAPI(@ozReadFileEx, @ReadFileEx, @ReadFileExHook, 'ReadFileEx');
// AddInterceptAPI(@ozWriteFile, @WriteFile, @WriteFileHook, 'WriteFile');
// AddInterceptAPI(@ozWriteFileEx, @WriteFileEx, @WriteFileExHook, 'WriteFileExHook');
{$ENDIF}
end;
if aOpt.bPrintSecu or aOpt.bPrintWater then
begin
AddInterceptAPI(@ozStartDocA, @StartDocA, @StartDocAHook, 'StartDocA');
AddInterceptAPI(@ozStartDocW, @StartDocW, @StartDocWHook, 'StartDocW');
AddInterceptAPI(@ozStartPage, @StartPage, @StartPageHook, 'StartPage');
AddInterceptAPI(@ozEndPage, @EndPage, @EndPageHook, 'EndPage');
// AddInterceptAPI(@ozEndDoc, @EndDoc, @EndDocHook, 'EndDoc');
// AddInterceptAPI(@ozWritePrinter, @WritePrinter, @WritePrinterHook, 'WritePrinter'); // 이거 하면 이후로 훅 진행이 먹통된다... 23_0419 14:11:21 kku
// if aOpt.bPrintSecu then
begin
//{
AddInterceptAPI(@ozExtTextOutA, @ExtTextOutA, @ExtTextOutAHook, 'ExtTextOutA'); // notepad++
AddInterceptAPI(@ozExtTextOutW, @ExtTextOutW, @ExtTextOutWHook, 'ExtTextOutW'); // notepad++
AddInterceptAPI(@ozSetWorldTransform, @SetWorldTransform, @SetWorldTransformHook, 'SetWorldTransform'); // 좌표값 추출
AddInterceptAPI(@ozModifyWorldTransform, @ModifyWorldTransform, @ModifyWorldTransformHook, 'ModifyWorldTransform'); // 좌표값 추출, 이거 켜면 PPT에서 텍스트 위치가 꼬인다 25_1001 22:00:24 kku
AddInterceptAPI(@ozRectangle, @Rectangle, @RectangleHook, 'Rectangle');
AddInterceptAPI(@ozSelectObject, @SelectObject, @SelectObjectHook, 'SelectObject');
AddInterceptAPI(@ozStretchDIBits, @StretchDIBits, @StretchDIBitsHook, 'StretchDIBits'); // chrome 필수
AddInterceptAPI(@ozSetStretchBltMode, @SetStretchBltMode, @SetStretchBltModeHook, 'SetStretchBltMode');
AddInterceptAPI(@ozSetPolyFillMode, @SetPolyFillMode, @SetPolyFillModeHook, 'SetPolyFillMode');
AddInterceptAPI(@ozBeginPath, @BeginPath, @BeginPathHook, 'BeginPath'); // chrome 필수
AddInterceptAPI(@ozMoveToEx, @MoveToEx, @MoveToExHook, 'MoveToEx'); // chrome 필수
AddInterceptAPI(@ozPolyBezierTo, @PolyBezierTo, @PolyBezierToHook, 'PolyBezierTo'); // chrome 필수
AddInterceptAPI(@ozLineTo, @LineTo, @LineToHook, 'LineTo'); // chrome 필수
AddInterceptAPI(@ozCloseFigure, @CloseFigure, @CloseFigureHook, 'CloseFigure');
AddInterceptAPI(@ozEndPath, @EndPath, @EndPathHook, 'EndPath'); // chrome 필수
AddInterceptAPI(@ozFillPath, @FillPath, @FillPathHook, 'FillPath'); // chrome 필수
AddInterceptAPI(@ozLPtoDP, @LPtoDP, @LPtoDPHook, 'LPtoDP');
AddInterceptAPI(@ozDPtoLP, @DPtoLP, @DPtoLPHook, 'DPtoLP');
AddInterceptAPI(@ozFillRect, @FillRect, @FillRectHook, 'FillRect');
AddInterceptAPI(@ozRestoreDC, @RestoreDC, @RestoreDCHook, 'RestoreDC');
AddInterceptAPI(@ozSaveDC, @SaveDC, @SaveDCHook, 'SaveDC');
AddInterceptAPI(@ozIntersectClipRect, @IntersectClipRect, @IntersectClipRectHook, 'IntersectClipRect');
AddInterceptAPI(@ozBitBlt, @BitBlt, @BitBltHook, 'BitBlt');
AddInterceptAPI(@ozSetPixel, @SetPixel, @SetPixelHook, 'SetPixel');
AddInterceptAPI(@ozPlgBlt, @PlgBlt, @PlgBltHook, 'PlgBlt');
AddInterceptAPI(@ozPatBlt, @PatBlt, @PatBltHook, 'PatBlt');
AddInterceptAPI(@ozStretchBlt, @StretchBlt, @StretchBltHook, 'StretchBlt');
AddInterceptAPI(@ozEllipse, @Ellipse, @EllipseHook, 'Ellipse');
AddInterceptAPI(@ozTextOutA, @TextOutA, @TextOutAHook, 'TextOutA');
AddInterceptAPI(@ozTextOutW, @TextOutW, @TextOutWHook, 'TextOutW');
AddInterceptAPI(@ozSetTextAlign, @SetTextAlign, @SetTextAlignHook, 'SetTextAlign');
AddInterceptAPI(@ozSetBkMode, @SetBkMode, @SetBkModeHook, 'SetBkMode');
AddInterceptAPI(@ozSetViewportOrgEx, @SetViewportOrgEx, @SetViewportOrgExHook, 'SetViewportOrgEx');
AddInterceptAPI(@ozExtSelectClipRgn, @ExtSelectClipRgn, @ExtSelectClipRgnHook, 'ExtSelectClipRgn');
AddInterceptAPI(@ozSelectClipRgn, @SelectClipRgn, @SelectClipRgnHook, 'SelectClipRgn');
AddInterceptAPI(@ozSetMapMode, @SetMapMode, @SetMapModeHook, 'SetMapMode');
AddInterceptAPI(@ozSetWindowOrgEx, @SetWindowOrgEx, @SetWindowOrgExHook, 'SetWindowOrgEx');
AddInterceptAPI(@ozSelectPalette, @SelectPalette, @SelectPaletteHook, 'SelectPalette');
AddInterceptAPI(@ozSetGraphicsMode, @SetGraphicsMode, @SetGraphicsModeHook, 'SetGraphicsMode');
AddInterceptAPI(@ozSetBkColor, @SetBkColor, @SetBkColorHook, 'SetBkColor');
AddInterceptAPI(@ozSetBrushOrgEx, @SetBrushOrgEx, @SetBrushOrgExHook, 'SetBrushOrgEx');
AddInterceptAPI(@ozSetDIBits, @SetDIBits, @SetDIBitsHook, 'SetDIBits');
AddInterceptAPI(@ozSetROP2, @SetROP2, @SetROP2Hook, 'SetROP2');
AddInterceptAPI(@ozSetColorSpace, @SetColorSpace, @SetColorSpaceHook, 'SetColorSpace');
AddInterceptAPI(@ozExcludeClipRect, @ExcludeClipRect, @ExcludeClipRectHook, 'ExcludeClipRect');
AddInterceptAPI(@ozSetViewportExtEx, @SetViewportExtEx, @SetViewportExtExHook, 'SetViewportExtEx');
AddInterceptAPI(@ozSetWindowExtEx, @SetWindowExtEx, @SetWindowExtExHook, 'SetWindowExtEx');
AddInterceptAPI(@ozScaleViewportExtEx, @ScaleViewportExtEx, @ScaleViewportExtExHook, 'ScaleViewportExtEx');
AddInterceptAPI(@ozSetTextColor, @SetTextColor, @SetTextColorHook, 'SetTextColor');
AddInterceptAPI(@ozSetDCBrushColor, @SetDCBrushColor, @SetDCBrushColorHook, 'SetDCBrushColor');
AddInterceptAPI(@ozSetDCPenColor, @SetDCPenColor, @SetDCPenColorHook, 'SetDCPenColor');
AddInterceptAPI(@ozCreateHalftonePalette, @CreateHalftonePalette, @CreateHalftonePaletteHook, 'CreateHalftonePalette');
AddInterceptAPI(@ozCreateDIBSection, @CreateDIBSection, @CreateDIBSectionHook, 'CreateDIBSection');
AddInterceptAPI(@ozSetBoundsRect, @SetBoundsRect, @SetBoundsRectHook, 'SetBoundsRect');
AddInterceptAPI(@ozSetSystemPaletteUse, @SetSystemPaletteUse, @SetSystemPaletteUseHook, 'SetSystemPaletteUse');
AddInterceptAPI(@ozRealizePalette, @RealizePalette, @RealizePaletteHook, 'RealizePalette');
AddInterceptAPI(@ozSetDIBColorTable, @SetDIBColorTable, @SetDIBColorTableHook, 'SetDIBColorTable');
AddInterceptAPI(@ozSetMapperFlags, @SetMapperFlags, @SetMapperFlagsHook, 'SetMapperFlags');
AddInterceptAPI(@ozSetColorAdjustment, @SetColorAdjustment, @SetColorAdjustmentHook, 'SetColorAdjustment');
AddInterceptAPI(@ozPolyBezier, @PolyBezier, @PolyBezierHook, 'PolyBezier');
AddInterceptAPI(@ozPolygon, @Polygon, @PolygonHook, 'Polygon');
AddInterceptAPI(@ozPolyline, @Polyline, @PolylineHook, 'Polyline');
AddInterceptAPI(@ozPolyLineTo, @PolyLineTo, @PolyLineToHook, 'PolyLineTo');
AddInterceptAPI(@ozPolyPolyline, @PolyPolyline, @PolyPolylineHook, 'PolyPolyline');
AddInterceptAPI(@ozPolyPolygon, @PolyPolygon, @PolyPolygonHook, 'PolyPolygon');
AddInterceptAPI(@ozSetPixelV, @SetPixelV, @SetPixelVHook, 'SetPixelV');
AddInterceptAPI(@ozColorCorrectPalette, @ColorCorrectPalette, @ColorCorrectPaletteHook, 'ColorCorrectPalette');
AddInterceptAPI(@ozSetICMProfileA, @SetICMProfileA, @SetICMProfileAHook, 'SetICMProfileA');
AddInterceptAPI(@ozSetICMProfileW, @SetICMProfileW, @SetICMProfileWHook, 'SetICMProfileW');
AddInterceptAPI(@ozSetTextJustification, @SetTextJustification, @SetTextJustificationHook, 'SetTextJustification');
AddInterceptAPI(@ozScaleWindowExtEx, @ScaleWindowExtEx, @ScaleWindowExtExHook, 'ScaleWindowExtEx');
AddInterceptAPI(@ozAngleArc, @AngleArc, @AngleArcHook, 'AngleArc');
AddInterceptAPI(@ozRoundRect, @RoundRect, @RoundRectHook, 'RoundRect');
AddInterceptAPI(@ozArc, @Arc, @ArcHook, 'Arc');
AddInterceptAPI(@ozChord, @Chord, @ChordHook, 'Chord');
AddInterceptAPI(@ozPie, @Pie, @PieHook, 'Pie');
AddInterceptAPI(@ozExtFloodFill, @ExtFloodFill, @ExtFloodFillHook, 'ExtFloodFill');
AddInterceptAPI(@ozArcTo, @ArcTo, @ArcToHook, 'ArcTo');
AddInterceptAPI(@ozPolyDraw, @PolyDraw, @PolyDrawHook, 'PolyDraw');
AddInterceptAPI(@ozSetMiterLimit, @SetMiterLimit, @SetMiterLimitHook, 'SetMiterLimit');
AddInterceptAPI(@ozStrokeAndFillPath, @StrokeAndFillPath, @StrokeAndFillPathHook, 'StrokeAndFillPath');
AddInterceptAPI(@ozStrokePath, @StrokePath, @StrokePathHook, 'StrokePath');
AddInterceptAPI(@ozFlattenPath, @FlattenPath, @FlattenPathHook, 'FlattenPath');
AddInterceptAPI(@ozWidenPath, @WidenPath, @WidenPathHook, 'WidenPath');
AddInterceptAPI(@ozSelectClipPath, @SelectClipPath, @SelectClipPathHook, 'SelectClipPath');
AddInterceptAPI(@ozAbortPath, @AbortPath, @AbortPathHook, 'AbortPath');
AddInterceptAPI(@ozFillRgn, @FillRgn, @FillRgnHook, 'FillRgn');
AddInterceptAPI(@ozFrameRgn, @FrameRgn, @FrameRgnHook, 'FrameRgn');
AddInterceptAPI(@ozInvertRgn, @InvertRgn, @InvertRgnHook, 'InvertRgn');
AddInterceptAPI(@ozPaintRgn, @PaintRgn, @PaintRgnHook, 'PaintRgn');
AddInterceptAPI(@ozMaskBlt, @MaskBlt, @MaskBltHook, 'MaskBlt');
AddInterceptAPI(@ozPolyTextOutA, @PolyTextOutA, @PolyTextOutAHook, 'PolyTextOutA');
AddInterceptAPI(@ozPolyTextOutW, @PolyTextOutW, @PolyTextOutWHook, 'PolyTextOutW');
AddInterceptAPI(@ozUpdateColors, @UpdateColors, @UpdateColorsHook, 'UpdateColors');
AddInterceptAPI(@ozOffsetViewportOrgEx, @OffsetViewportOrgEx, @OffsetViewportOrgExHook, 'OffsetViewportOrgEx');
AddInterceptAPI(@ozOffsetWindowOrgEx, @OffsetWindowOrgEx, @OffsetWindowOrgExHook, 'OffsetWindowOrgEx');
AddInterceptAPI(@ozSetDeviceGammaRamp, @SetDeviceGammaRamp, @SetDeviceGammaRampHook, 'SetDeviceGammaRamp');
AddInterceptAPI(@ozColorMatchToTarget, @ColorMatchToTarget, @ColorMatchToTargetHook, 'ColorMatchToTarget');
AddInterceptAPI(@ozPtVisible, @PtVisible, @PtVisibleHook, 'PtVisible');
AddInterceptAPI(@ozRectVisible, @RectVisible, @RectVisibleHook, 'RectVisible');
AddInterceptAPI(@ozSetPixelFormat, @SetPixelFormat, @SetPixelFormatHook, 'SetPixelFormat');
AddInterceptAPI(@ozOffsetClipRgn, @OffsetClipRgn, @OffsetClipRgnHook, 'OffsetClipRgn');
AddInterceptAPI(@ozSetArcDirection, @SetArcDirection, @SetArcDirectionHook, 'SetArcDirection');
AddInterceptAPI(@ozSetTextCharacterExtra, @SetTextCharacterExtra, @SetTextCharacterExtraHook, 'SetTextCharacterExtra');
AddInterceptAPI(@ozEnumICMProfilesA, @EnumICMProfilesA, @EnumICMProfilesAHook, 'EnumICMProfilesA');
AddInterceptAPI(@ozEnumICMProfilesW, @EnumICMProfilesW, @EnumICMProfilesWHook, 'EnumICMProfilesW');
AddInterceptAPI(@ozSetICMMode, @SetICMMode, @SetICMModeHook, 'SetICMMode');
AddInterceptAPI(@ozSetDIBitsToDevice, @SetDIBitsToDevice, @SetDIBitsToDeviceHook, 'SetDIBitsToDevice');
AddInterceptAPI(@ozDrawEscape, @DrawEscape, @DrawEscapeHook, 'DrawEscape');
AddInterceptAPI(@ozEnumFontsA, @EnumFontsA, @EnumFontsAHook, 'EnumFontsA');
AddInterceptAPI(@ozEnumFontsW, @EnumFontsW, @EnumFontsWHook, 'EnumFontsW');
AddInterceptAPI(@ozEnumFontFamiliesA, @EnumFontFamiliesA, @EnumFontFamiliesAHook, 'EnumFontFamiliesA');
AddInterceptAPI(@ozEnumFontFamiliesW, @EnumFontFamiliesW, @EnumFontFamiliesWHook, 'EnumFontFamiliesW');
AddInterceptAPI(@ozSetMetaRgn, @SetMetaRgn, @SetMetaRgnHook, 'SetMetaRgn');
AddInterceptAPI(@ozPlayEnhMetaFile, @PlayEnhMetaFile, @PlayEnhMetaFileHook, 'PlayEnhMetaFile');
AddInterceptAPI(@ozPlayEnhMetaFileRecord, @PlayEnhMetaFileRecord, @PlayEnhMetaFileRecordHook, 'PlayEnhMetaFileRecord');
// AddInterceptAPI(@ozTransparentBlt, @TransparentBlt, @TransparentBltHook, 'TransparentBlt');
// AddInterceptAPI(@ozGradientFill, @GradientFill, @GradientFillHook, 'GradientFill');
// AddInterceptAPI(@ozFrameRect, @FrameRect, @FrameRectHook, 'FrameRect');
// AddInterceptAPI(@ozFloodFill, @FloodFill, @FloodFillHook, 'FloodFill'); // 훅 제외
// AddInterceptAPI(@ozDrawTextExA, @DrawTextExA, @DrawTextExAHook_DW, 'DrawTextExA');
// AddInterceptAPI(@ozDrawTextExW, @DrawTextExW, @DrawTextExWHook_DW, 'DrawTextExW');
// AddInterceptAPI(@ozTabbedTextOutA, @TabbedTextOutA, @TabbedTextOutAHook, 'TabbedTextOutA');
// AddInterceptAPI(@ozTabbedTextOutW, @TabbedTextOutW, @TabbedTextOutWHook, 'TabbedTextOutW');
// AddInterceptAPI(@ozGetTextCharsetInfo, @GetTextCharsetInfo, @GetTextCharsetInfoHook, 'GetTextCharsetInfo'); // 훅 제외
// AddInterceptAPI(@ozGetGlyphIndicesA, @GetGlyphIndicesA, @GetGlyphIndicesAHook, 'GetGlyphIndicesA') // 훅 제외;
// AddInterceptAPI(@ozGetGlyphIndicesW, @GetGlyphIndicesW, @GetGlyphIndicesWHook, 'GetGlyphIndicesW'); // 훅 제외
// AddInterceptAPI(@ozGetFontLanguageInfo, @GetFontLanguageInfo, @GetFontLanguageInfoHook, 'GetFontLanguageInfo'); // 훅 제외
// AddInterceptAPI(@ozGetCharacterPlacementA, @GetCharacterPlacementA, @GetCharacterPlacementAHook, 'GetCharacterPlacementA'); // 훅 제외
// AddInterceptAPI(@ozGetCharacterPlacementW, @GetCharacterPlacementW, @GetCharacterPlacementWHook, 'GetCharacterPlacementW'); // 훅 제외
// AddInterceptAPI(@ozGetFontData, @GetFontData, @GetFontDataHook, 'GetFontData'); // 훅 제외
// AddInterceptAPI(@ozGetGlyphOutlineA, @GetGlyphOutlineA, @GetGlyphOutlineAHook, 'GetGlyphOutlineA'); // 훅 제외
// AddInterceptAPI(@ozGetGlyphOutlineW, @GetGlyphOutlineW, @GetGlyphOutlineWHook, 'GetGlyphOutlineW'); // 훅 제외
// AddInterceptAPI(@ozResetDCA, @ResetDCA, @ResetDCAHook, 'ResetDCA'); // 사용하지 않음
// AddInterceptAPI(@ozResetDCW, @ResetDCW, @ResetDCWHook, 'ResetDCW'); // 사용하지 않음
// AddInterceptAPI(@ozAlphaBlend, @AlphaBlend, @AlphaBlendHook, 'AlphaBlend'); // 훅 제외
// AddInterceptAPI(@ozGetTextMetricsA, @GetTextMetricsA, @GetTextMetricsAHook, 'GetTextMetricsA'); // 훅 제외
// AddInterceptAPI(@ozGetTextMetricsW, @GetTextMetricsW, @GetTextMetricsWHook, 'GetTextMetricsW'); // 훅 제외
// AddInterceptAPI(@ozGetTextExtentPoint32A, @GetTextExtentPoint32A, @GetTextExtentPoint32AHook, 'GetTextExtentPoint32A'); // 훅 제외
// AddInterceptAPI(@ozGetTextExtentPoint32W, @GetTextExtentPoint32W, @GetTextExtentPoint32WHook, 'GetTextExtentPoint32W'); // 훅 제외
// AddInterceptAPI(@ozGdiComment, @GdiComment, @GdiCommentHook, 'GdiComment'); // 훅 제외
// AddInterceptAPI(@ozGetCharABCWidthsA, @GetCharABCWidthsA, @GetCharABCWidthsAHook, 'GetCharABCWidthsA'); // 훅 제외
// AddInterceptAPI(@ozGetCharABCWidthsW, @GetCharABCWidthsW, @GetCharABCWidthsWHook, 'GetCharABCWidthsW'); // 훅 제외
// AddInterceptAPI(@ozExtEscape, @ExtEscape, @ExtEscapeHook, 'ExtEscape'); // 훅 제외
// AddInterceptAPI(@ozCreateCompatibleDC, @CreateCompatibleDC, @CreateCompatibleDCHook, 'CreateCompatibleDC'); // 훅 제외
// AddInterceptAPI(@ozCreateCompatibleBitmap, @CreateCompatibleBitmap, @CreateCompatibleBitmapHook, 'CreateCompatibleBitmap'); // 훅 제외
// 이거 활성화 하면 프린트 창이 안뜨고 죽는다 25_1001 19:27:29 kku
// AddInterceptAPI(@ozDrawTextA, @DrawTextA, @DrawTextAHook, 'DrawTextA');
// AddInterceptAPI(@ozDrawTextW, @DrawTextW, @DrawTextWHook, 'DrawTextW');
end;
end;
except
// ..
end;
end;
end.

View File

@ -0,0 +1,223 @@
{*******************************************************}
{ }
{ AppHookClient }
{ }
{ Copyright (C) 2023 kku }
{ }
{*******************************************************}
unit AppHookClient;
interface
uses
Tocsg.ClientBase, System.Classes, WinApi.Windows, Tocsg.Packet,
System.SysUtils;
type
TAppHookClient = class(TTgClientBase)
protected
dwPid_,
dwLastSaveTick_: DWORD;
sModulePath_: String;
evDisconnected_: TNotifyEvent;
procedure ConnectedEvent; override;
procedure DisconnectedEvent; override;
procedure ProcessRcvPacket(aRcv: IRcvPacket); override;
public
Constructor Create;
property ModulePath: String write sModulePath_;
property OnDisconnected: TNotifyEvent write evDisconnected_;
end;
implementation
uses
{$IFDEF _BS1HP_}
BS1Hook,
{$ELSE}
AppHook,
{$ENDIF}
Tocsg.Exception, superobject, GlobalDefine, Tocsg.Process, Tocsg.WndUtil,
AppCtrlDefine, Tocsg.Json;
{ TAppHookClient }
Constructor TAppHookClient.Create;
begin
Inherited Create('', -1);
@evDisconnected_ := nil;
dwPid_ := GetCurrentProcessId;
dwLastSaveTick_ := 0;
end;
procedure TAppHookClient.ConnectedEvent;
var
Send: ISendPacket;
begin
try
// Inherited;
SetSendPauseState(false);
_Trace('Connected.');
Send := TTgPacket.Create(ACC_APP_INFO);
Send.I['PID'] := dwPid_;
Send.S['Path'] := sModulePath_;
SendPacket(Send);
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. ConnectedEvent()');
end;
end;
procedure TAppHookClient.DisconnectedEvent;
begin
try
Inherited;
QSendPacket_.Clear;
if Assigned(evDisconnected_) then
evDisconnected_(Self);
_Trace('Disconnected');
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. DisconnectedEvent()');
end;
end;
procedure TAppHookClient.ProcessRcvPacket(aRcv: IRcvPacket);
var
Send: ISendPacket;
procedure process_ACC_TEST_LOG;
begin
_Trace(aRcv.S['Msg']);
Send := TTgPacket.Create(aRcv);
Send.S['Msg'] := aRcv.S['Msg'] + ' 하하하';
SendPacket(Send);
end;
procedure process_ACC_SET_POLICY;
var
Opt: TAppCtrlOpt;
begin
try
if aRcv.O['Opt'] = nil then
exit;
ZeroMemory(@Opt, SizeOf(Opt));
with aRcv.O['Opt'] do
begin
Opt.sTaskDir := S['sTaskDir'];
Opt.dwCustomerType := I['dwCustomerType'];
Opt.hMainWnd := I['hMainWnd'];
// DRM
Opt.DrmAccessKind := TDrmAccessKind(I['DrmAccessKind']);
Opt.DrmModifyKind := TDrmAccessKind(I['DrmModifyKind']);
Opt.bDrmAttachAble := B['bDrmAttachAble'];
Opt.sDrmPass := S['sDrmPass'];
Opt.sUName := S['sUName'];
Opt.sEmpNo := S['sEmpNo'];
Opt.sDeptName := S['sDeptName'];
Opt.sIpAddr := S['sIpAddr'];
// Print
Opt.nFontSize := I['nFontSize'];
Opt.nLineCount := I['nLineCount'];
// Opt.sTextOutApp := S['sTextOutApp'];
// Opt.sTextOutDir := S['sTextOutDir'];
Opt.sPrtEmfOutDir := S['sPrtEmfOutDir'];
Opt.sPrintWaterImg := S['sPrintWaterImg'];
Opt.nPrintWaterAlpha := I['nPrintWaterAlpha'];
// Opt.sPrintWaterTxt := S['sPrintWaterTxt'];
Opt.bPrintSecu := B['bPrintSecu'];
Opt.bPrintWater := B['bPrintWater'];
Opt.bPrtCollect := B['bPrtCollect'];
Opt.sPrintWaterExp := S['sPrintWaterExp'];
Opt.fWmTran := D['fWmTran'];
// Opt.bPrintMasking := B['bPrintMasking'];
try
Opt.PrtWaterCfg := TTgJson.GetDataAsType<TPrtWaterCfg>(O['PrtWaterCfg']);
except
ZeroMemory(@Opt.PrtWaterCfg, SizeOf(Opt.PrtWaterCfg));
end;
// File
Opt.FileUseBlock := TFileUseBlock(I['FileUseBlock']);
Opt.bCheckUrl := B['bCheckUrl'];
Opt.bUseContentFilter := B['bUseContentFilter'];
Opt.bReadBlock := B['bReadBlock'];
Opt.bWriteBlock := B['bWriteBlock'];
Opt.bFileApproval := B['bFileApproval'];
Opt.bIgrNetPathAB := B['bIgrNetPathAB'];
Opt.bOpenDetect := B['bOpenDetect'];
if O['ShFileCrMon'] <> nil then
begin
Opt.ShFileCrMon.nKind := O['ShFileCrMon'].I['nKind'];
Opt.ShFileCrMon.bBlkNoti := O['ShFileCrMon'].B['bBlkNoti'];
Opt.ShFileCrMon.bMonNoti := O['ShFileCrMon'].B['bMonNoti'];
Opt.ShFileCrMon.sExpLst := O['ShFileCrMon'].S['sExpLst'];
end else
Opt.ShFileCrMon.nKind := 0;
// Noti
Opt.hRcvWnd := I['hRcvWnd'];
Opt.hTagWnd := I['hTagWnd'];
Opt.hCltWnd := I['hCltWnd'];
// ETC
Opt.sAcName := S['sAcName'];
Opt.sAcSSid := S['sAcSSid'];
Opt.sAipPath := S['sAipPath'];
Opt.bMtpWB := B['bMtpWB'];
Opt.sMtpRoExp := S['sMtpRoExp'];
Opt.bIsTest := B['bIsTest'];
end;
// Opt := TTgJson.GetDataAsType<TAppCtrlOpt>(aRcv.O['Opt']);
gAppHook.ProcessAppCtrlOpt(Opt);
except
//
end;
end;
procedure process_ACC_SAFE_TERMINATE_CLIENT;
begin
gAppHook.DoInterceptRemove;
Disconnect;
Sleep(3000);
// StopThread;
end;
procedure process_ACC_SET_CAPTURE_BLOCK;
begin
{$IFDEF _BS1HP_}
if gAppHook <> nil then
begin
if aRcv.B['Block'] then
gAppHook.AddCapBlockWnd(aRcv.I['Wnd'])
else
gAppHook.DelCapBlockWnd(aRcv.I['Wnd']);
end;
{$ENDIF}
end;
begin
try
case aRcv.Command of
ACC_TEST_LOG : process_ACC_TEST_LOG;
ACC_SET_POLICY : process_ACC_SET_POLICY;
ACC_SAFE_TERMINATE_CLIENT : process_ACC_SAFE_TERMINATE_CLIENT;
ACC_SET_CAPTURE_BLOCK : process_ACC_SET_CAPTURE_BLOCK;
end;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. ProcessRcvPacket(), Cmd=%d', [aRcv.Command]);
end;
end;
end.

View File

@ -0,0 +1,11 @@
unit Define;
interface
const
CLIENT_TYPE = 10001;
CLIENT_VER = '1';
implementation
end.

View File

@ -0,0 +1,242 @@
{*******************************************************}
{ }
{ ProcessWatermark }
{ }
{ Copyright (C) 2025 kku }
{ }
{*******************************************************}
unit ProcessWM;
interface
uses
Winapi.Windows, System.Classes, Vcl.Graphics;
function ProcessWartermark(DC: HDC; bStartPage: Boolean = true): Boolean;
implementation
uses
AppCtrlDefine, ApiHookPrint, AppHook, Tocsg.Safe, System.SysUtils, Condition,
Tocsg.Graphic, Winapi.GDIPAPI, Tocsg.Convert;
function ProcessWartermark(DC: HDC; bStartPage: Boolean = true): Boolean;
var
nW, nH, i, nX, nY,
nGapW, nGapH, nDefDivFont: Integer;
sText: String;
MemCanvas: TCanvas;
hbmp, hOldBmp: HBITMAP;
pen: HPEN;
CtrlOpt: TAppCtrlOpt;
oldColor: TColor;
r: TRect;
begin
Result := true;
if _PrtDC <> DC then
exit;
// exit;
SaveDC(DC);
gAppHook.Helper.bIsWaterMaking_ := true;
try
try
if gAppHook.Helper.IsExcel then
begin
// 클리핑 제거 25_0605 14:51:11 kku
SelectClipRgn(DC, 0);
// 엑셀은 출력시트 설정에 따라 전체 영역으로 잡히는 않는 현상이 있다.. 24_0805 13:46:31 kku
nW := GetDeviceCaps(DC, HORZRES); // 세로모드 : 4961, 가로모드 : 7016, 크로미움 프린트 인쇄시 4760
nH := GetDeviceCaps(DC, VERTRES); // 세로모드 : 7016, 가로모드 : 4961, 크로미움 프린트 인쇄시 6814
// LogToReg('Step-1-excel', Format('W = %d, H = %d,', [nW, nH]));
end else
begin
// if bStartPage then // 이럴리 없겠지만 안전장치
// exit;
ZeroMemory(@r, SizeOf(r));
GetClipBox(DC, r);
nW := r.Width;
nH := r.Height;
// LogToReg('Step-1', Format('W = %d, H = %d,', [nW, nH]));
// LogToReg('Step-2', Format('W = %d, H = %d,', [GetDeviceCaps(DC, HORZRES), GetDeviceCaps(DC, VERTRES)]));
if nW = 0 then
nW := GetDeviceCaps(DC, HORZRES); // 세로모드 : 4961, 가로모드 : 7016, 크로미움 프린트 인쇄시 4760
if nH = 0 then
nH := GetDeviceCaps(DC, VERTRES); // 세로모드 : 7016, 가로모드 : 4961, 크로미움 프린트 인쇄시 6814
end;
// nX := GetDeviceCaps(DC, ASPECTX);
// nY := GetDeviceCaps(DC, ASPECTY);
// bStartPage := false;
Guard(MemCanvas, TCanvas.Create);
// if bStartPage then
// MemCanvas.Handle := CreateCompatibleDC(DC)
// else
MemCanvas.Handle := DC; //CreateCompatibleDC(DC);
hbmp := CreateCompatibleBitmap(MemCanvas.Handle, nW, nH);
hOldBmp := SelectObject(MemCanvas.Handle, hbmp);
// gAppHook.Log(Format('ProcessWartermark() - DocSize X=%d, Y=%d, W=%d, H=%d, dc=%d', [nX, nY, nW, nH, DC]));
// LogToReg('Step0', Format('ProcessWartermark() - DocSize X=%d, Y=%d, W=%d, H=%d, dc=%d', [nX, nY, nW, nH, DC]));
// if bStartPage then
// PatBlt(MemCanvas.Handle, 0, 0, nW, nH, WHITENESS);
// pen := CreatePen(PS_SOLID, 1, RGB(0, 255, 0));
// hOldBmp := SelectObject(MemCanvas.Handle, pen);
nGapW := 0;
nGapH := 0;
// SetBkMode(MemCanvas.Handle, TRANSPARENT);
// MemCanvas.Font.Orientation := 250;
MemCanvas.Font.Name := 'Tahoma';
if gAppHook.Helper.bSmallFont_ then
begin
if Pos('PDF', UpperCase(_sPrtName)) = 0 then
begin
// 일반 프린터에서만 밀리는 현상이 있어서 갭을 준다.. 24_0627 10:52:33 kku
nGapW := 19;
nGapH := 17;
end;
nDefDivFont := 180;
end else
begin
if gAppHook.Helper.bEndDocProc_ then
begin
if CompareText(gAppHook.ModuleName, 'winword.exe') = 0 then
nGapH := 70;
end;
nDefDivFont := 190;
end;
// 기본 폰트 조절
if nW > nH then
MemCanvas.Font.Size := nW div 180
else
MemCanvas.Font.Size := nH div 180;
oldColor := GetTextColor(DC);
// 폰트색 지정... 프로그램에 따라 지정되는 설정이 다르다
MemCanvas.Font.Color := clGray; // 메모장등
SetTextColor(DC, clGray); // 엑셀등
try
CtrlOpt := gAppHook.Helper.CtrlOpt;
// sText := CtrlOpt.sPrintWaterTxt;
with CtrlOpt do
begin
if CtrlOpt.sUName <> '' then
sText := Format('%s / %s / %s / %s', [sUName, sDeptName, sEmpNo, DateTimeToStr(Now)])
else if sDeptName <> '' then
sText := Format('%s / %s / %s', [sDeptName, sEmpNo, DateTimeToStr(Now)])
else
sText := Format('%s / %s', [sEmpNo, DateTimeToStr(Now)]);
end;
SetBkMode(MemCanvas.Handle, TRANSPARENT);
MemCanvas.Font.Color := clBlack;
MemCanvas.TextOut(nW - MemCanvas.TextWidth(sText) + nGapW,
nH - MemCanvas.TextHeight(sText) + nGapH, sText);
sText := gAppHook.Helper.sCurDocName_;
MemCanvas.TextOut(nGapW, nH - MemCanvas.TextHeight(sText) + nGapH, sText);
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
if nW < nH then
MemCanvas.Font.Size := nW div (nDefDivFont div 5) // 가운데 폰트 크기 키우려면 숫자를 키우면 됨
else
MemCanvas.Font.Size := nH div (nDefDivFont div 5);
MemCanvas.Font.Style := MemCanvas.Font.Style + [fsBold];
if _bmpWater = nil then
begin
sText := 'ToCSG BSOne';
_bmpWater := TBitmap.Create;
_bmpWater.SetSize(MemCanvas.TextWidth(sText), MemCanvas.TextHeight(sText));
_bmpWater.Canvas.Font.Assign(MemCanvas.Font);
_bmpWater.Canvas.Font.Color := clSilver;
_bmpWater.Canvas.TextOut(0, 0, sText);
_bmpWater.TransparentColor := clWhite;
_bmpWater.Transparent := true;
RotateBitmap_PlgBlt(_bmpWater, -0.8, true, clWhite);
end;
if _bmpWater <> nil then
begin
var cTrMatrix: TColorMatrix;
ZeroMemory(@cTrMatrix, SizeOf(cTrMatrix));
// 회색
// cTrMatrix[0][0] := 0.299;
// cTrMatrix[0][1] := 0.299;
// cTrMatrix[0][2] := 0.299;
// cTrMatrix[1][0] := 0.587;
// cTrMatrix[1][1] := 0.587;
// cTrMatrix[1][2] := 0.587;
// cTrMatrix[2][0] := 0.114;
// cTrMatrix[2][1] := 0.114;
// cTrMatrix[2][2] := 0.114;
// cTrMatrix[3][3] := 0.26; // 투명도 1.0 ~ 0.22
// cTrMatrix[4][4] := 1.0;
// 위 처럼하면 컬러랑 흑백이 섞인 출력의 경우 흑백에 로고가 안찍히는 문제 확인됨 24_0805 16:02:28 kku
cTrMatrix[0][0] := 1;
cTrMatrix[1][1] := 1;
cTrMatrix[2][2] := 1;
cTrMatrix[3][3] := BooleanToFloat(gAppHook.Helper.CtrlOpt.fWmTran <> 0.0, gAppHook.Helper.CtrlOpt.fWmTran, 0.26); // 투명도 1.0 ~ 0.22
// cTrMatrix[3][3] := 0.05; // 투명도 1.0 ~ 0.22
cTrMatrix[4][4] := 1;
Dec(nW, nGapW);
Dec(nH, nGapH);
nX := (nW div 4) - (_bmpWater.Width div 2);
nY := (nH div 4) - (_bmpWater.Height div 2);
if not gAppHook.Helper.IsExcel or
( gAppHook.Helper.IsExcel and bStartPage and not _bDoStartProc) or
( gAppHook.Helper.IsExcel and not bStartPage ) then
begin
DrawBitmapWaterEx(MemCanvas.Handle, nX, nY, _bmpWater, @cTrMatrix);
end;
end;
// <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
// if bStartPage then
// BitBlt(DC, 0, 0, nW, nH, MemCanvas.Handle, 0, 0, SRCCOPY);
SelectObject(MemCanvas.Handle, hOldBmp);
// DeleteObject(pen);
DeleteObject(hbmp);
// if bStartPage then
// DeleteDC(MemCanvas.Handle);
MemCanvas.Handle := 0;
finally
SetTextColor(DC, oldColor);
end;
// gAppHook.Log(Format('ProcessWartermark() - Completed, LastError=%d', [GetLastError]));
except
// 실패하면 출력 안되게 해준다 22_0907 14:28:52 kku
Result := false;
DeleteDC(DC);
end;
finally
gAppHook.Helper.bIsWaterMaking_ := false;
RestoreDC(DC, -1);
end;
end;
end.

View File

@ -0,0 +1,56 @@
program AppCtrl;
uses
Vcl.Forms,
Tocsg.Win32,
Tocsg.Safe,
Tocsg.Param,
Tocsg.Path,
Tocsg.Process,
Vcl.Dialogs,
System.SysUtils,
DAppCtrlMain in 'DAppCtrlMain.pas' {DlgAppCtrlMain},
AppCtrlServer in 'AppCtrlServer.pas',
Define in 'Define.pas',
AppCtrlDefine in '..\LIB_Common\AppCtrlDefine.pas',
Tocsg.DRM.Encrypt in '..\..\TocsgDRM\LIB_Common\Tocsg.DRM.Encrypt.pas',
Condition in '..\..\..\eCrmHE\LIB_Common\Condition.pas',
GlobalDefine in '..\..\..\eCrmHE\LIB_Common\GlobalDefine.pas';
{$R *.res}
var
mtx: TTgMutex;
param: TTgParam;
begin
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
param := TTgParam.Create;
try
if param.ExistsParam('-hook') then
begin
var nResult := InjectModule(StrToIntDef(param.GetParamValue('-hook'), 0), GetRunExePathDir + DLL_APIHOOK);
if nResult <> 1 then
ShowMessage('Fail .. Code=' + IntToStr(nResult));
exit;
end else
if param.ExistsParam('-clearhook') then
begin
EjectModuleFromPath(GetRunExePathDir + DLL_APIHOOK);
Sleep(1000);
EjectModuleFromPath(GetRunExePathDir + DLL_APIHOOK);
exit;
end;
finally
param.Free;
end;
Guard(mtx, TTgMutex.Create(APP_MUTEX {$IFNDEF WIN64} + '32' {$ENDIF}));
if mtx.MutexState <> msCreateOk then
exit;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgAppCtrlMain, DlgAppCtrlMain);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,217 @@
{*******************************************************}
{ }
{ AppCtrlServer }
{ }
{ Copyright (C) 2023 kku }
{ }
{*******************************************************}
unit AppCtrlServer;
interface
uses
Tocsg.ClientBase, System.SysUtils, System.Classes, WinApi.Windows, Tocsg.Packet,
Winapi.Messages, Tocsg.Process.IPC, System.Generics.Collections,
AppCtrlDefine;
const
WM_NOTIFY_CONNECT_MODULE = WM_USER + 5938;
type
PCMEnt = ^TCMEnt;
TCMEnt = record // Connect Module
hPipe: THandle;
dwPid: DWORD;
sPName,
sPPath: String;
end;
TDcCMEnt = TDictionary<THandle,PCMEnt>;
TEvtSendCtrlOpt = procedure(pEnt: PCMEnt) of object;
TAppCtrlServer = class(TTgClientBase)
private
hRcvWnd_: HWND;
evSendCtrlOpt_: TEvtSendCtrlOpt;
procedure OnCMEntNotify(Sender: TObject; const Item: PCMEnt; Action: TCollectionNotification);
protected
DcCMEnt_: TDcCMEnt;
dwLastSaveTick_: DWORD;
procedure OnNpDisconnected(Sender: TTgNpBase; hPipe: THandle);
function HasCMEnt(hPipe: THandle): Boolean;
procedure ConnectedEvent; override;
procedure DisconnectedEvent; override;
procedure ProcessRcvPacket(aRcv: IRcvPacket); override;
public
Constructor Create(hRcvWnd: HWND);
Destructor Destroy; override;
function CountEnt: Integer;
function ActiveNp(sPipeName: String; bNpServer: Boolean): Boolean; override;
property OnSendCtrlOpt: TEvtSendCtrlOpt write evSendCtrlOpt_;
end;
implementation
uses
Tocsg.Exception, superobject, GlobalDefine, Tocsg.Path, Tocsg.Json;
{ TAppCtrlServer }
Constructor TAppCtrlServer.Create(hRcvWnd: HWND);
begin
Inherited Create('', -1);
hRcvWnd_ := hRcvWnd;
evSendCtrlOpt_ := nil;
dwLastSaveTick_ := 0;
DcCMEnt_ := TDcCMEnt.Create;
DcCMEnt_.OnValueNotify := OnCMEntNotify;
end;
Destructor TAppCtrlServer.Destroy;
begin
FreeAndNIl(DcCMEnt_);
Inherited;
end;
procedure TAppCtrlServer.OnCMEntNotify(Sender: TObject; const Item: PCMEnt; Action: TCollectionNotification);
begin
if Action = cnRemoved then
Dispose(Item);
end;
procedure TAppCtrlServer.OnNpDisconnected(Sender: TTgNpBase; hPipe: THandle);
begin
// ¿¬°á ¸ðµâ Á¾·á
if hRcvWnd_ <> 0 then
SendMessage(hRcvWnd_, WM_NOTIFY_CONNECT_MODULE, 0, hPipe);
Lock;
try
if DcCMEnt_.ContainsKey(hPipe) then
DcCMEnt_.Remove(hPipe);
finally
Unlock;
end;
end;
function TAppCtrlServer.HasCMEnt(hPipe: THandle): Boolean;
begin
Lock;
try
Result := DcCMEnt_.ContainsKey(hPipe);
finally
Unlock;
end;
end;
function TAppCtrlServer.CountEnt: Integer;
begin
Lock;
try
Result := DcCMEnt_.Count;
finally
Unlock;
end;
end;
function TAppCtrlServer.ActiveNp(sPipeName: String; bNpServer: Boolean): Boolean;
begin
Result := Inherited;
if bNpServer and Result and (NpIpc_ <> nil) then
NpIpc_.OnDisconnected := OnNpDisconnected;
end;
procedure TAppCtrlServer.ConnectedEvent;
var
Send: ISendPacket;
begin
try
// Inherited;
// SetSendPauseState(false);
_Trace('Connected.');
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. ConnectedEvent()');
end;
end;
procedure TAppCtrlServer.DisconnectedEvent;
begin
try
// Inherited;
QSendPacket_.Clear;
_Trace('Disconnected');
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. DisconnectedEvent()');
end;
end;
procedure TAppCtrlServer.ProcessRcvPacket(aRcv: IRcvPacket);
var
Send: ISendPacket;
procedure process_ACC_TEST_LOG;
begin
_Trace(aRcv.S['Msg']);
// Send := TTgPacket.Create(aRcv);
// Send.S['Msg'] := aRcv.S['Msg'] + ' ÇÏÇÏÇÏ';
// SendPacket(Send);
end;
procedure process_ACC_APP_INFO;
var
pEnt: PCMEnt;
sPath: String;
begin
if HasCMEnt(aRcv.Toss) then
begin
_Trace('Fail .. process_ACC_APP_INFO() .. Already PipeInfo');
exit;
end;
New(pEnt);
pEnt.hPipe := aRcv.Toss;
pEnt.dwPid := aRcv.I['PID'];
sPath := aRcv.S['Path'];
pEnt.sPName := ExtractFileName(sPath);
pEnt.sPPath := ExtractFilePath(sPath);
Lock;
try
DcCMEnt_.Add(pEnt.hPipe, pEnt);
finally
Unlock;
end;
if hRcvWnd_ <> 0 then
SendMessage(hRcvWnd_, WM_NOTIFY_CONNECT_MODULE, 1, NativeInt(pEnt));
// Send := TTgPacket.Create(ACC_SET_POLICY);
// Send.Toss := aRcv.Toss;
// Send.O['Opt'] := TTgJson.ValueToJsonObject<TAppCtrlOpt>(AppCtrlOpt_);
// SendPacket(Send);
if Assigned(evSendCtrlOpt_) then
evSendCtrlOpt_(pEnt);
end;
begin
try
case aRcv.Command of
ACC_TEST_LOG : process_ACC_TEST_LOG;
ACC_APP_INFO : process_ACC_APP_INFO;
ACC_SET_POLICY : ;
end;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. ProcessRcvPacket(), Cmd=%d', [aRcv.Command]);
end;
end;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,156 @@
object DlgAppCtrlMain: TDlgAppCtrlMain
Left = 0
Top = 0
Caption = 'AppCtrl'
ClientHeight = 360
ClientWidth = 438
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poScreenCenter
TextHeight = 15
object pnTop: TPanel
Left = 0
Top = 0
Width = 438
Height = 41
Align = alTop
BevelOuter = bvNone
TabOrder = 0
ExplicitWidth = 434
object btnHook: TButton
Left = 0
Top = 10
Width = 113
Height = 25
Caption = 'APP '#51228#50612' '#49884#51089
TabOrder = 0
OnClick = btnHookClick
end
object Button2: TButton
Left = 168
Top = 10
Width = 75
Height = 25
Caption = 'Button2'
Enabled = False
TabOrder = 1
Visible = False
OnClick = Button2Click
end
object btnTestMsg: TButton
Left = 249
Top = 10
Width = 75
Height = 25
Caption = 'btnTestMsg'
TabOrder = 2
Visible = False
OnClick = btnTestMsgClick
end
end
object pnClient: TPanel
Left = 0
Top = 41
Width = 438
Height = 319
Align = alClient
BevelOuter = bvNone
TabOrder = 1
ExplicitWidth = 434
ExplicitHeight = 318
object GroupBox2: TGroupBox
Left = 0
Top = 0
Width = 438
Height = 105
Align = alTop
Caption = #51228#50612' '#45824#49345' APP'
TabOrder = 0
ExplicitWidth = 434
DesignSize = (
438
105)
object mmTgApp: TMemo
Left = 9
Top = 24
Width = 415
Height = 71
Anchors = [akLeft, akTop, akRight]
Lines.Strings = (
'chrome.exe|msedge.exe|Kakaotalk.exe')
ScrollBars = ssVertical
TabOrder = 0
ExplicitWidth = 411
end
end
object vtList: TVirtualStringTree
Left = 0
Top = 105
Width = 438
Height = 214
Align = alClient
Colors.BorderColor = 15987699
Colors.DisabledColor = clGray
Colors.DropMarkColor = 15385233
Colors.DropTargetColor = 15385233
Colors.DropTargetBorderColor = 15385233
Colors.FocusedSelectionColor = 15385233
Colors.FocusedSelectionBorderColor = 15385233
Colors.GridLineColor = 15987699
Colors.HeaderHotColor = clBlack
Colors.HotColor = clBlack
Colors.SelectionRectangleBlendColor = 15385233
Colors.SelectionRectangleBorderColor = 15385233
Colors.SelectionTextColor = clBlack
Colors.TreeLineColor = 9471874
Colors.UnfocusedColor = clGray
Colors.UnfocusedSelectionColor = clWhite
Colors.UnfocusedSelectionBorderColor = clWhite
Header.AutoSizeIndex = 0
Header.Options = [hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
HintMode = hmTooltip
ParentShowHint = False
ShowHint = True
TabOrder = 1
TreeOptions.PaintOptions = [toHideFocusRect, toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect]
OnFreeNode = vtListFreeNode
OnGetText = vtListGetText
OnGetHint = vtListGetHint
OnGetNodeDataSize = vtListGetNodeDataSize
Touch.InteractiveGestures = [igPan, igPressAndTap]
Touch.InteractiveGestureOptions = [igoPanSingleFingerHorizontal, igoPanSingleFingerVertical, igoPanInertia, igoPanGutter, igoParentPassthrough]
Columns = <
item
Position = 0
Text = #48264#54840
end
item
Position = 1
Text = #54532#47196#49464#49828' '#51060#47492
Width = 130
end
item
Position = 2
Text = 'PID'
Width = 80
end
item
Position = 3
Text = #44221#47196
Width = 250
end>
end
end
object tMtx: TTimer
Enabled = False
Interval = 500
OnTimer = tMtxTimer
Left = 368
Top = 8
end
end

View File

@ -0,0 +1,627 @@
unit DAppCtrlMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls,
Tocsg.CommonData, Vcl.ExtCtrls, Vcl.Buttons, Tocsg.Win32, Tocsg.Controls,
Tocsg.Process, AppCtrlServer, Tocsg.Trace, GlobalDefine,
VirtualTrees, System.Generics.Collections, Tocsg.WndUtil, AppCtrlDefine;
const
START_HOOK_APPS = 'msedgewebview2.exe'; // 'RuntimeBroker.exe'; //'PhotosApp.exe|PhotosService.exe'; // 'msedgewebview2.exe'; // 'spoolsv.exe'; //'splwow64.exe';;
{$IFDEF WIN64}
DLL_APIHOOK = 'AppCtrl.dll';
LOG_FILE = 'AppCtrl.log';
{$ELSE}
DLL_APIHOOK = 'AppCtrl32.dll';
//{$IFDEF DEBUG}
// DLL_APIHOOK = 'AppCtrl.dll';
//{$ELSE}
// DLL_APIHOOK = 'AppCtrl32.dll';
//{$ENDIF}
LOG_FILE = 'AppCtrl32.log';
{$ENDIF}
MAP_FILENAME_APIHOOK = 'Global\AppCtrl64';
HOOK_MUTEX = 'Global\Mtx@220915&AppCtrl';
APP_MUTEX = 'Global\Mtx@220915APP';
WM_CATCH_DROPFILES = WM_USER + 7894;
TXT_DROPINFO = '$DrpFle.txt';
type
TInstallPrintHook = function: Integer; stdcall;
TUninstallPrintHook = function: Integer; stdcall;
PAppCtrlEnt = ^TAppCtrlEnt;
TAppCtrlEnt = record
MdInfo: TCMEnt;
end;
PAppInfoEnt = ^TAppInfoEnt;
TAppInfoEnt = record
dwPid: DWORD;
hMain: HWND;
end;
TDcAppInfo = TDictionary<String,PAppInfoEnt>;
TDlgAppCtrlMain = class(TForm)
tMtx: TTimer;
pnTop: TPanel;
pnClient: TPanel;
btnHook: TButton;
Button2: TButton;
GroupBox2: TGroupBox;
mmTgApp: TMemo;
btnTestMsg: TButton;
vtList: TVirtualStringTree;
procedure btnHookClick(Sender: TObject);
procedure tMtxTimer(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure btnTestMsgClick(Sender: TObject);
procedure vtListGetHint(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; var LineBreakStyle: TVTTooltipLineBreakStyle;
var HintText: string);
procedure vtListGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
procedure vtListFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure vtListGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: string);
private
{ Private declarations }
sHlpExe_,
sDllPath_: String;
bIsWow64_: Boolean;
MgCtrls_: TManagerInputControlsData;
TgAppList_,
TgAppList2_: TStringList;
ThdAppMon_: TThdProcessWatch;
ThdWndMon_: TThdActiveWndMon;
ProcList_: TProcessEntList;
PidList_: TProcessIdList;
bActive_: Boolean;
Server_: TAppCtrlServer;
Trace_: TTgTrace;
DcNode_: TDictionary<THandle,PVirtualNode>;
DcApp_: TDcAppInfo;
DefCtrlOpt_: TAppCtrlOpt;
procedure OnAppInfoNotify(Sender: TObject; const Item: PAppInfoEnt; Action: TCollectionNotification);
procedure OnAppNotify(aSender: TThdProcessWatch; pEnt: PPwEnt; aKind: TProcessWatchKind);
procedure OnWndNotify(aSender: TObject; hActiveWnd: HWND);
procedure FreeMon;
procedure ClearHook(bMore: Boolean = false);
procedure SafeFreeClient;
function StartHookWatch: Boolean;
function StopHookWatch: Boolean;
function GetCtrlOpt(sPName: String): TAppCtrlOpt;
procedure OnSendCtrlOpt(pEnt: PCMEnt);
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
Destructor Destroy; override;
procedure process_WM_NOTIFY_CONNECT_MODULE(var msg: TMessage); Message WM_NOTIFY_CONNECT_MODULE;
end;
var
DlgAppCtrlMain: TDlgAppCtrlMain;
implementation
uses
Tocsg.Path, Tocsg.Safe, Vcl.Imaging.pngimage, Tocsg.WinInfo, Tocsg.Network,
Tocsg.Shell, Tocsg.Param, Winapi.TlHelp32, Tocsg.Exception,
Tocsg.Capture, Tocsg.Strings, Tocsg.User32, Tocsg.Packet, Tocsg.VTUtil,
Tocsg.Json, Condition;
{$R *.dfm}
Constructor TDlgAppCtrlMain.Create(aOwner: TComponent);
var
param: TTgParam;
sLogPath: String;
begin
Inherited Create(aOwner);
CUSTOMER_TYPE := CUSTOMER_DEV;
{$IFDEF Win64}
Caption := Caption + '64';
{$ELSE}
Caption := Caption + '32';
{$ENDIF}
sLogPath := GetRunExePathDir + LOG_FILE;
DeleteFile(PChar(sLogPath));
Trace_ := TTgTrace.Create(ExtractFilePath(sLogPath), ExtractFileName(sLogPath));
Server_ := nil;
MgCtrls_ := nil;
Guard(param, TTgParam.Create);
MgCtrls_ := TManagerInputControlsData.Create(CutFileExt(GetRunExePath) + '.ini');
MgCtrls_.RegInputCtrl(mmTgApp);
MgCtrls_.Load;
sDllPath_ := GetRunExePathDir + DLL_APIHOOK;
bIsWow64_ := IsWow64;
DcApp_ := TDcAppInfo.Create;
DcApp_.OnValueNotify := OnAppInfoNotify;
DcNode_ := TDictionary<THandle,PVirtualNode>.Create;
TgAppList_ := TStringList.Create;
TgAppList_.CaseSensitive := false;
TgAppList2_ := TStringList.Create;
TgAppList2_.CaseSensitive := false;
SplitString(START_HOOK_APPS, '|', TgAppList2_);
ThdAppMon_ := nil;
ThdWndMon_ := nil;
ProcList_ := TProcessEntList.Create;;
ProcList_.DetailInfo := false;
PidList_ := TProcessIdList.Create;
bActive_ := false;
sHlpExe_ := CutFileExt(GetRunExePath) + '32.exe';
if mmTgApp.Text = '' then
mmTgApp.Text := 'chrome.exe|msedge.exe';
ChangeWindowMessageFilter(WM_CATCH_DROPFILES, MSGFLT_ADD);
ZeroMemory(@DefCtrlOpt_, SizeOf(DefCtrlOpt_));
DefCtrlOpt_.sTaskDir := GetRunExePathDir + 'Task\';
DefCtrlOpt_.sUName := '김경덕'; //'김구진';
DefCtrlOpt_.sEmpNo := 'kdkim'; //'kjkim';
DefCtrlOpt_.sDeptName := 'BS솔루션부';
// DefCtrlOpt_.DrmAccessKind := dakAll;
DefCtrlOpt_.sDrmPass := GetMK(false);
DefCtrlOpt_.dwCustomerType := CUSTOMER_TYPE;
DefCtrlOpt_.nFontSize := 175;
DefCtrlOpt_.nLineCount := 4;
// DefCtrlOpt_.sTextOutApp := 'C:\taskToCSG\eCrmHE\OUT_Release - Win64\conf\BSWmcr.exe';
DefCtrlOpt_.sPrintWaterTxt := '이것은 워터마크입니다. This is watermark';
DefCtrlOpt_.sPrintWaterImg := 'C:\taskToCSG\Tocsg.Module\AppCtrl\OUT_Debug - Win64\LS 아이티씨 로고2.png';
// DefCtrlOpt_.nPrintWaterAlpha := 125;
// 워터마크 관련
// DefCtrlOpt_.sPrtEmfOutDir := 'C:\Users\kku\Desktop\TEST\_ColTest\';
// DefCtrlOpt_.bPrintSecu := true;
// DefCtrlOpt_.bPrintWater := true;
// DefCtrlOpt_.bDrmAttachAble := true;
// 파일 차단 관련
DefCtrlOpt_.FileUseBlock := fubBlock;
DefCtrlOpt_.bReadBlock := true;
DefCtrlOpt_.bWriteBlock := true;
// DefCtrlOpt_.bMtpWB := true;
ForceDirectories(DefCtrlOpt_.sTaskDir);
// ForceDirectories(DefCtrlOpt_.sTextOutDir);
{$IFDEF DEBUG}
// Button2.Enabled := true;
// Button2.Visible := true;
{$ENDIF}
end;
Destructor TDlgAppCtrlMain.Destroy;
begin
StopHookWatch;
FreeAndNil(MgCtrls_);
FreeAndNil(TgAppList2_);
FreeAndNil(TgAppList_);
FreeAndNil(DcNode_);
FreeAndNil(DcApp_);
FreeAndNil(PidList_);
FreeAndNil(ProcList_);
if Server_ <> nil then
FreeAndNil(Server_);
FreeAndNil(Trace_);
Inherited;
end;
procedure TDlgAppCtrlMain.FreeMon;
begin
if ThdAppMon_ <> nil then
begin
ThdAppMon_.OnProcessWatchNotify := nil;
FreeAndNil(ThdAppMon_);
end;
if ThdWndMon_ <> nil then
begin
ThdWndMon_.OnActiveWndNotify := nil;
FreeAndNil(ThdWndMon_);
end;
PidList_.Clear;
DcApp_.Clear;
end;
procedure TDlgAppCtrlMain.OnAppInfoNotify(Sender: TObject; const Item: PAppInfoEnt; Action: TCollectionNotification);
begin
if Action = cnRemoved then
Dispose(Item);
end;
procedure TDlgAppCtrlMain.OnAppNotify(aSender: TThdProcessWatch; pEnt: PPwEnt; aKind: TProcessWatchKind);
var
nIdx: Integer;
begin
case aKind of
pwkUnknown : {$IFDEF DEBUG} ASSERT(false) {$ENDIF};
pwkInit,
pwkExecute :
begin
if TgAppList2_.IndexOf(pEnt.sPName) = -1 then
exit;
if (GetProcessNameByPid(pEnt.dwPPid).ToUpper <> 'MS-TEAMS.EXE') and
(GetProcessNameByPid(pEnt.dwPPid).ToUpper <> 'OLK.EXE') then
exit;
if InjectModule(pEnt.dwPid, sDllPath_, @bIsWow64_) > 0 then
begin
TTgTrace.T('InjectModule() .. PName="%s", PID=%d, PPID=%d', [pEnt.sPName, pEnt.dwPid, pEnt.dwPPid]);
end else begin
{$IFDEF WIN64}
if FileExists(sHlpExe_) then
ExecutePath(sHlpExe_, Format('-hook %d', [pEnt.dwPid]));
{$ENDIF}
TTgTrace.T('Fail .. InjectModule() .. PName="%s"', [pEnt.sPName]);
end;
end;
pwkTerminated :
begin
nIdx := PidList_.IndexOf(pEnt.dwPid);
if nIdx <> -1 then
begin
PidList_.Delete(nIdx);
Trace_.T('종료됨 .. PName=%s', [pEnt.sPName]);
end;
if DcApp_.ContainsKey(UpperCase(pEnt.sPName)) then
DcApp_.Remove(UpperCase(pEnt.sPName));
end;
end;
end;
procedure TDlgAppCtrlMain.OnWndNotify(aSender: TObject; hActiveWnd: HWND);
var
dwPid: DWORD;
sPName: String;
pEnt: PProcessEntInfo;
pApp: PAppInfoEnt;
begin
try
dwPid := GetProcessPIDFromWndHandle(hActiveWnd);
if dwPid = 0 then
exit;
if PidList_.IndexOf(dwPid) <> -1 then
exit;
ProcList_.UpdateProcessList;
pEnt := ProcList_.GetProcInfoByPid(dwPid);
if pEnt <> nil then
begin
sPName := ExtractFileName(pEnt.sModuleFileName);
if TgAppList_.IndexOf(sPName) = -1 then
begin
// PidList_.Add(dwPid);
exit;
end;
case GetExeFileArchitectFromePath(pEnt.sModuleFileName) of
eakNoExe :
begin
if InjectModule(dwPid, sDllPath_, @bIsWow64_) > 0 then
begin
{$IFDEF DEBUG}
TTgTrace.T('InjectModule() .. PName="%s"', [sPName]);
{$ENDIF}
PidList_.Add(dwPid);
end else begin
if FileExists(sHlpExe_) then
begin
{$IFDEF DEBUG}
TTgTrace.T('InjectModule32() .. PName="%s"', [sPName]);
{$ENDIF}
ExecutePath(sHlpExe_, Format('-hook %d', [dwPid]));
PidList_.Add(dwPid);
end;
{$IFDEF DEBUG}
TTgTrace.T('Fail .. InjectModule() .. PName="%s"', [sPName]);
{$ENDIF}
end;
end;
eak32 :
begin
if FileExists(sHlpExe_) then
begin
{$IFDEF DEBUG}
TTgTrace.T('InjectModule32() ... PName="%s"', [sPName]);
{$ENDIF}
ExecutePath(sHlpExe_, Format('-hook %d', [dwPid]));
PidList_.Add(dwPid);
end else
TTgTrace.T('Fail .. Not found exe .. HlpExe="%s"', [sHlpExe_]);
end;
eak64 :
if InjectModule(dwPid, sDllPath_, @bIsWow64_) > 0 then
begin
{$IFDEF DEBUG}
TTgTrace.T('InjectModule() .. PName="%s"', [sPName]);
{$ENDIF}
PidList_.Add(dwPid);
end else
TTgTrace.T('Fail .. InjectModule() ... PName="%s"', [sPName]);
end;
if not DcApp_.ContainsKey(UpperCase(pEnt.sModuleBaseName)) then
begin
New(pApp);
pApp.dwPid := pEnt.dwPid;
pApp.hMain := hActiveWnd;
DcApp_.Add(UpperCase(pEnt.sModuleBaseName), pApp);
end;
end;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. OnWndNotify()');
end;
end;
procedure TDlgAppCtrlMain.ClearHook(bMore: Boolean = false);
begin
//exit;
if FileExists(sHlpExe_) then
ExecutePath_hide(sHlpExe_, '-clearhook');
EjectModuleFromPath2(sDllPath_, 'msedgewebview2.exe');
if bMore then
begin
Sleep(1000);
EjectModuleFromPath2(sDllPath_, 'msedgewebview2.exe');
end;
end;
procedure TDlgAppCtrlMain.SafeFreeClient;
var
nTO: Integer;
begin
if Server_ <> nil then
begin
// 안전 제거를 위해 종료를 미리 알림 23_0315 14:02:46 kku
// Server_.SendPacket(TTgPacket.Create(ACC_SAFE_TERMINATE_CLIENT));
//
// nTO := 0;
// while (Server_.CountEnt > 0) and (nTO < 10) do
// begin
// Inc(nTO);
// Sleep(500);
// Application.ProcessMessages;
// end;
FreeAndNil(Server_);
end;
end;
function TDlgAppCtrlMain.StartHookWatch: Boolean;
begin
Result := false;
try
if (ThdAppMon_ <> nil) and (ThdWndMon_ <> nil) then
exit;
if Server_ <> nil then
FreeAndNil(Server_);
Server_ := TAppCtrlServer.Create(Handle);
Server_.OnSendCtrlOpt := OnSendCtrlOpt;
if Server_.ActiveNp('NpAppCtrl', true) then
Server_.ConnectNp;
FreeMon;
ClearHook;
ThdAppMon_ := TThdProcessWatch.Create(false);
ThdAppMon_.OnProcessWatchNotify := OnAppNotify;
ThdAppMon_.StartThread;
ThdWndMon_ := TThdActiveWndMon.Create(false);
ThdWndMon_.OnActiveWndNotify := OnWndNotify;
ThdWndMon_.StartThread;
// EjectModuleFromPath(sDllPath_);
SplitString(mmTgApp.Text, '|', TgAppList_);
bActive_ := true;
Result := true;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. StartHookWatch()');
end;
end;
function TDlgAppCtrlMain.StopHookWatch: Boolean;
begin
Result := false;
try
if (ThdAppMon_ = nil) and (ThdWndMon_ = nil) then
exit;
FreeMon;
SafeFreeClient;
ClearHook(true);
bActive_ := false;
VT_Clear(vtList);
DcNode_.Clear;
Result := true;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. StopHookWatch()');
end;
end;
function TDlgAppCtrlMain.GetCtrlOpt(sPName: String): TAppCtrlOpt;
begin
sPName := UpperCase(sPName);
Result := DefCtrlOpt_;
if Server_ <> nil then
Result.hTagWnd := Server_.GetSelfWnd
else
Result.hTagWnd := 0;
// if DcApp_.ContainsKey(sPName) then
// Result.hCltWnd := DcApp_[sPName].hMain;
end;
procedure TDlgAppCtrlMain.OnSendCtrlOpt(pEnt: PCMEnt);
var
Send: ISendPacket;
begin
try
Send := TTgPacket.Create(ACC_SET_POLICY);
Send.Toss := pEnt.hPipe;
Send.O['Opt'] := TTgJson.ValueToJsonObject<TAppCtrlOpt>(GetCtrlOpt(pEnt.sPName));
Server_.SendPacket(Send);
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. OnSendCtrlOpt()');
end;
end;
procedure TDlgAppCtrlMain.tMtxTimer(Sender: TObject);
begin
if not MutexExists(HOOK_MUTEX) then
Close;
end;
procedure TDlgAppCtrlMain.vtListFreeNode(Sender: TBaseVirtualTree;
Node: PVirtualNode);
var
pData: PAppCtrlEnt;
begin
pData := Sender.GetNodeData(Node);
Finalize(pData^);
end;
procedure TDlgAppCtrlMain.vtListGetHint(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex;
var LineBreakStyle: TVTTooltipLineBreakStyle; var HintText: string);
begin
HintText := vtList.Text[Node, Column];
end;
procedure TDlgAppCtrlMain.vtListGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
begin
NodeDataSize := SizeOf(TAppCtrlEnt);
end;
procedure TDlgAppCtrlMain.vtListGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: string);
var
pData: PAppCtrlEnt;
begin
pData := Sender.GetNodeData(Node);
case Column of
0 : CellText := IntToStr(Node.Index + 1);
1 : CellText := pData.MdInfo.sPName;
2 : CellText := IntToStr(pData.MdInfo.dwPid);
3 : CellText := pData.MdInfo.sPPath;
end;
end;
procedure TDlgAppCtrlMain.btnHookClick(Sender: TObject);
begin
if not bActive_ then
begin
mmTgApp.Text := Trim(mmTgApp.Text);
if mmTgApp.Text = '' then
begin
MessageBox(Handle, PChar('제어 대상 APP을 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
MgCtrls_.Save;
if not StartHookWatch then
begin
MessageBox(Handle, PChar('DLL을 로드하는 중 실패했습니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
MessageBox(Handle, PChar('APP 제어가 시작 되었습니다.'), PChar(Caption), MB_ICONINFORMATION or MB_OK);
end else begin
StopHookWatch;
MessageBox(Handle, PChar('APP 제어가 중지 되었습니다.'), PChar(Caption), MB_ICONINFORMATION or MB_OK);
end;
if bActive_ then
begin
btnHook.Caption := 'APP 제어 중지';
end else begin
btnHook.Caption := 'APP 제어 시작';
end;
Application.ProcessMessages;
end;
procedure TDlgAppCtrlMain.btnTestMsgClick(Sender: TObject);
var
Send: ISendPacket;
begin
Send := TTgPacket.Create(ACC_TEST_LOG);
Send.S['Msg'] := '안녕하세요.';
Server_.SendPacket(Send);
end;
procedure TDlgAppCtrlMain.Button2Click(Sender: TObject);
begin
ShowMessage(IntToStr(EjectModuleFromPath(GetRunExePathDir + DLL_APIHOOK)));
end;
procedure TDlgAppCtrlMain.process_WM_NOTIFY_CONNECT_MODULE(var msg: TMessage);
var
pEnt: PCMEnt;
pNode: PVirtualNode;
pData: PAppCtrlEnt;
begin
try
vtList.BeginUpdate;
try
if msg.WParam = 1 then
begin
// 연결
pEnt := PCMEnt(msg.LParam);
ASSERT(not DcNode_.ContainsKey(pEnt.hPipe));
pData := VT_AddChildDataN(vtList, pNode);
pData.MdInfo := pEnt^;
DcNode_.Add(pData.MdInfo.hPipe, pNode);
end else begin
// 종료
if DcNode_.ContainsKey(msg.LParam) then
begin
pNode := DcNode_[msg.LParam];
DcNode_.Remove(msg.LParam);
vtList.DeleteNode(pNode);
end;
end;
finally
vtList.EndUpdate;
end;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. process_WM_NOTIFY_CONNECT_MODULE()');
end;
end;
end.

View File

@ -0,0 +1,19 @@
{*******************************************************}
{ }
{ Define }
{ }
{ Copyright (C) 2023 kku }
{ }
{*******************************************************}
unit Define;
interface
const
CLIENT_TYPE = 10001;
CLIENT_VER = '1';
implementation
end.

View File

@ -0,0 +1,709 @@
{*******************************************************}
{ }
{ AppCtrlDefine }
{ }
{ Copyright (C) 2023 kku }
{ }
{*******************************************************}
unit AppCtrlDefine;
interface
uses
{$IF Defined(_HE_) or Defined(_BS1HP_)}
GlobalDefine,
{$IFEND}
Tocsg.DRM.Encrypt, Tocsg.Obj, Winapi.Windows, System.Classes, System.SysUtils,
System.SyncObjs, Vcl.Graphics, System.Generics.Collections;
const
// \Personalization\Governance\|\Personalization\UserFacts\|\Personalization\Content\ >> \Personalization\
IGNORE_ATTACH_BLOCK_PATHS = ':\ProgramData\|:\Program Files\|:\Program Files (x86)\|:\Windows\|:\Users\Default\AppData\|' + // 이건 넘 범용적인데 일단 넣음
':\Windows\System32\|\WINDOWS\FONTS\|:\ProgramData\NVIDIA Corporation\|' +
'\Microsoft Office\|:\Windows\Microsoft.NET\|\Microsoft\Internet Explorer\|\WebServiceCache\|' +
'\AppData\Local\|\AppData\LocalLow\|:\ProgramData\Microsoft\Windows Defender\|\\.\|:\Program Files\Google\|' +
'\AppData\Roaming\|:\Program Files\Common Files\|\\?\|' +
'\\.\MOUNTPOINTMANAGER|:\PROGRAM FILES\GOOGLE\|:\WINDOWS\ASSEMBLY\|:\PROGRAM FILES (X86)\COMMON FILES\|' +
'\MyGuard\LOG\|\DesktopCentral_Agent\|\Program Files\chrome_BITS_|\Program Files (x86)\chrome_BITS_|' +
'\Manufacturer\Endpoint Agent\|\Microsoft\FORMS\|\Outlook\Offline Address Books\|\Lync\Tracing\|' +
'\Outlook\RoamCache\|\Microsoft\MSIPC\Logs\|ptnsch.dat|:\Windows\SysWOW64\|picpick.ini|\Dropbox\Client\|' +
'\Google\GoogleUpdater\|\Windows\WER\Temp\|\Local\Packages\|\Temp\System32\|\ofv1root\|\OTele\|' +
'\TokenBroker\Cache\|\DisplayForm\|\Personalization\|\Wef\{|\Microsoft\FontCache\|\Temp\Diagnostics\|' +
'\INetCache\IE\|\INetCache\Low\|\INetCache\Virtualized\|\Content.MSO\|\Content.Word\|' +
'\OneAuth\accounts\|\Floodgate\|\Opera Stable\|\Firefox\Profiles\|\WINDOWS\SystemTemp\|' +
'\ProgramData\Microsoft\Windows\|\Adobe\Acrobat DC\|\Globalization\ELS\|\WINDOWS\SysNative\|' +
'\DGAgent\|\FireEye\|\Java\Deployment\cache\|:\WWNTUSER\|\Administrator\Favorites\|' +
'\WeChat Files\|eCrmHeHelper.dll|eCrmHeHelper32.dll|eCrmHeHelperf.dll|eCrmHeHelper32f.dll|' +
'Chakra.ini|ChakraRules.ini|ChakraInfo-1.ini|ChakraGateWay.ini';
OPENDLG_WORDS = '파일|열기|다른|OPEN|SAVE|첨부|打开|打開';
IGNORE_ATTACH_BLOCK_EXTS_WB = 'CPL|PMA|manifest|PCKGDEP|API|tbres|ost|' +
'oab|db|xml|db-shm|db-wal|metadata|db-shm|db-journal|tbreq|TTF|OTF|vivaldi_reporting_data'; // |htm|html
IGNORE_ATTACH_BLOCK_EXTS = 'DLL|LNK|ICO|QMLC|' + IGNORE_ATTACH_BLOCK_EXTS_WB;
{$IF Defined(_HE_) or Defined(_BS1HP_)}
APP_WEB_BROWSERS = WEB_BROWSERS;
{$ELSE}
APP_WEB_BROWSERS = 'iexplore.exe|msedge.exe|whale.exe|chrome.exe|firefox.exe|opera.exe';
{$IFEND}
APP_MSOFFICE = 'winword.exe|excel.exe|powerpnt.exe';
IGNORE_WEB_AB_FILES = 'debug.log|icudtl.dat|preloaded_data.pb|messages.json|CHROME.LNK|' +
'msedge.lnk|firefox.lnk|opera.lnk|mip_config.json|kernel32.pdb|ntdll.pdb|ntdll.pdb';
DRM_EXTS = 'TXT|LOG|DOC|WPS|PDF|XLS|PPT|HWP|HWPX|DOCX|DOTX|XLSX|XLTX|PPTX|POTX|' +
'PPSX|HW|RTF|MW|OW| WP|WP4|WPD|WOP|WM|PW|WMF|WS|WSD|DIF|MWK|W40|WDB|CSV|' +
'WS2|SMTP|EML|MBX|STE|AW|UNI|WKS|WK1|WK3|WK4|FM3|LWP|MWP|XLC|XLM|123|PWD|' +
'MPP|VSD|MSG|OFT|VDX|SXW|SXC|STC|SXI|NSF|DOCM|DOTM|XLSM|XLTM|XLAM|PPTM|' +
'POTM|PPSM|PPAM|XLSB|XPS|DXL|ODT|ODS|ODP|ONM|GRV|PAGES|NUMBERS|KEY|XDW|' +
'ONE|DCM|MLS|ML3|ML4|ML5|ML6|ML7|ML8|ML9|MLA|EMCMF|ACCDT|GUL|JNT|MAT|FIG|' +
'OLM|VCF|ICS|VCS|IWA|VSSX|VSTX|VSTM|SDW|SGL|VOR|SDC|SDD|SDA|SMF|YML|SCPT|' +
'MB|JT|MO|QM|IV|PBIX|IBOOKS|FDF|XFDF|MSO|RSS|SMIL|XSPF|FB2|PPJ|RDF|RSD|SBML|' +
'SRU|SSML|PLS|TEI|METS|MODS|OPF|SRGS|SRX|VXML|CCXML|YIN|CML|VTU|SXD|SXG|ODM|' +
'OTH|FODP|FODS|FODT|OXT|SVM|XDF|HTM|HTML|ASF|MHT|MHTML|MXML|MXL|XML|ASP|METALINK|XDP|XUL';
DRM_SUPPORT_APPS = 'EXCEL.EXE|WINWORD.EXE|POWERPNT.EXE|hwp.exe|notepad.exe|notepad++.exe|' +
'Acrobat.exe|AcroRd32.exe|HwpViewer.exe';//|FoxitPDFReader.exe|FoxitPDFEditor.exe';
{$IFDEF DEBUG}
// 크롬 제거
// PRINT_SUPPORT_APPS = 'EXCEL.EXE|WINWORD.EXE|POWERPNT.EXE|hwp.exe|' + //'msedge.exe|' +
PRINT_SUPPORT_APPS = 'EXCEL.EXE|WINWORD.EXE|POWERPNT.EXE|hwp.exe|' + // 'chrome.exe|msedge.exe|whale.exe|' +
'Evernote.exe|mspaint.exe|Acrobat.exe|Honeyview.exe|notepad.exe|notepad++.exe|' +
'AcroRd32.exe|RdrCEF.exe|AcroCEF.exe|Hword.exe|Hpdf.exe|HCell.exe|HShow.exe|' +
'NeoiCube.exe|MSIP.Viewer.exe|FoxitPDFReader.exe|FoxitPDFEditor.exe|' +
'ALPDF.exe|wordpad.exe';
{$ELSE}
PRINT_SUPPORT_APPS = 'EXCEL.EXE|WINWORD.EXE|POWERPNT.EXE|hwp.exe|' + //'chrome.exe|msedge.exe|whale.exe|' +
'Evernote.exe|mspaint.exe|Acrobat.exe|Honeyview.exe|notepad.exe|notepad++.exe|' +
'AcroRd32.exe|RdrCEF.exe|AcroCEF.exe|Hword.exe|Hpdf.exe|HCell.exe|HShow.exe|' +
'NeoiCube.exe|MSIP.Viewer.exe|FoxitPDFReader.exe|FoxitPDFEditor.exe|' +
'scdmis.exe|scd_erp.exe|ALPDF.exe|wordpad.exe';
{$ENDIF}
RPINT_SUPPORT_APPS_HEC = 'EXCEL.EXE|WINWORD.EXE|POWERPNT.EXE|Acrobat.exe|AcroRd32.exe|AcroCEF.exe|' +
'MSIP.Viewer.exe|FoxitPDFReader.exe|FoxitPDFEditor.exe';
PRINT_PATH_EXT = 'DOC|DOCX|PPT|PPTX|XLS|XLSX|TXT|RTF|LOG|PDF|JPG|JPEG|PSD|' +
'BMP|PNG|HWP|HWPX|HTML|HTM|XML';
WEB_AB_DELAY_EXT = 'PDF|PPT|PPTX|DOC|DOCX|XLS|XLSX|CSV|TXT|HWP|JPG|JPEG|GIF|PNG|JFIF|SVG';
{$IFNDEF _HE_}
PASS_DRM_HEAD: AnsiString = '#df12mf8(zfq@'; // KvCttSch.exe (ThdCttSch.pas)에서 사용, 수정 시 주의
PASS_DRM_DATA: AnsiString = ':0A2CCABB38C8AD80963A5B1A668ECF9D99270819F1EEE2045B554E81043CCEC3E1E11851D7DE9C65F73F327E3E9585DA'; // 'M}[8k(Ga1/<;LE1j&q';
SIG_DRM: AnsiString = 'ToCSG';
PASS_STRENC = '(skd82_sl9+a'; // KvCttSch.exe (ThdCttSch.pas)에서 사용, 수정 시 주의
{$ENDIF}
SMALL_FONT = 'chrome.exe|msedge.exe|Evernote.exe';
// START_PROCESS = 'excel.exe';
END_PROCESS = 'chrome.exe|msedge.exe|Honeyview.exe|POWERPNT.EXE|' + // 'ApplicationFrameHost.exe|' +
'mspaint.exe|AcroRd32.exe|Acrobat.exe|Evernote.exe';
WORD_GAP = ' ';
ACC_TEST_LOG = 1001;
ACC_APP_INFO = 1002;
ACC_SET_POLICY = 1003;
ACC_SAFE_TERMINATE_CLIENT = 1004;
ACC_NOTI_MSG = 1005;
ACC_SET_CAPTURE_BLOCK = 1006;
type
TCurAppType = (catNormal, catOutlook, catWebb, catMsOffice, catHwp, catExplorer,
catAdobeReader, catNotepad, catPPT, catkvHelper, catwinscp, catBizbox, catFilezilla,
catChrome, catMsedge, catMswebv, catOlk);
TDrmHeadInfo = record
sEmpNo,
sHostName,
sPartName,
sPgName: String;
dwCustomerCode: DWORD;
end;
PDrmFileInfo = ^TDrmFileInfo;
TDrmFileInfo = record
hFile: THandle;
sOrgPath,
sDecPath: String;
bChgRO,
bModified,
bModifyAble: Boolean;
// Head 없앰 24_0814 09:06:42 kku
HeadInfo: TDrmHeadInfo;
end;
{$IF not Defined(_HE_) and not Defined(_BS1HP_)}
TDrmAccessKind = (dakNone, dakEmpNo, dakDept, dakAll);
TPrtWaterCfg = record
bActive: Boolean;
sTopText,
sBotText: String;
nTopSize,
nBotSize,
nTopPos,
nBotPos: Integer
end;
TShFileCrMon = record
sMode: String; // secu, sleep, vul, off, exp
nKind: Integer; // 0 : none, 1 : monitor, 2 : block
bBlkNoti,
bMonNoti: Boolean;
sExpLst: String;
end;
{$IFEND}
TFileUseBlock = (fubNone, fubBlock, fubMonitor);
TAppCtrlOpt = record
sTaskDir: String;
dwCustomerType: DWORD;
hMainWnd: HWND;
// DRM
DrmAccessKind,
DrmModifyKind: TDrmAccessKind;
bDrmAttachAble: Boolean;
sDrmPass,
sUName,
sEmpNo,
sDeptName: String;
// Print
nFontSize,
nLineCount,
nPrintWaterAlpha: Integer;
fWmTran: Double; // 투명도
// sTextOutApp,
// sTextOutDir,
sPrtEmfOutDir,
sIpAddr,
sPrintWaterImg,
sPrintWaterExp: String;
bPrintSecu,
bPrintWater,
bPrtCollect: Boolean;
PrtWaterCfg: TPrtWaterCfg;
// File WebbAB
FileUseBlock: TFileUseBlock;
bCheckUrl,
bUseContentFilter,
bReadBlock,
bWriteBlock,
bFileApproval,
bIgrNetPathAB,
bOpenDetect: Boolean;
ShFileCrMon: TShFileCrMon;
// Noti
hRcvWnd,
hTagWnd,
hCltWnd: HWND; // 캡쳐 방지 윈도우 메인값
// 기타, 테스트를 위한 기능
sAccount,
sAcName,
sAcSSid,
sAipPath: String;
bMtpWB: Boolean;
sMtpRoExp: String;
bIsTest: Boolean;
end;
TAppCtrlHelper = class(TTgObject)
private
CS_: TCriticalSection;
CurAppType_: TCurAppType;
CurAppDetailType_ : TCurAppType;
bForceEncSave_: Boolean;
DrmExtList_,
IgrAttBlkExts_,
OpenDlgWordList_,
IgrAttBlkWebFiles_,
IgrAttBlkPaths_: TStringList;
DcDecPath_: TDictionary<String,String>;
DcDrmFI_: TDictionary<THandle,PDrmFileInfo>;
bDrmSupport_,
bDrmUseBoxedApp_: Boolean;
CtrlOpt_: TAppCtrlOpt;
sAppName_,
sDllPath_: String;
dwPid_: DWORD;
IgrReadL_,
IgrWriteL_: TList<THandle>;
bIsExcel_: Boolean;
FoExpList_,
NetDrvList_,
MtpRoExpList_: TStringList;
sMtpRoExpList_: String;
// 브라우저 파일 차단할때 바로열기 체크, 지연처리를 위함
// WebAbOpenDelayExtList_: TStringList;
procedure Lock;
procedure Unlock;
procedure OnDrmFileNotify(Sender: TObject; const Item: PDrmFileInfo; Action: TCollectionNotification);
function GetCtrlOpt: TAppCtrlOpt;
procedure SetCtrlOpt(aOpt: TAppCtrlOpt);
public
hOpenDlgWnd_: HWND;
RecentDrmFI_: TDrmFileInfo; // MS오피스 저장 파일 암호화를 위함
// 프린트 관련 임시 저장
nPtrCnt_: Integer;
sPtrText_,
sCurDocName_: String;
bSmallFont_,
bBothDocProc_, // StartPage, EndPage 두번 처리 23_1024 11:02:43 kku
bEndDocProc_,
bIsPrinting_,
bIsWaterMaking_: Boolean;
// DRM 관련 임시 저장
dwRecentOpenCustomType_: DWORD;
sRecentOpenPath_,
sRecentOpenEmpNo_,
sRecentOpenDeptName_: String;
// 파일 쓰기 차단 체크
sRecentWrBkPath_: String;
nRecentWrBkCnt_: Integer;
sPrintWaterTxt: String;
Constructor Create(sAppPath: String);
Destructor Destroy; override;
function IsNetPath(sPath: String): Boolean;
procedure NoDrmUse;
// todo : 사용하지 않을거 같음 24_0122 14:18:40 kku
procedure AddIgrReadFile(aFile: THandle);
procedure DelOgrReadFile(aFile: THandle);
function IsIgrReadFile(aFile: THandle): Boolean;
// todo : 사용하지 않을거 같음 24_0122 14:18:40 kku
procedure AddIgrWriteFile(aFile: THandle);
procedure DelOgrWriteFile(aFile: THandle);
function IsIgrWriteFile(aFile: THandle): Boolean;
// function IsWebAbDelayExt(sExt: String): Boolean;
// procedure CopyPrintDC(hPtrDC: HDC);
property CurAppType: TCurAppType read CurAppType_;
property CurAppDetailType: TCurAppType read CurAppDetailType_;
property DrmExtList: TStringList read DrmExtList_;
property IgrAttBlkExts: TStringList read IgrAttBlkExts_;
property OpenDlgWordList: TStringList read OpenDlgWordList_;
property IgrAttBlkWebFiles: TStringList read IgrAttBlkWebFiles_;
property IgrAttBlkPaths: TStringList read IgrAttBlkPaths_;
property DcDecPath: TDictionary<String,String> read DcDecPath_;
property DcDrmFI: TDictionary<THandle,PDrmFileInfo> read DcDrmFI_;
property CtrlOpt: TAppCtrlOpt read GetCtrlOpt write SetCtrlOpt;
property IsDrmSupport: Boolean read bDrmSupport_;
property IsDrmUseBoxedApp: Boolean read bDrmUseBoxedApp_;
property IsForceEncSave: Boolean read bForceEncSave_;
property IsExcel: Boolean read bIsExcel_;
property DllPath: String read sDllPath_;
property PID: DWORD read dwPid_;
property MtpRoExpList: TStringList read MtpRoExpList_;
property AppName: String read sAppName_;
property FoExpList: TStringList read FoExpList_;
end;
{$IFNDEF _HE_} // BSOne는 GlobalDefine.pas에 정의됨
function DecText(sText: String): String; inline;
{$ENDIF}
implementation
uses
{$IFDEF _APPCTRL_}
AppHook,
{$ENDIF}
Tocsg.Strings, Tocsg.Safe, Tocsg.Encrypt, Condition, Tocsg.Graphic,
Tocsg.Network, Tocsg.Exception, Vcl.Imaging.pngimage;
{$IFNDEF _HE_}
function DecText(sText: String): String; inline;
begin
Result := '';
if Length(sText) < 2 then
exit;
if sText[1] = ':' then
begin
Delete(sText, 1, 1);
Result := DecBinStrToStr(ekAes256cbc, PASS_STRENC, sText);
end else
Result := sText;
end;
{$ENDIF}
{ TAppCtrlHelper }
Constructor TAppCtrlHelper.Create(sAppPath: String);
procedure Init;
var
TempList: TStringList;
sPath: array [0..512] of Char;
begin
Guard(TempList, TStringList.Create);
TempList.CaseSensitive := false;
sAppName_ := LowerCase(ExtractFileName(sAppPath));
// GetModuleFileName(0, sPath, 512); // sAppPath - Current App
if GetModuleFileName(HInstance, sPath, 512) > 0 then // DLL Path
sDllPath_ := String(sPath)
else
sDllPath_ := '';
dwPid_ := GetCurrentProcessId;
// 프린트 관련 임시 저장
nPtrCnt_ := 0;
sPtrText_ := '';
sCurDocName_ := '';
sPrintWaterTxt := '';
bIsPrinting_ := false;
bIsWaterMaking_ := false;
// bBothDocProc_ := false;
SplitString(END_PROCESS, '|', TempList);
// bEndDocProc_ := TempList.IndexOf(sAppName_) > -1;
bIsExcel_ := CompareText(sAppName_, 'excel.exe') = 0;
// HEC 방식 일괄적용 23_1222 10:12:57 kku
// bEndDocProc_ := true;
bEndDocProc_ := CompareText(sAppName_, 'notepad.exe') <> 0;
// 엑셀은 색상있는 셀의 경우 나중에 색상을 입히기 때문에 워터마크가 짤리는 문제가 있다.
// StartPage, EndPage 두개 모두 찍어준다. 23_1024 14:05:15 kku
bBothDocProc_ := bIsExcel_;
// 투명도를 도트 방식에서 GDI+로 변경하후 다시 이렇게 변경함.. 24_0125 13:41:22 kku
// 일단.. 위처럼 롤백함 24_0126 14:15:15 kku
// 엑셀에서 깔끔하게 투명도 적용할 방법이 떠오르지 않음 24_0126 14:15:28 kku
// bEndDocProc_ := CompareText(sAppName_, 'excel.exe') <> 0;
// bBothDocProc_ := false;
///////
SplitString(SMALL_FONT, '|', TempList);
bSmallFont_ := TempList.IndexOf(sAppName_) > -1;
CurAppType_ := catNormal;
ZeroMemory(@CtrlOpt_, SizeOf(CtrlOpt_));
ZeroMemory(@RecentDrmFI_, SizeOf(RecentDrmFI_));
if (sAppName_ = 'hwp.exe') or (sAppName_ = 'HwpViewer.exe') then
CurAppType_ := catHwp
else if sAppName_ = 'outlook.exe' then
CurAppType_ := catOutlook
else if sAppName_ = 'explorer.exe' then
CurAppType_ := catExplorer
else if (sAppName_ = 'acrobat.exe') or (sAppName_ = 'acrord32.exe') then
CurAppType_ := catAdobeReader
else if sAppName_ = 'notepad.exe' then
CurAppType_ := catNotepad
else if sAppName_ = 'powerpnt.exe' then
CurAppType_ := catPPT
else if sAppName_ = 'kvcttsch.exe' then
CurAppType_ := catkvHelper
else if sAppName_ = 'winscp.exe' then
CurAppType_ := catwinscp
else if sAppName_ = 'filezilla.exe' then //윈스테크넷 filezilla 타입 추가 251128 mgkim
CurAppType_ := catFilezilla
else if sAppName_ = 'bizboxamessenger.exe' then // 더존 메신저, 첨부와 파일 열기 구분 처리 25_1112 10:10:17 kku
CurAppType_ := catBizbox
else if sAppName_ = 'msedgewebview2.exe' then
CurAppType_ := catMswebv
else if sAppName_ = 'olk.exe' then
CurAppType_ := catOlk;
if CurAppType_ = catNormal then
begin
SplitString(APP_MSOFFICE, '|', TempList);
if TempList.IndexOf(sAppName_) <> -1 then
CurAppType_ := catMsOffice;
end;
if CurAppType_ = catNormal then
begin
SplitString(APP_WEB_BROWSERS, '|', TempList);
if TempList.IndexOf(sAppName_) <> -1 then
begin
CurAppType_ := catWebb;
bSmallFont_ := true;
//20251201 mgkim catWebb 별도 브라우저 구분이 없어서 추가
if CompareText(sAppName_, 'msedge.exe') = 0 then
CurAppDetailType_ := catMsedge;
if CompareText(sAppName_, 'chrome.exe') = 0 then
CurAppDetailType_ := catChrome;
end;
end;
bDrmUseBoxedApp_ := false; // ('acrord32.exe' = sAppName_) or ('acrobat.exe' = sAppName_);
// bDrmUseBoxedApp_ := CurAppType_ = catMsOffice;
// bDrmSupport_ := ('notepad.exe' = sAppName_) or ('notepad++.exe' = sAppName_);
// bDrmSupport_ := 'hwp.exe' = sAppName_;
SplitString(DRM_SUPPORT_APPS, '|', TempList);
bDrmSupport_ := TempList.IndexOf(sAppName_) <> -1;
OpenDlgWordList_ := TStringList.Create;
SplitString(UpperCase(OPENDLG_WORDS), '|', OpenDlgWordList_);
IgrAttBlkExts_ := TStringList.Create;
if CurAppType_ = catWebb then
SplitString(UpperCase(IGNORE_ATTACH_BLOCK_EXTS_WB), '|', IgrAttBlkExts_)
else
SplitString(UpperCase(IGNORE_ATTACH_BLOCK_EXTS), '|', IgrAttBlkExts_);
IgrAttBlkWebFiles_ := TStringList.Create;
IgrAttBlkWebFiles_.CaseSensitive := false;
SplitString(IGNORE_WEB_AB_FILES, '|', IgrAttBlkWebFiles_);
IgrAttBlkPaths_ := TStringList.Create;
SplitString(UpperCase(IGNORE_ATTACH_BLOCK_PATHS), '|', IgrAttBlkPaths_);
IgrAttBlkPaths_.Add(UpperCase(ExtractFilePath(sAppPath)));
// WebAbOpenDelayExtList_ := TStringList.Create;
// WebAbOpenDelayExtList_.CaseSensitive := false;
// SplitString(WEB_AB_DELAY_EXT, '|', WebAbOpenDelayExtList_);
MtpRoExpList_ := TStringList.Create;
sMtpRoExpList_ := '';
// 컨텐츠 필터 걸고
// 아웃룩은 \Content.Outlook\만 별도로 허용하도록 보완 24_0321 15:29:16 kku
// if CurAppType_ = catOutlook then
// begin
// // 이거 안빼면 한번 포함된어서 ..\AppData\Local\.. \Content.Outlook\ 경로에 있는 파일들은 차단이 안된다 23_0425 11:09:00 kku
// var i: Integer := IgrAttBlkPaths_.IndexOf('\AppData\Local\');
// if i <> -1 then
// IgrAttBlkPaths_.Delete(i);
// end;
DrmExtList_ := TStringList.Create;
DrmExtList_.CaseSensitive := false;
SplitString(DRM_EXTS, '|', DrmExtList_);
DcDecPath_ := TDictionary<String,String>.Create;
DcDrmFI_ := TDictionary<THandle,PDrmFileInfo>.Create;
DcDrmFI_.OnValueNotify := OnDrmFileNotify;
IgrReadL_ := TList<THandle>.Create;
IgrWriteL_ := TList<THandle>.Create;
NetDrvList_ := TStringList.Create;
GetNetDrives(NetDrvList_);
FoExpList_ := TStringList.Create;
end;
begin
Inherited Create;
CS_ := TCriticalSection.Create;
Init;
InitializeGDIPlus; // 추가 24_0125 11:19:36 kku
end;
Destructor TAppCtrlHelper.Destroy;
begin
FinalizeGDIPlus; // 추가 24_0125 11:19:36 kku
FreeAndNil(FoExpList_);
FreeAndNil(NetDrvList_);
FreeAndNil(IgrWriteL_);
FreeAndNil(IgrReadL_);
FreeAndNil(DcDrmFI_);
FreeAndNil(MtpRoExpList_);
FreeAndNil(DcDecPath_);
FreeAndNil(DrmExtList_);
// FreeAndNil(WebAbOpenDelayExtList_);
FreeAndNil(IgrAttBlkPaths_);
FreeANdNil(IgrAttBlkWebFiles_);
FreeAndNil(IgrAttBlkExts_);
FreeAndNil(OpenDlgWordList_);
Inherited;
FreeAndNil(CS_);
end;
procedure TAppCtrlHelper.Lock;
begin
CS_.Acquire;
end;
procedure TAppCtrlHelper.Unlock;
begin
CS_.Release;
end;
procedure TAppCtrlHelper.OnDrmFileNotify(Sender: TObject; const Item: PDrmFileInfo; Action: TCollectionNotification);
begin
if Action = cnRemoved then
Dispose(Item);
end;
function TAppCtrlHelper.IsNetPath(sPath: String): Boolean;
begin
if sPath = '' then
begin
Result := false;
exit;
end;
Result := NetDrvList_.IndexOf(Format('%s:', [UpperCase(sPath)[1]])) <> -1;
end;
procedure TAppCtrlHelper.NoDrmUse;
begin
bDrmSupport_ := false;
end;
procedure TAppCtrlHelper.AddIgrReadFile(aFile: THandle);
begin
if IgrReadL_.IndexOf(aFile) = -1 then
IgrReadL_.Add(aFile);
end;
procedure TAppCtrlHelper.DelOgrReadFile(aFile: THandle);
var
i: Integer;
begin
i := IgrReadL_.IndexOf(aFile);
if i <> -1 then
IgrReadL_.Delete(i);
end;
function TAppCtrlHelper.IsIgrReadFile(aFile: THandle): Boolean;
begin
Result := IgrReadL_.IndexOf(aFile) <> -1;
end;
procedure TAppCtrlHelper.AddIgrWriteFile(aFile: THandle);
begin
if IgrWriteL_.IndexOf(aFile) = -1 then
IgrWriteL_.Add(aFile);
end;
procedure TAppCtrlHelper.DelOgrWriteFile(aFile: THandle);
var
i: Integer;
begin
i := IgrWriteL_.IndexOf(aFile);
if i <> -1 then
IgrWriteL_.Delete(i);
end;
function TAppCtrlHelper.IsIgrWriteFile(aFile: THandle): Boolean;
begin
Result := IgrWriteL_.IndexOf(aFile) <> -1;
end;
function TAppCtrlHelper.GetCtrlOpt: TAppCtrlOpt;
begin
Lock;
try
Result := CtrlOpt_;
finally
Unlock;
end;
end;
procedure TAppCtrlHelper.SetCtrlOpt(aOpt: TAppCtrlOpt);
begin
Lock;
try
CtrlOpt_ := aOpt;
finally
Unlock;
end;
bEndDocProc_ := CompareText(sAppName_, 'notepad.exe') <> 0; //true;
bBothDocProc_ := false;// bIsExcel_; // 클리핑 제거로 엑셀 문제 해결, HEC 나중에 확인 25_0605 15:13:25 kku
case CtrlOpt_.dwCustomerType of
// CUSTOMER_KBIZ,
// CUSTOMER_JUVIS,
CUSTOMER_GEC,
CUSTOMER_HDENG :
begin
bEndDocProc_ := true;
// 엑셀은 색상있는 셀의 경우 나중에 색상을 입히기 때문에 워터마크가 짤리는 문제가 있다.
// StartPage, EndPage 두개 모두 찍어준다. 23_1024 14:05:15 kku
// bBothDocProc_ := CtrlOpt_.dwCustomerType <> CUSTOMER_JUVIS; // bIsExcel_;
// if CtrlOpt_.dwCustomerType = CUSTOMER_HDENG then
bBothDocProc_ := bIsExcel_;
// else
// bBothDocProc_ := false;
// 두명도를 도트 방식에서 GDI+로 변경한 후 이렇게 바꿈
// 엑셀을 두번 칠하게 되면 진해지는 문제가 있음...
// bEndDocProc_ := not bIsExcel_;
// bBothDocProc_ := false;
end;
CUSTOMER_ALADIN :
begin
var n: Integer := IgrAttBlkExts_.IndexOf('EXE');
if n <> -1 then
IgrAttBlkExts_.Delete(n);
end;
{ // 워터마크 전체적인 조절로 인해 bBothDocProc_ := true를 기본으로 함 24_0820 15:28:33 kku
// CUSTOMER_KOCES :
else
begin
var TempList: TStringList;
Guard(TempList, TStringList.Create);
SplitString(END_PROCESS, '|', TempList);
bEndDocProc_ := TempList.IndexOf(sAppName_) > -1;
case CtrlOpt_.dwCustomerType of
CUSTOMER_KOCES,
CUSTOMER_INZENT : bEndDocProc_ := bEndDocProc_ or bIsExcel_;
end;
// if CtrlOpt_.dwCustomerType = CUSTOMER_KOCES then
// bBothDocProc_ := bIsExcel_
// else
bBothDocProc_ := false;
end;
}
end;
if sMtpRoExpList_ <> CtrlOpt_.sMtpRoExp then
begin
sMtpRoExpList_ := CtrlOpt_.sMtpRoExp;
SplitString(sMtpRoExpList_, ';', MtpRoExpList_);
var i: Integer;
var s: String;
var EntList: TStringList;
Guard(EntList, TStringList.Create);
for i := MtpRoExpList_.Count - 1 downto 0 do
begin
s := StringReplace(UpperCase(MtpRoExpList_[i]), 'USB\', '', [rfReplaceAll]);
SplitString(s, '&', EntList);
if EntList.Count > 1 then
MtpRoExpList_[i] := EntList[0] + '&' + EntList[1]
else
MtpRoExpList_[i] := s;
end;
end;
end;
//function TAppCtrlHelper.IsWebAbDelayExt(sExt: String): Boolean;
//begin
// Result := WebAbOpenDelayExtList_.IndexOf(sExt) <> -1;
//end;
end.

View File

@ -0,0 +1,13 @@
How to use BoxedApp SDK as a DLL
---------------------------------
To use BoxedAppSDK as a DLL add unit 'BoxedAppSDK_DLL.pas' to a project;
the final EXE needs bxsdk32.DLL (for 32 bit applications) or bxsdk64.DLL (for 64 bit applications)
How to link BoxedApp SDK statically
------------------------------------
To use BoxedAppSDK statically) add unit 'BoxedAppSDK_Static.pas' to a project;
the final EXE DOESN'T need bxsdk32.DLL or bxsdk64.DLL
Sometimes it's useful when you should create single EXE without additional
dependencies.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,7 @@
// Copyright (c) Softanics
unit BoxedAppSDK_DLL;
{$DEFINE BOXEDAPP_PAS_IS_INCLUDED}
{$DEFINE BOXEDAPP_SDK_USE_DLL}
{$I 'BoxedAppSDK.inc'}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,6 @@
// Copyright (c) Softanics
unit BoxedAppSDK_Static;
{$DEFINE BOXEDAPP_PAS_IS_INCLUDED}
{$I 'BoxedAppSDK.inc'}

View File

@ -0,0 +1,51 @@
{*******************************************************}
{ }
{ GlobalDefine }
{ }
{ Copyright (C) 2022 kku }
{ }
{*******************************************************}
unit GlobalDefine;
interface
uses
Winapi.Windows, Winapi.Messages;
const
{$IFDEF WIN64}
DLL_APIHOOK = 'AppCtrl.dll';
LOG_FILE = 'AppCtrl.log';
{$ELSE}
DLL_APIHOOK = 'AppCtrl32.dll';
//{$IFDEF DEBUG}
// DLL_APIHOOK = 'AppCtrl.dll';
//{$ELSE}
// DLL_APIHOOK = 'AppCtrl32.dll';
//{$ENDIF}
LOG_FILE = 'AppCtrl32.log';
{$ENDIF}
MAP_FILENAME_APIHOOK = 'Global\AppCtrl64';
HOOK_MUTEX = 'Global\Mtx@220915&AppCtrl';
APP_MUTEX = 'Global\Mtx@220915APP';
WM_CATCH_DROPFILES = WM_USER + 7894;
TXT_DROPINFO = '$DrpFle.txt';
type
PSharedData = ^TSharedData;
TSharedData = record
bActive,
bDialogBlock,
bFileDropBlock,
bCaptureBlock: Boolean;
llRcvWnd: LONGLONG;
sTgPNames: array [0..4096] of Char;
sLogPath: array [0..1023] of Char;
end;
implementation
end.

View File

@ -0,0 +1,22 @@
program AppMon;
uses
Vcl.Forms,
DAppMonMain in 'DAppMonMain.pas' {DlgAppMonMain},
Define in 'Define.pas',
FProcessList in 'FProcessList.pas' {FrmProcessList: TFrame},
FInstallList in 'FInstallList.pas' {FrmInstallList: TFrame},
ThdProcessMon in 'ThdProcessMon.pas',
Tocsg.AppInfo in '..\..\Tocsg.Lib\VCL\Tocsg.AppInfo.pas',
Tocsg.Prefetch in '..\PrefetchAnal\Tocsg.Prefetch.pas';
{$R *.res}
begin
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgAppMonMain, DlgAppMonMain);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,33 @@
object DlgAppMonMain: TDlgAppMonMain
Left = 0
Top = 0
Caption = 'DlgAppMonMain'
ClientHeight = 537
ClientWidth = 885
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poScreenCenter
TextHeight = 15
object pcMain: TPageControl
Left = 0
Top = 0
Width = 885
Height = 537
ActivePage = tabProcess
Align = alClient
TabOrder = 0
ExplicitWidth = 881
ExplicitHeight = 536
object tabProcess: TTabSheet
Caption = #54532#47196#49464#49828' '#47785#47197
end
object tabInstall: TTabSheet
Caption = #49444#52824#46108' '#54532#47196#44536#47016
ImageIndex = 1
end
end
end

View File

@ -0,0 +1,52 @@
unit DAppMonMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ComCtrls, FProcessList,
FInstallList;
type
TDlgAppMonMain = class(TForm)
pcMain: TPageControl;
tabProcess: TTabSheet;
tabInstall: TTabSheet;
private
{ Private declarations }
FrmProcessList_: TFrmProcessList;
FrmInstallList_: TFrmInstallList;
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
end;
var
DlgAppMonMain: TDlgAppMonMain;
implementation
uses
Define;
{$R *.dfm}
Constructor TDlgAppMonMain.Create(aOwner: TComponent);
begin
Inherited Create(aOwner);
Caption := APP_TITLE;
FrmProcessList_ := TFrmProcessList.Create(Self);
FrmProcessList_.Parent := tabProcess;
FrmProcessList_.Align := alClient;
FrmProcessList_.Visible := true;
FrmInstallList_ := TFrmInstallList.Create(Self);
FrmInstallList_.Parent := tabInstall;
FrmInstallList_.Align := alClient;
FrmInstallList_.Visible := true;
pcMain.ActivePageIndex := 0;
end;
end.

View File

@ -0,0 +1,10 @@
unit Define;
interface
const
APP_TITLE = 'AppMon';
implementation
end.

View File

@ -0,0 +1,321 @@
object FrmInstallList: TFrmInstallList
Left = 0
Top = 0
Width = 662
Height = 436
TabOrder = 0
object Splitter1: TSplitter
Left = 452
Top = 0
Width = 4
Height = 436
Align = alRight
ExplicitLeft = 640
ExplicitTop = 16
end
object vtList: TVirtualStringTree
Left = 0
Top = 0
Width = 452
Height = 436
Align = alClient
Header.AutoSizeIndex = 1
Header.MainColumn = 2
Header.Options = [hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
HintMode = hmTooltip
IncrementalSearch = isAll
ParentShowHint = False
PopupMenu = popFun
ShowHint = True
TabOrder = 0
TreeOptions.PaintOptions = [toHideFocusRect, toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect, toMultiSelect, toRightClickSelect]
OnCompareNodes = vtListCompareNodes
OnContextPopup = vtListContextPopup
OnDblClick = miRemoveClick
OnFocusChanged = vtListFocusChanged
OnFreeNode = vtListFreeNode
OnGetText = vtListGetText
OnGetImageIndexEx = vtListGetImageIndexEx
OnGetHint = vtListGetHint
OnGetNodeDataSize = vtListGetNodeDataSize
OnHeaderClick = vtListHeaderClick
Touch.InteractiveGestures = [igPan, igPressAndTap]
Touch.InteractiveGestureOptions = [igoPanSingleFingerHorizontal, igoPanSingleFingerVertical, igoPanInertia, igoPanGutter, igoParentPassthrough]
Columns = <
item
Position = 0
Text = #48264#54840
end
item
Position = 1
Text = #49444#52824'/'#50629#45936#51060#53944' '#51068#49884
Width = 150
end
item
Position = 2
Text = #51060#47492
Width = 130
end
item
Position = 3
Text = #48260#51204
Width = 70
end
item
Position = 4
Text = #51228#51089#49324
Width = 80
end
item
Position = 5
Text = #49892#54665' '#54028#51068
Width = 130
end
item
Position = 6
Text = #49892#54665' '#54943#49688
Width = 70
end
item
Position = 7
Text = #51200#51089#44428
Width = 90
end
item
Position = 8
Text = #54532#47196#44536#47016' '#49444#47749
Width = 150
end
item
Position = 9
Text = 'URL'
Width = 120
end
item
Position = 10
Text = #49444#52824' '#44221#47196
Width = 150
end>
DefaultText = ''
end
object vtExe: TVirtualStringTree
Left = 456
Top = 0
Width = 206
Height = 436
Align = alRight
Header.AutoSizeIndex = 0
Header.Options = [hoAutoResize, hoColumnResize, hoDrag, hoShowSortGlyphs]
TabOrder = 1
TreeOptions.PaintOptions = [toHideFocusRect, toShowButtons, toShowDropmark, toShowRoot, toShowTreeLines, toThemeAware, toUseBlendedImages]
OnFreeNode = vtExeFreeNode
OnGetText = vtExeGetText
OnGetNodeDataSize = vtExeGetNodeDataSize
Touch.InteractiveGestures = [igPan, igPressAndTap]
Touch.InteractiveGestureOptions = [igoPanSingleFingerHorizontal, igoPanSingleFingerVertical, igoPanInertia, igoPanGutter, igoParentPassthrough]
Columns = <
item
Position = 0
Text = 'Info'
Width = 202
end>
end
object imgList: TImageList
Left = 64
Top = 120
Bitmap = {
494C010101000800040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600
0000000000003600000028000000400000001000000001002000000000000010
0000000000000000000000000000000000000404040004040400040404000404
040004040400040404001A1A1A00566363007CA2A2007F8C59004D401A000F0F
0F00040404000404040004040400040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000004040400B5B5B500E5E5E5007474
7400242424001A1A1A00A4A4A400B6C3C30099E5E500CCCC4C00B2B22600A5CC
7F000F0F0F000404040004040400040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000004040400B5B5B500E5E5E5007474
74009593930063636300B2B2B200BCBCBC0099D8D800B2B22600D7F1BE00E3E3
E300535353000404040004040400040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000004040400B5B5B500E5E5E5007474
74009593930095959500BFBFBF00B2B2B200333333003B3B3B00B4B4B400A7A7
A700727272000404040004040400040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000004040400B5B5B500E5E5E5007474
7400959393008E8E8E00B8C5AB00B2BF7F0036360F002F2F2F00D4D3D300A5A5
A500676767000404040004040400040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000004040400C2C2C200FFFFFF008181
81009593930089898900CCD84C00BFA53F0099BF8C008CBFBF00AEACAC00E5E5
E500505050000404040004040400040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000004040400C2C2C200FFFFFF008181
81009C999900928F8F00B0973E00A5A559008CF2F20066CCCC00AEADAD008E8C
8C003E3E3E0062626200BCBCBC00242424000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000004040400C2C2C200FFFFFF008181
8100A4A0A000A4A0A0005F5F5F00A9B69C008ABDBD0076A9A90096969600ADAD
AD00C2C2C200C2C2C200DFDFDF00454545000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000404040072727200727272003B3B
3B00A4A0A000A4A0A00024242400454545004545450045454500454545004545
4500454545004545450050505000525252000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
00000000000000000000000000000000000065656500C2C2C200C2C2C2009090
900042414100A4A0A00045454500DFDFDF00DFDFDF00DFDFDF00DFDFDF00DFDF
DF00DFDFDF00DFDFDF00A3A3A300040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000404040004040400242424006868
68005F5F5F004241410045454500BF7F7F00BF721900B2591900A64C0000B23F
0C00BF331900BF7F7F00A3A3A300040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000404040004040400040404002424
2400C2C2C200C2C2C20045454500BF7F7F00FFFF7F00FFD85900D8A51900CC99
0000F2722600BF7F7F00A3A3A300040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000404040004040400040404000404
0400040404000404040045454500BF7F7F00FFFF7F00FFFF7F00FFD85900D8A5
1900CC990000BF7F7F00A3A3A300040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000404040004040400040404000404
0400040404000404040045454500BF7F7F00FFD85900FFFF7F00FFFF7F00FFD8
5900D8A51900BF7F7F00A3A3A300040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000404040004040400040404000404
0400040404000404040045454500BF7F7F00BF663300BF722600BF7F3F00BF7F
3300BF663300BF7F7F00A3A3A300040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000404040004040400040404000404
0400040404000404040024242400BBBBBB00BBBBBB00BBBBBB00BBBBBB00BBBB
BB00BBBBBB00BBBBBB008D8D8D00040404000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
0000000000000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000000424D3E000000000000003E000000
2800000040000000100000000100010000000000800000000000000000000000
000000000000000000000000FFFFFF008C0F0000000000008007000000000000
8007000000000000800700000000000080070000000000008001000000000000
8000000000000000800000000000000080000000000000000000000000000000
C000000000000000E000000000000000FC00000000000000FC00000000000000
FC00000000000000FC0000000000000000000000000000000000000000000000
000000000000}
end
object popFun: TPopupMenu
AutoHotkeys = maManual
OnPopup = popFunPopup
Left = 304
Top = 120
object miRefresh: TMenuItem
Caption = #49352#47196#44256#52840
OnClick = miRefreshClick
end
object N2: TMenuItem
Caption = '-'
end
object miCopyCB: TMenuItem
Caption = #49440#53469#54620' '#54637#47785#51012' '#53364#47549#48372#46300#50640' '#48373#49324
ShortCut = 16451
OnClick = miCopyCBClick
end
object miExport: TMenuItem
Caption = #54532#47196#44536#47016' '#47785#47197' '#51221#48372' '#45236#48372#45236#44592' (ToJson for HE)'
OnClick = miExportClick
end
object miRemove: TMenuItem
Caption = #54532#47196#44536#47016' '#49444#52824' '#51228#44144
OnClick = miRemoveClick
end
object N1: TMenuItem
Caption = '-'
end
object miExportIcon: TMenuItem
Caption = #49440#53469#54620' '#54532#47196#44536#47016' '#50500#51060#53080' '#45236#48372#45236#44592
OnClick = miExportIconClick
end
object N3: TMenuItem
Caption = '-'
end
object miFilter: TMenuItem
Caption = #44160#49353' '#54596#53552
ShortCut = 16454
OnClick = miFilterClick
end
end
object SaveDialog: TSaveDialog
DefaultExt = 'json'
Filter = 'Json file|*.json'
Left = 264
Top = 216
end
object FileOpenDialog: TFileOpenDialog
FavoriteLinks = <>
FileTypes = <>
Options = [fdoPickFolders]
Left = 80
Top = 256
end
end

View File

@ -0,0 +1,494 @@
unit FInstallList;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VirtualTrees,
Tocsg.AppInfo, System.ImageList, Vcl.ImgList, Vcl.Menus, Vcl.ExtCtrls;
type
PInstEnt = ^TInstEnt;
TInstEnt = record
Info: PInstAppEnt;
nImgIdx: Integer;
end;
PIExeEnt = ^TIExeEnt;
TIExeEnt = record
sInfo: String;
end;
TFrmInstallList = class(TFrame)
vtList: TVirtualStringTree;
imgList: TImageList;
popFun: TPopupMenu;
miRefresh: TMenuItem;
N2: TMenuItem;
miRemove: TMenuItem;
miCopyCB: TMenuItem;
N3: TMenuItem;
miFilter: TMenuItem;
miExport: TMenuItem;
SaveDialog: TSaveDialog;
vtExe: TVirtualStringTree;
Splitter1: TSplitter;
N1: TMenuItem;
miExportIcon: TMenuItem;
FileOpenDialog: TFileOpenDialog;
procedure vtListGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
procedure vtListFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure vtListHeaderClick(Sender: TVTHeader; HitInfo: TVTHeaderHitInfo);
procedure vtListGetHint(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; var LineBreakStyle: TVTTooltipLineBreakStyle;
var HintText: string);
procedure vtListGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: string);
procedure vtListGetImageIndexEx(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: TImageIndex;
var ImageList: TCustomImageList);
procedure vtListCompareNodes(Sender: TBaseVirtualTree; Node1,
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
procedure miRefreshClick(Sender: TObject);
procedure vtListContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure miRemoveClick(Sender: TObject);
procedure miCopyCBClick(Sender: TObject);
procedure miFilterClick(Sender: TObject);
procedure popFunPopup(Sender: TObject);
procedure miExportClick(Sender: TObject);
procedure vtListFocusChanged(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex);
procedure vtExeGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
procedure vtExeGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: string);
procedure vtExeFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure miExportIconClick(Sender: TObject);
private
{ Private declarations }
FileImageList_,
FileImageListLg_: TImageList;
InstList_: TTgInstAppList;
procedure RefreshExe(pData: PInstEnt);
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
Destructor Destroy; override;
procedure RefreshList;
end;
implementation
uses
Tocsg.Shell, VirtualTrees.Types, Tocsg.VirtualTreeViewUtil, Tocsg.Safe,
System.DateUtils, Tocsg.Strings, Define, VirtualTrees.Filter, superobject,
Tocsg.Path;
{$R *.dfm}
Constructor TFrmInstallList.Create(aOwner: TComponent);
procedure InitCtrls;
var
hSysIcons: THandle;
begin
FileImageList_ := TImageList.Create(Self);
FileImageList_.ShareImages := true;
FileImageList_.BlendColor := clHighlight;
hSysIcons := GetShellImageHandle;
if hSysIcons <> 0 then
begin
FileImageList_.Handle := hSysIcons;
vtList.Images := FileImageList_;
end;
FileImageListLg_ := TImageList.Create(Self);
FileImageListLg_.ShareImages := true;
FileImageListLg_.BlendColor := clHighlight;
hSysIcons := GetShellImageHandle(false);
if hSysIcons <> 0 then
FileImageListLg_.Handle := hSysIcons;
end;
begin
Inherited Create(aOwner);
InitCtrls;
InstList_ := TTgInstAppList.Create;
RefreshList;
end;
Destructor TFrmInstallList.Destroy;
begin
FreeAndNil(InstList_);
Inherited;
end;
procedure TFrmInstallList.miRefreshClick(Sender: TObject);
begin
RefreshList;
end;
procedure TFrmInstallList.miRemoveClick(Sender: TObject);
var
pData: PInstEnt;
StrList: TStringList;
sTemp,
sParam: String;
i: Integer;
begin
pData := VT_Get1SelNodeData(vtList);
if pData = nil then
exit;
Guard(StrList, TStringList.Create);
if pData.Info.sUninstStr.Contains('.exe') then
SplitString(pData.Info.sUninstStr, '.exe', StrList)
else
SplitString(pData.Info.sUninstStr, '.EXE', StrList);
case StrList.Count of
0 :
begin
MessageBox(Handle, PChar('삭제 명령줄이 존재하지 않습니다.'), APP_TITLE, MB_ICONWARNING or MB_OK);
exit;
end;
1 : ExecutePath(pData.Info.sUninstStr);
else begin
sParam := '';
for i := 1 to StrList.Count - 1 do
begin
sTemp := StrList[i];
if StrList[i].StartsWith('" ') then
Delete(sTemp, 1, 2);
SumString(sParam, sTemp, ' ');
end;
sTemp := StrList[0] + '.exe';
if sTemp[1] = '"' then
sTemp := sTemp + '"';
ExecutePath(sTemp, sParam);
end;
end;
end;
procedure TFrmInstallList.popFunPopup(Sender: TObject);
begin
miFilter.Checked := vtList.GetFilterEditCtrl <> nil;
end;
procedure TFrmInstallList.miCopyCBClick(Sender: TObject);
begin
if VT_CopyToClipboardSelectedInfo(vtList) = 0 then
MessageBox(Handle, PChar('클립보드에 복사 되었습니다.'), APP_TITLE, MB_ICONINFORMATION or MB_OK);
end;
procedure TFrmInstallList.miExportClick(Sender: TObject);
var
InstList: TTgInstAppList;
O: ISuperObject;
begin
if vtList.RootNodeCount = 0 then
begin
MessageBox(Handle, PChar('내보내기 할 프로그램 정보가 없습니다.'), APP_TITLE, MB_ICONWARNING or MB_OK);
exit;
end;
SaveDialog.FileName := '';
if SaveDialog.Execute(Handle) then
begin
Guard(InstList, TTgInstAppList.Create);
InstList.UpdateInstAppList;
O := SO;
O.O['InstList'] := InstList.ToJsonObjHE;
SaveJsonObjToFile(O, SaveDialog.FileName);
MessageBox(Handle, PChar('프로그램 목록 정보 내보내기를 완료했습니다.'), APP_TITLE, MB_ICONINFORMATION or MB_OK);
end;
end;
const
PixelsQuad = MaxInt div SizeOf(TRGBQuad) - 1;
type
TRGBAArray = Array [0..PixelsQuad - 1] of TRGBQuad;
PRGBAArray = ^TRGBAArray;
procedure TFrmInstallList.miExportIconClick(Sender: TObject);
var
pNode: PVirtualNode;
pData: PInstEnt;
bmp: TBitmap;
X, Y: Integer;
RowInOut: PRGBAArray;
begin
pNode := vtList.GetFirstSelected;
if pNode = nil then
exit;
FileOpenDialog.FileName := '';
FileOpenDialog.DefaultFolder := GetDesktopDir;
if FileOpenDialog.Execute then
begin
Guard(bmp, TBitmap.Create);
bmp.SetSize(FileImageListLg_.Width, FileImageListLg_.Height);
bmp.PixelFormat := pf32bit;
while pNode <> nil do
begin
pData := vtList.GetNodeData(pNode);
if pData.nImgIdx <> -1 then
begin
// for Y := 0 to bmp.Height - 1 do
// begin
// RowInOut := bmp.ScanLine[Y];
// for X := 0 to bmp.Width - 1 do
// RowInOut[X].rgbReserved := 0;
// end;
// bmp.AlphaFormat := afDefined;
FileImageListLg_.Draw(bmp.Canvas, 0, 0, pData.nImgIdx, true);
// bmp.AlphaFormat := afIgnored;
bmp.SaveToFile(IncludeTrailingBackslash(FileOpenDialog.FileName) + pData.Info.sName + '.bmp');
end;
pNode := vtList.GetNextSelected(pNode);
end;
end;
end;
procedure TFrmInstallList.miFilterClick(Sender: TObject);
begin
if miFilter.Checked then
vtList.DestroyFilterEdit
else
vtList.CreateFilterEdit;
end;
procedure TFrmInstallList.RefreshList;
var
i: Integer;
pData: PInstEnt;
begin
vtList.BeginUpdate;
try
VT_Clear(vtList);
InstList_.UpdateInstAppList;
for i := 0 to InstList_.Count - 1 do
begin
pData := VT_AddChildData(vtList);
pData.Info := InstList_[i];
pData.nImgIdx := -1;
end;
VT_SortAll(vtList, 1, sdDescending);
finally
vtList.EndUpdate;
end;
end;
procedure TFrmInstallList.vtExeFreeNode(Sender: TBaseVirtualTree;
Node: PVirtualNode);
var
pData: PIExeEnt;
begin
pData := Sender.GetNodeData(Node);
Finalize(pData^);
end;
procedure TFrmInstallList.vtExeGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
begin
NodeDataSize := SizeOf(TIExeEnt);
end;
procedure TFrmInstallList.vtExeGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: string);
var
pData: PIExeEnt;
begin
if Column = 0 then
begin
pData := Sender.GetNodeData(Node);
CellText := pData.sInfo;
end;
end;
procedure TFrmInstallList.vtListCompareNodes(Sender: TBaseVirtualTree; Node1,
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
var
pData1, pData2: PInstEnt;
begin
if Column = 1 then
begin
pData1 := Sender.GetNodeData(Node1);
pData2 := Sender.GetNodeData(Node2);
Result := CompareDateTime(pData1.Info.dtInst, pData2.Info.dtInst);
end else
Result := CompareText(vtList.Text[Node1, Column], vtList.Text[Node2, Column]);
end;
procedure TFrmInstallList.vtListContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
miRemove.Visible := vtList.GetNodeAt(MousePos) <> nil;
miCopyCB.Visible := miRemove.Visible;
end;
procedure TFrmInstallList.RefreshExe(pData: PInstEnt);
function AddIExeInfo(pParent: PVirtualNode; sInfo: String): PVirtualNode;
var
pData: PIExeEnt;
begin
pData := VT_AddChildDataN(vtExe, Result, pParent);
pData.sInfo := sInfo;
end;
var
i, c: Integer;
pNode: PVirtualNode;
begin
vtExe.BeginUpdate;
try
VT_Clear(vtExe);
for i := 0 to pData.Info.InstExeList.Count - 1 do
begin
pNode := AddIExeInfo(nil, pData.Info.InstExeList[i].FileName);
AddIExeInfo(pNode, '실행 횟수 : ' + IntToStr(pData.Info.InstExeList[i].RunCount));
for c := 0 to pData.Info.InstExeList[i].ExeDtList.Count - 1 do
AddIExeInfo(pNode, DateTimeToStr(pData.Info.InstExeList[i].ExeDtList[c]));
end;
VT_ExpandAll(vtExe, true);
finally
vtExe.EndUpdate;
end;
end;
procedure TFrmInstallList.vtListFocusChanged(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex);
var
pData: PInstEnt;
begin
if Node = nil then
exit;
RefreshExe(Sender.GetNodeData(Node));
end;
procedure TFrmInstallList.vtListFreeNode(Sender: TBaseVirtualTree;
Node: PVirtualNode);
var
pData: PInstEnt;
begin
pData := Sender.GetNodeData(Node);
Finalize(pData^);
end;
procedure TFrmInstallList.vtListGetHint(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex;
var LineBreakStyle: TVTTooltipLineBreakStyle; var HintText: string);
begin
HintText := vtList.Text[Node, Column];
end;
procedure TFrmInstallList.vtListGetImageIndexEx(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: TImageIndex;
var ImageList: TCustomImageList);
var
pData: PInstEnt;
begin
case Kind of
ikNormal,
ikSelected:
begin
if Column = 2 then
begin
pData := Sender.GetNodeData(Node);
if pData.nImgIdx = -1 then
pData.nImgIdx := GetShellImageIndex_path(pData.Info.sIconPath);
if pData.nImgIdx = 0 then
ImageList := imgList
else
ImageList := FileImageList_;
ImageIndex := pData.nImgIdx;
end;
end;
end;
end;
procedure TFrmInstallList.vtListGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
begin
NodeDataSize := SizeOf(TInstEnt);
end;
procedure TFrmInstallList.vtListGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: string);
var
pData: PInstEnt;
begin
pData := Sender.GetNodeData(Node);
case Column of
0 : CellText := IntToStr(Node.Index + 1);
1 : CellText := DateTimeToStr(pData.Info.dtInst);
2 : CellText := pData.Info.sName;
3 : CellText := pData.Info.sVersion;
4 : CellText := pData.Info.sPublisher;
5 : if pData.Info.InstExeList <> nil then CellText := pData.Info.InstExeList.GetExeFiles;
6 : if pData.Info.InstExeList <> nil then CellText := IntToStr(pData.Info.InstExeList.GetRunCount);
7 : CellText := pData.Info.sCopyright;
8 : CellText := pData.Info.sDescription;
9 : CellText := pData.Info.sUrlInfo;
10 : CellText := pData.Info.sInstDir;
end;
end;
procedure TFrmInstallList.vtListHeaderClick(Sender: TVTHeader;
HitInfo: TVTHeaderHitInfo);
begin
if HitInfo.Button = mbLeft then
begin
if HitInfo.Column < 0 then
exit;
with Sender, Treeview do
begin
if SortColumn > NoColumn then
Columns[SortColumn].Options := Columns[SortColumn].Options + [coParentColor];
if HitInfo.Column = 0 then
SortColumn := NoColumn
else
begin
if (SortColumn = NoColumn) or (SortColumn <> HitInfo.Column) then
begin
SortColumn := HitInfo.Column;
SortDirection := sdAscending;
end else
if SortDirection = sdAscending then
SortDirection := sdDescending
else
SortDirection := sdAscending;
Columns[SortColumn].Color := $00EFEFEF;
vtList.BeginUpdate;
try
vtList.SortTree(SortColumn, SortDirection, False);
finally
vtList.EndUpdate;
end;
end;
end;
end;
end;
end.

View File

@ -0,0 +1,169 @@
object FrmProcessList: TFrmProcessList
Left = 0
Top = 0
Width = 866
Height = 480
TabOrder = 0
object vtList: TVirtualStringTree
Left = 0
Top = 0
Width = 866
Height = 480
Align = alClient
Colors.BorderColor = 15987699
Colors.DisabledColor = clGray
Colors.DropMarkColor = 15385233
Colors.DropTargetColor = 15385233
Colors.DropTargetBorderColor = 15385233
Colors.FocusedSelectionColor = 15385233
Colors.FocusedSelectionBorderColor = 15385233
Colors.GridLineColor = 15987699
Colors.HeaderHotColor = clBlack
Colors.HotColor = clBlack
Colors.SelectionRectangleBlendColor = 15385233
Colors.SelectionRectangleBorderColor = 15385233
Colors.SelectionTextColor = clBlack
Colors.TreeLineColor = 9471874
Colors.UnfocusedColor = clGray
Colors.UnfocusedSelectionColor = clWhite
Colors.UnfocusedSelectionBorderColor = clWhite
Header.AutoSizeIndex = 10
Header.MainColumn = 1
Header.Options = [hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
HintMode = hmTooltip
IncrementalSearch = isVisibleOnly
ParentShowHint = False
PopupMenu = popFun
ShowHint = True
TabOrder = 0
TreeOptions.PaintOptions = [toHideFocusRect, toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect, toMultiSelect, toRightClickSelect]
OnCompareNodes = vtListCompareNodes
OnContextPopup = vtListContextPopup
OnFreeNode = vtListFreeNode
OnGetText = vtListGetText
OnGetImageIndex = vtListGetImageIndex
OnGetHint = vtListGetHint
OnGetNodeDataSize = vtListGetNodeDataSize
OnHeaderClick = vtListHeaderClick
Touch.InteractiveGestures = [igPan, igPressAndTap]
Touch.InteractiveGestureOptions = [igoPanSingleFingerHorizontal, igoPanSingleFingerVertical, igoPanInertia, igoPanGutter, igoParentPassthrough]
Columns = <
item
Position = 0
Text = #48264#54840
end
item
Position = 1
Text = #51060#47492
Width = 120
end
item
Position = 2
Text = 'PID'
Width = 60
end
item
Position = 3
Text = 'CPU'
end
item
Position = 4
Text = #47700#47784#47532
Width = 70
end
item
Position = 5
Text = #49324#50857' '#49884#44036
Width = 100
end
item
Position = 6
Text = #49892#54665' '#49884#44036
Width = 150
end
item
Position = 7
Text = #49324#50857#51088
Width = 80
end
item
Position = 8
Text = #50864#49440' '#49692#50948
Width = 110
end
item
Position = 9
Text = #49444#47749
Width = 200
end
item
Position = 10
Text = #51228#51089#49324
Width = 100
end
item
Position = 11
Text = #48260#51204
Width = 100
end
item
Position = 12
Text = #51200#51089#44428
Width = 80
end
item
Position = 13
Text = #44221#47196
Width = 250
end>
DefaultText = ''
end
object tUpdate: TTimer
Enabled = False
OnTimer = tUpdateTimer
Left = 104
Top = 104
end
object popFun: TPopupMenu
AutoHotkeys = maManual
OnPopup = popFunPopup
Left = 304
Top = 120
object miCopyCB: TMenuItem
Caption = #49440#53469#54620' '#54637#47785#51012' '#53364#47549#48372#46300#50640' '#48373#49324
ShortCut = 16451
OnClick = miCopyCBClick
end
object miExportJson: TMenuItem
Caption = #54532#47196#49464#49828' '#47785#47197' '#51221#48372' '#45236#48372#45236#44592' (ToJson for HE)'
OnClick = miExportJsonClick
end
object N2: TMenuItem
Caption = '-'
end
object miTerminate: TMenuItem
Caption = #54532#47196#49464#49828' '#51333#47308
ShortCut = 46
OnClick = miTerminateClick
end
object miTerminateName: TMenuItem
Caption = #44057#51008' '#51060#47492#51032' '#54532#47196#49464#49828' '#47784#46160' '#51333#47308
OnClick = miTerminateNameClick
end
object N3: TMenuItem
Caption = '-'
end
object miFilter: TMenuItem
Caption = #44160#49353' '#54596#53552
ShortCut = 16454
OnClick = miFilterClick
end
end
object SaveDialog: TSaveDialog
DefaultExt = 'json'
Filter = 'Json file|*.json'
Left = 264
Top = 216
end
end

View File

@ -0,0 +1,380 @@
unit FProcessList;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ThdProcessMon,
VirtualTrees, Vcl.ExtCtrls, Vcl.Menus;
type
PProcEnt = ^TProcEnt;
TProcEnt = record
Data: TProcMonEnt;
nImgIdx: Integer;
end;
TFrmProcessList = class(TFrame)
vtList: TVirtualStringTree;
tUpdate: TTimer;
popFun: TPopupMenu;
miCopyCB: TMenuItem;
miTerminate: TMenuItem;
N3: TMenuItem;
miFilter: TMenuItem;
miTerminateName: TMenuItem;
N2: TMenuItem;
miExportJson: TMenuItem;
SaveDialog: TSaveDialog;
procedure vtListGetHint(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; var LineBreakStyle: TVTTooltipLineBreakStyle;
var HintText: string);
procedure vtListGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
procedure vtListGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: string);
procedure vtListFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure tUpdateTimer(Sender: TObject);
procedure vtListHeaderClick(Sender: TVTHeader; HitInfo: TVTHeaderHitInfo);
procedure vtListCompareNodes(Sender: TBaseVirtualTree; Node1,
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
procedure vtListGetImageIndex(Sender: TBaseVirtualTree; Node: PVirtualNode;
Kind: TVTImageKind; Column: TColumnIndex; var Ghosted: Boolean;
var ImageIndex: TImageIndex);
procedure miCopyCBClick(Sender: TObject);
procedure miFilterClick(Sender: TObject);
procedure vtListContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure popFunPopup(Sender: TObject);
procedure miTerminateClick(Sender: TObject);
procedure miTerminateNameClick(Sender: TObject);
procedure miExportJsonClick(Sender: TObject);
private
{ Private declarations }
FileImageList_: TImageList;
ThdProcMon_: TThdProcessMon;
VtFilter_: Pointer; // TVtFilterEdit;
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
Destructor Destroy; override;
end;
implementation
uses
Tocsg.VirtualTreeViewUtil, Tocsg.Convert, Tocsg.DateTime, VirtualTrees.Types,
System.Math, System.DateUtils, Tocsg.Shell, Tocsg.Process,
VirtualTrees.Filter, Define, superobject, Tocsg.Safe;
{$R *.dfm}
Constructor TFrmProcessList.Create(aOwner: TComponent);
procedure InitCtrls;
var
hSysIcons: THandle;
begin
VtFilter_ := nil;
FileImageList_ := TImageList.Create(Self);
FileImageList_.ShareImages := true;
FileImageList_.BlendColor := clHighlight;
hSysIcons := GetShellImageHandle;
if hSysIcons <> 0 then
begin
FileImageList_.Handle := hSysIcons;
vtList.Images := FileImageList_;
end;
end;
begin
Inherited Create(aOwner);
InitCtrls;
ThdProcMon_ := TThdProcessMon.Create;
tUpdate.Enabled := true;
end;
Destructor TFrmProcessList.Destroy;
begin
FreeAndNil(ThdProcMon_);
Inherited;
end;
procedure TFrmProcessList.miCopyCBClick(Sender: TObject);
begin
if VT_CopyToClipboardSelectedInfo(vtList) = 0 then
MessageBox(Handle, PChar('클립보드에 복사 되었습니다.'), APP_TITLE, MB_ICONINFORMATION or MB_OK);
end;
procedure TFrmProcessList.miExportJsonClick(Sender: TObject);
var
ProcList: TProcessEntList;
O: ISuperObject;
begin
if vtList.RootNodeCount = 0 then
begin
MessageBox(Handle, PChar('내보내기 할 프로세스 정보가 없습니다.'), APP_TITLE, MB_ICONWARNING or MB_OK);
exit;
end;
SaveDialog.FileName := '';
if SaveDialog.Execute(Handle) then
begin
Guard(ProcList, TProcessEntList.Create);
ProcList.UpdateProcessList;
O := SO;
O.O['ProcList'] := ProcList.ToJsonObjHE;
SaveJsonObjToFile(O, SaveDialog.FileName);
MessageBox(Handle, PChar('프로세스 목록 정보 내보내기를 완료했습니다.'), APP_TITLE, MB_ICONINFORMATION or MB_OK);
end;
end;
procedure TFrmProcessList.miFilterClick(Sender: TObject);
begin
if miFilter.Checked then
begin
vtList.DestroyFilterEdit;
VtFilter_ := nil;
end else
VtFilter_ := vtList.CreateFilterEdit;
end;
procedure TFrmProcessList.miTerminateClick(Sender: TObject);
var
pNode: PVirtualNode;
pData: PProcEnt;
begin
if vtList.SelectedCount = 0 then
exit;
if MessageBox(Handle, PChar('선택한 프로세스를 종료하시겠습니까?'),
APP_TITLE, MB_ICONWARNING or MB_YESNO) = IDNO then exit;
pNode := vtList.GetFirstSelected;
while pNode <> nil do
begin
pData := vtList.GetNodeData(pNode);
TerminateProcessByPid(pData.Data.Info.dwPid);
pNode := vtList.GetNextSelected(pNode);
end;
end;
procedure TFrmProcessList.miTerminateNameClick(Sender: TObject);
var
pNode: PVirtualNode;
pData: PProcEnt;
begin
if vtList.SelectedCount = 0 then
exit;
if MessageBox(Handle, PChar('선택한 프로세스와 동일한 이름의 프로세스를 모두 종료하시겠습니까?'),
APP_TITLE, MB_ICONWARNING or MB_YESNO) = IDNO then exit;
pNode := vtList.GetFirstSelected;
while pNode <> nil do
begin
pData := vtList.GetNodeData(pNode);
TerminateProcessByName(ExtractFileName(pData.Data.Info.sModuleFileName));
pNode := vtList.GetNextSelected(pNode);
end;
end;
procedure TFrmProcessList.popFunPopup(Sender: TObject);
begin
miFilter.Checked := VtFilter_ <> nil;
end;
procedure TFrmProcessList.tUpdateTimer(Sender: TObject);
procedure AddData(pEnt: PProcMonEnt);
var
pNode: PVirtualNode;
pData: PProcEnt;
begin
if pEnt.bTerminated then
exit;
pData := VT_AddChildDataN(vtList, pNode);
pEnt.pNode := pNode;
pData.Data := pEnt^;
pData.nImgIdx := -1;
if VtFilter_ <> nil then
vtList.IsVisible[pNode] := TVtFilterEdit(VtFilter_).IsNodeVisible(pNode);
end;
var
i: Integer;
pEnt: PProcMonEnt;
pData: PProcEnt;
begin
vtList.BeginUpdate;
ThdProcMon_.LockThread;
try
if vtList.RootNodeCount = 0 then
begin
for i := 0 to ThdProcMon_.EntList.Count - 1 do
AddData(ThdProcMon_.EntList[i]);
VT_SortAll(vtList, 1, sdAscending);
end else begin
for i := 0 to ThdProcMon_.EntList.Count - 1 do
begin
pEnt := ThdProcMon_.EntList[i];
if pEnt.bTerminated then
begin
vtList.DeleteNode(pEnt.pNode);
pEnt.pNode := nil;
continue;
end;
if pEnt.pNode <> nil then
begin
pData := vtList.GetNodeData(pEnt.pNode);
pData.Data := pEnt^;
end else
AddData(ThdProcMon_.EntList[i]);
end;
end;
finally
ThdProcMon_.UnlockThread;
vtList.EndUpdate;
end;
end;
procedure TFrmProcessList.vtListCompareNodes(Sender: TBaseVirtualTree; Node1,
Node2: PVirtualNode; Column: TColumnIndex; var Result: Integer);
var
pData1, pData2: PProcEnt;
begin
pData1 := Sender.GetNodeData(Node1);
pData2 := Sender.GetNodeData(Node2);
case Column of
1, 7, 9, 10, 11, 12, 13 : Result := CompareText(vtList.Text[Node1, Column], vtList.Text[Node2, Column]);
2 : Result := CompareValue(pData1.Data.Info.dwPid, pData2.Data.Info.dwPid);
3 : Result := CompareValue(pData1.Data.Res.fCpu, pData2.Data.Res.fCpu);
4 : Result := CompareValue(pData1.Data.Res.llMemSize, pData2.Data.Res.llMemSize);
5, 6: Result := CompareDateTime(pData1.Data.Info.dtStart, pData2.Data.Info.dtStart);
8 : Result := CompareDateTime(pData1.Data.Info.nPriority, pData2.Data.Info.nPriority);
end;
end;
procedure TFrmProcessList.vtListContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
miCopyCB.Visible := vtList.GetNodeAt(MousePos) <> nil;
miTerminate.Visible := miCopyCB.Visible;
miTerminateName.Visible := miCopyCB.Visible;
end;
procedure TFrmProcessList.vtListFreeNode(Sender: TBaseVirtualTree;
Node: PVirtualNode);
var
pData: PProcEnt;
begin
pData := Sender.GetNodeData(Node);
Finalize(pData^);
end;
procedure TFrmProcessList.vtListGetHint(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex;
var LineBreakStyle: TVTTooltipLineBreakStyle; var HintText: string);
begin
HintText := vtList.Text[Node, Column];
end;
procedure TFrmProcessList.vtListGetImageIndex(Sender: TBaseVirtualTree;
Node: PVirtualNode; Kind: TVTImageKind; Column: TColumnIndex;
var Ghosted: Boolean; var ImageIndex: TImageIndex);
var
pData: PProcEnt;
begin
if Column = 1 then
begin
case Kind of
ikNormal,
ikSelected:
begin
pData := Sender.GetNodeData(Node);
if pData.nImgIdx = -1 then
pData.nImgIdx := GetShellImageIndex_path(pData.Data.Info.sModuleFileName);
ImageIndex := pData.nImgIdx;
end;
end;
end;
end;
procedure TFrmProcessList.vtListGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
begin
NodeDataSize := SizeOf(TProcEnt);
end;
procedure TFrmProcessList.vtListGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: string);
var
pData: PProcEnt;
begin
pData := Sender.GetNodeData(Node);
case Column of
0 : CellText := IntToStr(Node.Index + 1);
1 : CellText := ExtractFileName(pData.Data.Info.sModuleFileName);
2 : CellText := IntToStr(pData.Data.Info.dwPid);
3 : CellText := Format('%.2f%%', [pData.Data.Res.fCpu]);
4 : CellText := ByteSizeToStr(pData.Data.Res.llMemSize);
5 : CellText := ConvSecBetweenToProgTime(pData.Data.Info.dtStart, Now);
6 : CellText := DateTimeToStr(pData.Data.Info.dtStart);
7 : CellText := pData.Data.Info.sOwner;
8 : CellText := PriorityStrByClass(pData.Data.Info.nPriority);
9 : CellText := pData.Data.Info.sDescription;
10 : CellText := pData.Data.Info.sCompany;
11 : CellText := pData.Data.Info.sVersion;
12 : CellText := pData.Data.Info.sCopyright;
13 : CellText := ExtractFilePath(pData.Data.Info.sModuleFileName);
end;
end;
procedure TFrmProcessList.vtListHeaderClick(Sender: TVTHeader;
HitInfo: TVTHeaderHitInfo);
begin
if HitInfo.Button = mbLeft then
begin
if HitInfo.Column < 0 then
exit;
with Sender, Treeview do
begin
if SortColumn > NoColumn then
Columns[SortColumn].Options := Columns[SortColumn].Options + [coParentColor];
if HitInfo.Column = 0 then
SortColumn := NoColumn
else
begin
if (SortColumn = NoColumn) or (SortColumn <> HitInfo.Column) then
begin
SortColumn := HitInfo.Column;
SortDirection := sdAscending;
end else
if SortDirection = sdAscending then
SortDirection := sdDescending
else
SortDirection := sdAscending;
Columns[SortColumn].Color := $00EFEFEF;
vtList.BeginUpdate;
try
vtList.SortTree(SortColumn, SortDirection, False);
finally
vtList.EndUpdate;
end;
end;
end;
end;
end;
end.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

View File

@ -0,0 +1,208 @@
{*******************************************************}
{ }
{ ThdProcessMon }
{ }
{ Copyright (C) 2022 kku }
{ }
{*******************************************************}
unit ThdProcessMon;
interface
uses
Tocsg.Thread, System.SysUtils, System.Classes, Tocsg.Process, Winapi.Windows,
System.Generics.Collections;
type
TProcTimeInfoRec = record
ftKernelTime,
ftUserTime: TFileTime;
end;
TProcResInfo = record
fCpu: Single;
llMemSize: LONGLONG;
hProcess: THandle;
LastSystemTimes,
LastProcessTimes: TProcTimeInfoRec;
end;
PProcMonEnt = ^TProcMonEnt;
TProcMonEnt = record
Info: TProcessEntInfo;
Res: TProcResInfo;
bTerminated: Boolean;
pNode: Pointer;
end;
TProcMonEntList = class(TList<PProcMonEnt>)
protected
procedure Notify(const Item: PProcMonEnt; Action: TCollectionNotification); override;
end;
TThdProcessMon = class(TTgThread)
protected
EntList_: TProcMonEntList;
procedure Execute; override;
public
Constructor Create;
Destructor Destroy; override;
procedure LockThread;
procedure UnlockThread;
property EntList: TProcMonEntList read EntList_;
end;
implementation
uses
Tocsg.Safe, Winapi.PsAPI;
{ TProcMonEntList }
procedure TProcMonEntList.Notify(const Item: PProcMonEnt; Action: TCollectionNotification);
begin
if Action = cnRemoved then
Dispose(Item);
end;
{ TThdProcessMon }
Constructor TThdProcessMon.Create;
begin
Inherited Create;
EntList_ := TProcMonEntList.Create;
StartThread;
end;
Destructor TThdProcessMon.Destroy;
begin
FreeAndNil(EntList_);
Inherited;
end;
procedure TThdProcessMon.LockThread;
begin
Lock;
end;
procedure TThdProcessMon.UnlockThread;
begin
Unlock;
end;
procedure TThdProcessMon.Execute;
procedure UpdateProcRes(var aRes: TProcResInfo);
function SubtFileTime(ft1: TFileTIme; ft2: TFileTIme): TFileTIme;
begin
Result := TFileTIme(LONGLONG(ft1) - LONGLONG(ft2));
end;
var
SystemTimes,
SystemDiffTimes,
ProcessDiffTimes,
ProcessTimes: TProcTimeInfoRec;
SystemTimesIdleTime,
ProcessTimesCreationTime,
ProcessTimesExitTime: TFileTime;
ProcMemCnts: TProcessMemoryCounters;
begin
if aRes.hProcess <> 0 then
begin
if Winapi.Windows.GetSystemTimes(SystemTimesIdleTime, SystemTimes.ftKernelTime, SystemTimes.ftUserTime) then
begin
SystemDiffTimes.ftKernelTime := SubtFileTime(SystemTimes.ftKernelTime, aRes.LastSystemTimes.ftKernelTime);
SystemDiffTimes.ftUserTime := SubtFileTime(SystemTimes.ftUserTime, aRes.LastSystemTimes.ftUserTime);
aRes.LastSystemTimes := SystemTimes;
if GetProcessTimes(aRes.hProcess, ProcessTimesCreationTime, ProcessTimesExitTime, ProcessTimes.ftKernelTime, ProcessTimes.ftUserTime) then
begin
ProcessDiffTimes.ftKernelTime := SubtFileTime(ProcessTimes.ftKernelTime, aRes.LastProcessTimes.ftKernelTime);
ProcessDiffTimes.ftUserTime := SubtFileTime(ProcessTimes.ftUserTime, aRes.LastProcessTimes.ftUserTime);
aRes.LastProcessTimes := ProcessTimes;
if (Int64(SystemDiffTimes.ftKernelTime) + Int64(SystemDiffTimes.ftUserTime)) > 0 then
aRes.fCpu := (Int64(ProcessDiffTimes.ftKernelTime) + Int64(ProcessDiffTimes.ftUserTime)) / (Int64(SystemDiffTimes.ftKernelTime) + Int64(SystemDiffTimes.ftUserTime)) * 100;
end;
end;
if GetProcessMemoryInfo(aRes.hProcess, @ProcMemCnts, SizeOf(ProcMemCnts)) then
aRes.llMemSize := ProcMemCnts.WorkingSetSize
else
aRes.llMemSize := -1;
end;
end;
procedure AddProcMonEnt(pPinfo: PProcessEntInfo);
var
pEnt: PProcMonEnt;
begin
New(pEnt);
ZeroMemory(pEnt, SizeOf(TProcMonEnt));
pEnt.Info := pPinfo^;
pEnt.Res.hProcess := OpenProcess(PROCESS_ALL_ACCESS, false, pEnt.Info.dwPid);
EntList_.Add(pEnt);
end;
var
ChkList: TProcessEntList;
i, c: Integer;
pEnt: PProcMonEnt;
pPInfo: PProcessEntInfo;
begin
Guard(ChkList, TProcessEntList.Create);
while not Terminated and not GetWorkStop do
begin
ChkList.UpdateProcessList;
Lock;
try
if EntList_.Count = 0 then
begin
for i := 0 to ChkList.Count - 1 do
begin
if Terminated or GetWorkStop then
exit;
AddProcMonEnt(ChkList[i]);
end;
end else begin
for i := EntList_.Count - 1 downto 0 do
begin
if Terminated or GetWorkStop then
exit;
pEnt := EntList_[i];
pPInfo := ChkList.GetProcInfoByPid(pEnt.Info.dwPid);
if not pEnt.bTerminated and (pPinfo <> nil) then
begin
pEnt.Info := pPInfo^;
UpdateProcRes(pEnt.Res);
c := ChkList.IndexOf(pPInfo);
if c <> -1 then
ChkList.Delete(c);
end else begin
if pEnt.pNode = nil then
EntList_.Delete(i)
else
pEnt.bTerminated := true;
end;
end;
for i := 0 to ChkList.Count - 1 do
begin
if Terminated or GetWorkStop then
exit;
AddProcMonEnt(ChkList[i]);
end;
end;
finally
Unlock;
end;
Sleep(1000);
end;
end;
end.

View File

@ -0,0 +1,14 @@
program AutoTokenKey;
uses
Vcl.Forms,
DAtTktKeyMain in 'DAtTktKeyMain.pas' {DlgAtTktKeyMain};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgAtTktKeyMain, DlgAtTktKeyMain);
Application.Run;
end.

View File

@ -0,0 +1,966 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{906522ED-206B-476A-8DA6-DE095DBB3CD0}</ProjectGuid>
<ProjectVersion>19.4</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Release</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
<MainSource>AutoTokenKey.dpr</MainSource>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\_OUT_Object\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>.\OUT_$(Config) - $(Platform)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<SanitizedProjectName>AutoTokenKey</SanitizedProjectName>
<VerInfo_Locale>1042</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UsePackage>vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;EsVclComponents;emsedge;bindcompfmx;hclcore_xe104;DBXFirebirdDriver;htmlreports_xe104;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;htmlcompfm_xe104;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;OverbyteIcsD110Run;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;htmlcomp_xe104;FireDACMongoDBDriver;IndySystem;PngComponentsD;FireDACTDataDriver;PKIEDB25;vcldb;ibxbindings;FFmpeg_DXT4;VirtualTreesR;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;htmledit_xe104;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;htmleditcore_xe104;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;htmleditfm_xe104;DBXSybaseASEDriver;DBXDb2Driver;PKIECtrl25;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;vclib;fmxobj;bindcompvclsmp;FMXTee;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
<Icon_MainIcon>AutoTokenKey_Icon.ico</Icon_MainIcon>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>none</AppDPIAwarenessMode>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_UsePackage>vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;appanalytics;IndyProtocols;vclx;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;EsVclComponents;emsedge;bindcompfmx;DBXFirebirdDriver;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;DataSnapIndy10ServerTransport;OverbyteIcsD110Run;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;PngComponentsD;FireDACTDataDriver;PKIEDB25;vcldb;ibxbindings;FFmpeg_DXT4;VirtualTreesR;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;PKIECtrl25;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;vclib;fmxobj;bindcompvclsmp;FMXTee;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<DCC_RemoteDebug>true</DCC_RemoteDebug>
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
<DCC_RangeChecking>true</DCC_RangeChecking>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_RemoteDebug>false</DCC_RemoteDebug>
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<AppEnableRuntimeThemes>true</AppEnableRuntimeThemes>
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="DAtTktKeyMain.pas">
<Form>DlgAtTktKeyMain</Form>
<FormType>dfm</FormType>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType>Application</Borland.ProjectType>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">AutoTokenKey.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment Version="3">
<DeployFile LocalName="Win32\Debug\AutoTokenKey.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>AutoTokenKey.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClasses">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>64</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>classes</RemoteDir>
<Operation>64</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidFileProvider">
<Platform Name="Android">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiv7aFile">
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput_Android32">
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStylesV21">
<Platform Name="Android">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_Colors">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon192">
<Platform Name="Android">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon24">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_Strings">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyModule">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="Android64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iOS_AppStore1024">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_AppIcon152">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_AppIcon167">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_LaunchDark2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Notification40">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Setting58">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_SpotLight80">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_AppIcon120">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_AppIcon180">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch3x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_LaunchDark2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_LaunchDark3x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Notification40">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Notification60">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Setting58">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Setting87">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Spotlight120">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Spotlight80">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSEntitlements">
<Platform Name="iOSDevice32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSInfoPList">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSLaunchScreen">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen</RemoteDir>
<Operation>64</Operation>
</Platform>
<Platform Name="iOSSimulator">
<RemoteDir>..\$(PROJECTNAME).launchscreen</RemoteDir>
<Operation>64</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXDebug">
<Platform Name="OSX64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXEntitlements">
<Platform Name="OSX32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXInfoPList">
<Platform Name="OSX32">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="Linux64">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOutput_Android32">
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectUWPManifest">
<Platform Name="Win32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo150">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo44">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimulator" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
</Deployment>
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,40 @@
object DlgAtTktKeyMain: TDlgAtTktKeyMain
Left = 0
Top = 0
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'AutoTokenKey'
ClientHeight = 154
ClientWidth = 285
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
TextHeight = 15
object lbMsg: TLabel
Left = 0
Top = 0
Width = 285
Height = 154
Align = alClient
Alignment = taCenter
Caption = #53664#53360' '#53412' '#51088#46041#51077#47141' '#51089#46041#51473'....'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = [fsBold]
ParentFont = False
Layout = tlCenter
ExplicitWidth = 141
ExplicitHeight = 15
end
object tInput: TTimer
Enabled = False
OnTimer = tInputTimer
Left = 32
Top = 24
end
end

View File

@ -0,0 +1,83 @@
unit DAtTktKeyMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls;
type
TDlgAtTktKeyMain = class(TForm)
tInput: TTimer;
lbMsg: TLabel;
procedure tInputTimer(Sender: TObject);
private
{ Private declarations }
sTokenKey_: String;
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
end;
var
DlgAtTktKeyMain: TDlgAtTktKeyMain;
implementation
uses
Tocsg.WndUtil, Tocsg.Keyboard, Tocsg.Param;
{$R *.dfm}
Constructor TDlgAtTktKeyMain.Create(aOwner: TComponent);
procedure InitKey;
var
param: TTgParam;
begin
param := TTgParam.Create;
sTokenKey_ := param.GetParamValue('/key');
param.Free;
end;
begin
Inherited Create(aOwner);
Left := Screen.PrimaryMonitor.Width - Width - 200;
Top := 100;
InitKey;
tInput.Enabled := true;
end;
procedure TDlgAtTktKeyMain.tInputTimer(Sender: TObject);
//const
// TOKEN_KEY = 'Q8fbju0Ez@';
var
h, hChild: HWND;
begin
if sTokenKey_ = '' then
begin;
TerminateProcess(GetCurrentProcess, 99);
exit;
end;
h := FindWindow(nil, 'ÅäÅ« ·Î±×¿Â');
if h <> 0 then
begin
Sleep(500);
SetForegroundWindow(h);
hChild := 0;
hChild := GetWndChildClass(h, 'Edit', hChild);
while hChild <> 0 do
begin
if GetEditText(hChild) = '' then
begin
SetEditText(hChild, sTokenKey_);
PressKeys(#13);
exit;
end;
hChild := GetWndChildClass(h, 'Edit', hChild);
end;
end;
end;
end.

Binary file not shown.

View File

@ -0,0 +1,41 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.4.33213.308
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BSCrypto", "DLL_BSCrypto\DLL_BSCrypto.vcxproj", "{FA609B28-0884-40FF-877B-D863FBB337C4}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BSCryptoTest", "EXE_BSCryptoTest\EXE_BSCryptoTest.vcxproj", "{09F03220-6F39-4CA7-9CF8-8C35479AC145}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{FA609B28-0884-40FF-877B-D863FBB337C4}.Debug|x64.ActiveCfg = Debug|x64
{FA609B28-0884-40FF-877B-D863FBB337C4}.Debug|x64.Build.0 = Debug|x64
{FA609B28-0884-40FF-877B-D863FBB337C4}.Debug|x86.ActiveCfg = Debug|Win32
{FA609B28-0884-40FF-877B-D863FBB337C4}.Debug|x86.Build.0 = Debug|Win32
{FA609B28-0884-40FF-877B-D863FBB337C4}.Release|x64.ActiveCfg = Release|x64
{FA609B28-0884-40FF-877B-D863FBB337C4}.Release|x64.Build.0 = Release|x64
{FA609B28-0884-40FF-877B-D863FBB337C4}.Release|x86.ActiveCfg = Release|Win32
{FA609B28-0884-40FF-877B-D863FBB337C4}.Release|x86.Build.0 = Release|Win32
{09F03220-6F39-4CA7-9CF8-8C35479AC145}.Debug|x64.ActiveCfg = Debug|x64
{09F03220-6F39-4CA7-9CF8-8C35479AC145}.Debug|x64.Build.0 = Debug|x64
{09F03220-6F39-4CA7-9CF8-8C35479AC145}.Debug|x86.ActiveCfg = Debug|Win32
{09F03220-6F39-4CA7-9CF8-8C35479AC145}.Debug|x86.Build.0 = Debug|Win32
{09F03220-6F39-4CA7-9CF8-8C35479AC145}.Release|x64.ActiveCfg = Release|x64
{09F03220-6F39-4CA7-9CF8-8C35479AC145}.Release|x64.Build.0 = Release|x64
{09F03220-6F39-4CA7-9CF8-8C35479AC145}.Release|x86.ActiveCfg = Release|Win32
{09F03220-6F39-4CA7-9CF8-8C35479AC145}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {118D0124-25EB-4C37-9B2C-2452C1139FAC}
EndGlobalSection
EndGlobal

View File

@ -0,0 +1,524 @@
#include "stdio.h"
#include "BSCrypto.h"
#include "sha256.h"
#include "aria.h"
int _nState = BS_STATE_NONE;
BYTE _pEncKey[32] = { 0, };
BYTE _pDecKey[32] = { 0, };
ARIA_Key _AEncKey;
ARIA_Key _ADecKey;
SHA256_CTX _EncCTX;
SHA256_CTX _DecCTX;
// 문자열키를 32byte 바이너리 키로 생성, 모듈 내부에서만 사용됨
void _BuildStrToKey(const char* sKey, BYTE* pOut, int nSize)
{
for (int i = 0; i < nSize; ++i)
pOut[i] = i;
int n = strlen(sKey);
for (int i = 0; i < n; ++i)
{
pOut[i % nSize] ^= sKey[i];
}
}
char* BSCrypto_GetVersion()
{
return VER_BSCRYPTO;
}
// 암호모듈을 초기화하고 자가시험을 수행한다.
// BS_SUCCESS (0x0001) : 초기화 성공
// BS_CRYPTO_ERROR_SELFTEST_FAILED (0x0002) : 자가시험 실패
// BS_CRYPTO_ERROR_STATE_IN_ERROR (0x0003) : 오류 상태
int BSCrypto_Initialize()
{
if (_nState != BS_STATE_NONE)
return BS_SUCCESS;
// 자가시험
if (BSCrypto_SelfTest() != BS_SUCCESS)
return BS_ERROR_INIT;
// 초기화
BSCrypto_Clear();
_nState = BS_STATE_INIT;
return BS_SUCCESS;
}
int BSCrypto_SelfTest()
{
BYTE rk[16 * 17], c[16], * b, mk[32];
int i, flag;
const DWORD NUMBER = 0x00000042;
BYTE p[16] = { 0x11, 0x11, 0x11, 0x11, 0xaa, 0xaa, 0xaa, 0xaa,
0x11, 0x11, 0x11, 0x11, 0xbb, 0xbb, 0xbb, 0xbb };
const BYTE cryptResult[] = {
0x8d, 0x14, 0x70, 0x62, 0x5f, 0x59, 0xeb, 0xac,
0xb0, 0xe5, 0x5b, 0x53, 0x4b, 0x3e, 0x46, 0x2b };
// 리틀 엔디안 체크
b = (BYTE*)(&NUMBER);
if (b[0] != 0x42)
return BS_ERROR_CRYPTO_SELFTEST_FAILED; // BIG ENDIAN platform
for (i = 0; i < 16; i++)
mk[i] = i * 0x11;
for (i = 16; i < 24; i++)
mk[i] = (i - 16) * 0x11;
Crypt(p, EncKeySetup(mk, rk, 192), rk, c);
flag = 0;
for (i = 0; i < 16; i++)
if (c[i] != cryptResult[i])
flag = 1;
if (flag == 1)
return BS_ERROR_CRYPTO_SELFTEST_FAILED;
for (i = 0; i < 32; i++)
mk[i] = 0;
for (i = 0; i < 16; i++)
p[i] = 0;
EncKeySetup(mk, rk, 192);
Crypt(p, 14, rk, c);
DecKeySetup(mk, rk, 192);
Crypt(c, 14, rk, p);
flag = 0;
for (i = 0; i < 16; i++)
if (p[i] != 0)
flag = 1;
if (flag == 1)
return BS_ERROR_CRYPTO_SELFTEST_FAILED;
return BS_SUCCESS;
}
int BSCrypto_Clear()
{
if (_nState != BS_STATE_INIT)
return BS_ERROR_STATE_IN_ERROR;
memset(&_pEncKey, 0, 32);
memset(&_pDecKey, 0, 32);
memset(&_AEncKey, 0, sizeof(_AEncKey));
memset(&_ADecKey, 0, sizeof(_AEncKey));
memset(&_EncCTX, 0, sizeof(_EncCTX));
memset(&_DecCTX, 0, sizeof(_DecCTX));
return BS_SUCCESS;
}
int BSCrypto_GetState()
{
return _nState;
}
int BSCrypto_FileToSha256(LPCWCH sPath, BYTE* pOutHash)
{
FILE* f = NULL;
_wfopen_s(&f, sPath, L"rb");
if (f != NULL)
{
fseek(f, 0, SEEK_END);
LONGLONG llRead = 0, llReaded = 0;
LONGLONG llSize = _ftelli64(f);
fseek(f, 0, SEEK_SET);
BYTE pBuf[BUF_SIZE] = { 0, };
SHA256_CTX ctx;
sha256_init(&ctx);
while (llReaded < llSize)
{
if (llSize < (llReaded + BUF_SIZE))
llRead = llSize - llReaded;
else
llRead = BUF_SIZE;
llRead = fread_s(pBuf, BUF_SIZE, 1, llRead, f);
if (llRead == 0)
break;
llReaded += llRead;
sha256_update(&ctx, pBuf, llRead);
}
sha256_final(&ctx, pOutHash);
fclose(f);
return BS_SUCCESS;
}
else
return BS_ERROR_OPEN_FILE;
}
void BSCrypto_SetRandomStr(char* sRnd, int nLen)
{
int i;
srand((unsigned int)time(NULL));
for (i = 0; i < nLen; i++)
sRnd[i] = 'a' + rand() % 26;
}
int BSCrypto_EncInit(const char* sKey)
{
if (_nState != BS_STATE_INIT)
return BS_ERROR_STATE_IN_ERROR;
sha256_init(&_EncCTX);
_BuildStrToKey(sKey, _pEncKey, 32);
ARIA_EncKeySetup(_pEncKey, &_AEncKey, 256);
_nState = BS_STATE_ENC;
return BS_SUCCESS;
}
int BSCrypto_EncUpdate(const BYTE* pIn, BYTE* pOut, int nIn)
{
if (_nState != BS_STATE_ENC)
return BS_ERROR_STATE_IN_ERROR;
sha256_update(&_EncCTX, pIn, nIn);
ARIA_Crypt(pIn, pOut, nIn, &_AEncKey);
return BS_SUCCESS;
}
int BSCrypto_EncFinal(BYTE** pOutHash)
{
if (_nState != BS_STATE_ENC)
return BS_ERROR_STATE_IN_ERROR;
BYTE pHash[SHA256_BLOCK_SIZE];
sha256_final(&_EncCTX, pHash);
if (pOutHash != NULL)
memcpy(*pOutHash, pHash, SHA256_BLOCK_SIZE);
_nState = BS_STATE_INIT;
BSCrypto_Clear;
return BS_SUCCESS;
}
int BSCrypto_DecInit(const char* sKey)
{
if (_nState != BS_STATE_INIT)
return BS_ERROR_STATE_IN_ERROR;
sha256_init(&_DecCTX);
_BuildStrToKey(sKey, _pDecKey, 32);
ARIA_EncKeySetup(_pDecKey, &_ADecKey, 256);
_nState = BS_STATE_DEC;
return BS_SUCCESS;
}
int BSCrypto_DecUpdate(const BYTE* pIn, BYTE* pOut, int nIn)
{
if (_nState != BS_STATE_DEC)
return BS_ERROR_STATE_IN_ERROR;
sha256_update(&_DecCTX, pIn, nIn);
ARIA_Crypt(pIn, pOut, nIn, &_ADecKey);
return BS_SUCCESS;
}
int BSCrypto_DecFinal(BYTE** pOutHash)
{
if (_nState != BS_STATE_DEC)
return BS_ERROR_STATE_IN_ERROR;
BYTE pHash[SHA256_BLOCK_SIZE];
sha256_final(&_DecCTX, pHash);
if (pOutHash != NULL)
memcpy(*pOutHash, pHash, SHA256_BLOCK_SIZE);
_nState = BS_STATE_INIT;
BSCrypto_Clear;
return BS_SUCCESS;
}
int BSCrypto_EncFile(const char* sKey, LPCWCH sSrcPath, LPCWCH sDestPath)
{
BSCryptoHead HeadInfo;
memset(&HeadInfo, 0, sizeof(HeadInfo));
HeadInfo.nHeadLen = sizeof(HeadInfo);
int nPad = 0;
FILE* fSrc = NULL;
_wfopen_s(&fSrc, sSrcPath, L"rb");
if (fSrc != NULL)
{
fseek(fSrc, 0, SEEK_END);
LONGLONG llRead = 0, llReaded = 0;
LONGLONG llSize = _ftelli64(fSrc);
fseek(fSrc, 0, SEEK_SET);
BYTE pBuf[BUF_SIZE] = { 0, };
BYTE pBufOut[BUF_SIZE] = { 0, };
BYTE pHash[SHA256_BLOCK_SIZE];
FILE* fDest = NULL;
_wfopen_s(&fDest, sDestPath, L"wb");
if (fDest == NULL)
return BS_ERROR_OPEN_FILE;
// 시그니처 추가
fwrite(ENC_SIG, 1, 5, fDest);
// 헤더정보 채울 수 있는거 채우고
HeadInfo.llSize = llSize;
time(&HeadInfo.tTime);
BSCrypto_SetRandomStr(HeadInfo.sReserve, 220);
// 헤더자리 비우고 시작
fseek(fDest, HeadInfo.nHeadLen, SEEK_CUR);
// 암호화 준비
BYTE pKey[32];
_BuildStrToKey(sKey, pKey, 32);
ARIA_Key AKey;
ARIA_EncKeySetup(pKey, &AKey, 256);
SHA256_CTX ctx;
sha256_init(&ctx);
while (llReaded < llSize)
{
if (llSize < (llReaded + BUF_SIZE))
{
llRead = llSize - llReaded;
nPad = llRead % 16;
if (nPad > 0)
{
nPad = 16 - nPad;
memset(pBufOut, 0, BUF_SIZE);
}
}
else
{
llRead = BUF_SIZE;
}
llRead = fread_s(pBuf, BUF_SIZE, 1, llRead, fSrc);
if (llRead == 0)
break;
llReaded += llRead;
ARIA_Crypt(pBuf, pBufOut, llRead + nPad, &AKey);
fwrite(pBufOut, 1, llRead + nPad, fDest);
sha256_update(&ctx, pBuf, llRead);
}
sha256_final(&ctx, pHash);
// 원본 해시값 입력
memcpy(HeadInfo.pOrgHash, pHash, SHA256_BLOCK_SIZE);
// 헤더 정보 암호화 --------------------------------------------------
_BuildStrToKey(PASS_HEAD, pKey, 32);
ARIA_EncKeySetup(pKey, &AKey, 256);
ARIA_Crypt((BYTE*)&HeadInfo, pBufOut, HeadInfo.nHeadLen, &AKey);
// 헤더 정보 암호화 --------------------------------------------------
// 암호화된 헤더 쓰기
fseek(fDest, 5, SEEK_SET);
fwrite(pBufOut, 1, HeadInfo.nHeadLen, fDest);
if (fDest != NULL)
fclose(fDest);
fclose(fSrc);
return BS_SUCCESS;
} else
return BS_ERROR_OPEN_FILE;
}
int BSCrypto_DecFile(const char* sKey, LPCWCH sSrcPath, LPCWCH sDestPath)
{
FILE* fEnc = NULL;
_wfopen_s(&fEnc, sSrcPath, L"rb");
if (fEnc != NULL)
{
fseek(fEnc, 0, SEEK_END);
LONGLONG llSize = _ftelli64(fEnc);
fseek(fEnc, 0, SEEK_SET);
char sSig[5];
if (fread_s(sSig, 5, 1, 5, fEnc) != 5)
return BS_ERROR_INVALID_ENC_FILE;
if (memcmp(sSig, ENC_SIG, 5) != 0)
return BS_ERROR_INVALID_ENC_FILE;
BYTE pBuf[BUF_SIZE] = { 0, };
BYTE pBufOut[BUF_SIZE] = { 0, };
BYTE pHash[SHA256_BLOCK_SIZE];
BSCryptoHead HeadInfo;
int nHeadLen = sizeof(HeadInfo);
memset(&HeadInfo, 0, nHeadLen);
// 헤더 정보 복호화 --------------------------------------------------
if (fread_s(pBuf, BUF_SIZE, 1, nHeadLen, fEnc) != nHeadLen)
return BS_ERROR_INVALID_ENC_FILE;
BYTE pKey[32];
_BuildStrToKey(PASS_HEAD, pKey, 32);
ARIA_Key AKey;
ARIA_DecKeySetup(pKey, &AKey, 256);
ARIA_Crypt(pBuf, (BYTE*)&HeadInfo, nHeadLen, &AKey);
if (HeadInfo.nHeadLen != nHeadLen)
return BS_ERROR_INVALID_ENC_FILE;
// 헤더 정보 복호화 --------------------------------------------------
// 복호화 준비
_BuildStrToKey(sKey, pKey, 32);
ARIA_DecKeySetup(pKey, &AKey, 256);
FILE* fDec = NULL;
_wfopen_s(&fDec, sDestPath, L"wb");
if (fDec == NULL)
return BS_ERROR_CREATE_FILE;
LONGLONG llWrite = 0, llRead = 0, llReaded = 0;
SHA256_CTX ctx;
sha256_init(&ctx);
while (llReaded < llSize)
{
if (llSize < (llReaded + BUF_SIZE))
{
llRead = llSize - llReaded;
// 원본 크기로 최종 보정
llWrite = HeadInfo.llSize - llReaded;
}
else
{
llRead = BUF_SIZE;
llWrite = llRead;
}
llRead = fread_s(pBuf, BUF_SIZE, 1, llRead, fEnc);
if (llRead == 0)
break;
llReaded += llRead;
ARIA_Crypt(pBuf, pBufOut, llRead, &AKey);
fwrite(pBufOut, 1, llWrite, fDec);
sha256_update(&ctx, pBufOut, llWrite);
}
sha256_final(&ctx, pHash);
if (fDec != NULL)
fclose(fDec);
fclose(fEnc);
// 원본과 해시 비교 후 종료
if (memcmp(HeadInfo.pOrgHash, pHash, SHA256_BLOCK_SIZE) != 0)
return BS_ERROR_DECRYPT_FILE;
else
return BS_SUCCESS;
} else
return BS_ERROR_OPEN_FILE;
}
int BSCrypto_GetOrgFileHash(LPCWCH sEncPath, BYTE* pOutHash)
{
FILE* fEnc = NULL;
_wfopen_s(&fEnc, sEncPath, L"rb");
if (fEnc != NULL)
{
fseek(fEnc, 0, SEEK_SET);
char sSig[5];
if (fread_s(sSig, 5, 1, 5, fEnc) != 5)
return BS_ERROR_INVALID_ENC_FILE;
if (memcmp(sSig, ENC_SIG, 5) != 0)
return BS_ERROR_INVALID_ENC_FILE;
BYTE pBuf[BUF_SIZE] = { 0, };
BSCryptoHead HeadInfo;
int nHeadLen = sizeof(HeadInfo);
memset(&HeadInfo, 0, nHeadLen);
// 헤더 정보 복호화 --------------------------------------------------
if (fread_s(pBuf, BUF_SIZE, 1, nHeadLen, fEnc) != nHeadLen)
return BS_ERROR_INVALID_ENC_FILE;
fclose(fEnc);
BYTE pKey[32];
_BuildStrToKey(PASS_HEAD, pKey, 32);
ARIA_Key AKey;
ARIA_DecKeySetup(pKey, &AKey, 256);
ARIA_Crypt(pBuf, (BYTE*)&HeadInfo, nHeadLen, &AKey);
if (HeadInfo.nHeadLen != nHeadLen)
return BS_ERROR_INVALID_ENC_FILE;
// 헤더 정보 복호화 --------------------------------------------------
memcpy(pOutHash, HeadInfo.pOrgHash, SHA256_BLOCK_SIZE);
return BS_SUCCESS;
}
else
return BS_ERROR_OPEN_FILE;
}
int BSCrypto_IsEncFile(LPCWCH sEncPath)
{
FILE* fEnc = NULL;
_wfopen_s(&fEnc, sEncPath, L"rb");
if (fEnc != NULL)
{
fseek(fEnc, 0, SEEK_SET);
char sSig[5];
if (fread_s(sSig, 5, 1, 5, fEnc) != 5)
return BS_ERROR_INVALID_ENC_FILE;
if (memcmp(sSig, ENC_SIG, 5) != 0)
return BS_ERROR_INVALID_ENC_FILE;
BYTE pBuf[BUF_SIZE] = { 0, };
BSCryptoHead HeadInfo;
int nHeadLen = sizeof(HeadInfo);
memset(&HeadInfo, 0, nHeadLen);
// 헤더 정보 복호화 --------------------------------------------------
if (fread_s(pBuf, BUF_SIZE, 1, nHeadLen, fEnc) != nHeadLen)
return BS_ERROR_INVALID_ENC_FILE;
fclose(fEnc);
BYTE pKey[32];
_BuildStrToKey(PASS_HEAD, pKey, 32);
ARIA_Key AKey;
ARIA_DecKeySetup(pKey, &AKey, 256);
ARIA_Crypt(pBuf, (BYTE*)&HeadInfo, nHeadLen, &AKey);
if (HeadInfo.nHeadLen != nHeadLen)
return BS_ERROR_INVALID_ENC_FILE;
// 헤더 정보 복호화 --------------------------------------------------
return BS_SUCCESS;
}
else
return BS_ERROR_OPEN_FILE;
}

View File

@ -0,0 +1,6 @@
LIBRARY "BSCrypto"
SECTIONS
.SHARDATA READ WRITE SHARED
EXPORTS
ARIA_test @1

View File

@ -0,0 +1,124 @@
#ifndef BS_CryptoH
#define BS_CryptoH
#include "BSDefine.h"
#define VER_BSCRYPTO "BSCrypto 1.0"
#ifdef __cplusplus
extern "C" {
#endif
// BSCrypto의 버전을 표시합니다. (BSCrypto 1.0)
DLL_EXPORT char* BSCrypto_GetVersion();
// 블록 암호화 사용 시 모듈을 준비합니다.
// 자가시험 후 모듈을 초기화 합니다.
// 성공 : BS_SUCCESS, 실패 : BS_ERROR_INIT
DLL_EXPORT int BSCrypto_Initialize();
// 자가시험을 시도합니다.
// 성공 : BS_SUCCESS, 실패 : BS_ERROR_CRYPTO_SELFTEST_FAILED
DLL_EXPORT int BSCrypto_SelfTest();
// 암/복호화 정보를 초기화 합니다.
// 암호화 또는 복호화 중일 경우 실패합니다.
// 성공 : BS_SUCCESS, 실패 : BS_ERROR_STATE_IN_ERROR
DLL_EXPORT int BSCrypto_Clear();
// 현재 상태값을 반환합니다.
// BS_STATE_NONE : 준비가 안된 상태입니다. BSCrypto_Initialize() 호출 이전에 블록 암호화를 진행할 수 없습니다.
// BS_STATE_INIT : BSCrypto_Initialize() 호출 후 정상 동작이 가능한 상태입니다. 암호화, 복호화 대기중입니다.
// BS_STATE_ENC : 암호화 중입니다.
// BS_STATE_DEC : 복호화 중입니다.
DLL_EXPORT int BSCrypto_GetState();
// 첫번째 인자의 파일의 해시를 구합니다. (SHA-256)
// 성공 : BS_SUCCESS, 실패 : BS_ERROR_OPEN_FILE
DLL_EXPORT int BSCrypto_FileToSha256(LPCWCH sPath, BYTE* pOutHash);
// 지정된 크기만큼 임의의 문자를 발생시킴니다.
DLL_EXPORT void BSCrypto_SetRandomStr(char* sRnd, int nLen);
// 블록 암호화를 준비합니다.
// 인자로 받은 키를 32byte binary키로 재구성 하고 대상 데이터 해시계산(SHA-256)을 준비합니다.
// 상태가 BS_STATE_INIT가 아닌경우 실패합니다.
// // 준비가 완료되면 상태를 BS_STATE_ENC로 변경합니다.
// 성공 : BS_SUCCESS, 실패 : BS_ERROR_STATE_IN_ERROR
DLL_EXPORT int BSCrypto_EncInit(const char* sKey);
// 데이터를 암호화 합니다. 원본데이터는 무결성 검사를 위해 해시를 업데이트 합니다.
// 상태가 BS_STATE_ENC가 아닌 경우 실패합니다.
// 성공 : BS_SUCCESS, 실패: BS_ERROR_STATE_IN_ERROR
DLL_EXPORT int BSCrypto_EncUpdate(const BYTE* pIn, BYTE* pOut, int nIn);
// 암호화를 종료 합니다. pOutHash 주소값이 NULL 아닌 경우 원본 데이터의 해키값을 반환합니다. (32byte 고정)
// 상태가 BS_STATE_ENC가 아닌 경우 실패합니다.
// 암호화 정보를 초기화 후 상태 정보를 BS_STATE_INIT로 되돌립니다.
// 성공 : BS_SUCCESS, 실패: BS_ERROR_STATE_IN_ERROR
DLL_EXPORT int BSCrypto_EncFinal(BYTE** pOutHash);
// 블록 복호화를 준비합니다.
// 인자로 받은 키를 32byte binary키로 재구성 하고 복호화된 데이터 해시계산(SHA-256)을 준비합니다.
// 상태가 BS_STATE_INIT가 아닌경우 실패합니다.
// 준비가 완료되면 상태를 BS_STATE_DEC로 변경합니다.
// 성공 : BS_SUCCESS, 실패 : BS_ERROR_STATE_IN_ERROR
DLL_EXPORT int BSCrypto_DecInit(const char* sKey);
// 데이터를 복호화 합니다. 복호화된 데이터는 무결성 검사를 위해 해시를 업데이트 합니다.
// 상태가 BS_STATE_DEC가 아닌 경우 실패합니다.
// 성공 : BS_SUCCESS, 실패: BS_ERROR_STATE_IN_ERROR
DLL_EXPORT int BSCrypto_DecUpdate(const BYTE* pIn, BYTE* pOut, int nIn);
// 복호화를 종료 합니다. pOutHash 주소값이 NULL 아닌 경우 복호화된 데이터의 해키값을 반환합니다. (32byte 고정)
// 상태가 BS_STATE_DEC가 아닌 경우 실패합니다.
// 암호화 정보를 초기화 후 상태 정보를 BS_STATE_INIT로 되돌립니다.
// 성공 : BS_SUCCESS, 실패: BS_ERROR_STATE_IN_ERROR
DLL_EXPORT int BSCrypto_DecFinal(BYTE** pOutHash);
// 파일을 암호화 합니다.
// 인자값 : 암호화 키, 대상 파일 경로, 암호화된 파일 저장 경로
//
// 결과값
// BS_SUCCESS : 성공
// BS_ERROR_OPEN_FILE : 원본 파일 열기 실패
DLL_EXPORT int BSCrypto_EncFile(const char* sKey, LPCWCH sSrcPath, LPCWCH sDestPath);
// 파일을 복호화 합니다.
// 인자값 : 복호화 키, 암호화된 파일 경로, 복호화된 파일 저장 경로
//
// 결과값
// BS_SUCCESS : 성공
// BS_ERROR_OPEN_FILE : 암호화된 파일 열기 실패
// BS_ERROR_INVALID_ENC_FILE : 잘못된 암호화 파일
// BS_ERROR_CREATE_FILE : 복호화 파일 생성 실패
// BS_ERROR_DECRYPT_FILE : 복호화 후 무결성 검사 실패, 복호화 키가 잘못 되었거나 파일이 손상된 경우 발생
DLL_EXPORT int BSCrypto_DecFile(const char* sKey, LPCWCH sSrcPath, LPCWCH sDestPath);
// 암호화된 파일의 헤더 정보에서 원본 파일의 해시값(SHA-256)을 반환합니다.
//
// 결과값
// BS_SUCCESS : 성공
// BS_ERROR_OPEN_FILE : 암호화된 파일 열기 실패
// BS_ERROR_INVALID_ENC_FILE : 잘못된 암호화 파일
DLL_EXPORT int BSCrypto_GetOrgFileHash(LPCWCH sEncPath, BYTE* pOutHash);
// 암호화된 파일인지 확인합니다.
//
// 결과값
// BS_SUCCESS : 성공
// BS_ERROR_OPEN_FILE : 대상 파일 열기 실패
// BS_ERROR_INVALID_ENC_FILE : 암호화 파일 아님
DLL_EXPORT int BSCrypto_IsEncFile(LPCWCH sEncPath);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,173 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{fa609b28-0884-40ff-877b-d863fbb337c4}</ProjectGuid>
<RootNamespace>DLLBSCrypto</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>BSCrypto</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;DLLBSCRYPTO_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;DLLBSCRYPTO_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;DLLBSCRYPTO_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>NotUsing</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
<AdditionalIncludeDirectories>..\LIB_Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>
</ModuleDefinitionFile>
<OutputFile>$(OutDir)$(TargetName)$(TargetExt)</OutputFile>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;DLLBSCRYPTO_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>pch.h</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<EnableUAC>false</EnableUAC>
<ModuleDefinitionFile>Source.def</ModuleDefinitionFile>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\LIB_Common\aria.h" />
<ClInclude Include="..\LIB_Common\BSDefine.h" />
<ClInclude Include="..\LIB_Common\sha256.h" />
<ClInclude Include="BSCrypto.h" />
<ClInclude Include="framework.h" />
<ClInclude Include="pch.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\LIB_Common\aria.c" />
<ClCompile Include="..\LIB_Common\BSUtil.c" />
<ClCompile Include="..\LIB_Common\sha256.c" />
<ClCompile Include="BSCrypto.c" />
<ClCompile Include="dllmain.cpp" />
<ClCompile Include="pch.cpp">
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
</ClCompile>
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,19 @@
// dllmain.cpp : DLL 애플리케이션의 진입점을 정의합니다.
#include "pch.h"
BOOL APIENTRY DllMain( HMODULE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
case DLL_THREAD_ATTACH:
case DLL_THREAD_DETACH:
case DLL_PROCESS_DETACH:
break;
}
return TRUE;
}

View File

@ -0,0 +1,5 @@
#pragma once
#define WIN32_LEAN_AND_MEAN // 거의 사용되지 않는 내용을 Windows 헤더에서 제외합니다.
// Windows 헤더 파일
#include <windows.h>

View File

@ -0,0 +1,5 @@
// pch.cpp: 미리 컴파일된 헤더에 해당하는 소스 파일
#include "pch.h"
// 미리 컴파일된 헤더를 사용하는 경우 컴파일이 성공하려면 이 소스 파일이 필요합니다.

View File

@ -0,0 +1,13 @@
// pch.h: 미리 컴파일된 헤더 파일입니다.
// 아래 나열된 파일은 한 번만 컴파일되었으며, 향후 빌드에 대한 빌드 성능을 향상합니다.
// 코드 컴파일 및 여러 코드 검색 기능을 포함하여 IntelliSense 성능에도 영향을 미칩니다.
// 그러나 여기에 나열된 파일은 빌드 간 업데이트되는 경우 모두 다시 컴파일됩니다.
// 여기에 자주 업데이트할 파일을 추가하지 마세요. 그러면 성능이 저하됩니다.
#ifndef PCH_H
#define PCH_H
// 여기에 미리 컴파일하려는 헤더 추가
#include "framework.h"
#endif //PCH_H

View File

@ -0,0 +1,131 @@
#include "stdio.h"
#include "BSCrypto.h"
#include "BSUtil.h"
#include "wchar.h"
void printBlockOfLength(BYTE* b, int len)
{
int i;
for (i = 0; i < len; i++, b++)
{
printf("%02x", *b);
}
printf("\n\n");
}
int wmain(int argc, WCHAR *argv[])
{
printf("%s\n\n", BSCrypto_GetVersion());
if (BSCrypto_SelfTest() != BS_SUCCESS)
{
printf("자가시험에 실패했습니다.. 환경을 확인 후 관리자에게 문의해주세요.\n");
return 0;
}
if (argc < 4)
{
printf("명령어가 잘못 되었습니다.\n");
printf("ex) BSCryptoText.exe -k 1111 \"원본 파일\" \"암호화 후 저장될 파일\"\n");
printf("ex) BSCryptoText.exe -k 1111 -d \"암호화된 파일\" \"복호화 후 저장될 파일\"\n");
return 0;
}
else if (argc > 6)
{
printf("명령어 인자가 너무 많습니다.\n");
return 0;
}
char sKey[256] = { 0, };
if (wcscmp(argv[1], L"-k") == 0)
{
sprintf_s(sKey, "%ws", argv[2]);
}
else
{
printf("암/복호화 키를 입력해주세요.\n");
return 0;
}
if (wcscmp(argv[3], L"-d") != 0)
{
// 암호화
WCHAR* sOrgPath = argv[3];
WCHAR* sEncPath = argv[4];
if (BSCrypto_IsEncFile(sOrgPath) == BS_SUCCESS)
{
printf("이미 암호화된 파일입니다.\n");
return 0;
}
switch (BSCrypto_EncFile(sKey, sOrgPath, sEncPath))
{
case BS_SUCCESS :
// 암호화 무결성 체크
BYTE pHash1[SHA256_BLOCK_SIZE];
BYTE pHash2[SHA256_BLOCK_SIZE];
if (BSCrypto_FileToSha256(sOrgPath, pHash1) == BS_SUCCESS)
{
// 원본 해시를 구해서
printf("원본파일 해시 : ");
printBlockOfLength(pHash1, SHA256_BLOCK_SIZE);
// 블록 암호화 시 사용된 데이터 해시를 비교한다.
if (BSCrypto_GetOrgFileHash(sEncPath, pHash2) == BS_SUCCESS)
{
printf("암호화 적용전 해시 : ");
printBlockOfLength(pHash2, SHA256_BLOCK_SIZE);
if (memcmp(pHash1, pHash2, SHA256_BLOCK_SIZE) == 0)
{
printf("암호화 성공\n");
}
}
}
return 0;
case BS_ERROR_OPEN_FILE :
printf("파일을 열수 없습니다.\n");
return 0;
default :
printf("알수없는 오류.\n");
return 0;
}
}
else
{
// 복호화
WCHAR* sEncPath = argv[4];
WCHAR* sDecPath = argv[5];
if (BSCrypto_IsEncFile(sEncPath) != BS_SUCCESS)
{
printf("암호화된 파일이 아닙니다.\n");
return 0;
}
switch (BSCrypto_DecFile(sKey, sEncPath, sDecPath))
{
case BS_SUCCESS :
printf("복호화 성공\n");
return 0;
case BS_ERROR_OPEN_FILE :
printf("파일을 열수 없습니다.\n");
return 0;
case BS_ERROR_INVALID_ENC_FILE :
printf("잘못된 암호 파일입니다.\n");
return 0;
case BS_ERROR_CREATE_FILE :
printf("복호화 파일을 생성할 수 없습니다.\n");
return 0;
case BS_ERROR_DECRYPT_FILE :
printf("무결성 검증 실패. 복호화키가 잘못되었을 수 있습니다.\n");
return 0;
default:
printf("알수없는 오류.\n");
return 0;
}
}
}

View File

@ -0,0 +1,148 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{09f03220-6f39-4ca7-9cf8-8c35479ac145}</ProjectGuid>
<RootNamespace>EXEBSCryptoTest</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
<ProjectName>BSCryptoTest</ProjectName>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v143</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
<AdditionalIncludeDirectories>..\DLL_BSCrypto;..\LIB_Common;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CallingConvention>Cdecl</CallingConvention>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<ImportLibrary>
</ImportLibrary>
<AdditionalDependencies>BSCrypto.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>..\x64\Debug\;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClCompile Include="..\LIB_Common\BSUtil.c" />
<ClCompile Include="BSCryptoTest.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\DLL_BSCrypto\BSCrypto.h" />
<ClInclude Include="..\LIB_Common\BSDefine.h" />
<ClInclude Include="..\LIB_Common\BSUtil.h" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

View File

@ -0,0 +1,54 @@
{*******************************************************}
{ }
{ BSCrypto }
{ }
{ Copyright (C) 2023 kku }
{ }
{*******************************************************}
unit BSCrypto;
interface
uses
Winapi.Windows;
const
DLL_BSCRYPTO = 'BSCrypto.dll';
//{$IFDEF Win64}
// DLL_BSCRYPTO = 'BSCrypto64.dll';
//{$ELSE}
// DLL_BSCRYPTO = 'BSCrypto32.dll';
//{$ENDIF}
type
TARIA_test = procedure; cdecl;
procedure ARIA_test;
implementation
var
_hBSc: THandle = 0;
_fnARIA_test: TARIA_test = nil;
function InitBSCrypto: Boolean;
begin
if _hBSc = 0 then
begin
_hBSc := LoadLibrary(DLL_BSCRYPTO);
if _hBSc <> 0 then
begin
@_fnARIA_test := GetProcAddress(_hBSc, 'ARIA_test');
end;
end;
Result := _hBSc <> 0;
end;
procedure ARIA_test;
begin
if InitBSCrypto and Assigned(_fnARIA_test) then
_fnARIA_test;
end;
end.

View File

@ -0,0 +1,48 @@
//#pragma once
#ifndef BS_DefineH
#define BS_DefineH
#include "time.h"
#define CONST const
typedef wchar_t WCHAR;
typedef WCHAR* PWCHAR, * LPWCH, * PWCH;
typedef CONST WCHAR* LPCWCH, * PCWCH;
typedef __int64 LONGLONG;
typedef unsigned char BYTE;
typedef unsigned int DWORD;
#define BUF_SIZE 65536
#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest. in sha256.h
#define ENC_SIG "ToCSG"
#define PASS_HEAD "BSCrypto@230320H"
#define BS_SUCCESS 0x0001
#define BS_ERROR_CRYPTO_SELFTEST_FAILED 0x0002
#define BS_ERROR_STATE_IN_ERROR 0x0003
#define BS_ERROR_OPEN_FILE 0x0004
#define BS_ERROR_CREATE_FILE 0x0005
#define BS_ERROR_INVALID_ENC_FILE 0x0006
#define BS_ERROR_DECRYPT_FILE 0x0007
#define BS_ERROR_INIT 0x0008
#define BS_STATE_NONE 0
#define BS_STATE_INIT 0x0001
#define BS_STATE_ENC 0x0002
#define BS_STATE_DEC 0x0003
#define DLL_EXPORT __declspec(dllexport)
typedef struct _BSCryptoHead
{
int nHeadLen;
LONGLONG llSize;
time_t tTime;
char sReserve[232];
BYTE pOrgHash[SHA256_BLOCK_SIZE];
} BSCryptoHead, *PBSCryptoHead;
#endif

View File

@ -0,0 +1,17 @@
#include "stdio.h"
#include "BSDefine.h"
LONGLONG GetFileSizeFromPath(LPCWCH sPath)
{
LONGLONG llSize = -1;
FILE* f = NULL;
_wfopen_s(&f, sPath, L"rb");
if (f != NULL)
{
fseek(f, 0, SEEK_END);
llSize = _ftelli64(f);
fclose(f);
}
return llSize;
}

View File

@ -0,0 +1,20 @@
//#pragma once
#ifndef BS_UtilH
#define BS_UtilH
#include "BSDefine.h"
#ifdef __cplusplus
extern "C" {
#endif
LONGLONG GetFileSizeFromPath(LPCWCH sPath);
void BuildStrToKey(const char* sKey, BYTE* pOut, int nSize);
void SetRandomStr(char* sRnd, int nLen);
int FileToSha256(LPCWCH sPath, BYTE* pOutHash);
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,596 @@
/*
* A 32-bit implementation for ARIA
*
* follows the specifications given in
* the ARIA specification at
* http://www.nsri.re.kr/ARIA/
*
* Note:
* - Main body optimized for speed for 32 bit platforms
* * Utilizes 32-bit optimization techniques presented in ICISC 2003
* * Only four 32-bit tables are used
*
* - Implemented some ideas for optimization from the creators of ARIA,
* and adopted some ideas from works submitted to ARIA implementation contest on Aug. 2004.
*
* - Handles endian problem pretty well.
* * For optimization, for little endian architecture key setup functions return
* endian-reversed round keys; Crypt() function handles this correctly.
*
* 17, January 2005
* Aaram Yun
* National Security Research Institute, KOREA
*
* Substantial portion of the code originally written by Jin Hong.
*
*/
#include "stdio.h"
#include "aria.h"
/* 사용 플랫폼의 endian 특성에 따라 LITTLE_ENDIAN 혹은
* BIG_ENDIAN .
* Windows+Intel LITTLE_ENDIAN이고,
* BIG_ENDIAN입니다.
* . ARIA_test()
* ENDIAN
* . */
#define LITTLE_ENDIAN
//#define BIG_ENDIAN
/*********************************************************/
#ifdef BIG_ENDIAN
#undef LITTLE_ENDIAN
#else
#ifndef LITTLE_ENDIAN
#error In order to compile this, you have to \
define either LITTLE_ENDIAN or BIG_ENDIAN. \
If unsure, try define either of one and run \
checkEndian() function to see if your guess \
is correct.
#endif
#endif
const DWORD KRK[3][4] = {
{0x517cc1b7, 0x27220a94, 0xfe13abe8, 0xfa9a6ee0},
{0x6db14acc, 0x9e21c820, 0xff28b1d5, 0xef5de2b0},
{0xdb92371d, 0x2126e970, 0x03249775, 0x04e8c90e}
};
/* S-box들을 정의하기 위한 마크로. */
#define AAA(V) 0x ## 00 ## V ## V ## V
#define BBB(V) 0x ## V ## 00 ## V ## V
#define CCC(V) 0x ## V ## V ## 00 ## V
#define DDD(V) 0x ## V ## V ## V ## 00
#define XX(NNN,x0,x1,x2,x3,x4,x5,x6,x7,x8,x9,xa,xb,xc,xd,xe,xf) \
NNN(x0),NNN(x1),NNN(x2),NNN(x3),NNN(x4),NNN(x5),NNN(x6),NNN(x7), \
NNN(x8),NNN(x9),NNN(xa),NNN(xb),NNN(xc),NNN(xd),NNN(xe),NNN(xf)
const DWORD S1[256] = {
XX(AAA,63,7c,77,7b,f2,6b,6f,c5,30,01,67,2b,fe,d7,ab,76),
XX(AAA,ca,82,c9,7d,fa,59,47,f0,ad,d4,a2,af,9c,a4,72,c0),
XX(AAA,b7,fd,93,26,36,3f,f7,cc,34,a5,e5,f1,71,d8,31,15),
XX(AAA,04,c7,23,c3,18,96,05,9a,07,12,80,e2,eb,27,b2,75),
XX(AAA,09,83,2c,1a,1b,6e,5a,a0,52,3b,d6,b3,29,e3,2f,84),
XX(AAA,53,d1,00,ed,20,fc,b1,5b,6a,cb,be,39,4a,4c,58,cf),
XX(AAA,d0,ef,aa,fb,43,4d,33,85,45,f9,02,7f,50,3c,9f,a8),
XX(AAA,51,a3,40,8f,92,9d,38,f5,bc,b6,da,21,10,ff,f3,d2),
XX(AAA,cd,0c,13,ec,5f,97,44,17,c4,a7,7e,3d,64,5d,19,73),
XX(AAA,60,81,4f,dc,22,2a,90,88,46,ee,b8,14,de,5e,0b,db),
XX(AAA,e0,32,3a,0a,49,06,24,5c,c2,d3,ac,62,91,95,e4,79),
XX(AAA,e7,c8,37,6d,8d,d5,4e,a9,6c,56,f4,ea,65,7a,ae,08),
XX(AAA,ba,78,25,2e,1c,a6,b4,c6,e8,dd,74,1f,4b,bd,8b,8a),
XX(AAA,70,3e,b5,66,48,03,f6,0e,61,35,57,b9,86,c1,1d,9e),
XX(AAA,e1,f8,98,11,69,d9,8e,94,9b,1e,87,e9,ce,55,28,df),
XX(AAA,8c,a1,89,0d,bf,e6,42,68,41,99,2d,0f,b0,54,bb,16)
};
const DWORD S2[256] = {
XX(BBB,e2,4e,54,fc,94,c2,4a,cc,62,0d,6a,46,3c,4d,8b,d1),
XX(BBB,5e,fa,64,cb,b4,97,be,2b,bc,77,2e,03,d3,19,59,c1),
XX(BBB,1d,06,41,6b,55,f0,99,69,ea,9c,18,ae,63,df,e7,bb),
XX(BBB,00,73,66,fb,96,4c,85,e4,3a,09,45,aa,0f,ee,10,eb),
XX(BBB,2d,7f,f4,29,ac,cf,ad,91,8d,78,c8,95,f9,2f,ce,cd),
XX(BBB,08,7a,88,38,5c,83,2a,28,47,db,b8,c7,93,a4,12,53),
XX(BBB,ff,87,0e,31,36,21,58,48,01,8e,37,74,32,ca,e9,b1),
XX(BBB,b7,ab,0c,d7,c4,56,42,26,07,98,60,d9,b6,b9,11,40),
XX(BBB,ec,20,8c,bd,a0,c9,84,04,49,23,f1,4f,50,1f,13,dc),
XX(BBB,d8,c0,9e,57,e3,c3,7b,65,3b,02,8f,3e,e8,25,92,e5),
XX(BBB,15,dd,fd,17,a9,bf,d4,9a,7e,c5,39,67,fe,76,9d,43),
XX(BBB,a7,e1,d0,f5,68,f2,1b,34,70,05,a3,8a,d5,79,86,a8),
XX(BBB,30,c6,51,4b,1e,a6,27,f6,35,d2,6e,24,16,82,5f,da),
XX(BBB,e6,75,a2,ef,2c,b2,1c,9f,5d,6f,80,0a,72,44,9b,6c),
XX(BBB,90,0b,5b,33,7d,5a,52,f3,61,a1,f7,b0,d6,3f,7c,6d),
XX(BBB,ed,14,e0,a5,3d,22,b3,f8,89,de,71,1a,af,ba,b5,81)
};
const DWORD X1[256] = {
XX(CCC,52,09,6a,d5,30,36,a5,38,bf,40,a3,9e,81,f3,d7,fb),
XX(CCC,7c,e3,39,82,9b,2f,ff,87,34,8e,43,44,c4,de,e9,cb),
XX(CCC,54,7b,94,32,a6,c2,23,3d,ee,4c,95,0b,42,fa,c3,4e),
XX(CCC,08,2e,a1,66,28,d9,24,b2,76,5b,a2,49,6d,8b,d1,25),
XX(CCC,72,f8,f6,64,86,68,98,16,d4,a4,5c,cc,5d,65,b6,92),
XX(CCC,6c,70,48,50,fd,ed,b9,da,5e,15,46,57,a7,8d,9d,84),
XX(CCC,90,d8,ab,00,8c,bc,d3,0a,f7,e4,58,05,b8,b3,45,06),
XX(CCC,d0,2c,1e,8f,ca,3f,0f,02,c1,af,bd,03,01,13,8a,6b),
XX(CCC,3a,91,11,41,4f,67,dc,ea,97,f2,cf,ce,f0,b4,e6,73),
XX(CCC,96,ac,74,22,e7,ad,35,85,e2,f9,37,e8,1c,75,df,6e),
XX(CCC,47,f1,1a,71,1d,29,c5,89,6f,b7,62,0e,aa,18,be,1b),
XX(CCC,fc,56,3e,4b,c6,d2,79,20,9a,db,c0,fe,78,cd,5a,f4),
XX(CCC,1f,dd,a8,33,88,07,c7,31,b1,12,10,59,27,80,ec,5f),
XX(CCC,60,51,7f,a9,19,b5,4a,0d,2d,e5,7a,9f,93,c9,9c,ef),
XX(CCC,a0,e0,3b,4d,ae,2a,f5,b0,c8,eb,bb,3c,83,53,99,61),
XX(CCC,17,2b,04,7e,ba,77,d6,26,e1,69,14,63,55,21,0c,7d)
};
const DWORD X2[256] = {
XX(DDD,30,68,99,1b,87,b9,21,78,50,39,db,e1,72,09,62,3c),
XX(DDD,3e,7e,5e,8e,f1,a0,cc,a3,2a,1d,fb,b6,d6,20,c4,8d),
XX(DDD,81,65,f5,89,cb,9d,77,c6,57,43,56,17,d4,40,1a,4d),
XX(DDD,c0,63,6c,e3,b7,c8,64,6a,53,aa,38,98,0c,f4,9b,ed),
XX(DDD,7f,22,76,af,dd,3a,0b,58,67,88,06,c3,35,0d,01,8b),
XX(DDD,8c,c2,e6,5f,02,24,75,93,66,1e,e5,e2,54,d8,10,ce),
XX(DDD,7a,e8,08,2c,12,97,32,ab,b4,27,0a,23,df,ef,ca,d9),
XX(DDD,b8,fa,dc,31,6b,d1,ad,19,49,bd,51,96,ee,e4,a8,41),
XX(DDD,da,ff,cd,55,86,36,be,61,52,f8,bb,0e,82,48,69,9a),
XX(DDD,e0,47,9e,5c,04,4b,34,15,79,26,a7,de,29,ae,92,d7),
XX(DDD,84,e9,d2,ba,5d,f3,c5,b0,bf,a4,3b,71,44,46,2b,fc),
XX(DDD,eb,6f,d5,f6,14,fe,7c,70,5a,7d,fd,2f,18,83,16,a5),
XX(DDD,91,1f,05,95,74,a9,c1,5b,4a,85,6d,13,07,4f,4e,45),
XX(DDD,b2,0f,c9,1c,a6,bc,ec,73,90,7b,cf,59,8f,a1,f9,2d),
XX(DDD,f2,b1,00,94,37,9f,d0,2e,9c,6e,28,3f,80,f0,3d,d3),
XX(DDD,25,8a,b5,e7,42,b3,c7,ea,f7,4c,11,33,03,a2,ac,60)
};
/* BY(X, Y)는 DWORD X의 Y번째 바이트
* BRF(T,R) T>>R의 1
* WO(X, Y) BYTE array X를 DWORD array로 Y번째 DWORD
*/
#define BY(X,Y) (((BYTE *)(&X))[Y])
#define BRF(T,R) ((BYTE)((T)>>(R)))
#define WO(X,Y) (((DWORD *)(X))[Y])
/* abcd의 4 BYTEA로 된 DWORD를 dcba로 변환하는 함수 */
#if defined(_MSC_VER)
/* MSC 사용 환경의 경우에는 _lrotr() 함수를
* . */
#define ReverseDWORD(W) { \
(W)=(0xff00ff00 & _lrotr((W), 8)) ^ (0x00ff00ff & _lrotl((W), 8)); \
}
#else
#define ReverseDWORD(W) { \
(W)=(W)<<24 ^ (W)>>24 ^ ((W)&0x0000ff00)<<8 ^ ((W)&0x00ff0000)>>8; \
}
#endif
/* BYTEA array를 DWORD에 싣는 함수. LITTLE_ENDIAN의 경우
* . */
#ifdef LITTLE_ENDIAN
#define WordLoad(ORIG, DEST) { \
DWORD ___t; \
BY(___t,0)=BY(ORIG,3); \
BY(___t,1)=BY(ORIG,2); \
BY(___t,2)=BY(ORIG,1); \
BY(___t,3)=BY(ORIG,0); \
DEST=___t; \
}
#else
#define WordLoad(ORIG, DEST) { \
DEST = ORIG; \
}
#endif
#if defined(_MSC_VER)
#undef WordLoad
#define WordLoad(ORIG, DEST) { \
(DEST) = (0xff00ff00 & _lrotr((ORIG), 8)) ^ (0x00ff00ff & _lrotl((ORIG), 8)); \
}
#endif
/* Key XOR Layer */
#define KXL { \
t0^=WO(rk,0); t1^=WO(rk,1); t2^=WO(rk,2); t3^=WO(rk,3); \
rk += 16; \
}
/* S-Box Layer 1 + M 변환 */
#define SBL1_M(T0,T1,T2,T3) { \
T0=S1[BRF(T0,24)]^S2[BRF(T0,16)]^X1[BRF(T0,8)]^X2[BRF(T0,0)]; \
T1=S1[BRF(T1,24)]^S2[BRF(T1,16)]^X1[BRF(T1,8)]^X2[BRF(T1,0)]; \
T2=S1[BRF(T2,24)]^S2[BRF(T2,16)]^X1[BRF(T2,8)]^X2[BRF(T2,0)]; \
T3=S1[BRF(T3,24)]^S2[BRF(T3,16)]^X1[BRF(T3,8)]^X2[BRF(T3,0)]; \
}
/* S-Box Layer 2 + M 변환 */
#define SBL2_M(T0,T1,T2,T3) { \
T0=X1[BRF(T0,24)]^X2[BRF(T0,16)]^S1[BRF(T0,8)]^S2[BRF(T0,0)]; \
T1=X1[BRF(T1,24)]^X2[BRF(T1,16)]^S1[BRF(T1,8)]^S2[BRF(T1,0)]; \
T2=X1[BRF(T2,24)]^X2[BRF(T2,16)]^S1[BRF(T2,8)]^S2[BRF(T2,0)]; \
T3=X1[BRF(T3,24)]^X2[BRF(T3,16)]^S1[BRF(T3,8)]^S2[BRF(T3,0)]; \
}
/* 워드 단위의 변환 */
#define MM(T0,T1,T2,T3) { \
(T1)^=(T2); (T2)^=(T3); (T0)^=(T1); \
(T3)^=(T1); (T2)^=(T0); (T1)^=(T2); \
}
/* P 변환. 확산 계층의 중간에 들어가는 바이트 단위 변환이다.
* endian과 . */
#if defined(_MSC_VER)
#define P(T0,T1,T2,T3) { \
(T1) = (((T1)<< 8)&0xff00ff00) ^ (((T1)>> 8)&0x00ff00ff); \
(T2) = _lrotr((T2),16); \
ReverseDWORD((T3)); \
}
#else
#define P(T0,T1,T2,T3) { \
(T1) = (((T1)<< 8)&0xff00ff00) ^ (((T1)>> 8)&0x00ff00ff); \
(T2) = (((T2)<<16)&0xffff0000) ^ (((T2)>>16)&0x0000ffff); \
ReverseDWORD((T3)); \
}
#endif
/* FO: 홀수번째 라운드의 F 함수
* FE: F
* MM과 P는 endian에 ,
* endian . , SBLi_M은 LITTLE_ENDIAN에서
* DWORD endian을 .
* , FO, FE는 BIG_ENDIAN ARIA spec과 ,
* LITTLE_ENDIAN ARIA spec에서 +endian
* . */
#define FO {SBL1_M(t0,t1,t2,t3) MM(t0,t1,t2,t3) P(t0,t1,t2,t3) MM(t0,t1,t2,t3)}
#define FE {SBL2_M(t0,t1,t2,t3) MM(t0,t1,t2,t3) P(t2,t3,t0,t1) MM(t0,t1,t2,t3)}
/* n-bit right shift of Y XORed to X */
/* DWORD 단위로 정의된 블록에서의 회전 + XOR이다. */
#define GSRK(X, Y, n) { \
q = 4-((n)/32); \
r = (n) % 32; \
WO(rk,0) = ((X)[0]) ^ (((Y)[(q )%4])>>r) ^ (((Y)[(q+3)%4])<<(32-r)); \
WO(rk,1) = ((X)[1]) ^ (((Y)[(q+1)%4])>>r) ^ (((Y)[(q )%4])<<(32-r)); \
WO(rk,2) = ((X)[2]) ^ (((Y)[(q+2)%4])>>r) ^ (((Y)[(q+1)%4])<<(32-r)); \
WO(rk,3) = ((X)[3]) ^ (((Y)[(q+3)%4])>>r) ^ (((Y)[(q+2)%4])<<(32-r)); \
rk += 16; \
}
/* DecKeySetup()에서 사용하는 마크로 */
#if defined(_MSC_VER)
#define WordM1(X,Y) { \
w=_lrotr((X), 8); \
(Y)=w^_lrotr((X)^w, 16); \
}
#else
#define DWORDM1(X,Y) { \
Y=(X)<<8 ^ (X)>>8 ^ (X)<<16 ^ (X)>>16 ^ (X)<<24 ^ (X)>>24; \
}
#endif
/* 암호화 함수.
* const BYTE *i:
* int Nr:
* const BYTE *rk:
* BYTE *o:
*/
void Crypt(const BYTE* i, int Nr, const BYTE* rk, BYTE* o)
{
register DWORD t0, t1, t2, t3;
WordLoad(WO(i, 0), t0); WordLoad(WO(i, 1), t1);
WordLoad(WO(i, 2), t2); WordLoad(WO(i, 3), t3);
if (Nr > 12) { KXL FO KXL FE }
if (Nr > 14) { KXL FO KXL FE }
KXL FO KXL FE KXL FO KXL FE KXL FO KXL FE
KXL FO KXL FE KXL FO KXL FE KXL FO KXL
/* 최종 라운드는 특별함 */
#ifdef LITTLE_ENDIAN
o[0] = (BYTE)(X1[BRF(t0, 24)]) ^ rk[3];
o[1] = (BYTE)(X2[BRF(t0, 16)] >> 8) ^ rk[2];
o[2] = (BYTE)(S1[BRF(t0, 8)]) ^ rk[1];
o[3] = (BYTE)(S2[BRF(t0, 0)]) ^ rk[0];
o[4] = (BYTE)(X1[BRF(t1, 24)]) ^ rk[7];
o[5] = (BYTE)(X2[BRF(t1, 16)] >> 8) ^ rk[6];
o[6] = (BYTE)(S1[BRF(t1, 8)]) ^ rk[5];
o[7] = (BYTE)(S2[BRF(t1, 0)]) ^ rk[4];
o[8] = (BYTE)(X1[BRF(t2, 24)]) ^ rk[11];
o[9] = (BYTE)(X2[BRF(t2, 16)] >> 8) ^ rk[10];
o[10] = (BYTE)(S1[BRF(t2, 8)]) ^ rk[9];
o[11] = (BYTE)(S2[BRF(t2, 0)]) ^ rk[8];
o[12] = (BYTE)(X1[BRF(t3, 24)]) ^ rk[15];
o[13] = (BYTE)(X2[BRF(t3, 16)] >> 8) ^ rk[14];
o[14] = (BYTE)(S1[BRF(t3, 8)]) ^ rk[13];
o[15] = (BYTE)(S2[BRF(t3, 0)]) ^ rk[12];
#else
o[0] = (BYTE)(X1[BRF(t0, 24)]);
o[1] = (BYTE)(X2[BRF(t0, 16)] >> 8);
o[2] = (BYTE)(S1[BRF(t0, 8)]);
o[3] = (BYTE)(S2[BRF(t0, 0)]);
o[4] = (BYTE)(X1[BRF(t1, 24)]);
o[5] = (BYTE)(X2[BRF(t1, 16)] >> 8);
o[6] = (BYTE)(S1[BRF(t1, 8)]);
o[7] = (BYTE)(S2[BRF(t1, 0)]);
o[8] = (BYTE)(X1[BRF(t2, 24)]);
o[9] = (BYTE)(X2[BRF(t2, 16)] >> 8);
o[10] = (BYTE)(S1[BRF(t2, 8)]);
o[11] = (BYTE)(S2[BRF(t2, 0)]);
o[12] = (BYTE)(X1[BRF(t3, 24)]);
o[13] = (BYTE)(X2[BRF(t3, 16)] >> 8);
o[14] = (BYTE)(S1[BRF(t3, 8)]);
o[15] = (BYTE)(S2[BRF(t3, 0)]);
WO(o, 0) ^= WO(rk, 0); WO(o, 1) ^= WO(rk, 1);
WO(o, 2) ^= WO(rk, 2); WO(o, 3) ^= WO(rk, 3);
#endif
}
/* 암호화 라운드 키 생성
* const BYTE *mk:
* BYTE *rk:
* int keyBits:
*/
int EncKeySetup(const BYTE* mk, BYTE* rk, int keyBits)
{
register DWORD t0, t1, t2, t3;
DWORD w0[4], w1[4], w2[4], w3[4];
int q, r;
WordLoad(WO(mk, 0), w0[0]); WordLoad(WO(mk, 1), w0[1]);
WordLoad(WO(mk, 2), w0[2]); WordLoad(WO(mk, 3), w0[3]);
q = (keyBits - 128) / 64;
t0 = w0[0] ^ KRK[q][0]; t1 = w0[1] ^ KRK[q][1];
t2 = w0[2] ^ KRK[q][2]; t3 = w0[3] ^ KRK[q][3];
FO;
if (keyBits > 128)
{
WordLoad(WO(mk, 4), w1[0]);
WordLoad(WO(mk, 5), w1[1]);
if (keyBits > 192)
{
WordLoad(WO(mk, 6), w1[2]);
WordLoad(WO(mk, 7), w1[3]);
}
else
{
w1[2] = w1[3] = 0;
}
}
else
{
w1[0] = w1[1] = w1[2] = w1[3] = 0;
}
w1[0] ^= t0; w1[1] ^= t1; w1[2] ^= t2; w1[3] ^= t3;
t0 = w1[0]; t1 = w1[1]; t2 = w1[2]; t3 = w1[3];
q = (q == 2) ? 0 : (q + 1);
t0 ^= KRK[q][0]; t1 ^= KRK[q][1]; t2 ^= KRK[q][2]; t3 ^= KRK[q][3];
FE;
t0 ^= w0[0]; t1 ^= w0[1]; t2 ^= w0[2]; t3 ^= w0[3];
w2[0] = t0; w2[1] = t1; w2[2] = t2; w2[3] = t3;
q = (q == 2) ? 0 : (q + 1);
t0 ^= KRK[q][0]; t1 ^= KRK[q][1]; t2 ^= KRK[q][2]; t3 ^= KRK[q][3];
FO;
w3[0] = t0 ^ w1[0]; w3[1] = t1 ^ w1[1]; w3[2] = t2 ^ w1[2]; w3[3] = t3 ^ w1[3];
GSRK(w0, w1, 19);
GSRK(w1, w2, 19);
GSRK(w2, w3, 19);
GSRK(w3, w0, 19);
GSRK(w0, w1, 31);
GSRK(w1, w2, 31);
GSRK(w2, w3, 31);
GSRK(w3, w0, 31);
GSRK(w0, w1, 67);
GSRK(w1, w2, 67);
GSRK(w2, w3, 67);
GSRK(w3, w0, 67);
GSRK(w0, w1, 97);
if (keyBits > 128)
{
GSRK(w1, w2, 97);
GSRK(w2, w3, 97);
}
if (keyBits > 192)
{
GSRK(w3, w0, 97);
GSRK(w0, w1, 109);
}
return (keyBits + 256) / 32;
}
/* 복호화 라운드 키 생성
* const BYTE *mk:
* BYTE *rk:
* int keyBits:
*/
int DecKeySetup(const BYTE* mk, BYTE* rk, int keyBits)
{
DWORD* a, * z;
int rValue;
#if defined(_MSC_VER)
register DWORD w;
#else
register BYTEA sum;
#endif
register DWORD t0, t1, t2, t3;
DWORD s0, s1, s2, s3;
rValue = EncKeySetup(mk, rk, keyBits);
a = (DWORD*)(rk); z = a + rValue * 4;
t0 = a[0]; t1 = a[1]; t2 = a[2]; t3 = a[3];
a[0] = z[0]; a[1] = z[1]; a[2] = z[2]; a[3] = z[3];
z[0] = t0; z[1] = t1; z[2] = t2; z[3] = t3;
a += 4; z -= 4;
for (; a < z; a += 4, z -= 4)
{
WordM1(a[0], t0); WordM1(a[1], t1); WordM1(a[2], t2); WordM1(a[3], t3);
MM(t0, t1, t2, t3) P(t0, t1, t2, t3) MM(t0, t1, t2, t3)
s0 = t0; s1 = t1; s2 = t2; s3 = t3;
WordM1(z[0], t0); WordM1(z[1], t1); WordM1(z[2], t2); WordM1(z[3], t3);
MM(t0, t1, t2, t3) P(t0, t1, t2, t3) MM(t0, t1, t2, t3)
a[0] = t0; a[1] = t1; a[2] = t2; a[3] = t3;
z[0] = s0; z[1] = s1; z[2] = s2; z[3] = s3;
}
WordM1(a[0], t0); WordM1(a[1], t1); WordM1(a[2], t2); WordM1(a[3], t3);
MM(t0, t1, t2, t3) P(t0, t1, t2, t3) MM(t0, t1, t2, t3)
z[0] = t0; z[1] = t1; z[2] = t2; z[3] = t3;
return rValue;
}
void ARIA_Crypt(const BYTE* pIn, BYTE* pOut, int nIn, ARIA_Key* aKey)
{
int i, p;
int n = nIn / 16;
for (i = 0; i < n; i++)
{
p = 16 * i;
Crypt(pIn + p, aKey->nRoundCnt, (BYTE*)&aKey->pRoundKey, pOut + p);
}
}
void ARIA_EncKeySetup(const BYTE* mk, ARIA_Key* aKey, int keyBits)
{
aKey->nRoundCnt = EncKeySetup(mk, (BYTE*)&aKey->pRoundKey, keyBits);
}
void ARIA_DecKeySetup(const BYTE* mk, ARIA_Key* aKey, int keyBits)
{
aKey->nRoundCnt = DecKeySetup(mk, (BYTE*)&aKey->pRoundKey, keyBits);
}
void printBlockOfLength(BYTE* b, int len)
{
int i;
for (i = 0; i < len; i++, b++) {
printf("%02x", *b);
if (i % 4 == 3 && i < len - 1) printf(" ");
}
}
void printBlock(BYTE* b)
{
printBlockOfLength(b, 16);
}
/* ARIA_test(): 기본적인 테스트를 위한 함수로,
*
* .
*
* reference
* .
*/
void ARIA_test()
{
BYTE rk[16 * 17], c[16], * b, mk[32];
int i, flag;
const DWORD NUMBER = 0x00000042;
BYTE p[16] = { 0x11, 0x11, 0x11, 0x11, 0xaa, 0xaa, 0xaa, 0xaa,
0x11, 0x11, 0x11, 0x11, 0xbb, 0xbb, 0xbb, 0xbb };
const BYTE cryptResult[] = {
0x8d, 0x14, 0x70, 0x62, 0x5f, 0x59, 0xeb, 0xac,
0xb0, 0xe5, 0x5b, 0x53, 0x4b, 0x3e, 0x46, 0x2b };
printf("BEGIN testing endianness...\n");
printf("Since you are running this, it means that you have defined \
either LITTLE_ENDIAN or BIG_ENDIAN. Let's see if you were correct.\n");
b = (BYTE*)(&NUMBER);
if (b[0] == 0x42) {
printf("We are on LITTLE_ENDIAN platform.\n");
#ifdef BIG_ENDIAN
printf("WARNING: BIG_ENDIAN defined on LITTLE_ENDIAN platform.\n");
printf(" You should define LITTLE_ENDIAN instead of BIG_ENDIAN.\n");
#else
printf("Okay. You were correct.\n");
#endif
}
else {
printf("We are on BIG_ENDIAN platform.\n");
#ifdef LITTLE_ENDIAN
printf("WARNING: LITTLE_ENDIAN defined on BIG_ENDIAN platform.\n");
printf(" You should define BIG_ENDIAN instead of LITTLE_ENDIAN.\n");
#else
printf("Okay. You were correct.\n");
#endif
}
printf("END testing endianness.\n\n");
for (i = 0; i < 16; i++)
mk[i] = i * 0x11;
for (i = 16; i < 24; i++)
mk[i] = (i - 16) * 0x11;
Crypt(p, EncKeySetup(mk, rk, 192), rk, c);
printf("BEGIN testing basic encryption...\n");
printf("Testing whether the encryption would come out correctly, for 14-round ARIA.\n");
printf("key : "); printBlockOfLength(mk, 24); printf("\n");
printf("plaintext: "); printBlock(p); printf("\n");
printf("result is: "); printBlock(c); printf("\n");
printf("should be: "); printBlock((BYTE*)cryptResult); printf("\n");
flag = 0;
for (i = 0; i < 16; i++)
if (c[i] != cryptResult[i])
flag = 1;
if (flag == 1)
printf("The result is incorrect!\n");
else
printf("Okay. The result is correct.\n");
printf("END testing basic encryption.\n\n");
for (i = 0; i < 32; i++)
mk[i] = 0;
for (i = 0; i < 16; i++)
p[i] = 0;
printf("BEGIN testing the roundtrip...\n");
printf("For key size of 192 bits, starting with the zero plaintext and the zero key, let's see if \
we may recover the plaintext by decrypting the encrypted ciphertext.\n");
EncKeySetup(mk, rk, 192);
printf("plaintext : "); printBlock(p); printf("\n");
Crypt(p, 14, rk, c);
printf("ciphertext: "); printBlock(c); printf("\n");
DecKeySetup(mk, rk, 192);
Crypt(c, 14, rk, p);
printf("decrypted : "); printBlock(p); printf("\n");
flag = 0;
for (i = 0; i < 16; i++)
if (p[i] != 0)
flag = 1;
if (flag == 1)
printf("The result is incorrect!\n");
else
printf("Okay. The result is correct.\n");
printf("END testing the roundtrip.\n");
return;
}
/*
int main(int argc, char **argv) {
ARIA_test();
return 0;
}
*/

View File

@ -0,0 +1,31 @@
#ifndef __ARIA_H__
#define __ARIA_H__
#include "stdlib.h"
#include "BSDefine.h"
typedef struct _ARIA_Key
{
int nRoundCnt;
BYTE pRoundKey[16*17];
} ARIA_Key, *PARIA_Key;
#ifdef __cplusplus
extern "C" {
#endif
void Crypt(const BYTE *i, int Nr, const BYTE *rk, BYTE *o);
int EncKeySetup(const BYTE *mk, BYTE *rk, int keyBits);
int DecKeySetup(const BYTE *mk, BYTE *rk, int keyBits);
void ARIA_Crypt(const BYTE* pIn, BYTE* pOut, int nIn, ARIA_Key* aria_key);
void ARIA_EncKeySetup(const BYTE *mk, ARIA_Key* aria_key, int keyBits);
void ARIA_DecKeySetup(const BYTE *mk, ARIA_Key* aria_key, int keyBits);
__declspec(dllexport) void ARIA_test();
#ifdef __cplusplus
}
#endif
#endif

View File

@ -0,0 +1,158 @@
/*********************************************************************
* Filename: sha256.c
* Author: Brad Conte (brad AT bradconte.com)
* Copyright:
* Disclaimer: This code is presented "as is" without any guarantees.
* Details: Implementation of the SHA-256 hashing algorithm.
SHA-256 is one of the three algorithms in the SHA2
specification. The others, SHA-384 and SHA-512, are not
offered in this implementation.
Algorithm specification can be found here:
* http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf
This implementation uses little endian byte order.
*********************************************************************/
/*************************** HEADER FILES ***************************/
#include <stdlib.h>
#include <memory.h>
#include "sha256.h"
/****************************** MACROS ******************************/
#define ROTLEFT(a,b) (((a) << (b)) | ((a) >> (32-(b))))
#define ROTRIGHT(a,b) (((a) >> (b)) | ((a) << (32-(b))))
#define CH(x,y,z) (((x) & (y)) ^ (~(x) & (z)))
#define MAJ(x,y,z) (((x) & (y)) ^ ((x) & (z)) ^ ((y) & (z)))
#define EP0(x) (ROTRIGHT(x,2) ^ ROTRIGHT(x,13) ^ ROTRIGHT(x,22))
#define EP1(x) (ROTRIGHT(x,6) ^ ROTRIGHT(x,11) ^ ROTRIGHT(x,25))
#define SIG0(x) (ROTRIGHT(x,7) ^ ROTRIGHT(x,18) ^ ((x) >> 3))
#define SIG1(x) (ROTRIGHT(x,17) ^ ROTRIGHT(x,19) ^ ((x) >> 10))
/**************************** VARIABLES *****************************/
static const WORD k[64] = {
0x428a2f98,0x71374491,0xb5c0fbcf,0xe9b5dba5,0x3956c25b,0x59f111f1,0x923f82a4,0xab1c5ed5,
0xd807aa98,0x12835b01,0x243185be,0x550c7dc3,0x72be5d74,0x80deb1fe,0x9bdc06a7,0xc19bf174,
0xe49b69c1,0xefbe4786,0x0fc19dc6,0x240ca1cc,0x2de92c6f,0x4a7484aa,0x5cb0a9dc,0x76f988da,
0x983e5152,0xa831c66d,0xb00327c8,0xbf597fc7,0xc6e00bf3,0xd5a79147,0x06ca6351,0x14292967,
0x27b70a85,0x2e1b2138,0x4d2c6dfc,0x53380d13,0x650a7354,0x766a0abb,0x81c2c92e,0x92722c85,
0xa2bfe8a1,0xa81a664b,0xc24b8b70,0xc76c51a3,0xd192e819,0xd6990624,0xf40e3585,0x106aa070,
0x19a4c116,0x1e376c08,0x2748774c,0x34b0bcb5,0x391c0cb3,0x4ed8aa4a,0x5b9cca4f,0x682e6ff3,
0x748f82ee,0x78a5636f,0x84c87814,0x8cc70208,0x90befffa,0xa4506ceb,0xbef9a3f7,0xc67178f2
};
/*********************** FUNCTION DEFINITIONS ***********************/
void sha256_transform(SHA256_CTX *ctx, const BYTE data[])
{
WORD a, b, c, d, e, f, g, h, i, j, t1, t2, m[64];
for (i = 0, j = 0; i < 16; ++i, j += 4)
m[i] = (data[j] << 24) | (data[j + 1] << 16) | (data[j + 2] << 8) | (data[j + 3]);
for ( ; i < 64; ++i)
m[i] = SIG1(m[i - 2]) + m[i - 7] + SIG0(m[i - 15]) + m[i - 16];
a = ctx->state[0];
b = ctx->state[1];
c = ctx->state[2];
d = ctx->state[3];
e = ctx->state[4];
f = ctx->state[5];
g = ctx->state[6];
h = ctx->state[7];
for (i = 0; i < 64; ++i) {
t1 = h + EP1(e) + CH(e,f,g) + k[i] + m[i];
t2 = EP0(a) + MAJ(a,b,c);
h = g;
g = f;
f = e;
e = d + t1;
d = c;
c = b;
b = a;
a = t1 + t2;
}
ctx->state[0] += a;
ctx->state[1] += b;
ctx->state[2] += c;
ctx->state[3] += d;
ctx->state[4] += e;
ctx->state[5] += f;
ctx->state[6] += g;
ctx->state[7] += h;
}
void sha256_init(SHA256_CTX *ctx)
{
ctx->datalen = 0;
ctx->bitlen = 0;
ctx->state[0] = 0x6a09e667;
ctx->state[1] = 0xbb67ae85;
ctx->state[2] = 0x3c6ef372;
ctx->state[3] = 0xa54ff53a;
ctx->state[4] = 0x510e527f;
ctx->state[5] = 0x9b05688c;
ctx->state[6] = 0x1f83d9ab;
ctx->state[7] = 0x5be0cd19;
}
void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len)
{
WORD i;
for (i = 0; i < len; ++i) {
ctx->data[ctx->datalen] = data[i];
ctx->datalen++;
if (ctx->datalen == 64) {
sha256_transform(ctx, ctx->data);
ctx->bitlen += 512;
ctx->datalen = 0;
}
}
}
void sha256_final(SHA256_CTX *ctx, BYTE hash[])
{
WORD i;
i = ctx->datalen;
// Pad whatever data is left in the buffer.
if (ctx->datalen < 56) {
ctx->data[i++] = 0x80;
while (i < 56)
ctx->data[i++] = 0x00;
}
else {
ctx->data[i++] = 0x80;
while (i < 64)
ctx->data[i++] = 0x00;
sha256_transform(ctx, ctx->data);
memset(ctx->data, 0, 56);
}
// Append to the padding the total message's length in bits and transform.
ctx->bitlen += ctx->datalen * 8;
ctx->data[63] = ctx->bitlen;
ctx->data[62] = ctx->bitlen >> 8;
ctx->data[61] = ctx->bitlen >> 16;
ctx->data[60] = ctx->bitlen >> 24;
ctx->data[59] = ctx->bitlen >> 32;
ctx->data[58] = ctx->bitlen >> 40;
ctx->data[57] = ctx->bitlen >> 48;
ctx->data[56] = ctx->bitlen >> 56;
sha256_transform(ctx, ctx->data);
// Since this implementation uses little endian byte ordering and SHA uses big endian,
// reverse all the bytes when copying the final state to the output hash.
for (i = 0; i < 4; ++i) {
hash[i] = (ctx->state[0] >> (24 - i * 8)) & 0x000000ff;
hash[i + 4] = (ctx->state[1] >> (24 - i * 8)) & 0x000000ff;
hash[i + 8] = (ctx->state[2] >> (24 - i * 8)) & 0x000000ff;
hash[i + 12] = (ctx->state[3] >> (24 - i * 8)) & 0x000000ff;
hash[i + 16] = (ctx->state[4] >> (24 - i * 8)) & 0x000000ff;
hash[i + 20] = (ctx->state[5] >> (24 - i * 8)) & 0x000000ff;
hash[i + 24] = (ctx->state[6] >> (24 - i * 8)) & 0x000000ff;
hash[i + 28] = (ctx->state[7] >> (24 - i * 8)) & 0x000000ff;
}
}

View File

@ -0,0 +1,42 @@
/*********************************************************************
* Filename: sha256.h
* Author: Brad Conte (brad AT bradconte.com)
* Copyright:
* Disclaimer: This code is presented "as is" without any guarantees.
* Details: Defines the API for the corresponding SHA1 implementation.
*********************************************************************/
#ifndef SHA256_H
#define SHA256_H
/*************************** HEADER FILES ***************************/
#include "stddef.h"
/****************************** MACROS ******************************/
#define SHA256_BLOCK_SIZE 32 // SHA256 outputs a 32 byte digest
/**************************** DATA TYPES ****************************/
typedef unsigned char BYTE; // 8-bit byte
typedef unsigned int WORD; // 32-bit word, change to "long" for 16-bit machines
typedef struct {
BYTE data[64];
WORD datalen;
unsigned long long bitlen;
WORD state[8];
} SHA256_CTX;
/*********************** FUNCTION DECLARATIONS **********************/
#ifdef __cplusplus
extern "C" {
#endif
void sha256_init(SHA256_CTX *ctx);
void sha256_update(SHA256_CTX *ctx, const BYTE data[], size_t len);
void sha256_final(SHA256_CTX *ctx, BYTE hash[]);
#ifdef __cplusplus
}
#endif
#endif // SHA256_H

View File

@ -0,0 +1,63 @@
/*********************************************************************
* Filename: sha256.c
* Author: Brad Conte (brad AT bradconte.com)
* Copyright:
* Disclaimer: This code is presented "as is" without any guarantees.
* Details: Performs known-answer tests on the corresponding SHA1
implementation. These tests do not encompass the full
range of available test vectors, however, if the tests
pass it is very, very likely that the code is correct
and was compiled properly. This code also serves as
example usage of the functions.
*********************************************************************/
/*************************** HEADER FILES ***************************/
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include "sha256.h"
/*********************** FUNCTION DEFINITIONS ***********************/
int sha256_test()
{
BYTE text1[] = {"abc"};
BYTE text2[] = {"abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq"};
BYTE text3[] = {"aaaaaaaaaa"};
BYTE hash1[SHA256_BLOCK_SIZE] = {0xba,0x78,0x16,0xbf,0x8f,0x01,0xcf,0xea,0x41,0x41,0x40,0xde,0x5d,0xae,0x22,0x23,
0xb0,0x03,0x61,0xa3,0x96,0x17,0x7a,0x9c,0xb4,0x10,0xff,0x61,0xf2,0x00,0x15,0xad};
BYTE hash2[SHA256_BLOCK_SIZE] = {0x24,0x8d,0x6a,0x61,0xd2,0x06,0x38,0xb8,0xe5,0xc0,0x26,0x93,0x0c,0x3e,0x60,0x39,
0xa3,0x3c,0xe4,0x59,0x64,0xff,0x21,0x67,0xf6,0xec,0xed,0xd4,0x19,0xdb,0x06,0xc1};
BYTE hash3[SHA256_BLOCK_SIZE] = {0xcd,0xc7,0x6e,0x5c,0x99,0x14,0xfb,0x92,0x81,0xa1,0xc7,0xe2,0x84,0xd7,0x3e,0x67,
0xf1,0x80,0x9a,0x48,0xa4,0x97,0x20,0x0e,0x04,0x6d,0x39,0xcc,0xc7,0x11,0x2c,0xd0};
BYTE buf[SHA256_BLOCK_SIZE];
SHA256_CTX ctx;
int idx;
int pass = 1;
sha256_init(&ctx);
sha256_update(&ctx, text1, strlen((char*)text1));
sha256_final(&ctx, buf);
pass = pass && !memcmp(hash1, buf, SHA256_BLOCK_SIZE);
sha256_init(&ctx);
sha256_update(&ctx, text2, strlen((char*)text2));
sha256_final(&ctx, buf);
pass = pass && !memcmp(hash2, buf, SHA256_BLOCK_SIZE);
sha256_init(&ctx);
for (idx = 0; idx < 100000; ++idx)
sha256_update(&ctx, text3, strlen((char*)text3));
sha256_final(&ctx, buf);
pass = pass && !memcmp(hash3, buf, SHA256_BLOCK_SIZE);
return(pass);
}
/*
int main()
{
printf("SHA-256 tests: %s\n", sha256_test() ? "SUCCEEDED" : "FAILED");
return(0);
}
*/

View File

@ -0,0 +1,622 @@
/*
*
* Copyright (c) Microsoft Corporation.
* All rights reserved.
*
* This code is licensed under the MIT License.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files(the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions :
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.InformationProtection.File;
using Microsoft.InformationProtection.Exceptions;
using Microsoft.InformationProtection;
using System.Configuration;
using static BSOneMip.Define;
using Microsoft.InformationProtection.Protection;
using Microsoft.InformationProtection.Policy.Actions;
namespace BSOneMip
{
/// <summary>
/// Action class implements the various MIP functionality.
/// For this sample, only profile, engine, and handler creation are defined.
/// The IFileHandler may be used to label a file and read a labeled file.
/// </summary>
public class Action : IDisposable
{
// Fetch tenant name to build identity for service principal
private static readonly string tenant = TENANT_ID; // ConfigurationManager.AppSettings["ida:Tenant"];
private AuthDelegateImplementation authDelegate;
private ApplicationInfo appInfo;
private IFileProfile profile;
private IFileEngine engine;
//private IProtectionProfile profile_protec;
//private IProtectionEngine engine_protec;
private MipContext mipContext;
private string sDelegatedUserEmail_;
private string sEmpNo_;
// Used to pass in options for labeling the file.
public struct FileOptions
{
public string FileName;
public string OutputName;
public string LabelId;
public DataState DataState;
public AssignmentMethod AssignmentMethod;
public ActionSource ActionSource;
public bool IsAuditDiscoveryEnabled;
public bool GenerateChangeAuditEvent;
}
/// <summary>
/// Constructor for Action class. Pass in AppInfo to simplify passing settings to AuthDelegate.
/// </summary>
/// <param name="appInfo"></param>
public Action(ApplicationInfo appInfo, string sDelegatedUserEmail = "")
{
this.appInfo = appInfo;
this.sDelegatedUserEmail_ = sDelegatedUserEmail;
this.sEmpNo_ = sDelegatedUserEmail_;
int i = this.sEmpNo_.IndexOf('@');
if (i > 0)
this.sEmpNo_ = this.sEmpNo_.Substring(0, i);
if ((sEmpNo_ != "") && (sEmpNo_.ToLower() == "bsowner"))
sDelegatedUserEmail_ = "";
//sDelegatedUserEmail_ = "aiptest@unitus.co.kr";
//sDelegatedUserEmail_ = "kjkim@tocsgm365.onmicrosoft.com";
authDelegate = new AuthDelegateImplementation(this.appInfo);
// Initialize SDK DLLs. If DLLs are missing or wrong type, this will throw an exception
MIP.Initialize(MipComponent.File);
// Create MipConfiguration Object
MipConfiguration mipConfiguration = new MipConfiguration(appInfo, "mip_data", LogLevel.Trace, false);
// Create MipContext using MipConfiguration
mipContext = MIP.CreateMipContext(mipConfiguration);
// We must construct a service principal identity mail address as it can't be fetched from the token.
// Here, we set it to be ClientId@Tenant.com, but the SDK will accept any properly formatted email address.
Identity id = new Identity(String.Format("{0}@{1}", appInfo.ApplicationId, tenant))
//Identity id = new Identity("kjkim@kku97.onmicrosoft.com")
//Identity id = new Identity("2323308@hec.co.kr")
{
// Use this if you want the app to protect on behalf of a user. That user owns the protected content.
//Email = "2323308@hec.co.kr"
};
// Create profile.
profile = CreateFileProfile(appInfo, ref authDelegate);
// Create engine providing Identity from authDelegate to assist with service discovery.
engine = CreateFileEngine(id);
//profile_protec = CreateProtectionProfile(appInfo, ref authDelegate);
//engine_protec = CreateProtectionEngine(id);
}
/// <summary>
/// Null refs to engine and profile and release all MIP resources.
/// </summary>
public void Dispose()
{
profile.UnloadEngineAsync(engine.Settings.EngineId).Wait();
//profile_protec.Dispose();
//engine_protec.Dispose();
engine.Dispose();
profile.Dispose();
mipContext.ShutDown();
mipContext.Dispose();
}
//public List<TemplateDescriptor> ListTemplates()
//{
// return engine_protec.GetTemplates();
//}
private IProtectionProfile CreateProtectionProfile(ApplicationInfo appInfo, ref AuthDelegateImplementation authDelegate)
{
// Initialize ProtectionProfileSettings
var profileSettings = new ProtectionProfileSettings(mipContext,
CacheStorageType.OnDisk,
new ConsentDelegateImplementation());
// Use MIP.LoadProtectionProfileAsync() providing settings to create IProtectionProfile
// IProtectionProfile is the root of all SDK operations for a given application
var profile = MIP.LoadProtectionProfile(profileSettings);
return profile;
}
//private IProtectionEngine CreateProtectionEngine(Identity identity)
//{
// if (profile_protec == null)
// {
// profile_protec = CreateProtectionProfile(appInfo, ref authDelegate);
// }
// // Create protection engine settings object. Passing in empty string for the first parameter, engine ID, will cause the SDK to generate a GUID.
// // Passing in a email address or other unique value helps to ensure that the cached engine is loaded each time for the same user.
// // Locale settings are supported and should be provided based on the machine locale, particular for client applications.
// var engineSettings = new ProtectionEngineSettings(identity.Email, authDelegate, "", "")
// {
// Identity = identity
// };
// var engine = profile_protec.AddEngine(engineSettings);
// return engine;
//}
/// <summary>
/// Creates an IFileProfile and returns.
/// IFileProfile is the root of all MIP SDK File API operations. Typically only one should be created per app.
/// </summary>
/// <param name="appInfo"></param>
/// <param name="authDelegate"></param>
/// <returns></returns>
private IFileProfile CreateFileProfile(ApplicationInfo appInfo, ref AuthDelegateImplementation authDelegate)
{
// Initialize file profile settings to create/use local state.
var profileSettings = new FileProfileSettings(mipContext, CacheStorageType.OnDiskEncrypted, new ConsentDelegateImplementation());
// Use MIP.LoadFileProfileAsync() providing settings to create IFileProfile.
// IFileProfile is the root of all SDK operations for a given application.
var profile = Task.Run(async () => await MIP.LoadFileProfileAsync(profileSettings)).Result;
return profile;
}
/// <summary>
/// Creates a file engine, associating the engine with the specified identity.
/// File engines are generally created per-user in an application.
/// IFileEngine implements all operations for fetching labels and sensitivity types.
/// IFileHandlers are added to engines to perform labeling operations.
/// </summary>
/// <param name="identity"></param>
/// <returns></returns>
private IFileEngine CreateFileEngine(Identity identity)
{
// If the profile hasn't been created, do that first.
if (profile == null)
{
profile = CreateFileProfile(appInfo, ref authDelegate);
}
// Create file settings object. Passing in empty string for the first parameter, engine ID, will cause the SDK to generate a GUID.
// Locale settings are supported and should be provided based on the machine locale, particular for client applications.
var engineSettings = new FileEngineSettings("", authDelegate, "", "en-US")
{
// Provide the identity for service discovery.
Identity = identity,
DelegatedUserEmail = sDelegatedUserEmail_ // 위임할 계정 정보... 해냈다... 23_1031 kku
};
// Add the IFileEngine to the profile and return.
var engine = Task.Run(async () => await profile.AddEngineAsync(engineSettings)).Result;
return engine;
}
/// <summary>
/// Method creates a file handler and returns to the caller.
/// IFileHandler implements all labeling and protection operations in the File API.
/// </summary>
/// <param name="options">Struct provided to set various options for the handler.</param>
/// <returns></returns>
private IFileHandler CreateFileHandler(FileOptions options)
{
// Create the handler using options from FileOptions. Assumes that the engine was previously created and stored in private engine object.
// There's probably a better way to pass/store the engine, but this is a sample ;)
var handler = Task.Run(async () => await engine.CreateFileHandlerAsync(options.FileName, options.FileName, options.IsAuditDiscoveryEnabled)).Result;
return handler;
}
private IFileHandler CreateFileHandler(string filename)
{
// Create the handler using options from FileOptions. Assumes that the engine was previously created and stored in private engine object.
// There's probably a better way to pass/store the engine, but this is a sample ;)
var handler = Task.Run(async () => await engine.CreateFileHandlerAsync(filename, filename, false)).Result;
return handler;
}
/// <summary>
/// List all labels from the engine and return in IEnumerable<Label>
/// </summary>
/// <returns></returns>
public IEnumerable<Label> ListLabels()
{
// Get labels from the engine and return.
// For a user principal, these will be user specific.
// For a service principal, these may be service specific or global.
return engine.SensitivityLabels;
}
/// <summary>
/// Set the label on the given file.
/// Options for the labeling operation are provided in the FileOptions parameter.
/// </summary>
/// <param name="options">Details about file input, output, label to apply, etc.</param>
/// <returns></returns>
public bool SetLabel(FileOptions options)
{
// The change isn't committed to the file referenced by the handler until CommitAsync() is called.
// Pass the desired output file name in to the CommitAsync() function.
bool result = false;
try
{
RemoveLabel(options);
// LabelingOptions allows us to set the metadata associated with the labeling operations.
// Review the API Spec at https://aka.ms/mipsdkdocs for details
LabelingOptions labelingOptions = new LabelingOptions()
{
AssignmentMethod = options.AssignmentMethod,
IsDowngradeJustified = true,
JustificationMessage = "BSOne"
};
var handler = CreateFileHandler(options);
/////////////////////////////
//List<string> users = new List<string>()
//{
// //USER_ANYONE
// //"aiptest@unitus.co.kr"
//};
//List<string> roles = new List<string>()
//{
// //Microsoft.InformationProtection.Protection.Roles.Viewer, // 사용자 보호해제 금지, 문서 편집, 인쇄, 내보내기, 복사 금지
// //Microsoft.InformationProtection.Protection.Roles.Reviewer // 사용자 보호해제 금지, 문서 편집, 저장 가능, 그외 인쇄, 내보내기, 복사 금지
// //Microsoft.InformationProtection.Protection.Roles.Author // 공동 작성자 - 보기, 편집, 복사, 인쇄
// //Microsoft.InformationProtection.Protection.Roles.CoOwner // 공동 소유자
// "OWNER"
//};
//List<UserRoles> userroles = new List<UserRoles>()
//{
// new UserRoles(users, roles)
//};
//ProtectionDescriptor protectionDescriptor = new ProtectionDescriptor(userroles);
//handler.SetProtection(protectionDescriptor, new ProtectionSettings());
//////////////////////////////
// Use the SetLabel method on the handler, providing label ID and LabelingOptions
// The handler already references a file, so those details aren't needed.
handler.SetLabel(engine.GetLabelById(options.LabelId), labelingOptions, new ProtectionSettings());
//if (bRemoveProctect)
// handler.RemoveProtection();
//handler.DeleteLabel() // 라벨을 설정할 때 (labelingOptions 매개변수를 통해) 작업이 정당화되어야 하는 경우 JustificationRequiredError가 발생합니다.
// Check to see that modifications occurred on the handler. If not, skip commit.
if (handler.IsModified())
{
result = Task.Run(async () => await handler.CommitAsync(options.OutputName)).Result;
}
// If the commit was successful and GenerateChangeAuditEvents is true, call NotifyCommitSuccessful()
if (result && options.GenerateChangeAuditEvent)
{
// Submits and audit event about the labeling action to Azure Information Protection Analytics
handler.NotifyCommitSuccessful(options.FileName);
}
}
catch (Exception ex)
{
Console.WriteLine("Fail .. SetLabel() .. " + ex.Message);
if (ex.InnerException != null)
Console.WriteLine("Fail .. SetLabel() .. 내부 예외 : " + ex.InnerException.Message);
}
return result;
}
public bool RemoveLabel(FileOptions options)
{
// The change isn't committed to the file referenced by the handler until CommitAsync() is called.
// Pass the desired output file name in to the CommitAsync() function.
bool result = false;
try
{
// LabelingOptions allows us to set the metadata associated with the labeling operations.
// Review the API Spec at https://aka.ms/mipsdkdocs for details
LabelingOptions labelingOptions = new LabelingOptions()
{
AssignmentMethod = options.AssignmentMethod,
IsDowngradeJustified = true,
JustificationMessage = "Auto"
};
var handler = CreateFileHandler(options);
handler.DeleteLabel(labelingOptions);
// Check to see that modifications occurred on the handler. If not, skip commit.
if (handler.IsModified())
{
result = Task.Run(async () => await handler.CommitAsync(options.OutputName)).Result;
}
// If the commit was successful and GenerateChangeAuditEvents is true, call NotifyCommitSuccessful()
if (result && options.GenerateChangeAuditEvent)
{
// Submits and audit event about the labeling action to Azure Information Protection Analytics
handler.NotifyCommitSuccessful(options.FileName);
}
}
catch (Exception ex)
{
Console.WriteLine("Fail .. RemoveLabel() .. " + ex.Message);
if (ex.InnerException != null)
Console.WriteLine("Fail .. RemoveLabel() .. 내부 예외 : " + ex.InnerException.Message);
}
return result;
}
public bool SaveLabelList(string sPath)
{
bool result = true;
string sLabelList = "";
try
{
IEnumerable<Label> labels = ListLabels();
foreach (var label in labels)
{
sLabelList += label.Name + "::" + label.Id + "\n";
if (label.Children.Count > 0)
{
foreach (Label child in label.Children)
{
sLabelList += child.Name + "::" + child.Id + "\n";
}
}
}
System.IO.File.WriteAllText(sPath, sLabelList, Encoding.UTF8);
}
catch (Exception ex)
{
Console.WriteLine("Fail .. SetLabel() .. " + ex.Message);
result = false;
if (ex.InnerException != null)
Console.WriteLine("Fail .. SetLabel() .. 내부 예외 : " + ex.InnerException.Message);
}
return result;
}
public bool RemoveProtection(FileOptions options)
{
bool result = false;
try
{
var handler = CreateFileHandler(options);
if (handler.Protection == null)
return result;
handler.RemoveProtection();
//LabelingOptions labelingOptions = new LabelingOptions()
//{
// AssignmentMethod = AssignmentMethod.Privileged
//};
//handler.DeleteLabel(labelingOptions);
if (handler.IsModified())
{
result = Task.Run(async () => await handler.CommitAsync(options.OutputName)).Result;
}
// If the commit was successful and GenerateChangeAuditEvents is true, call NotifyCommitSuccessful()
if (result && options.GenerateChangeAuditEvent)
{
// Submits and audit event about the labeling action to Azure Information Protection Analytics
handler.NotifyCommitSuccessful(options.FileName);
}
}
catch (Exception ex)
{
Console.WriteLine("Fail .. RemoveProtection() .. " + ex.Message);
if (ex.InnerException != null)
Console.WriteLine("Fail .. RemoveProtection() .. 내부 예외 : " + ex.InnerException.Message);
}
return result;
}
//public IProtectionHandler CreatePublishingHandler(string templateId)
//{
// ProtectionDescriptor protectionDescriptor = new ProtectionDescriptor(templateId);
// PublishingSettings publishingSettings = new PublishingSettings(protectionDescriptor);
// var protectionHandler = engine_protec.CreateProtectionHandlerForPublishing(publishingSettings);
// return protectionHandler;
//}
public bool IsProtection(string sPath)
{
bool result = false;
try
{
var handler = CreateFileHandler(sPath);
if (handler.Protection == null)
return result;
result = true;
}
catch (Exception ex)
{
Console.WriteLine("Fail .. SetProtection() .. " + ex.Message);
if (ex.InnerException != null)
Console.WriteLine("Fail .. SetProtection() .. 내부 예외 : " + ex.InnerException.Message);
}
return result;
}
public bool SetProtection(FileOptions options)
{
bool result = false;
try
{
var handler = CreateFileHandler(options);
if (handler.Protection != null)
return result;
//ProtectionDescriptor protectionDescriptor = new ProtectionDescriptor("de6d83a0-f18c-4c66-b51c-9fcf8fd32e52");
//handler.SetProtection(protectionDescriptor, new ProtectionSettings());
//handler.SetProtection(CreatePublishingHandler("00000000-0000-0000-0000-000000000000"));
//var protecTemp = CreateFileHandler("C:\\Users\\kku\\Desktop\\MIP-TEST\\새 Microsoft Excel 워크시트 - 복사본_mipProctec.xlsx").Protection;
//Console.WriteLine("UserRights={0}", protecTemp.ProtectionDescriptor.UserRights);
//Console.WriteLine("UserRoles={0}", protecTemp.ProtectionDescriptor.UserRoles);
//Console.WriteLine("TempId={0}", protecTemp.ProtectionDescriptor.TemplateId);
//handler.SetProtection(protecTemp);
List<string> users = new List<string>()
{
USER_ANYONE
//"aiptest@unitus.co.kr"
//sDelegatedUserEmail_
};
List<string> roles = new List<string>()
{
//Microsoft.InformationProtection.Protection.Roles.Viewer, // 사용자 보호해제 금지, 문서 편집, 인쇄, 내보내기, 복사 금지
//Microsoft.InformationProtection.Protection.Roles.Reviewer // 사용자 보호해제 금지, 문서 편집, 저장 가능, 그외 인쇄, 내보내기, 복사 금지
Microsoft.InformationProtection.Protection.Roles.Author // 공동 작성자 - 보기, 편집, 복사, 인쇄
//Microsoft.InformationProtection.Protection.Roles.CoOwner // 공동 소유자
//"OWNER"
};
List<UserRoles> userroles = new List<UserRoles>()
{
new UserRoles(users, roles)
};
ProtectionDescriptor protectionDescriptor = new ProtectionDescriptor(userroles);
handler.SetProtection(protectionDescriptor, new ProtectionSettings());
// Check to see that modifications occurred on the handler. If not, skip commit.
if (handler.IsModified())
{
result = Task.Run(async () => await handler.CommitAsync(options.OutputName)).Result;
}
// If the commit was successful and GenerateChangeAuditEvents is true, call NotifyCommitSuccessful()
if (result && options.GenerateChangeAuditEvent)
{
// Submits and audit event about the labeling action to Azure Information Protection Analytics
handler.NotifyCommitSuccessful(options.FileName);
}
}
//catch (BadInputException ex1)
//{
//Console.WriteLine("Fail .. SetProtection() .. " + ex1.Message);
//}
catch (Exception ex)
{
Console.WriteLine("Fail .. SetProtection() .. " + ex.Message);
if (ex.InnerException != null)
Console.WriteLine("Fail .. SetProtection() .. 내부 예외 : " + ex.InnerException.Message);
}
return result;
}
/// <summary>
/// Read the label from a file provided via FileOptions.
/// </summary>
/// <param name="options"></param>
/// <returns></returns>
public ContentLabel GetLabel(FileOptions options)
{
try
{
var handler = CreateFileHandler(options);
return handler.Label;
}
catch (Exception ex)
{
Console.WriteLine("Fail .. GetLabel() .. " + ex.Message);
if (ex.InnerException != null)
Console.WriteLine("Fail .. GetLabel() .. 내부 예외 : " + ex.InnerException.Message);
return null;
}
}
public string GetOwner(string sPath)
{
string sOwner = "";
try
{
var handler = CreateFileHandler(sPath);
if ((handler != null) && (handler.Protection != null))
sOwner = handler.Protection.Owner;
}
catch (Exception ex)
{
Console.WriteLine("Fail .. GetOwner() .. " + ex.Message);
if (ex.InnerException != null)
Console.WriteLine("Fail .. GetOwner() .. 내부 예외 : " + ex.InnerException.Message);
}
return sOwner;
}
public string GetDelegatedUserEmail()
{
return sDelegatedUserEmail_;
}
public string GetEmpNo()
{
return sEmpNo_;
}
}
}

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8"/>
</startup>
<appSettings>
<add key="ida:ClientId" value="9ad412fe-e47b-43cc-93dc-9844c9b1cc0b"/>
<add key="ida:RedirectUri" value="https://login.microsoftonline.com/common/oauth2/nativeclient"/>
<add key="ida:CertThumbprint" value="0c8a4e4b-adb8-4a20-9329-c79b13563c90"/>
<add key="ida:ClientSecret" value="LAX8Q~owiSpc1hDqTRacZlU.OxABtlV796QPGcif"/>
<!-- change this flag to true if you're doing certificate based auth. False if using client secret. -->
<add key="ida:DoCertAuth" value="false"/>
<!-- Tenant name in format of Contoso.com or contoso.onmicrosot.com -->
<add key="ida:Tenant" value="461c81ec-bcc4-4ebe-a37f-2d9a82c9e560"/>
<!-- Your app name. This name will appear in AIP Analytics logs -->
<add key="app:Name" value="ToCSG-BSOne"/>
<!-- Your app version. This will appear in AIP Analytics logs -->
<add key="app:Version" value="1.0"/>
<add key="ClientSettingsProvider.ServiceUri" value=""/>
</appSettings>
<system.web>
<membership defaultProvider="ClientAuthenticationMembershipProvider">
<providers>
<add name="ClientAuthenticationMembershipProvider" type="System.Web.ClientServices.Providers.ClientFormsAuthenticationMembershipProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri=""/>
</providers>
</membership>
<roleManager defaultProvider="ClientRoleProvider" enabled="true">
<providers>
<add name="ClientRoleProvider" type="System.Web.ClientServices.Providers.ClientRoleProvider, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" serviceUri="" cacheTimeout="86400"/>
</providers>
</roleManager>
</system.web>
</configuration>

View File

@ -0,0 +1,154 @@
/*
*
* Copyright (c) Microsoft Corporation.
* All rights reserved.
*
* This code is licensed under the MIT License.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files(the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions :
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
using System;
using System.Configuration;
using Microsoft.InformationProtection;
using Microsoft.Identity.Client;
using System.Security.Cryptography.X509Certificates;
using System.Linq;
using static BSOneMip.Define;
namespace BSOneMip
{
public class AuthDelegateImplementation : IAuthDelegate
{
// Set the redirect URI from the AAD Application Registration.
private static readonly string redirectUri = REDIRECT_URL; // ConfigurationManager.AppSettings["ida:RedirectUri"];
// Fetch cert thumbprint, appkey, and DoCertAuth flag from app.config
private static readonly string certThumb = APPSECU_ID; // ConfigurationManager.AppSettings["ida:CertThumbprint"];
private static readonly bool doCertAuth = false; // Convert.ToBoolean(ConfigurationManager.AppSettings["ida:DoCertAuth"]);
private static readonly string clientSecret = APPSECU_VAL; // ConfigurationManager.AppSettings["ida:ClientSecret"];
// Fetch tenant name from app.config
// We use the tenant ID to append to the authority, as we need this as a hint to find the correct tenant.
// Using the common endpoint without tenant throws an exception.
private static readonly string tenant = TENANT_ID; // ConfigurationManager.AppSettings["ida:Tenant"];
private ApplicationInfo appInfo;
//private TokenCache tokenCache = new TokenCache();
public AuthDelegateImplementation(ApplicationInfo appInfo)
{
this.appInfo = appInfo;
}
/// <summary>
/// AcquireToken is called by the SDK when auth is required for an operation.
/// Adding or loading an IFileEngine is typically where this will occur first.
/// The SDK provides all three parameters below.Identity from the EngineSettings.
/// Authority and resource are provided from the 401 challenge.
/// The SDK cares only that an OAuth2 token is returned.How it's fetched isn't important.
/// In this sample, we fetch the token using Active Directory Authentication Library(ADAL).
/// </summary>
/// <param name="identity"></param>
/// <param name="authority"></param>
/// <param name="resource"></param>
/// <returns>The OAuth2 token for the user</returns>
public string AcquireToken(Identity identity, string authority, string resource, string claim)
{
string sResult = "";
try
{
// Append tenant to authority and remove common.
if (authority.ToLower().Contains("common"))
{
var authorityUri = new Uri(authority);
authority = String.Format("https://{0}/{1}", authorityUri.Host, tenant);
}
IConfidentialClientApplication app;
if (doCertAuth)
{
//Console.WriteLine("Performing certificate based auth with {0}", certThumb);
Console.WriteLine("Performing certificate based auth with {0}", certThumb);
// Read cert from local machine
var certificate = ReadCertificateFromStore(certThumb);
// Use cert to build ClientAssertionCertificate
app = ConfidentialClientApplicationBuilder.Create(appInfo.ApplicationId)
.WithCertificate(certificate)
.WithRedirectUri(redirectUri)
.Build();
}
else
{
//Console.WriteLine("Performing client secret based auth.");
//Console.WriteLine("[BSOne] AIP 클라이언트 암호 기반 인증 .. 성공");
app = ConfidentialClientApplicationBuilder.Create(appInfo.ApplicationId)
.WithClientSecret(clientSecret)
.WithRedirectUri(redirectUri)
.Build();
}
string[] scopes = new string[] { resource[resource.Length - 1].Equals('/') ? $"{resource}.default" : $"{resource}/.default" };
AuthenticationResult authResult = app.AcquireTokenForClient(scopes)
.WithAuthority(authority)
.ExecuteAsync()
.GetAwaiter()
.GetResult();
// Return the token. The token is sent to the resource.
sResult = authResult.AccessToken;
}
catch (Exception ex)
{
//Console.WriteLine("[BSOne] AIP 클라이언트 암호 기반 인증 .. 실패");
Console.WriteLine("Fail .. AcquireToken() .. " + ex.Message);
}
return sResult;
}
private static X509Certificate2 ReadCertificateFromStore(string thumbprint)
{
X509Certificate2 cert = null;
X509Store store = new X509Store(StoreName.My, StoreLocation.CurrentUser);
store.Open(OpenFlags.ReadOnly);
X509Certificate2Collection certCollection = store.Certificates;
// Find unexpired certificates.
X509Certificate2Collection currentCerts = certCollection.Find(X509FindType.FindByTimeValid, DateTime.Now, false);
// From the collection of unexpired certificates, find the ones with the correct name.
X509Certificate2Collection signingCert = currentCerts.Find(X509FindType.FindByThumbprint, thumbprint, false);
// Return the first certificate in the collection, has the right name and is current.
cert = signingCert.OfType<X509Certificate2>().OrderByDescending(c => c.NotBefore).FirstOrDefault();
store.Close();
return cert;
}
}
}

View File

@ -0,0 +1,176 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{719FA341-B943-409A-886F-C6EA32D526A9}</ProjectGuid>
<OutputType>Exe</OutputType>
<RootNamespace>BSOneMip</RootNamespace>
<AssemblyName>BSOne-AIP-Decrypt</AssemblyName>
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<NuGetPackageImportStamp>
</NuGetPackageImportStamp>
<IsWebBootstrapper>false</IsWebBootstrapper>
<TargetFrameworkProfile />
<PublishUrl>publish\</PublishUrl>
<Install>true</Install>
<InstallFrom>Disk</InstallFrom>
<UpdateEnabled>false</UpdateEnabled>
<UpdateMode>Foreground</UpdateMode>
<UpdateInterval>7</UpdateInterval>
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
<UpdatePeriodically>false</UpdatePeriodically>
<UpdateRequired>false</UpdateRequired>
<MapFileExtensions>true</MapFileExtensions>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<BootstrapperEnabled>true</BootstrapperEnabled>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>TRACE;DEBUG</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.ComponentModel.Composition" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing" />
<Reference Include="System.IdentityModel" />
<Reference Include="System.Web.Extensions" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Action.cs" />
<Compile Include="AuthDelegateImplementation.cs" />
<Compile Include="ConsentDelegateImplementation.cs" />
<Compile Include="Define.cs" />
<Compile Include="MessagePasser.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Program.cs" />
</ItemGroup>
<ItemGroup>
<None Include="App.config">
<SubType>Designer</SubType>
</None>
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
<Visible>False</Visible>
<ProductName>Microsoft .NET Framework 4.6.1%28x86 및 x64%29</ProductName>
<Install>true</Install>
</BootstrapperPackage>
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
<Visible>False</Visible>
<ProductName>.NET Framework 3.5 SP1</ProductName>
<Install>false</Install>
</BootstrapperPackage>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.Identity.Client">
<Version>4.74.1</Version>
</PackageReference>
<PackageReference Include="Microsoft.InformationProtection.File">
<Version>1.17.154</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.3</Version>
</PackageReference>
<PackageReference Include="System.IO">
<Version>4.3.0</Version>
</PackageReference>
<PackageReference Include="System.Net.Http">
<Version>4.3.4</Version>
</PackageReference>
<PackageReference Include="System.Runtime">
<Version>4.3.1</Version>
</PackageReference>
<PackageReference Include="System.Security.Cryptography.Algorithms">
<Version>4.3.1</Version>
</PackageReference>
<PackageReference Include="System.Security.Cryptography.Encoding">
<Version>4.3.0</Version>
</PackageReference>
<PackageReference Include="System.Security.Cryptography.Primitives">
<Version>4.3.0</Version>
</PackageReference>
<PackageReference Include="System.Security.Cryptography.X509Certificates">
<Version>4.3.2</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="MessagePasser.resx">
<DependentUpon>MessagePasser.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@ -0,0 +1,50 @@
/*
*
* Copyright (c) Microsoft Corporation.
* All rights reserved.
*
* This code is licensed under the MIT License.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files(the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions :
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Microsoft.InformationProtection;
namespace BSOneMip
{
/// <summary>
/// Certain SDK operations require that the user consents to the action as it may log PII.
/// IConsentDelegate allows developers to impement a consent flow that meets their application and business requirement.
/// This sample always passes back Consent.Accept, but the user could be presented with options that show them the URL
/// And allow them to accept or reject consent.
/// </summary>
class ConsentDelegateImplementation : IConsentDelegate
{
public Consent GetUserConsent(string url)
{
return Consent.Accept;
}
}
}

View File

@ -0,0 +1,118 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BSOneMip
{
// 인증된 계정 테넌트 정보
// HKEY_CURRENT_USER\SOFTWARE\Microsoft\IdentityCRL\TokenBroker\DefaultAccount
// 예 : u:d8e27a25-fa3b-4f68-8773-c0bc5d68638c.a27ddcc1-bea5-4183-aa29-fd96d7612a1d
// 아래 키의 하위키, 값 정보가 인증 변경 시 변경 되는거 같음...
// HKEY_CURRENT_USER\SOFTWARE\Microsoft\Office\16.0\Common\Identity\ServiceAuthInfoCache
internal class Define
{
public static readonly string APP_NAME = "ToCSG-BSOne";
public static readonly string APP_VER = "1.0";
public static readonly string REDIRECT_URL = "https://login.microsoftonline.com/common/oauth2/nativeclient";
#if _HDENG_
// DEV
//public static readonly string APP_ID = "75881f51-22ca-4217-b66f-70b9b1522707";
//public static readonly string TENANT_ID = "654693fb-be52-4135-af55-739adbc92144";
//public static readonly string APPSECU_ID = "8d2682bd-a9bf-4ac3-bb93-e5a488eeea47"; // 2023-07-17
//public static readonly string APPSECU_VAL = "a.58Q~-BVJFo4z-d-IuMkzQMjKuAUXXDdcK2JbTs";
// HEC - OP, 만료일 : 2025-07-17 (예상)
//public static readonly string APP_ID = "1ea54ecc-b3d1-4892-8c27-57418e667fdb";
//public static readonly string TENANT_ID = "a27ddcc1-bea5-4183-aa29-fd96d7612a1d";
//public static readonly string APPSECU_ID = "c633a238-e3fa-4c3a-a133-7d88fdccbb7c";
//public static readonly string APPSECU_VAL = "2T18Q~bQ_IWsEe7DPS~3B3zKjR1FvyG9jF1kJbTN";
// 기존 암호/비밀ID 값 만료일: 2025.09.03
// HEC - OP, 키 설명: BSOne-EncKey, 만료일: 2027-05-29
public static readonly string APP_ID = "1ea54ecc-b3d1-4892-8c27-57418e667fdb";
public static readonly string TENANT_ID = "a27ddcc1-bea5-4183-aa29-fd96d7612a1d";
public static readonly string APPSECU_ID = "1ccf4dc5-a57d-4712-adec-8001140bb7f8"; // 2027-05-29
public static readonly string APPSECU_VAL = "_F.8Q~M_IqYUnWdTRGF7cor1KRR85Tqa6tq-haDr";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@hec.co.kr";
#elif _HCA_
public static readonly string APP_ID = "e9dc4b6c-8c8f-4133-b0e4-86a8c0fa7509";
public static readonly string TENANT_ID = "54c9f638-105a-4d83-8b7e-f5ea3ed1986f";
public static readonly string APPSECU_ID = "3ca327fa-698a-4b4a-80ee-a027dd8d83f6"; // 2024-11-15
public static readonly string APPSECU_VAL = "Ucb8Q~YFkRT5_Ezy4nosG9WZUw1Xj9jdIOdCdaUs";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@hkmc10.onmcirosoft.com";
//public static readonly string APP_ID = "29fdd0e7-2218-4997-96b8-e786cca199ea";
//public static readonly string TENANT_ID = "458bd810-54c3-4de9-8807-d9555e217e9b";
//public static readonly string APPSECU_ID = "08cc1dd1-4ea7-46fd-a9d0-310876d1f957";
//public static readonly string APPSECU_VAL = "mZp8Q~PMqxLdPSh0tlMkZLs.HX~xxp4jNEXGddbY";
//public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@hmccloud10.onmicrosoft.com";
#elif _HAE_
public static readonly string APP_ID = "71fb6bea-8c43-44ba-94ad-d28e9416da3b";
public static readonly string TENANT_ID = "c3009ee9-85dd-4ecf-a86f-79941767d706";
public static readonly string APPSECU_ID = "9cbb412a-4535-432d-9a85-527bbdefe7de";
public static readonly string APPSECU_VAL = "NAI8Q~_FSGRdrOHV8.KcQJ.ThWRhrOSGsqZcva8r";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@hyundai-autoever.com";
#elif _JUVIS_
public static readonly string APP_ID = "12578a98-0721-4c2a-a972-6ae283be7c5e";
public static readonly string TENANT_ID = "43680acd-ee7e-4213-b458-5f6d31410fd6";
public static readonly string APPSECU_ID = "83da4d12-54a0-4338-9556-2115f5f7a711"; // 2024-02-05
public static readonly string APPSECU_VAL = "1TE8Q~tHdMmTLZd1RZ2pH1pM81EYn9gFJwhBeajt";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@juvis.co.kr";
#elif _UNITUS_
public static readonly string APP_ID = "3cbc5216-b53c-4684-8314-a09832a0470b";
public static readonly string TENANT_ID = "e78533f2-de02-4a1f-9a30-afff5b5505f2";
public static readonly string APPSECU_ID = "3d0a832f-5736-48ae-9f42-8d33d84fdfa7"; // 2024-11-08
public static readonly string APPSECU_VAL = "jIN8Q~sa1USPuvjibMiZl9scD6~cBPTHfoHB_aEI";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@unitus.co.kr";
#elif _MOTRAS_
public static readonly string APP_ID = "1fb1e032-2b4c-4d7d-90cc-18370121e3b9";
public static readonly string TENANT_ID = "b4f65b7e-df81-4527-84be-6552f2220b70";
public static readonly string APPSECU_ID = "d2b249eb-5297-4bae-8e84-2049508de393"; // 2024-11-11
public static readonly string APPSECU_VAL = "Gwt8Q~mxethV1.2w.lKbm7W4_x0IGOco7K_FAc8s";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@motras.co.kr";
#elif _KDNVN_
public static readonly string APP_ID = "f8ff02a8-67b7-4394-9f0c-964a4c5161a1";
public static readonly string TENANT_ID = "7fa15276-5814-4556-87ee-2f791ec559c2";
public static readonly string APPSECU_ID = "a08a5abc-7cc6-4f63-b3e7-9857ae79a896"; // 2024-11-06
public static readonly string APPSECU_VAL = "Fyl8Q~_sTnnrxeFYVuF.ZM9Fpm-QwOcmoRc3~anv";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@kdiwin.com";
#elif _CJOV_GLOBAL_
public static readonly string APP_ID = "57c08dc7-b56f-424f-9f43-bc7e25de872c";
public static readonly string TENANT_ID = "ee6af5c5-684f-4539-9eb6-64793af08027";
public static readonly string APPSECU_ID = "32491836-401f-492e-9596-d37d73b926da"; // 2024-11-28
public static readonly string APPSECU_VAL = "BY88Q~P1kfcsIA2OMpV0jDzmNf_7V2gGleI-wag8";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@cj.net";
#elif _SKEC_
public static readonly string APP_ID = "361ffe36-7592-4247-b13f-1688440dcffe";
public static readonly string TENANT_ID = "43d7489c-57ce-4967-b332-b53a94d66806";
public static readonly string APPSECU_ID = "9692a153-b95a-4071-8753-0cb29c48c29a"; // 2025-07-30 ~ 만료일 2027.07.30
public static readonly string APPSECU_VAL = "e5H8Q~Iy_9w6UQfJ2TBnnaS.gqq9WNoFOMBEIdeH";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@skec.com";
#elif _WHANIN_
public static readonly string APP_ID = "3be6cd5c-e1c0-44e4-a664-d4879a3e6efe";
public static readonly string TENANT_ID = "a2f2a594-d6d7-423d-844e-a0365e16e441";
public static readonly string APPSECU_ID = "0b883d75-13eb-4005-ad38-c8b98bc8a658"; // 2025-11-06 ~ 만료일 2027-11-06
public static readonly string APPSECU_VAL = "ODy8Q~xSfOOAfyw04wFwYqf1n7kmocqUsJhT_a.P";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@whanin.com";
#else
public static readonly string APP_ID = "f46b44f7-ef21-443d-8d30-cb1b6998204f";
public static readonly string TENANT_ID = "ae3cc733-f6a2-4bb8-b7f2-3166de909f4d";
public static readonly string APPSECU_ID = "af617123-365f-42ef-8d30-75dea6c80fb2";
public static readonly string APPSECU_VAL = "WuO8Q~4Y9OGJuLrKk3yaV~Wu_2CureYTLnxLwc2O";
public static readonly string USER_ANYONE = "AllStaff-7184AB3F-CCD1-46F3-8233-3E09E9CF0E66@tocsgm365.onmicrosoft.com";
//old
//public static readonly string APP_ID = "9ad412fe-e47b-43cc-93dc-9844c9b1cc0b";
//public static readonly string TENANT_ID = "461c81ec-bcc4-4ebe-a37f-2d9a82c9e560";
//public static readonly string APPSECU_ID = "0c8a4e4b-adb8-4a20-9329-c79b13563c90";
//public static readonly string APPSECU_VAL = "LAX8Q~owiSpc1hDqTRacZlU.OxABtlV796QPGcif";
#endif
}
}

View File

@ -0,0 +1,622 @@
/* ===================
* WM_COPYDATA example
* ===================
*
* Working example for sending a string between C# handles (Controls/Forms) using WM_COPYDATA.
*
* TODO:
* -----
* * Add more info
* * Make generic struct copying work
*
*
* TL;DR:
* ------
* Put Catcher.Demo() in Program.Main() and step through it.
* `MessagePasser.SendString(<handle>, "test");` will send a string to the Handle.
* Make sure target window WndProc has `MessagePasser.ReceiveString` in it/
*
*/
using Microsoft.InformationProtection;
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
using static BSOneMip.Action;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System.Xml.Linq;
using Microsoft.Win32;
using System.Reflection.Emit;
using System.Linq.Expressions;
using System.IO;
//using static BSOneMip.Define;
namespace PassMessage {
/// <summary>
/// A form to demonstrate WndProc CopyData
/// </summary>
public class BS1Aip : Form {
private static BS1Aip mInstance;
public delegate void CopyStringDelegate(string msg);
public delegate void CopyDataDelegate(CopyData msg);
public static event CopyStringDelegate StringCopied;
public static event CopyDataDelegate DataCopied;
//public static BSOneMip.Action ac_;
public static int nProcResult_ = 99;
private static TaskCompletionSource<BS1Aip> onLoad = new TaskCompletionSource<BS1Aip>();
public static IntPtr hMod_;
[DllImport("kernel32.dll", EntryPoint = "LoadLibrary")]
private extern static IntPtr LoadLibrary(string librayName);
[DllImport("kernel32.dll", EntryPoint = "GetProcAddress", CharSet = CharSet.Ansi)]
private extern static IntPtr GetProcAddress(IntPtr hwnd, string procedureName);
[DllImport("kernel32.dll", EntryPoint = "FreeLibrary")]
private extern static bool FreeLibrary(IntPtr hModule);
[DllImport("kernel32")]
public static extern Int32 GetLastError();
[DllImport("user32.dll", SetLastError = true)]
public static extern bool ChangeWindowMessageFilter(uint message, uint dwFlag);
//private const uint WM_DROPFILES = 0x233;
private const uint WM_COPYDATA = 0x004A;
//private const uint WM_COPYGLOBALDATA = 0x0049;
private const uint MSGFLT_ADD = 1;
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public delegate int FP_DSCSIsEncryptedFile(string sPath);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
public delegate int FP_DSCSDecryptFile(string sSrcPath, string sDestPath);
public static FP_DSCSIsEncryptedFile DSCSIsEncryptedFile;
public static FP_DSCSDecryptFile DSCSDecryptFile;
public BS1Aip() {
this.ShowInTaskbar = false; // 작업표시줄에서 숨기기
this.Opacity = 0; // 폼 숨기기, 투명도 0
this.Width = 1;
this.Height = 1;
this.Text = "BSOne-AIP-T140713-" + System.IO.Path.GetFileName(Application.ExecutablePath);
DSCSIsEncryptedFile = null;
DSCSDecryptFile = null;
hMod_ = LoadLibrary("C:\\Windows\\DSCSLink64.dll");
if (hMod_ != IntPtr.Zero)
{
IntPtr pFuncAddr = IntPtr.Zero;
pFuncAddr = GetProcAddress(hMod_, "DSCSIsEncryptedFile");
if (pFuncAddr != IntPtr.Zero)
DSCSIsEncryptedFile = (FP_DSCSIsEncryptedFile)Marshal.GetDelegateForFunctionPointer(
pFuncAddr, typeof(FP_DSCSIsEncryptedFile));
else
Console.WriteLine(string.Format("GetProcAddress 실패 .. Error = {0}", GetLastError()));
pFuncAddr = GetProcAddress(hMod_, "DSCSDecryptFile");
if (pFuncAddr != IntPtr.Zero)
DSCSDecryptFile = (FP_DSCSDecryptFile)Marshal.GetDelegateForFunctionPointer(
pFuncAddr, typeof(FP_DSCSDecryptFile));
}
ChangeWindowMessageFilter(WM_COPYDATA, MSGFLT_ADD);
}
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;
cp.ExStyle |= 0x80; // alt + tab 화면에서 숨기기 23_1204 kku
//cp.ClassName = "BS1Aip";
//cp.Style |= 0x00000040; // BS_ICON value
return cp;
}
}
/// <summary>
/// Creates a catcher window to demonstrate Message Passing
/// </summary>
public static void Demo() {
Start().Wait();
StringCopied += Console.WriteLine;
DataCopied += msg => {
//Console.WriteLine("Received " + msg.dwData + ": " + msg.lpData);
};
MessagePasser.SendString(GetHandle(), "test");
MessagePasser.SendString(GetHandle(), 3, "other test");
while (IsOpen()) {
Thread.Sleep(1);
}
}
class AipEnt
{
public string src = "";
public string dst = "";
public string lid = "";
public string ssid = "";
public string regval = "";
public string mail = "";
}
public static void RcvCmd(BSOneMip.Action ac, BSOneMip.Action acNoD) // acNoD 추가, 위임안한 높은 권한이 필요해서.. 비밀, 극비등 암호화 확인24_0723 kku
//public static void RcvCmd(BSOneMip.Action ac)
{
Start().Wait();
//StringCopied += Console.WriteLine;
DataCopied =
msg => {
try
{
AipEnt aEnt = JsonConvert.DeserializeObject<AipEnt>(msg.lpData.ToString());
BSOneMip.Action.FileOptions options = new BSOneMip.Action.FileOptions
{
FileName = aEnt.src,
OutputName = aEnt.dst,
ActionSource = ActionSource.Manual,
AssignmentMethod = AssignmentMethod.Privileged,
DataState = DataState.Rest,
GenerateChangeAuditEvent = true,
IsAuditDiscoveryEnabled = true,
LabelId = aEnt.lid
};
nProcResult_ = 1;
int cmd = msg.dwData.ToInt32();
switch (cmd) // 0 : 레이블 추출, 1 : 암호화, 2 : 복호화, 3 : 암호화 확인, 4 : 레이블 확인, 5 : 레이블 설정, 6 : 소캠 복호화
{
case 0: // 레이블 추출
if (ac.SaveLabelList(aEnt.src))
nProcResult_ = 10;
break;
case 1: // 암호화
if (ac.SetProtection(options))
nProcResult_ = 10;
break;
case 2: // 복호화
if (ac.RemoveProtection(options))
nProcResult_ = 10;
break;
case 3: // 암호화 확인
if (acNoD.IsProtection(aEnt.src))
nProcResult_ = 10;
break;
case 4: // 레이블 확인
var ALabel = ac.GetLabel(options);
var sLabelName = "";
if (ALabel != null)
sLabelName = ALabel.Label.Name;
RegistryKey reg;
if (aEnt.ssid != "")
reg = Registry.Users.CreateSubKey(aEnt.ssid + "\\SOFTWARE").CreateSubKey("eCrmHomeEdition");
else
reg = Registry.LocalMachine.CreateSubKey("SOFTWARE").CreateSubKey("eCrmHomeEdition");
//if (reg != null)
//{
var sRegVal = aEnt.regval;
if (sRegVal == "")
sRegVal = "ALabel";
reg.SetValue(sRegVal, sLabelName, RegistryValueKind.String);
nProcResult_ = 10;
//}
break;
case 5: // 레이블 설정
// 레이블 소유자가 같을때만 적용 kku, 23_1113
string sEmpNo = ac.GetEmpNo();
string sPxMail = aEnt.mail; // proxyAddress 처리 추가 23_1228 kku
string sFOwner = ac.GetOwner(aEnt.src);
int i = sFOwner.IndexOf('@');
if (i > 0)
sFOwner = sFOwner.Substring(0, i);
i = sPxMail.IndexOf('@');
if (i > 0)
sPxMail = sPxMail.Substring(0, i);
nProcResult_ = 2;
if ((sFOwner == "") || (sEmpNo == sFOwner) || (sPxMail == sFOwner))
{
nProcResult_ = 3;
// 레이블이 현재와 다를때만 적용 kku, 23_1110
//options.LabelId = "";
ContentLabel ALabel2 = null;
try
{
ALabel2 = ac.GetLabel(options);
}
catch {
ALabel2 = null;
}
#if _HDENG_
if ((ALabel2 != null) && (ALabel2.Label != null))
{
// 레이블이 "비밀(Secret)"이면 무시 24_0527 kku
if (ALabel2.Label.Id == "1bd401ce-2296-409e-b28d-ebe7aa124c57")
{
nProcResult_ = 22;
return;
}
// 레이블이 "극비(Top-Secret)"면 무시 24_0527 kku
if (ALabel2.Label.Id == "ba70c971-4f13-4229-83fa-9d8a22a0788e")
{
nProcResult_ = 33;
return;
}
}
#endif
nProcResult_ = 4;
if ((ALabel2 == null) || (ALabel2.Label == null) ||
(ALabel2.Label.Id == "") || (ALabel2.Label.Id != aEnt.lid))
{
#if _KDNVN_
if ((ALabel2 != null) && (ALabel2.Label != null))
{
if (ALabel2.Label.Id == "5b6a34f5-525c-4c52-b832-c9c630e05005") // 일반_반출용 (Public Release)
{
options.LabelId = "7c1e97b0-1625-488a-a30c-4f2188693461"; // 일반 (General Purpose)
}
else if (ALabel2.Label.Id == "f2fa99e1-c17d-4934-9665-44d4df5ef1e6") // 대외비_반출용 (Confidential Release)
{
options.LabelId = "e7bd3a2c-b905-4bdb-8892-e6cd8d1eb00b"; // 대외비 (Confidential)
}
else if (ALabel2.Label.Id == "3fce3511-ace7-47a2-8106-f8bf1be7332b") // 기밀_반출용 (Secret Release)
{
options.LabelId = "7d1539f9-8f3b-4cbd-b787-7ae1b30eae22"; // 기밀 (Secret)
}
else if (ALabel2.Label.Id == "9f09d5d6-3008-4f6d-b4d3-c978a7d30f16") // 극비_반출용 (Top Secret Release)
{
options.LabelId = "b40a7c1a-5443-458b-9215-2abda0acc4a4"; // 극비 (Top Secret)
}
}
#endif
#if _UNITUS_
if ((ALabel2 != null) && (ALabel2.Label != null))
{
if ( (ALabel2.Label.Id == "da2900a7-a8d4-4880-8110-5ead362bd600") ||
(ALabel2.Label.Id == "26783f26-fa77-46b6-95df-19ceac22456f") ||
(ALabel2.Label.Id == "4db57f7c-4e09-49fc-a866-84a60c363440") ||
(ALabel2.Label.Id == "555d3b5c-162b-43bf-a400-f553314e6743") ) // Top Secret 레이블이면 무시함 24_1211 kku
{
nProcResult_ = 20;
return;
}
}
#endif
#if _MOTRAS_
if ((ALabel2 != null) && (ALabel2.Label != null))
{
if ( (ALabel2.Label.Id == "0ab0807a-d010-48fe-84fa-5c445d40d3e3") ||
(ALabel2.Label.Id == "70c3db47-908f-4fcb-bac6-e31e97fa7b7d") ||
(ALabel2.Label.Id == "a45bd5c7-405d-4e58-8e59-35c98d74876b") ) // Top Secret 레이블이면 무시함 24_1211 kku
{
nProcResult_ = 20;
return;
}
}
#endif
nProcResult_ = 5;
if (ac.SetLabel(options))
{
nProcResult_ = 10;
}
else
{
nProcResult_ = 6;
}
// 아래처럼 하니까... 2중으로 암호화 되는 경우가 발생한다... HEC 24_0405 kku
// 레이블 변경에 실패하는 경우가 있어서 아래처럼 보완 24_0306 kku
//if (!ac.SetLabel(options))
//{
// nProcResult_ = 111;
// options.FileName = aEnt.src;
// options.OutputName = aEnt.dst + "_1";
// if (ac.RemoveProtection(options))
// {
// nProcResult_ = 112;
// options.FileName = aEnt.dst + "_1";
// options.OutputName = aEnt.dst;
// if (ac.SetLabel(options))
// {
// nProcResult_ = 10;
// }
// }
//}
//else nProcResult_ = 10;
}
}
break;
case 6:
if (hMod_ != IntPtr.Zero)
{
if ((DSCSIsEncryptedFile != null) && (DSCSDecryptFile != null))
{
if ((DSCSIsEncryptedFile(aEnt.src) == 1) && (DSCSDecryptFile(aEnt.src, aEnt.dst) == 1))
nProcResult_ = 10;
}
}
break;
case 7:
if (acNoD.RemoveLabel(options))
nProcResult_ = 10;
break;
}
}catch
{
// ...
//nProcResult_ = 0;
}
//Console.WriteLine("Result: " + nProcResult_ + " - Received " + msg.dwData + ": " + msg.lpData);
};
//mInstance.Text = mInstance.Handle.ToInt64().ToString();
while (true) // (IsOpen()) // IsOpen() 하면 메모리릭 발생함 23_1005 kku
{
Thread.Sleep(10);
}
}
/// <summary>
/// Run the Catcher
/// </summary>
/// <returns></returns>
public static async Task<BS1Aip> Start() {
Thread t = new Thread(runForm);
t.SetApartmentState(ApartmentState.STA);
t.IsBackground = true;
t.Start();
return await onLoad.Task.ConfigureAwait(false);
}
protected override void OnLoad(EventArgs e) {
base.OnLoad(e);
onLoad.SetResult(this);
}
public static IntPtr GetHandle() {
IntPtr val = IntPtr.Zero;
if (mInstance == null) throw new InvalidOperationException("Catcher not started");
mInstance.Invoke((MethodInvoker)delegate { val = mInstance.Handle; });
return val;
}
public static bool IsOpen() {
bool val = false;
if (mInstance == null) throw new InvalidOperationException("Catcher not started");
if (mInstance.IsDisposed || mInstance.Disposing)
return false;
try {
mInstance.Invoke((MethodInvoker)delegate { val = mInstance.Visible; });
}
catch {
return false;
}
return val;
}
public static void Stop() {
if (mInstance == null) throw new InvalidOperationException("Catcher not started");
DataCopied = null;
mInstance.Invoke(new MethodInvoker(mInstance.endForm));
}
private static void runForm() {
mInstance = new BS1Aip();
Application.Run(mInstance);
}
private void endForm() {
this.Close();
}
/// <inheritdoc />
protected override void WndProc(ref Message m) {
if (m.Msg == NativeMethods.WM_COPYDATA) {
DataCopied?.Invoke(MessagePasser.ReceiveData(m));
StringCopied?.Invoke(MessagePasser.ReceiveString(m));
m.Result = new IntPtr(BS1Aip.nProcResult_);
} else
base.WndProc(ref m);
}
private void InitializeComponent()
{
this.SuspendLayout();
//
// BS1Aip
//
this.ClientSize = new System.Drawing.Size(284, 261);
this.Name = "BS1Aip";
this.ResumeLayout(false);
}
}
public static class NativeMethods {
public const int WM_COPYDATA = 0x004A;
[DllImport("user32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr hWnd, int Msg, IntPtr wParam, ref CopyData lParam);
[DllImport("user32")]
public static extern int RegisterWindowMessage(string message);
// TODO: possibly could send custom structs by changing CopyData.lpData to an IntPtr
public static IntPtr IntPtrAlloc<T>(T param) {
IntPtr retval = Marshal.AllocHGlobal(Marshal.SizeOf(param));
Marshal.StructureToPtr(param, retval, false);
return retval;
}
public static void IntPtrFree(IntPtr preAllocated) {
if (IntPtr.Zero == preAllocated) throw new InvalidOperationException("IntPtr is already 0");
Marshal.FreeHGlobal(preAllocated);
preAllocated = IntPtr.Zero;
}
public static T GetStruct<T>(IntPtr param) {
return (T)Marshal.PtrToStructure(param, typeof(T));
}
public static IntPtr StringToIntPtr(string data) {
return Marshal.StringToHGlobalAnsi(data);
}
public static string IntPtrToString(IntPtr data) {
return Marshal.PtrToStringAnsi(data);
}
}
/// <summary>
/// Pre-assembled class for sending/receiving strings between Windows applications.
/// </summary>
public static class MessagePasser {
/// <summary>
/// ReceiveData will throw if Message.Msg isn't WindowsMessageId
/// </summary>
public static bool ThrowOnBadMessage = true;
/// <summary>
/// Defaults to MS COPYDATA, can use NativeMethods.RegisterWindowMessage to create a new MessageId
/// </summary>
public static int WindowsMessageId = NativeMethods.WM_COPYDATA;
/// <summary>
/// Sends "data" to the target window
/// </summary>
/// <param name="targetWindowHandle"></param>
/// <param name="messageId">Usually WM_COPYDATA</param>
/// <param name="id"></param>
/// <param name="message"></param>
/// <returns></returns>
public static int SendData(IntPtr targetWindowHandle, int messageId, int id, string message) {
var data = new CopyData();
data.dwData = new IntPtr(id);
data.cbData = (message.Length + 1) * Marshal.SystemDefaultCharSize;
data.lpData = message;
var resp = NativeMethods.SendMessage(
targetWindowHandle,
messageId,
IntPtr.Zero,
ref data
);
var er = Marshal.GetLastWin32Error();
var errorMessage = new Win32Exception(er).Message;
if (er != 0)
throw new InvalidOperationException("Last Error isn't success:" + er + Environment.NewLine + errorMessage);
return resp.ToInt32();
}
/// <summary>
/// Send a string with an id
/// </summary>
/// <param name="targetWindowHandle"></param>
/// <param name="id"></param>
/// <param name="message"></param>
/// <returns></returns>
public static int SendString(IntPtr targetWindowHandle, int id, string message) {
return SendData(targetWindowHandle, WindowsMessageId, id, message);
}
/// <summary>
/// Call to send a string with message type 1.
/// </summary>
/// <param name="targetWindowHandle"></param>
/// <param name="message"></param>
/// <returns></returns>
public static int SendString(IntPtr targetWindowHandle, string message) {
return SendString(targetWindowHandle, 1, message);
}
/// <summary>
/// Call this from WndProc to switch on dwData
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
public static CopyData ReceiveData(Message m) {
if (m.Msg != WindowsMessageId) {
if (ThrowOnBadMessage)
throw new InvalidOperationException("Message isn't WM_COPYDATA");
return default(CopyData);
}
m.Result = new IntPtr(1);
var data = (CopyData)m.GetLParam(typeof(CopyData));
m.Result = new IntPtr(0);
return data;
}
/// <summary>
/// Call this from WndProc if you don't care about message types
/// </summary>
/// <param name="m"></param>
/// <returns></returns>
public static string ReceiveString(Message m) {
return ReceiveData(m).lpData;
}
}
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
public struct CopyData {
/// <summary>
/// data to be passed, can be used as a message type identifier
/// </summary>
public IntPtr dwData;
/// <summary>
/// sizeof lpData
/// </summary>
public int cbData;
/// <summary>
/// data to be passed, can be null
/// </summary>
[MarshalAs(UnmanagedType.LPWStr)]
public string lpData;
}
}

View File

@ -0,0 +1,120 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>

View File

@ -0,0 +1,430 @@
/*
*
* Copyright (c) Microsoft Corporation.
* All rights reserved.
*
* This code is licensed under the MIT License.
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files(the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and / or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions :
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*
*/
using System;
using System.Threading.Tasks;
using Microsoft.InformationProtection;
using Microsoft.InformationProtection.File;
using Microsoft.InformationProtection.Protection;
using Microsoft.InformationProtection.Policy;
using System.Collections.Generic;
using System.Configuration;
using static BSOneMip.Define;
using System.Diagnostics.Eventing.Reader;
using static PassMessage.MessagePasser;
using PassMessage;
using System.Runtime.InteropServices;
using System.Data;
using System.IO;
namespace BSOneMip
{
class Program
{
private static readonly string clientId = APP_ID; // ConfigurationManager.AppSettings["ida:ClientId"];
private static readonly string appName = APP_NAME; // ConfigurationManager.AppSettings["app:Name"];
private static readonly string appVersion = APP_VER; // ConfigurationManager.AppSettings["app:Version"];
[DllImport("kernel32.dll", EntryPoint = "LoadLibrary")]
private extern static IntPtr LoadLibrary(string librayName);
[DllImport("kernel32.dll", EntryPoint = "GetProcAddress", CharSet = CharSet.Ansi)]
private extern static IntPtr GetProcAddress(IntPtr hwnd, string procedureName);
[DllImport("kernel32.dll", EntryPoint = "FreeLibrary")]
private extern static bool FreeLibrary(IntPtr hModule);
[DllImport("kernel32")]
public static extern Int32 GetLastError();
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
private delegate int FP_DSCSIsEncryptedFile(string sPath);
[UnmanagedFunctionPointer(CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
private delegate int FP_DSCSDecryptFile(string sSrcPath, string sDestPath);
private static FP_DSCSIsEncryptedFile DSCSIsEncryptedFile;
private static FP_DSCSDecryptFile DSCSDecryptFile;
static void Main(string[] args)
{
string sEncPath = "";
string sDecPath = "";
string sLabelId = "";
string sDelegatedUserEmail = "";
bool bInputMode = false;
int nMode = 0; // 0 : 복호화, 1 : 암호화, 2 : 레이블 설정, 3 : 통신 모드, 4 : 레이블 제거
try
{
for (var i = 0; i < args.Length; i++)
{
var arg = args[i];
if (arg == "-i" || arg == "-I")
{
bInputMode = true;
break;
}
if (arg == "-e" || arg == "-E")
{
nMode = 1;
continue;
}
if (arg == "-l" || arg == "-L")
{
nMode = 2;
continue;
}
if (arg == "-r" || arg == "-R")
{
nMode = 3;
if (i < args.Length - 1)
sDelegatedUserEmail = args[i + 1];
break;
}
if (arg == "-x" || arg == "-X")
{
nMode = 4;
continue;
}
if (arg == "-p" || arg == "-P")
{
nMode = 5;
continue;
}
if (arg == "-b" || arg == "-B")
{
nMode = 6;
continue;
}
sEncPath = arg;
if (i < args.Length - 1)
{
sDecPath = args[i + 1];
i++;
if (nMode == 2)
{
sLabelId = args[i + 1];
i++;
}
}
}
bool result = false;
if (nMode == 3)
{
ApplicationInfo apInfo = new ApplicationInfo()
{
// ApplicationId should ideally be set to the same ClientId found in the Azure AD App Registration.
// This ensures that the clientID in AAD matches the AppId reported in AIP Analytics.
ApplicationId = clientId,
ApplicationName = appName,
ApplicationVersion = appVersion
};
BS1Aip.RcvCmd(new Action(apInfo, sDelegatedUserEmail), new Action(apInfo)); // 이렇게 하면 권한 오류 발생함. 재부팅 전까지 권한발급 안됨 24_0723 kku
//BS1Aip.RcvCmd(new Action(apInfo, sDelegatedUserEmail));
return;
}
//return; // 연동 외 cmd 명령 실행방식 지원하지 않도록 조치 23_1025 kku
if (bInputMode)
{
Console.Write("AIP로 암호화된 파일 경로 : ");
sEncPath = Console.ReadLine();
Console.Write("복호화해서 저장될 파일 경로: ");
sDecPath = Console.ReadLine();
}
//if (sEncPath == "" || ((nMode < 2) && sDecPath == ""))
// return;
//Console.WriteLine(string.Format("SrcPath : {0}", sEncPath));
//Console.WriteLine(string.Format("DestPath : {0}", sDecPath));
// Create ApplicationInfo, setting the clientID from Azure AD App Registration as the ApplicationId
// If any of these values are not set API throws BadInputException.
ApplicationInfo appInfo = new ApplicationInfo()
{
// ApplicationId should ideally be set to the same ClientId found in the Azure AD App Registration.
// This ensures that the clientID in AAD matches the AppId reported in AIP Analytics.
ApplicationId = clientId,
ApplicationName = appName,
ApplicationVersion = appVersion
};
// Initialize Action class, passing in AppInfo.
Action action = new Action(appInfo);
//if (nMode == 1)
//{
/*
var templates = action.ListTemplates();
for (int i = 0; i < templates.Count; i++)
{
Console.WriteLine("{0}: Name={1}, ID={2}", i.ToString(), templates[i].Name, templates[i].Id);
}
*/
//}
// List all labels available to the engine created in Action
IEnumerable<Label> labels = action.ListLabels();
Console.WriteLine("레이블 정보 확인 ..");
Console.WriteLine("");
// Enumerate parent and child labels and print name/ID.
foreach (var label in labels)
{
Console.WriteLine(string.Format("{0} - {1}", label.Name, label.Id));
if (label.Children.Count > 0)
{
foreach (Label child in label.Children)
{
Console.WriteLine(string.Format("\t{0} - {1}", child.Name, child.Id));
}
}
}
Console.WriteLine("");
/*
// Prompt user to enter a label ID from above
Console.Write("Enter a label identifier from above: ");
var labelId = Console.ReadLine();
// Prompt for path inputs
Console.Write("Enter an input file path: ");
string sEncPath = Console.ReadLine();
Console.Write("Enter an output file path: ");
string sDecPath = Console.ReadLine();
// Set file options from FileOptions struct. Used to set various parameters for FileHandler
Action.FileOptions options = new Action.FileOptions
{
FileName = sEncPath,
OutputName = sDecPath,
ActionSource = ActionSource.Manual,
AssignmentMethod = AssignmentMethod.Privileged,
DataState = DataState.Rest,
GenerateChangeAuditEvent = true,
IsAuditDiscoveryEnabled = true,
LabelId = labelId
};
//Set the label on the file handler object
Console.WriteLine(string.Format("Set label ID {0} on {1}", labelId, sEncPath));
// Set label, commit change to outputfile, and send audit event if enabled.
bool result = action.SetLabel(options);
*/
// Set file options from FileOptions struct. Used to set various parameters for FileHandler
Action.FileOptions options = new Action.FileOptions
{
FileName = sEncPath,
OutputName = sDecPath,
ActionSource = ActionSource.Manual,
AssignmentMethod = AssignmentMethod.Privileged,
DataState = DataState.Rest,
GenerateChangeAuditEvent = true,
IsAuditDiscoveryEnabled = true,
LabelId = sLabelId
};
//Set the label on the file handler object
// Set label, commit change to outputfile, and send audit event if enabled.
switch (nMode)
{
case 0:
result = action.RemoveProtection(options);
break;
//string sMail = "2323308@hec.co.kr";
//int i = sMail.IndexOf('@');
//if (i > 0)
//{
// sMail = sMail.Substring(0, i);
//}
//string sOwner = action.GetOwner(sEncPath);
//i = sOwner.IndexOf('@');
//if ( i > 0)
//{
// sOwner = sOwner.Substring(0, i);
//}
//if (sMail == sOwner)
// Console.WriteLine(string.Format("사용자 (true) : {0}, Chk : {1}", sOwner, sMail));
//else
// Console.WriteLine(string.Format("사용자 (false) : {0}, Chk : {1}", sOwner, sMail));
//return;
case 1:
result = action.SetProtection(options);
break;
case 2:
result = action.SetLabel(options);
break;
case 4:
result = action.RemoveLabel(options);
break;
case 5:
//Directory.SetCurrentDirectory("C:\\Windows");
IntPtr hMod;
//if (4 < nVoidPtrLen)
hMod = LoadLibrary("C:\\Windows\\DSCSLink64.dll");
//else
//hMod = LoadLibrary("C:\\Windows\\DSCSLink.dll");
if (hMod != IntPtr.Zero)
{
IntPtr pFuncAddr = IntPtr.Zero;
pFuncAddr = GetProcAddress(hMod, "DSCSIsEncryptedFile");
if (pFuncAddr != IntPtr.Zero)
DSCSIsEncryptedFile = (FP_DSCSIsEncryptedFile)Marshal.GetDelegateForFunctionPointer(
pFuncAddr, typeof(FP_DSCSIsEncryptedFile));
else
Console.WriteLine(string.Format("GetProcAddress 실패 .. Error = {0}", GetLastError()));
pFuncAddr = GetProcAddress(hMod, "DSCSDecryptFile");
if (pFuncAddr != IntPtr.Zero)
DSCSDecryptFile = (FP_DSCSDecryptFile)Marshal.GetDelegateForFunctionPointer(
pFuncAddr, typeof(FP_DSCSDecryptFile));
if ((DSCSIsEncryptedFile != null) && (DSCSDecryptFile != null))
{
if (DSCSIsEncryptedFile(sEncPath) == 1)
result = DSCSDecryptFile(sEncPath, sDecPath) == 1;
}
//FreeLibrary(hMod);
}
break;
case 6:
var ALabel = action.GetLabel(options);
var sLabelName = "None";
if (ALabel != null)
sLabelName = ALabel.Label.Name;
Console.WriteLine(string.Format("레이블 : {0}", sLabelName));
return;
}
if (result)
{
//Console.WriteLine(string.Format("Committed label ID {0} to {1}", labelId, sDecPath));
// Create a new handler to read the labeled file metadata.
//Console.WriteLine(string.Format("Getting the label committed to file: {0}", sDecPath));
switch (nMode)
{
case 0:
Console.WriteLine(string.Format("복호화가 완료되었습니다 : {0}", sDecPath));
break;
case 1:
Console.WriteLine(string.Format("암호화가 완료되었습니다 : {0}", sDecPath));
break;
case 2:
options.FileName = options.OutputName;
var ContentLabel = action.GetLabel(options);
Console.WriteLine(string.Format("레이블이 지정 되었습니다 : {0}", ContentLabel.Label.Name));
break;
case 4:
Console.WriteLine(string.Format("레이블이 제거 되었습니다. : {0}", sDecPath));
break;
case 5:
Console.WriteLine(string.Format("소캠 복호화가 완료되었습니다 : {0}", sDecPath));
break;
}
// Update options to read the previously generated file output.
//options.FileName = options.OutputName;
// Read label from the previously labeled file.
//var contentLabel = action.GetLabel(options);
// Display the label with protection information.
//Console.WriteLine(string.Format("File Label: {0} \r\nIsProtected: {1}", contentLabel.Label.Name, contentLabel.IsProtectionAppliedFromLabel.ToString()));
}
else
{
//Console.WriteLine("No changes to file {0}", sEncPath);
switch (nMode)
{
case 0:
Console.WriteLine(string.Format("복호화 중 오류가 발생했습니다"));
break;
case 1:
Console.WriteLine(string.Format("AIP로 암호화 중 오류가 발생했습니다."));
break;
case 2:
Console.WriteLine(string.Format("레이블 처리 중 오류가 발생했습니다."));
break;
case 3:
Console.WriteLine(string.Format("레이블 지정 오류."));
break;
case 4:
Console.WriteLine(string.Format("레이블 제거 오류."));
break;
case 5:
Console.WriteLine(string.Format("소캠 복호화 중 오류가 발생했습니다."));
break;
}
}
}
catch (Exception ex)
{
Console.WriteLine("Fail .. " + ex.Message);
if (ex.InnerException != null)
Console.WriteLine("Fail .. 내부 예외 : " + ex.InnerException.Message);
}
#if DEBUG
Console.WriteLine("Press a key to quit.");
Console.WriteLine("아무키나 누르면 종료 됩니다.");
Console.ReadKey();
#endif
}
}
}

View File

@ -0,0 +1,18 @@
program BlueMon;
uses
Vcl.Forms,
DBlueMonMain in 'DBlueMonMain.pas' {DlgBlueMon},
GlobalDefine in '..\..\eCrmHE\LIB_Common\GlobalDefine.pas',
Define in 'Define.pas',
Condition in '..\..\eCrmHE\LIB_Common\Condition.pas',
DNoticeBT in 'DNoticeBT.pas' {DlgNoticeBT};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgBlueMon, DlgBlueMon);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

View File

@ -0,0 +1,356 @@
object DlgBlueMon: TDlgBlueMon
Left = 0
Top = 0
BorderIcons = [biSystemMenu, biMinimize]
Caption = 'BlueMon'
ClientHeight = 315
ClientWidth = 541
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poScreenCenter
TextHeight = 15
object pcMain: TPageControl
Left = 0
Top = 0
Width = 541
Height = 315
ActivePage = tabBlueList
Align = alClient
TabOrder = 0
ExplicitWidth = 537
ExplicitHeight = 314
object tabBlueList: TTabSheet
Caption = #48660#47336#53804#49828' '#47785#47197' '#51221#48372
object pnTop: TPanel
Left = 0
Top = 0
Width = 533
Height = 29
Align = alTop
BevelOuter = bvNone
TabOrder = 0
ExplicitWidth = 529
object btnRefresh: TButton
Left = 0
Top = 1
Width = 75
Height = 25
Caption = #49352#47196#44256#52840
TabOrder = 0
OnClick = btnRefreshClick
end
end
object vtList: TVirtualStringTree
Left = 0
Top = 29
Width = 533
Height = 256
Align = alClient
Colors.BorderColor = 15987699
Colors.DisabledColor = clGray
Colors.DropMarkColor = 15385233
Colors.DropTargetColor = 15385233
Colors.DropTargetBorderColor = 15385233
Colors.FocusedSelectionColor = 15385233
Colors.FocusedSelectionBorderColor = 15385233
Colors.GridLineColor = 15987699
Colors.HeaderHotColor = clBlack
Colors.HotColor = clBlack
Colors.SelectionRectangleBlendColor = 15385233
Colors.SelectionRectangleBorderColor = 15385233
Colors.SelectionTextColor = clBlack
Colors.TreeLineColor = 9471874
Colors.UnfocusedColor = clGray
Colors.UnfocusedSelectionColor = clWhite
Colors.UnfocusedSelectionBorderColor = clWhite
Header.AutoSizeIndex = 0
Header.Options = [hoColumnResize, hoDrag, hoShowSortGlyphs, hoVisible]
PopupMenu = popFun
TabOrder = 1
TreeOptions.PaintOptions = [toHideFocusRect, toShowButtons, toShowDropmark, toShowTreeLines, toThemeAware, toUseBlendedImages]
TreeOptions.SelectionOptions = [toFullRowSelect, toRightClickSelect]
OnContextPopup = vtListContextPopup
OnFreeNode = vtListFreeNode
OnGetText = vtListGetText
OnGetNodeDataSize = vtListGetNodeDataSize
OnHeaderClick = vtListHeaderClick
Touch.InteractiveGestures = [igPan, igPressAndTap]
Touch.InteractiveGestureOptions = [igoPanSingleFingerHorizontal, igoPanSingleFingerVertical, igoPanInertia, igoPanGutter, igoParentPassthrough]
Columns = <
item
Position = 0
Text = #48264#54840
end
item
Position = 1
Text = #49345#53468
Width = 70
end
item
Position = 2
Text = #51060#47492
Width = 120
end
item
Position = 3
Text = 'CoD'
Width = 80
end
item
Position = 4
Text = #51333#47448' (Major)'
Width = 90
end
item
Position = 5
Text = #51333#47448' (Minor)'
Width = 90
end
item
Position = 6
Text = #51064#51613
end
item
Position = 7
Text = #51109#52824' '#51452#49548
Width = 110
end
item
Position = 8
Text = #52572#44540' '#49324#50857' '#51068#49884
Width = 150
end
item
Position = 9
Text = #52572#44540' '#48156#44204' '#51068#49884
Width = 150
end>
DefaultText = ''
end
end
object tabBlueMon: TTabSheet
Caption = #48660#47336#53804#49828' '#44048#49884'/'#52264#45800
ImageIndex = 1
object Label1: TLabel
Left = 29
Top = 64
Width = 146
Height = 15
Caption = #50672#44208' '#52264#45800' '#50696#50808' (; '#51004#47196' '#44396#48516')'
end
object btnPB_MJAdd: TSpeedButton
Left = 428
Top = 55
Width = 23
Height = 23
Caption = '+'
OnClick = btnPB_MJAddClick
end
object btnPB_MNAdd: TSpeedButton
Left = 428
Top = 178
Width = 23
Height = 23
Caption = '+'
OnClick = btnPB_MNAddClick
end
object btnPB_MJDel: TSpeedButton
Left = 454
Top = 55
Width = 23
Height = 23
Caption = '-'
OnClick = btnPB_MJDelClick
end
object btnPB_MNDel: TSpeedButton
Left = 454
Top = 178
Width = 23
Height = 23
Caption = '-'
OnClick = btnPB_MNDelClick
end
object Panel1: TPanel
Left = 0
Top = 0
Width = 533
Height = 29
Align = alTop
BevelOuter = bvNone
TabOrder = 0
object btnBlueMon: TButton
Left = 0
Top = 1
Width = 97
Height = 25
Caption = #44048#49884'/'#52264#45800' '#49884#51089
TabOrder = 0
OnClick = btnBlueMonClick
end
end
object chPreventBtAll: TCheckBox
Left = 16
Top = 36
Width = 183
Height = 17
Caption = #47784#46304' '#48660#47336#53804#49828' '#51109#52824' '#50672#44208' '#52264#45800
TabOrder = 1
end
object mmExcept: TMemo
Left = 29
Top = 85
Width = 228
Height = 97
Lines.Strings = (
'04:52:C7:1A:12:2F')
ScrollBars = ssVertical
TabOrder = 2
end
object chPB_Name: TCheckBox
Left = 16
Top = 214
Width = 273
Height = 17
Caption = #48660#47336#53804#49828' '#51109#52824' '#51060#47492#50640' '#45796#51020' '#47928#44396#44032' '#51080#51004#47732' '#52264#45800
TabOrder = 3
end
object edPB_Name: TEdit
Left = 16
Top = 237
Width = 257
Height = 23
TabOrder = 4
Text = 'LG'
end
object cbPB_MJ: TComboBox
Left = 320
Top = 55
Width = 105
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 6
Text = 'Misc'
Items.Strings = (
'Misc'
'Computer'
'Phone'
'LanAccessPoint'
'Audio/Video'
'Peripheral'
'Imaging'
'Unclassified')
end
object chPB_MJ: TCheckBox
Left = 304
Top = 32
Width = 233
Height = 17
Caption = #48660#47336#53804#49828' '#51109#52824' Major '#51333#47448#47196' '#52264#45800
TabOrder = 5
end
object cbPB_MN: TComboBox
Left = 320
Top = 178
Width = 105
Height = 23
Style = csDropDownList
ItemIndex = 0
TabOrder = 9
Text = 'Uncategorised'
Items.Strings = (
'Uncategorised'
'Desktop'
'Server'
'Laptop'
'Handheld'
'Palm'
'Wearable'
'Mobile'
'Cordless'
'Smart phone'
'Wired modem or voice gateway'
'Common ISDN access'
'Sim card reader'
'Device conforms to the Headset profile'
'Hands-free'
'Reserved'
'Microphone'
'Loudspeaker'
'Headphones'
'Portable audio'
'Car audio'
'Set-top box'
'HiFi audio device'
'VCR'
'Video camera'
'Camcorder'
'Video monitor'
'Video display and loudspeaker'
'Video conferencing'
'Gaming/toy'
'Keyboard'
'Pointing device'
'Display'
'Camera'
'Scanner'
'Printer'
'Wrist watch'
'Pager'
'Jacket'
'Helmet'
'Glasses'
'Robot'
'Vehicle'
'Doll/action figure'
'Controller'
'Game')
end
object chPB_MN: TCheckBox
Left = 304
Top = 155
Width = 233
Height = 17
Caption = #48660#47336#53804#49828' '#51109#52824' Minor '#51333#47448#47196' '#52264#45800
TabOrder = 8
end
object lxPB_MJ: TListBox
Left = 320
Top = 83
Width = 157
Height = 61
ItemHeight = 15
TabOrder = 7
end
object lxPB_MN: TListBox
Left = 320
Top = 207
Width = 157
Height = 61
ItemHeight = 15
TabOrder = 10
end
end
end
object popFun: TPopupMenu
AutoHotkeys = maManual
Left = 260
Top = 98
object miPreventBlue: TMenuItem
Caption = #50672#44208' '#54644#51228
OnClick = miPreventBlueClick
end
object N1: TMenuItem
Caption = '-'
end
object miCopyCB: TMenuItem
Caption = #53364#47549#48372#46300#47196' '#48373#49324
ShortCut = 16451
OnClick = miCopyCBClick
end
end
end

View File

@ -0,0 +1,756 @@
unit DBlueMonMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.ComCtrls,
VirtualTrees, Tocsg.Bluetooth, EM.jwabluetoothapis, Vcl.Menus, Vcl.Buttons;
type
PBlueEnt = ^TBlueEnt;
TBlueEnt = record
sName,
sMajor,
sMinor,
sAddress: String;
nClassofDevice: Integer;
bAuth,
bConnected: Boolean;
dtSeen,
dtRecent: TDateTime;
Address: BLUETOOTH_ADDRESS;
end;
TPreventBlue = record
bPreventAll,
bPvIncName,
bPvMajor,
bPvMinor: Boolean;
// sExcepDev,
// sPvIncName,
// sPvMajor,
// sPvMinor: String;
end;
TDlgBlueMon = class(TForm)
pcMain: TPageControl;
tabBlueList: TTabSheet;
pnTop: TPanel;
btnRefresh: TButton;
tabBlueMon: TTabSheet;
vtList: TVirtualStringTree;
popFun: TPopupMenu;
miPreventBlue: TMenuItem;
Panel1: TPanel;
btnBlueMon: TButton;
N1: TMenuItem;
miCopyCB: TMenuItem;
chPreventBtAll: TCheckBox;
Label1: TLabel;
mmExcept: TMemo;
chPB_Name: TCheckBox;
edPB_Name: TEdit;
cbPB_MJ: TComboBox;
btnPB_MJAdd: TSpeedButton;
chPB_MJ: TCheckBox;
cbPB_MN: TComboBox;
btnPB_MNAdd: TSpeedButton;
chPB_MN: TCheckBox;
lxPB_MJ: TListBox;
btnPB_MJDel: TSpeedButton;
btnPB_MNDel: TSpeedButton;
lxPB_MN: TListBox;
procedure btnRefreshClick(Sender: TObject);
procedure vtListGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
procedure vtListFreeNode(Sender: TBaseVirtualTree; Node: PVirtualNode);
procedure vtListHeaderClick(Sender: TVTHeader; HitInfo: TVTHeaderHitInfo);
procedure vtListGetText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; TextType: TVSTTextType; var CellText: string);
procedure miPreventBlueClick(Sender: TObject);
procedure vtListContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
procedure miCopyCBClick(Sender: TObject);
procedure btnBlueMonClick(Sender: TObject);
procedure btnPB_MJAddClick(Sender: TObject);
procedure btnPB_MNAddClick(Sender: TObject);
procedure btnPB_MJDelClick(Sender: TObject);
procedure btnPB_MNDelClick(Sender: TObject);
private
{ Private declarations }
ThdBlueMon_: TThdBtDevNotify;
PreventBlue_: TPreventBlue;
PvBtNameList_,
PvMajorList_,
PvMinorList_,
ExcepBtDevList_: TStringList;
procedure RefreshBtList;
function ProcessPreventBT(pEnt: PBtDevEnt): Boolean;
procedure OnBtDevEntNotify(pEnt: PBtDevEnt; csBT: TBTChangeStates; var bPrevent: Boolean);
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
Destructor Destroy; override;
end;
var
DlgBlueMon: TDlgBlueMon;
implementation
uses
Tocsg.Safe, VirtualTrees.Types, Tocsg.Convert, Tocsg.VTUtil,
Tocsg.Strings, Define, GlobalDefine, superobject, Tocsg.Driver,
Tocsg.Exception, DNoticeBT;
{$R *.dfm}
Constructor TDlgBlueMon.Create(aOwner: TComponent);
begin
Inherited Create(aOwner);
Caption := APP_TITLE;
ThdBlueMon_ := nil;
PvBtNameList_ := TStringList.Create;
PvMajorList_ := TStringList.Create;
PvMinorList_ := TStringList.Create;
ExcepBtDevList_ := TStringList.Create;
RefreshBtList;
pcMain.ActivePageIndex := 0;
end;
Destructor TDlgBlueMon.Destroy;
begin
if ThdBlueMon_ <> nil then
FreeAndNil(ThdBlueMon_);
FreeAndNil(ExcepBtDevList_);
FreeAndNil(PvMinorList_);
FreeAndNil(PvMajorList_);
FreeAndNil(PvBtNameList_);
Inherited;
end;
procedure TDlgBlueMon.RefreshBtList;
var
BTDevice: TBluetoothDevice;
i: Integer;
pData: PBlueEnt;
sMajor, sMinor: String;
begin
Guard(BTDevice, TBluetoothDevice.Create);
BTDevice.RefreshBTDevice;
vtList.BeginUpdate;
try
vtList.Clear;
for i := 0 to BTDevice.Count - 1 do
begin
BtDevTypeToStr(BTDevice[i].dInfo.ulClassofDevice, sMajor, sMinor);
pData := VT_AddChildData(vtList);
pData.sName := BTDevice[i].dInfo.szName;
pData.sMajor := sMajor;
pData.sMinor := sMinor;
pData.nClassofDevice := BTDevice[i].dInfo.ulClassofDevice;
pData.sAddress := BTDevice[i].sAddress;
pData.bConnected := BTDevice[i].dInfo.fConnected;
pData.bAuth := BTDevice[i].dInfo.fAuthenticated;
pData.dtSeen := BTDevice[i].dtLastSeen;
pData.dtRecent := BTDevice[i].dtLastUsed;
pData.Address := BTDevice[i].dInfo.Address;
end;
finally
vtList.EndUpdate;
end;
end;
procedure PopMsg(pEnt: PBtDevEnt; bPrevent: Boolean);
var
O: ISuperObject;
sMajor, sMinor, sData: String;
begin
BtDevTypeToStr(pEnt.dInfo.ulClassofDevice, sMajor, sMinor);
O := SO;
O.I['T'] := TYPE_MSG_PREVENT_BLUETOOTH;
sData := String(pEnt.dInfo.szName) + '|' + Format('%s (%s)', [sMajor, sMinor]) + '|' + pEnt.sAddress;
if bPrevent then
sData := sData + '|PV';
O.S['D'] := sData;
TDlgNoticeBT.Create(nil).PopupMessage(O.AsString);
end;
function TDlgBlueMon.ProcessPreventBT(pEnt: PBtDevEnt): Boolean;
var
sTemp1, sTemp2: String;
i: Integer;
begin
Result := false;
if not pEnt.dInfo.fConnected then
exit;
if ExcepBtDevList_.IndexOf(pEnt.sAddress) <> -1 then
exit;
if PreventBlue_.bPreventAll then
begin
Result := BluetoothRemoveDevice(pEnt.dInfo.Address) = 0;
Result := true; // 차단 대상이면 위 작업과 별개로 장치 차단을 하도록 함 22_0630 09:15:10 kku
exit;
end;
if PreventBlue_.bPvIncName then
begin
sTemp1 := UpperCase(pEnt.dInfo.szName);
for i := 0 to PvBtNameList_.Count - 1 do
begin
if sTemp1.Contains(PvBtNameList_[i]) then
begin
Result := BluetoothRemoveDevice(pEnt.dInfo.Address) = 0;
Result := true; // 차단 대상이면 위 작업과 별개로 장치 차단을 하도록 함 22_0630 09:15:10 kku
exit;
end;
end;
end;
if PreventBlue_.bPvMajor or PreventBlue_.bPvMinor then
begin
BtDevTypeToStr(pEnt.dInfo.ulClassofDevice, sTemp1, sTemp2);
if PreventBlue_.bPvMajor and (PvMajorList_.IndexOf(sTemp1) <> -1) then
begin
Result := BluetoothRemoveDevice(pEnt.dInfo.Address) = 0;
Result := true; // 차단 대상이면 위 작업과 별개로 장치 차단을 하도록 함 22_0630 09:15:10 kku
exit;
end;
if PreventBlue_.bPvMinor and (PvMinorList_.IndexOf(sTemp2) <> -1) then
begin
Result := BluetoothRemoveDevice(pEnt.dInfo.Address) = 0;
Result := true; // 차단 대상이면 위 작업과 별개로 장치 차단을 하도록 함 22_0630 09:15:10 kku
end;
end;
end;
procedure TDlgBlueMon.OnBtDevEntNotify(pEnt: PBtDevEnt; csBT: TBTChangeStates; var bPrevent: Boolean);
var
bPreventBtEnt: Boolean;
begin
if (csConnected in csBT) or (csAuthenticated in csBT) then
begin
bPreventBtEnt := ProcessPreventBT(pEnt);
bPrevent := bPrevent or bPreventBtEnt;
PopMsg(pEnt, bPreventBtEnt);
end;
end;
procedure TDlgBlueMon.btnBlueMonClick(Sender: TObject);
var
BTDevice: TBluetoothDevice;
i: Integer;
bPvreventCurBT: Boolean;
begin
if ThdBlueMon_ = nil then
begin
mmExcept.Text := Trim(mmExcept.Text);
edPB_Name.Text := Trim(edPB_Name.Text);
if chPB_Name.Checked and (edPB_Name.Text = '') then
begin
MessageBox(Handle, PChar('차단 문구를 입력해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
edPB_Name.SetFocus;
exit;
end;
if chPB_MJ.Checked and (lxPB_MJ.Count = 0) then
begin
MessageBox(Handle, PChar('차단 Major 정보를 하나이상 추가해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
if chPB_MN.Checked and (lxPB_MN.Count = 0) then
begin
MessageBox(Handle, PChar('차단 Minor 정보를 하나이상 추가해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
ZeroMemory(@PreventBlue_, SizeOf(PreventBlue_));
PreventBlue_.bPreventAll := chPreventBtAll.Checked;
PreventBlue_.bPvIncName := chPB_Name.Checked;
PreventBlue_.bPvMajor := chPB_MJ.Checked;
PreventBlue_.bPvMinor := chPB_MN.Checked;
SplitString(mmExcept.Text, ';', ExcepBtDevList_);
SplitString(UpperCase(edPB_Name.Text), ';', PvBtNameList_);
SplitString(lxPB_MJ.Items.CommaText, ',', PvMajorList_);
SplitString(lxPB_MN.Items.CommaText, ',', PvMinorList_);
bPvreventCurBT := false;
Guard(BTDevice, TBluetoothDevice.Create);
BTDevice.RefreshBTDevice;
for i := 0 to BTDevice.Count - 1 do
bPvreventCurBT := bPvreventCurBT or ProcessPreventBT(BTDevice[i]);
ThdBlueMon_ := TThdBtDevNotify.Create(true);
ThdBlueMon_.PreventBtDevs := bPvreventCurBT;
ThdBlueMon_.OnChangeBTDevice := OnBtDevEntNotify;
ThdBlueMon_.StartThread;
btnBlueMon.Caption := '감시/차단 중지';
end else begin
FreeAndNil(ThdBlueMon_);
btnBlueMon.Caption := '감시/차단 시작';
end;
chPreventBtAll.Enabled := ThdBlueMon_ = nil;
tabBlueList.TabVisible := chPreventBtAll.Enabled;
Label1.Enabled := chPreventBtAll.Enabled;
mmExcept.Enabled := chPreventBtAll.Enabled;
chPB_Name.Enabled := chPreventBtAll.Enabled;
edPB_Name.Enabled := chPreventBtAll.Enabled;
chPB_MJ.Enabled := chPreventBtAll.Enabled;
cbPB_MJ.Enabled := chPreventBtAll.Enabled;
btnPB_MJAdd.Enabled := chPreventBtAll.Enabled;
btnPB_MJDel.Enabled := chPreventBtAll.Enabled;
lxPB_MJ.Enabled := chPreventBtAll.Enabled;
chPB_MN.Enabled := chPreventBtAll.Enabled;
cbPB_MN.Enabled := chPreventBtAll.Enabled;
btnPB_MNAdd.Enabled := chPreventBtAll.Enabled;
btnPB_MNDel.Enabled := chPreventBtAll.Enabled;
lxPB_MN.Enabled := chPreventBtAll.Enabled;
if tabBlueList.TabVisible then
RefreshBtList;
Application.ProcessMessages;
end;
procedure TDlgBlueMon.btnPB_MJAddClick(Sender: TObject);
var
sAdd: String;
begin
sAdd := cbPB_MJ.Text;
if lxPB_MJ.Items.IndexOf(sAdd) = -1 then
lxPB_MJ.Items.Add(sAdd);
end;
procedure TDlgBlueMon.btnPB_MJDelClick(Sender: TObject);
begin
if lxPB_MJ.SelCount = 0 then
begin
MessageBox(Handle, PChar('삭제할 항목을 선택해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
lxPB_MJ.DeleteSelected;
end;
procedure TDlgBlueMon.btnPB_MNAddClick(Sender: TObject);
var
sAdd: String;
begin
sAdd := cbPB_MN.Text;
if lxPB_MN.Items.IndexOf(sAdd) = -1 then
lxPB_MN.Items.Add(sAdd);
end;
procedure TDlgBlueMon.btnPB_MNDelClick(Sender: TObject);
begin
if lxPB_MN.SelCount = 0 then
begin
MessageBox(Handle, PChar('삭제할 항목을 선택해 주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
lxPB_MN.DeleteSelected;
end;
procedure TDlgBlueMon.btnRefreshClick(Sender: TObject);
begin
RefreshBtList;
end;
function FindFirstBluetoothDevicePath(out ADevicePath: string): Boolean;
const
GUID_BLUETOOTH_DEVICE_INTERFACE: TGUID = '{E0CBF06C-CD8B-4647-BB8A-263B43F0F974}'; // 클래식
GUID_BLUETOOTHLE_DEVICE_INTERFACE: TGUID = '{781AEE18-7733-4CE4-ADD0-91F41C67B592}'; // BLE
type
TGuidArray = array[0..1] of TGUID;
var
Guids: TGuidArray;
FlagsArr: array[0..1] of DWORD;
g, f: Integer;
hDev: HDEVINFO;
DevIfData: SP_DEVICE_INTERFACE_DATA;
Required: DWORD;
Detail: PSPDeviceInterfaceDetailData;
Index: DWORD;
begin
Result := False;
ADevicePath := '';
Guids[0] := GUID_BLUETOOTH_DEVICE_INTERFACE; // 클래식
Guids[1] := GUID_BLUETOOTHLE_DEVICE_INTERFACE; // BLE
// PRESENT 유무 두 번 시도: (1) PRESENT 포함, (2) PRESENT 제외
FlagsArr[0] := DIGCF_DEVICEINTERFACE or DIGCF_PRESENT;
FlagsArr[1] := DIGCF_DEVICEINTERFACE;
for g := Low(Guids) to High(Guids) do
begin
for f := Low(FlagsArr) to High(FlagsArr) do
begin
hDev := SetupDiGetClassDevs(@Guids[g], nil, 0, FlagsArr[f]);
if hDev = INVALID_HANDLE_VALUE then
Continue;
try
Index := 0;
while True do
begin
ZeroMemory(@DevIfData, SizeOf(DevIfData));
DevIfData.cbSize := SizeOf(DevIfData);
if not SetupDiEnumDeviceInterfaces(hDev, nil, Guids[g], Index, DevIfData) then
begin
if GetLastError = ERROR_NO_MORE_ITEMS then
Break
else
Break; // 다른 오류라면 필요시 로그
end;
// 1차 호출: 필요한 버퍼 크기 얻기 (여기서는 실패 + ERROR_INSUFFICIENT_BUFFER가 정상)
Required := 0;
SetupDiGetDeviceInterfaceDetail(hDev, @DevIfData, nil, 0, Required, nil);
if (Required = 0) then
begin
Inc(Index);
Continue;
end;
Detail := PSPDeviceInterfaceDetailData(AllocMem(Required));
try
Detail.cbSize := SizeOf(TSPDeviceInterfaceDetailData);
if SetupDiGetDeviceInterfaceDetail(hDev, @DevIfData, Detail, Required, Required, nil) then
begin
{$IFDEF UNICODE}
ADevicePath := Detail.DevicePath;
{$ELSE}
ADevicePath := string(Detail.DevicePath); // 필요시 변환
{$ENDIF}
Result := True;
Exit; // 첫 번째 것만 반환. 모두 수집하려면 리스트에 Add하고 계속.
end;
finally
FreeMem(Detail);
end;
Inc(Index);
end;
finally
SetupDiDestroyDeviceInfoList(hDev);
end;
end;
end;
end;
function GetBluetoothDevicePath: string;
const
GUID_BLUETOOTH_DEVICE_INTERFACE: TGUID = '{E0CBF06C-CD8B-4647-BB8A-263B43F0F974}';
GUID_BLUETOOTHLE_DEVICE_INTERFACE: TGUID = '{781AEE18-7733-4CE4-ADD0-91F41C67B592}'; // BLE
GUID_BTHPORT_DEVICE_INTERFACE: TGUID = '{0850302A-B344-4FDA-9BE9-90576B8D46F0}';
var
hDInfo: HDEVINFO;
DevInfData: TSPDeviceInterfaceData;
pBuf: TBytes;
dwReqSize: DWORD;
begin
Result := '';
// FindFirstBluetoothDevicePath(Result);
// exit;
// DeviceInfoSet := SetupDiGetClassDevs(nil, 'BTHENUM', 0, DIGCF_PRESENT or DIGCF_ALLCLASSES);
// DeviceInfoSet := SetupDiGetClassDevs(@GUID_DEVCLASS_BLUETOOTH, nil, 0, DIGCF_PRESENT or DIGCF_ALLCLASSES);
// DeviceInfoSet := SetupDiGetClassDevs(@GUID_BLUETOOTH_DEVICE_INTERFACE, nil, 0, DIGCF_PRESENT or DIGCF_DEVICEINTERFACE);
hDInfo := SetupDiGetClassDevs(@GUID_BTHPORT_DEVICE_INTERFACE, nil, 0, DIGCF_PRESENT or DIGCF_DEVICEINTERFACE);
if hDInfo = INVALID_HANDLE_VALUE then
exit;
try
ZeroMemory(@DevInfData, SizeOf(DevInfData));
DevInfData.cbSize := SizeOf(SP_DEVICE_INTERFACE_DATA);
if SetupDiEnumDeviceInterfaces(hDInfo, nil, GUID_BTHPORT_DEVICE_INTERFACE, 0, DevInfData) then
begin
SetupDiGetDeviceInterfaceDetail(hDInfo, @DevInfData, nil, 0, dwReqSize, nil);
// DeviceInterfaceDetailData := AllocMem(RequiredSize);
SetLength(pBuf, dwReqSize);
ZeroMemory(pBuf, dwReqSize);
PSPDeviceInterfaceDetailData(@pBuf[0]).cbSize := SizeOf(TSPDeviceInterfaceDetailData);
try
if SetupDiGetDeviceInterfaceDetail(hDInfo, @DevInfData, PSPDeviceInterfaceDetailData(@pBuf[0]), dwReqSize, dwReqSize, nil) then
Result := PChar(@pBuf[4]);
finally
//
end;
end;
finally
SetupDiDestroyDeviceInfoList(hDInfo);
end;
end;
function BluetoothDisconnectDevice(aBtAddr: BLUETOOTH_ADDRESS): Boolean;
const
IOCTL_BTH_DISCONNECT_DEVICE = (
(FILE_DEVICE_BLUETOOTH shl 16) or (METHOD_BUFFERED shl 14) or
($0301 shl 2) or FILE_ANY_ACCESS);
// CTL_CODE(FILE_DEVICE_BLUETOOTH, 6, METHOD_BUFFERED, FILE_ANY_ACCESS);
var
BtFindParams: BLUETOOTH_FIND_RADIO_PARAMS;
hRadio: THandle;
hDevice: THandle;
sDevPath: String;
ulllBuf: ULONGLONG;
begin
Result := false;
// 블루투스 라디오 핸들 가져오기
// hRadio := 0;
hDevice := 0;
// ZeroMemory(@BtFindParams, SizeOf(BtFindParams));
// BtFindParams.dwSize := SizeOf(BtFindParams);
// if BluetoothFindFirstRadio(@BtFindParams, hRadio) <> 0 then
// begin
// try
// Bluetooth 장치 핸들 열기
sDevPath := GetBluetoothDevicePath;
if sDevPath = '' then
exit;
// hDevice := CreateFile(PChar('\\.\BTHENUM#' + IntToStr(aBtAddr.ullLong)),
// hDevice := CreateFile(PChar('\\.\BTHLE\DEV_BC87FA05FBF7\7&17003C4D&0&BC87FA05FBF7'),
hDevice := CreateFile(PChar(sDevPath),
GENERIC_WRITE or GENERIC_READ,
FILE_SHARE_READ or FILE_SHARE_WRITE,
nil,
OPEN_EXISTING,
0,
0);
if hDevice <> INVALID_HANDLE_VALUE then
begin
try
ulllBuf := aBtAddr.ullLong;
// DeviceIoControl을 사용하여 연결 해제
Result := DeviceIoControl(hDevice,
IOCTL_BTH_DISCONNECT_DEVICE,
@ulllBuf,
SizeOf(ulllBuf),
nil,
0,
DWORD(nil^),
nil);
finally
CloseHandle(hDevice);
end;
end;
// finally
// CloseHandle(hRadio);
// end;
// end;
end;
function BluetoothDisconnectDevice2(aBtAddr: BLUETOOTH_ADDRESS): Boolean;
const
// 표준 Bluetooth 서비스 GUID
BLUETOOTH_SERVICE_GUID: TGUID = '{00001124-0000-1000-8000-00805F9B34FB}';
// 서비스 GUID 목록
SERVICE_GUID_A2DP: TGUID = '{0000110D-0000-1000-8000-00805F9B34FB}'; // Advanced Audio Distribution
SERVICE_GUID_AVRCP: TGUID = '{0000110E-0000-1000-8000-00805F9B34FB}'; // Audio/Video Remote Control
SERVICE_GUID_HFP: TGUID = '{0000111E-0000-1000-8000-00805F9B34FB}'; // Hands-Free Profile
SERVICE_GUID_HID: TGUID = '{00001124-0000-1000-8000-00805F9B34FB}'; // Human Interface Device
SERVICE_GUID_PANU: TGUID = '{00001115-0000-1000-8000-00805F9B34FB}'; // Personal Area Networking
SERVICE_GUID_SPP: TGUID = '{00001101-0000-1000-8000-00805F9B34FB}'; // Serial Port Profile
var
hFindRadio: HBLUETOOTH_RADIO_FIND;
hFindDev: HBLUETOOTH_DEVICE_FIND;
hRadio: THandle;
BtRadiFindParam: BLUETOOTH_FIND_RADIO_PARAMS;
// BtRadiInfo: BLUETOOTH_RADIO_INFO;
BtDevInfo: BLUETOOTH_DEVICE_INFO;
searchParams: BLUETOOTH_DEVICE_SEARCH_PARAMS;
pInfo: PBtRdiEnt;
begin
Result := false;
ZeroMemory(@BtRadiFindParam, SizeOf(BtRadiFindParam));
BtRadiFindParam.dwSize := SizeOf(BtRadiFindParam);
// ZeroMemory(@BtRadiInfo, SizeOf(BtRadiInfo));
// BtRadiInfo.dwSize := SizeOf(BtRadiInfo);
hFindRadio := 0;
hFindDev := 0;
hRadio := 0;
hFindRadio := BluetoothFindFirstRadio(@BtRadiFindParam, hRadio);
if hFindRadio = 0 then
exit;
try
ZeroMemory(@searchParams, SizeOf(searchParams));
searchParams.dwSize := SizeOf(searchParams);
searchParams.fReturnAuthenticated := True;
searchParams.fReturnRemembered := True;
searchParams.fReturnConnected := True;
searchParams.fReturnUnknown := False;
searchParams.hRadio := hRadio;
ZeroMemory(@BtDevInfo, SizeOf(BtDevInfo));
BtDevInfo.dwSize := SizeOf(BtDevInfo);
hFindDev := BluetoothFindFirstDevice(searchParams, BtDevInfo);
if hFindDev = 0 then
exit;
repeat
// 주소 비교
if CompareMem(@BtDevInfo.Address, @aBtAddr, SizeOf(aBtAddr)) then
begin
// 장치 연결 해제 시도
Result := BluetoothSetServiceState(hRadio, BtDevInfo, SERVICE_GUID_A2DP, BLUETOOTH_SERVICE_DISABLE) = ERROR_SUCCESS;
if not Result then
Result := BluetoothSetServiceState(hRadio, BtDevInfo, SERVICE_GUID_AVRCP, BLUETOOTH_SERVICE_DISABLE) = ERROR_SUCCESS;
if not Result then
Result := BluetoothSetServiceState(hRadio, BtDevInfo, SERVICE_GUID_HFP, BLUETOOTH_SERVICE_DISABLE) = ERROR_SUCCESS;
if not Result then
Result := BluetoothSetServiceState(hRadio, BtDevInfo, SERVICE_GUID_HID, BLUETOOTH_SERVICE_DISABLE) = ERROR_SUCCESS;
if not Result then
Result := BluetoothSetServiceState(hRadio, BtDevInfo, SERVICE_GUID_PANU, BLUETOOTH_SERVICE_DISABLE) = ERROR_SUCCESS;
if not Result then
Result := BluetoothSetServiceState(hRadio, BtDevInfo, SERVICE_GUID_SPP, BLUETOOTH_SERVICE_DISABLE) = ERROR_SUCCESS;
exit;
end;
until not BluetoothFindNextDevice(hFindDev, BtDevInfo);
finally
if hFindDev <> 0 then
BluetoothFindDeviceClose(hFindDev);
if hFindRadio <> 0 then
BluetoothFindRadioClose(hFindRadio);
end;
end;
procedure TDlgBlueMon.miPreventBlueClick(Sender: TObject);
var
pNode: PVirtualNode;
pData: PBlueEnt;
dwResult: DWORD;
begin
pNode := vtList.GetFirstSelected;
if pNode = nil then
exit;
if MessageBox(Handle, PChar('연결을 해제 하시겠습니까?'),
PChar(Caption), MB_ICONQUESTION or MB_YESNO) = IDNO then exit;
pData := vtList.GetNodeData(pNode);
// dwResult := BluetoothRemoveDevice(pData.Address);
// if dwResult = 0 then
if BluetoothDisconnectDevice2(pData.Address) then
vtList.DeleteNode(pNode)
else
ShowMessage(Format('Fail .. %d', [dwResult]));
end;
procedure TDlgBlueMon.miCopyCBClick(Sender: TObject);
begin
VT_CopyToClipboardSelectedInfo(vtList);
MessageBox(Handle, PChar('클립보드로 복사되었습니다.'), PChar(Caption), MB_ICONINFORMATION or MB_OK);
end;
procedure TDlgBlueMon.vtListContextPopup(Sender: TObject; MousePos: TPoint;
var Handled: Boolean);
begin
Handled := vtList.GetNodeAt(MousePos) = nil;
end;
procedure TDlgBlueMon.vtListFreeNode(Sender: TBaseVirtualTree;
Node: PVirtualNode);
var
pData: PBlueEnt;
begin
pData := Sender.GetNodeData(Node);
Finalize(pData^);
end;
procedure TDlgBlueMon.vtListGetNodeDataSize(Sender: TBaseVirtualTree;
var NodeDataSize: Integer);
begin
NodeDataSize := SizeOf(TBlueEnt);
end;
procedure TDlgBlueMon.vtListGetText(Sender: TBaseVirtualTree;
Node: PVirtualNode; Column: TColumnIndex; TextType: TVSTTextType;
var CellText: string);
var
pData: PBlueEnt;
begin
pData := Sender.GetNodeData(Node);
case Column of
0 : CellText := IntToStr(Node.Index + 1);
1 : CellText := BooleanToStr(pData.bConnected, '연결됨', '연결안됨');
2 : CellText := pData.sName;
3 : CellText := Format('0x%.6x', [pData.nClassofDevice]);
4 : CellText := pData.sMajor;
5 : CellText := pData.sMinor;
6 : CellText := BooleanToStr(pData.bAuth, 'O', 'X');
7 : CellText := pData.sAddress;
8 : if pData.dtRecent <> 0 then CellText := DateTimeToStr(pData.dtRecent);
9 : if pData.dtSeen <> 0 then CellText := DateTimeToStr(pData.dtSeen);
end;
end;
procedure TDlgBlueMon.vtListHeaderClick(Sender: TVTHeader;
HitInfo: TVTHeaderHitInfo);
begin
if HitInfo.Button = mbLeft then
begin
if HitInfo.Column < 0 then
exit;
with Sender, Treeview do
begin
if SortColumn > NoColumn then
Columns[SortColumn].Options := Columns[SortColumn].Options + [coParentColor];
if HitInfo.Column = 0 then
SortColumn := NoColumn
else
begin
if (SortColumn = NoColumn) or (SortColumn <> HitInfo.Column) then
begin
SortColumn := HitInfo.Column;
SortDirection := sdAscending;
end else
if SortDirection = sdAscending then
SortDirection := sdDescending
else
SortDirection := sdAscending;
Columns[SortColumn].Color := $00EFEFEF;
vtList.BeginUpdate;
try
vtList.SortTree(SortColumn, SortDirection, False);
finally
vtList.EndUpdate;
end;
end;
end;
end;
end;
end.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,998 @@
unit DNoticeBT;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.Imaging.pngimage,
Vcl.StdCtrls, System.ImageList, Vcl.ImgList, PngImageList, Tocsg.Win32,
Define, Vcl.WinXPanels, superobject;
const
PARAM_GO_SETPASS = '/c explorer ms-settings:signinoptions'; // '/c control userpasswords';
PARAM_GO_ANTIVIRUS = '/c explorer windowsdefender:';
PARAM_GO_FIREWALL = '/c control firewall.cpl';
PARAM_GO_FIREWALL2 = '/c explorer windowsdefender://network/';
PARAM_GO_WINUPDATE = '/c explorer ms-settings:windowsupdate';
PARAM_GO_SETSAVER = '/c rundll32.exe shell32.dll,Control_RunDLL desk.cpl,,1';
PARAM_GO_SYSTEMINFO = '/c control /name Microsoft.System';
PARAM_GO_UNINSTALL = '/c appwiz.cpl';
type
TDlgNoticeBT = class(TForm)
imgTop: TImage;
lbTitle: TLabel;
imgBtnList: TPngImageList;
tInit: TTimer;
btnClose: TButton;
imgTitles: TPngImageCollection;
cpMain: TCardPanel;
cdDef: TCard;
imgOk: TImage;
imgSet: TImage;
lbOk: TLabel;
mmMsg: TMemo;
lbSet: TLabel;
cdPI: TCard;
Label2: TLabel;
lbGrade: TLabel;
Label5: TLabel;
lbPiCnt: TLabel;
lbMsgEx: TLabel;
tClose: TTimer;
pnTop: TPanel;
lbMode: TLabel;
procedure imgOkMouseEnter(Sender: TObject);
procedure imgOkMouseLeave(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure imgOkClick(Sender: TObject);
procedure imgSetClick(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormKeyPress(Sender: TObject; var Key: Char);
procedure imgTopMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure tInitTimer(Sender: TObject);
procedure btnCloseClick(Sender: TObject);
procedure lbPiCntMouseEnter(Sender: TObject);
procedure lbPiCntMouseLeave(Sender: TObject);
procedure lbPiCntClick(Sender: TObject);
procedure tCloseTimer(Sender: TObject);
private
{ Private declarations }
sCmdParam_,
sNotiCenterMsg_: String;
Mutex_: TTgMutex;
procedure SetNotiForm;
procedure SetImgBtn(imgBtn: TImage; nImgIdx: Integer);
procedure SetOneButtion;
procedure SetPiResult4HEC(nRstCnt: Integer);
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
procedure CreateParams(var Params: TCreateParams); override; // 작업표시줄에 표시
Destructor Destroy; override;
procedure PopupMessage(sJsonData: String);
property NotiCenterMsg: String read sNotiCenterMsg_;
end;
var
DlgNoticeBT: TDlgNoticeBT;
resourcestring
RS_SecuViol = '보안 정책 위반';
RS_Vul = '취약점 발생';
RS_Noti = '공지 사항';
RS_Info = '정보 알림';
RS_SetVul = '조치';
RS_DevExcept = '예외';
implementation
uses
Tocsg.Exception, Tocsg.Safe, Tocsg.Shell, GlobalDefine,
Tocsg.Strings, Vcl.Clipbrd, Condition, Tocsg.Path, Tocsg.Trace,
Tocsg.WTS, Tocsg.Process, Tocsg.Json, Tocsg.Hash, Tocsg.Convert;
resourcestring
RS_TitleVul = '보안 취약점이 발견되었습니다.';
RS_TitlePrevent = '보안정책 관련 활동이 탐지되었습니다'; // '보안정책 위반 행위가 탐지되었습니다.';
RS_TitlePreventSimple = '보안정책 위반 행위 탐지';
RS_SafeCompleted = '취약점 점검 대상 항목 조치가 완료되었습니다.';
RS_SafeCompletedSimple = '보안 취약점 조치 완료';
RS_InitRemoteConn = '보안 취약점이 모두 조치 되어서' + #13#10 + '보안모드를 사용할 수 있습니다.'; // '이제 원격접속을 시작할 수 있습니다.';
RS_SafeCompletedLX = '보안 취약점 조치가 완료되었습니다.';
RS_InitRemoteConnLX = '원격 접속을 사용할 수 있습니다.';
RS_UnsafeOS = '사용하시는 OS는 안전하지 않습니다.';
RS_EOSVersion = '(End-of-Service 버전)';
RS_NoAllVulCheck = '특정 취약점검은 동작하지 않을 수 있습니다.';
RS_NoAllVulCheckLX = '최신 OS 버전으로 업데이트 후 사용하시기 바랍니다.';
RS_NoUpToDateOS = '윈도우 보안 패치가 최신이 아닙니다.';
RS_OSPatchAction1 = ' 조치 버튼 클릭 후 "업데이트 확인"을 통해 패치를';
RS_OSPatchAction2 = ' 진행하세요.';
RS_OSPatchAction3 = ' 보안 패치에 따라 PC재부팅이 필요합니다.';
RS_OSPatchActionLX = '조치 버튼 클릭 후 최신 보안 패치를 설치를 권고합니다.';
RS_VulPW1 = '사용자 계정 암호가 설정되어 있지 않습니다.';
RS_VulPW2 = ' 조치 버튼 클릭 후 "PC설정에서 내 계정 변경"';
RS_VulPW3 = ' -> "로그인옵션"';
RS_VulPW4 = ' -> "비밀번호"에서 암호를 설정하세요.';
RS_VulPW2LX = '조치 버튼 클릭 후 [사용자 계정 변경]';
RS_VulPW3LX = ' [다른 계정 관리] [암호 만들기]에서 암호를 생성 후';
RS_VulPW4LX = '사용하시기 바랍니다. ';
RS_LastChangePw = '마지막으로 암호 설정한 날짜 :';
RS_VulPwDate1 = '사용자 계정 암호가 오래되었습니다.';
RS_VulPwDate2 = ' 조치 버튼 클릭 후 "다른 계정 관리"';
RS_VulPwDate3 = ' -> "계정 클릭"';
RS_VulPwDate4 = ' -> "암호 변경"에서 새암호를 설정하세요.';
RS_VulAV1 = '백신 프로그램이 설정되어 있지 않습니다.';
RS_VulAV2 = ' 조치 버튼 클릭 후 "Windows 보안센터"';
RS_VulAV3 = ' -> "바이러스 및 위협 방지"에서';
RS_VulAV4 = ' 백신을 활성화 하세요.';
RS_VulAV2LX = '조치 버튼 클릭 후 [바이러스 및 위협 방지]';
RS_VulAV3LX = ' [앱 열기] [환경설정] [백신 실시간 검사 사용]을';
RS_VulAV4LX = '활성화하시기 바랍니다.';
RS_VulFW1 = '방화벽 설정이 되어있지 않습니다.';
RS_VulFW2 = ' 조치 버튼 클릭 후 "권장 설정 사용"을';
RS_VulFW3 = ' 눌러 방화벽을 활성화하세요.';
RS_VulFW2LX = '조치 버튼 클릭 후 [권장 설정 사용]을 눌러 방화벽을';
RS_VulFW3LX = '활성화하시기 바랍니다.';
RS_VulScreen1 = '화면 보호기가 설정되어 있지 않습니다.';
RS_VulScreen2 = ' 조치 버튼 클릭 후 "다시 시작할 때 로그온 화면 표시';
RS_VulScreen3 = ' 체크박스"를 활성화 하세요.';
RS_VulScreen2LX = '조치 버튼 클릭 후 [다시 시작할 때 로그온 화면 표시';
RS_VulScreen3LX = '체크박스]를 활성화하시기 바랍니다. ';
RS_VulEmpNo1 = '서버에서 검증되지 않은 사번입니다.';
RS_VulEmpNo2 = '조치 버튼 클릭 후 검증된 사번을 입력하거나';
RS_VulEmpNo3 = '관리자에게 검증을 요청 해주십시오.';
RS_InvalidEmpNo = ' 미검증 사번 : ';
RS_VulAllow1 = '접속 승인이 되지 않았습니다.';
RS_VulAllow2 = '접속 승인 여부를 확인 후 재시도하세요.';
RS_NoAccessMAC = '현재 PC의 MAC이 접속허용되지 않았습니다.';
RS_RequestManager = '관리자에게 문의하세요.';
RS_ExpireConnDate = '접속 승인 기간이 만료되었습니다.';
RS_PersonalInfoOver = '개인정보 임계치가 초과 되었습니다.';
RS_PersonalInfoOver1 = '검출출된 개인정보 결과를 확인 / 조치 후';
RS_PersonalInfoOver2 = '개인정보 검사를 수행해 주십시오.';
RS_UpdateCompleted = '업데이트 완료';
RS_MsgUpdateCompleted = '프로그램이 업데이트 되었습니다.';
RS_FMT_Version = ' - 버전 : %s';
RS_WriteReport = '사용 보고서 작성';
RS_MsgWriteReport1 = '다시 보안 모드에 진입하기 전에';
RS_MsgWriteReport2 = '사용 보고서를 작성 해주십시오.';
RS_MsgLxPrevent = '** 원격지 근무 보안 정책이 위반되었습니다 **';
RS_ClipCutLX = '- 복사, 캡쳐를 금지합니다.';
RS_ClipCut = '클립보드 (복사, 캡쳐) 사용이 차단 되었습니다.';
RS_FMT_ClipCutApp = '사용 프로그램 : %s';
RS_USBCutLX = '** USB 사용을 금지합니다. **';
RS_USB_RO_LX = '** USB가 쓰기 금지됩니다. **';
RS_USBCut = '외부 저장소 연결이 해제 되었습니다.';
RS_USB_RO = '외부 저장소의 쓰기가 금지됩니다.';
RS_CDROMCut = 'CD/DVD 저장소 연결이 해제 되었습니다.';
RS_CDROMCutLX = '** CD/DCD 사용을 금지합니다. **';
RS_RouteCutLX = '라우팅 테이블 변경이 차단 되었습니다.';
RS_RouteCut = '라우팅 테이블 변경이 차단 되었습니다.';
RS_FWaterLX = '워터마크가 적용되었습니다.';
RS_FWater = '워터마크가 적용되었습니다.';
RS_FWatchLX = '파일 변경이 탐지되었습니다.';
RS_FWatch = '로컬 파일 변경이 탐지되었습니다.';
RS_FCutLX = '파일 저장이 차단됩니다.';
RS_FDelAfter = '만약 사용 중이면, 사용 후 삭제됩니다.';
RS_FCut = '파일 생성이 차단 되었습니다.';
RS_TempConnect = '임시 접속이 허용되었습니다. (Unsafe Mode)';
RS_TempConnectExit = '본 연결은 %d분 뒤 강제 종료됩니다.';
RS_TerminateApp = '앱이 종료되었습니다.';
RS_MonitorApp = '앱 실행이 감지되었습니다.';
RS_ExeWhiteAppLX = '- 필수 앱을 실행해 주세요.';
RS_ExeWhiteApp1 = '다음 필수 앱이 실행되고 있지 않습니다.';
RS_ExeWhiteApp2 = '연결이 초기화됩니다.';
RS_FMaskLX = '민감정보를 마스킹합니다.';
RS_FMask = '파일이 마스킹 되었습니다.';
RS_URLCut = 'URL 연결이 차단 되었습니다.';
RS_URLMon = 'URL 연결이 감지 되었습니다.';
RS_FMT_URLCut = ' - URL : %s';
RS_FMT_URLInfo = ' - URL 평판 : %s';
RS_DetectAppInstSankyo = '비인가 소프트웨어 설치 행위가 탐지되었습니다.';
RS_DetectAppInstSankyo2 = '비인가 프로그램 설치가 감지되었습니다.';
RS_DetectAppInst = '프로그램 설치가 감지되었습니다.';
RS_DetectAppInst1 = '아래 ''조치'' 버튼을 눌러 제어판에서 해당 프로그램을';
RS_DetectAppInst2 = '삭제 해주시기 바랍니다.';
RS_DetectWIFI = '무선 네트워크 접속(WIFI)이 감지되었습니다.';
RS_AfterCut = '잠시 후 차단됩니다.';
RS_DetectBlue = '블루투스 연결이 감지되었습니다.';
RS_BlueCut = '블루투스 연결을 차단합니다.';
RS_DetectMTP = 'MTP 연결이 감지되었습니다.';
RS_MTPCut = 'MTP 연결을 차단합니다.';
RS_DetectPrinter = '프린터 사용이 감지되었습니다.';
RS_NotSupportWT = '워터마크를 지원하지 않는 프로그램입니다.';
RS_NotSupportPTR = '승인되지 않은 프린터 입니다.';
RS_NotSupportPTR_IP = '승인되지 않은 프린터 IP 입니다.';
RS_NotSupportAPP = '승인되지 않은 APP : ';
RS_NotSupportURL = '승인되지 않은 URL : ';
RS_FoundCtt = '개인정보 검출됨 : ';
RS_PrinterCut = '프린터 사용을 차단합니다.';
RS_MsgCopyClipboard = '메시지가 클립보드에 복사 되었습니다.';
RS_CTTSCH = '개인정보 검사';
RS_CTTSCH_START = '개인정보 검사가 시작되었습니다.';
RS_CTTSCH_COMPLETE = '개인정보 검사를 완료했습니다.';
RS_CTTSCH_TILE = '검사 시간';
RS_CTTSCH_RESULT_COUNT = '검출된 파일 수';
RS_CttSchVulModeMsg1 = '많은 수의 개인정보가 추출 되었습니다.';
RS_CttSchVulModeMsg2 = '개인정보 검사 결과를 확인하고 조치 후';
RS_CttSchVulModeMsg3 = '개인정보 검사를 다시 수행해 주십시오.';
RS_DetectCopyCapture = '- 복사, 캡쳐가 감지 되었습니다.';
RS_DetectCB = '클립보드 (복사, 캡쳐) 사용이 감지 되었습니다.';
RS_DetectRemoveableDev = '외부 저장소 연결이 감지 되었습니다.';
RS_DetectCdrom = 'CD/DVD 연결이 감지 되었습니다.';
RS_DeleteInstApp = '설치된 프로그램을 삭제합니다.';
RS_DeleteInstAppMsg1 = '아래 ''조치'' 버튼을 눌러 삭제를 확인하고,';
RS_DeleteInstAppMsg2 = '삭제가 되지 않았다면 삭제해주십시오.';
RS_PrintWater1 = '프린트 워터마크 적용';
RS_PrintWater2 = '프린트 워터마크가 적용 되었습니다.';
RS_DetectFileUse = '파일 첨부, 사용이 감지 되었습니다.';
RS_DetectFileBlock = '파일 첨부, 사용이 차단 되었습니다.';
RS_Program = '프로그램 : ';
RS_FileName = '파일 이름 : ';
RS_FilePath = '파일 경로 : ';
RS_FileTag = '파일 태그 : ';
RS_OpenDrm1 = 'DRM 문서 열람';
RS_OpenDrm2 = 'DRM 문서를 확인합니다.';
RS_OpenDrm3 = 'DRM 문서를 수정할 수 없습니다..';
RS_BlockDrm1 = 'DRM 문서를 열람할 수 없습니다.';
RS_BlockDrm2 = '관리자에게 열람 권한을 문의해 주십시오.';
RS_BlockDrm3 = '다른 환경에서 만들어진 DRM 문서입니다.';
RS_EncDrm1 = 'DRM 문서 암호화';
RS_EncDrm2 = 'DRM 문서 암호화가 적용됩니다.';
RS_DocName = '문서이름 : ';
RS_DetectFRename = '파일 이름변경이 감지 되었습니다.';
RS_BlockFRename = '파일 이름변경이 차단 되었습니다.';
RS_OrgName = '원본 이름 : ';
RS_ChgName = '변경 이름 : ';
RS_BlockShareFolder = '공유 폴더 설정이 차단 되었습니다.';
RS_DetectShareFolder = '공유 폴더 설정이 감지 되었습니다.';
RS_BlockCappApp = '캡쳐 APP이 차단 되었습니다.';
RS_DetectCappApp = '캡쳐 APP이 감지 되었습니다.';
RS_MsgVul1_ABL = '%s 설정이 되어 있지 않습니다.';
RS_MsgVul2_ABL = '[취약상태]로 되어 있는 버튼을 클릭하여 설정을 변경하세요.';
RS_ScrSv_ABL = '[화면 보호기]';
RS_AV_ABL = '[Anti-Virus]';
RS_UserPw_ABL = '[계정 비밀번호]';
RS_FW_ABL = '[방화벽]';
RS_OsVer_ABL = '[OS 버전]';
RS_OsPatch_ABL = '[OS 패치]';
RS_TITLE = '제목 : ';
RS_CC = '참조 : ';
RS_TO = '수신자 : ';
RS_OutlookMonMsg = '아웃룩 메일 전송이 감지 되었습니다.';
RS_OutlookMaskMsg = '아웃룩 전송 메일이 마스킹 되었습니다.';
RS_OutlookBlockMsg = '아웃룩 메일 전송이 차단 되었습니다.';
RS_OutlookBlockApp = '아웃룩이 보안 정책으로 차단 되었습니다.';
RS_OutlookBlockAppMsg1 = '아래 "조치" 버튼을 눌러서';
RS_OutlookBlockAppMsg2 = '아웃룩 보안 모듈을 적용 후 다시 실행 해주십시오.';
RS_OutlookSecu = '아웃룩 보안 적용';
RS_OutlookSecuMsg = '아웃룩 보안이 적용되었습니다.';
RS_BLOCK_MTP_WRITE = 'MTP 장치에서 파일쓰기가 차단 되었습니다.';
RS_RELEASE_QUARANTINE = '검역소에 격리된 파일이 해제 되었습니다.';
RS_RELEASE_FILE_QUARANTINE = '파일 격리 해제';
RS_ChangeMode = '모드 변경';
RS_BlockTethering = '네트워크가 차단 되었습니다.';
RS_MsgModeSleep = '[수면 모드 입니다]';
RS_MsgModeSecu = '[보안 모드 입니다]';
RS_MsgModeVul = '[취약 모드 입니다. 취약점을 조치해주세요]';
RS_RS_MsgModeNoId = '[미인증 모드 입니다. ID 인증이 필요합니다]';
RS_MsgModeOff = '[오프라인 모드 입니다]';
RS_MsgModeExpt = '[예외 모드 입니다]';
RS_ReqApproval = '결재 승인 요청';
RS_Confirm = '승인';
RS_MsgConfirm = '확인하시고 승인 바랍니다';
RS_PrtApproval = '출력 요청';
RS_MsgPrtApproval = '출력이 요청 되었습니다.';
RS_UsbExcept = 'USB 매체 예외';
RS_MsgUsbExcept = 'USB 매체 예외가 요청 되었습니다.';
RS_UrlExcept = '브라우저 접근 예외';
RS_MsgUrlExcept = '브라우저 접근 예외가 요청 되었습니다.';
RS_DecExcept = 'DRM 해제 요청';
RS_MsgDecExcept = 'DRM 해제가 요청 되었습니다.';
RS_FileExpExcept = '파일 반출 요청';
RS_MsgFileExpExcept = '파일 반출이 요청 되었습니다.';
RS_MtpExcept = 'MTP 매체 예외';
RS_MtpUrlExcept = 'MTP 매체 예외 요청 되었습니다.';
RS_BtExcept = 'Bluetooth 매체 예외';
RS_BtUrlExcept = 'Bluetooth 매체 예외 요청 되었습니다.';
RS_CdExcept = 'CD/DVD 매체 예외';
RS_CdUrlExcept = 'CD/DVD 매체 예외 요청 되었습니다.';
RS_PrtWaterExcept = '프린트 워터마크 예외';
RS_MsgPrtWaterExcept = '프린트 워터마크가 예외 요청 되었습니다.';
RS_ApprovalResult = '결재 확인';
RS_NotFoundPrintInfo = '출력 정보를 찾을 수 없습니다. (%s)';
RS_PrintPass = '출력 요청이 승인 되었습니다.';
RS_PrintReqReject = '출력 요청이 반려 되었습니다.';
RS_MsgError = '오류가 발생했습니다';
RS_UsbReqPass = 'USB 매체 예외가 승인 되었습니다.';
RS_UsbReqReject = 'USB 매체 예외 요청이 반려 되었습니다.';
RS_UrlReqPass = '브라우저 접근 예외가 승인 되었습니다.';
RS_DrmReqPass = 'DRM 해제 요청이 승인 되었습니다.';
RS_DrmReqReject = 'DRM 해제 요청이 반려 되었습니다.';
RS_FileExpReqPass = '파일 반출 요청이 승인 되었습니다.';
RS_FileExpReqReject = '파일 반출 요청이 반려 되었습니다.';
RS_UrlReqReject = '브라우저 접근 예외 요청이 반려 되었습니다.';
RS_MtpReqPass = 'MTP 매체 예외가 승인 되었습니다.';
RS_MtpReqReject = 'MTP 매체 예외 요청이 반려 되었습니다.';
RS_BtReqPass = 'Bluetooth 매체 예외가 승인 되었습니다.';
RS_BtReqReject = 'Bluetooth 매체 예외 요청이 반려 되었습니다.';
RS_CdReqPass = 'CD/DVD 매체 예외가 승인 되었습니다.';
RS_PrtWaterReqPass = '프린트 워터마크 예외가 승인 되었습니다.';
RS_CdReqReject = 'CD/DVD 매체 예외 요청이 반려 되었습니다.';
RS_PrtWaterReject = '프린트 워터마크 예외 요청이 반려 되었습니다.';
RS_ApprovalReason = '결재 처리 사유';
RS_NoApprovalInfo = '결재자 정보를 가져올 수 없습니다.';
RS_UpdateReboot = '업데이트 기능 적용을 위해 PC를 재부팅해야 합니다.';
{$R *.dfm}
var
_nNotiCnt: Integer = 0;
Constructor TDlgNoticeBT.Create(aOwner: TComponent);
var
hTarkBar: HWND;
r: TRect;
nVCnt, nHPos: Integer;
begin
Inherited Create(aOwner);
Caption := APP_TITLE;
if CUSTOMER_TYPE = CUSTOMER_TMAP then // 티맵은 위치 고정
_nNotiCnt := 1
else
Inc(_nNotiCnt);
sCmdParam_ := '';
sNotiCenterMsg_ := '';
Mutex_ := nil;
hTarkBar := FindWindow('Shell_TrayWnd', '');
if hTarkBar <> 0 then
begin
SetNotiForm;
GetWindowRect(hTarkBar, r);
// Top가 0이면 위, 왼쪽 아님 오른쪽
if (r.Left <= 0) and (r.Right < Screen.PrimaryMonitor.Width) then
begin
// 왼쪽
Top := Screen.PrimaryMonitor.Height;
Left := Screen.PrimaryMonitor.Width;
end else
if (r.Left <= 0) and (r.Top = 0) and
(r.Bottom < Screen.PrimaryMonitor.Height) then
begin
// 위쪽
Top := Screen.PrimaryMonitor.Height;
Left := Screen.PrimaryMonitor.Width;
end else
if (r.Left <= 0) and (r.Top > 0) then
begin
// 아래쪽
Top := Screen.PrimaryMonitor.Height - (r.Bottom - r.Top);
Left := Screen.PrimaryMonitor.Width;// - Width;
end else begin
// 오른쪽
Top := Screen.PrimaryMonitor.Height;
Left := Screen.PrimaryMonitor.Width - (r.Right - r.Left);// - Width - (r.Right - r.Left);
end;
// if CUSTOMER_TYPE = CUSTOMER_TMAP then
// begin
// nVCnt := 1; // 티맵은 위치 고정
// nHPos := 0;
// end else begin
//
// end;
nVCnt := Screen.PrimaryMonitor.Height div Height;
nHPos := _nNotiCnt mod nVCnt;
if nHPos = 0 then
begin
Left := Left - (_nNotiCnt div nVCnt) * Width;
nHPos := nVCnt;
end else
Left := Left - ((_nNotiCnt div nVCnt) + 1) * Width;
Top := Top - (nHPos * Height);
end;
tInit.Enabled := true;
{$IFDEF _HE_}
nHPos := gMgSvc.ModePolicy.NotiCloseSec;
if nHPos > 0 then
begin
tClose.Interval := nHPos * 1000;;
tClose.Enabled := true;
end else
if IsHD then
begin
tClose.Interval := 5000;
tClose.Enabled := true;
end;
{$ENDIF}
end;
procedure TDlgNoticeBT.CreateParams(var Params: TCreateParams);
begin
Inherited CreateParams(Params);
Params.ExStyle := WS_EX_APPWINDOW;
end;
Destructor TDlgNoticeBT.Destroy;
begin
if Mutex_ <> nil then
FreeAndNil(Mutex_);
Inherited;
end;
procedure TDlgNoticeBT.SetNotiForm;
begin
cpMain.ActiveCard := cdDef;
// if aNotiType = nftNormal then
// begin
// lbTitle.Caption := RS_TitleVul;
// imgTop.Picture.Assign(imgTitles.Items[0].PngImage);
// Width := 454;
// Height := 461;
// lbTitle.Top := 193;
// lbTitle.Left := 31;
// mmMsg.Top := 44;
// mmMsg.Left := 31;
// lbMode.Left := 31;
// lbOk.Top := 187;
// lbOk.Left := 31;
// imgOk.Top := 187;
// imgOk.Left := 31;
// lbSet.Top := 187;
// lbSet.Left := 243;
// imgSet.Top := 187;
// imgSet.Left := 243;
// lbMsgEx.Top := 163;
//
// if pnTop.Visible then
// begin
// Height := Height + pnTop.Height;
// lbTitle.Top := lbTitle.Top + pnTop.Height;
// mmMsg.Top := mmMsg.Top + pnTop.Height;
//// lbOk.Top := lbOk.Top + pnTop.Height;
//// imgOk.Top := imgOk.Top + pnTop.Height;
//// lbSet.Top := lbSet.Top + pnTop.Height;
//// imgSet.Top := imgSet.Top + pnTop.Height;
// lbMsgEx.Top := lbMsgEx.Top + pnTop.Height;
// end;
// end else
begin
if not pnTop.Visible then
Height := Height - pnTop.Height;
end;
end;
procedure TDlgNoticeBT.PopupMessage(sJsonData: String);
var
O: ISuperObject;
MsgList: TStringList;
sTemp: String;
StrList: TStringList;
procedure SetOneNomal(bShowTitle: Boolean = false);
begin
SetOneButtion;
lbTitle.Visible := bShowTitle;
mmMsg.Font.Color := $635653;
mmMsg.Font.Style := mmMsg.Font.Style + [fsBold];
// if not bShowTitle and (NotiType <> nftMin) then
// mmMsg.Top := lbTitle.Top;
end;
procedure SetPrevent(bOneButton: Boolean = true; bReqDevExcept: Boolean = false);
begin
if bOneButton then
begin
SetOneButtion;
end else
if bReqDevExcept then
begin
imgSet.Tag := 4;
SetImgBtn(imgSet, imgSet.Tag);
sCmdParam_ := 'RegDevExcept';
end;
// if NotiType = nftMin then
lbTitle.Caption := RS_TitlePreventSimple;
// else
// lbTitle.Caption := RS_TitlePrevent;
mmMsg.Font.Color := $635653;
mmMsg.Font.Style := mmMsg.Font.Style + [fsBold];
// MsgList.Add(APP_TITLE);
// MsgList.Add('보안정책 위반행위가 탐지되었습니다.');
// MsgList.Add('');
end;
var
nType: Integer;
begin
try
Guard(StrList, TStringList.Create);
O := SO(sJsonData);
nType := O.I['T'];
Guard(MsgList, TStringList.Create);
// TTgTrace.T('PopupMessage() .. Type=%d', [O.I['T']]);
case nType of
TYPE_MSG_PREVENT_BLUETOOTH :
begin
if CUSTOMER_TYPE = CUSTOMER_LX then
SetOneButtion
else begin
{$IFDEF _HE_}
if IsApproveSupport and gMgSvc.UseApproval then
SetPrevent((gMgSvc.IsNewApi and not PO.AbleBtExceptReq and not PO.BtApproval) or
(CUSTOMER_TYPE = CUSTOMER_HDENG) or (CUSTOMER_TYPE = CUSTOMER_GEC), true)
else
SetPrevent((gMgSvc.IsNewApi and not PO.AbleBtExceptReq) or
(CUSTOMER_TYPE = CUSTOMER_HDENG) or (CUSTOMER_TYPE = CUSTOMER_GEC), true)
{$ELSE}
SetPrevent(true, true);
{$ENDIF}
end;
MsgList.Add(RS_DetectBlue);
SplitString2(O.S['D'], '|', StrList, true);
{$IFDEF _HE_}
ReqDevExceptInfo_.ReqDevType := rdtBluetooth;
// ReqDevExceptInfo_.sDevName := Format('Ts (%s)', [StrList[0], StrList[1]]); // 이거 왜 이렇게 했는지 기억이 안남... 25_0218 08:50:41 kku
ReqDevExceptInfo_.sDevName := Format('%s, %s', [StrList[0], StrList[1]]);
try
ReqDevExceptInfo_.sSerial := StrList[2];
except
ReqDevExceptInfo_.sSerial := 'Unknown';
end;
{$ENDIF}
MsgList.Add(Format(' - Name : %s', [StrList[0]]));
MsgList.Add(Format(' - Type : %s', [StrList[1]]));
// if StrList.Count > 2 then
// MsgList.Add(Format(' - Adress : %s', [StrList[2]]));
if StrList.Count > 3 then
MsgList.Add(RS_BlueCut);
end;
end;
{$IFDEF _HE_}
if PO.NotifyType = nftACenter then
begin
_nNotiCnt := 0; // 알림센터에서 일반 팝업 으로 넘어갈때를 위함, 일단 여기에 넣음..22_0825 09:02:09 kku
var sTitle: String := RS_SecuViol;
case O.I['T'] of
TYPE_MSG_SAFEAPPLIED : sTitle := RS_Info;
TYPE_MSG_OLD_WINDOWS,
TYPE_MSG_VUL_OS,
TYPE_MSG_VUL_PW,
TYPE_MSG_VUL_AV,
TYPE_MSG_VUL_FW,
TYPE_MSG_VUL_SCREEN,
TYPE_MSG_VUL_ALLOWACCESS,
TYPE_MSG_VUL_EMPNO : sTitle := RS_Vul;
// TYPE_MSG_NOTIFICATION,
TYPE_MSG_UPDATE,
TYPE_MSG_AFTERREPORT :
begin
sTitle := RS_Info;
end;
TYPE_MSG_NOTIFICATION : sTitle := RS_Noti;
end;
sNotiCenterMsg_ := sTitle + ':' + MsgList.Text;
end else
{$ENDIF}
begin
mmMsg.Text := MsgList.Text;
// if ((NotiType = nftNormal) and (mmMsg.Lines.Count > 9)) or
// ((NotiType = nftMin) and (mmMsg.Lines.Count > 5)) then
if mmMsg.Lines.Count > 5 then
mmMsg.ScrollBars := TScrollStyle.ssVertical;
{$IFNDEF _HE_}
Show;
{$ENDIF}
end;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. PopupMessage()');
end;
end;
procedure TDlgNoticeBT.FormClose(Sender: TObject; var Action: TCloseAction);
begin
try
if _nNotiCnt > 0 then
Dec(_nNotiCnt);
Action := caFree;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. FormClose()');
end;
end;
procedure TDlgNoticeBT.FormKeyPress(Sender: TObject; var Key: Char);
begin
if Key = #27 then
begin
try
Close;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. FormKeyPress()');
end;
end;
end;
procedure TDlgNoticeBT.FormMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
end;
procedure TDlgNoticeBT.FormShow(Sender: TObject);
begin
FormStyle := fsNormal;
end;
procedure TDlgNoticeBT.imgOkClick(Sender: TObject);
begin
try
Close;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. imgOkClick()');
end;
end;
procedure TDlgNoticeBT.imgOkMouseEnter(Sender: TObject);
var
img: TImage;
begin
if Sender = nil then
exit;
if Sender is TImage then
img := TImage(Sender)
else if Sender = lbOk then
img := imgOk
else
img := imgSet;
SetImgBtn(img, img.Tag + 1);
end;
procedure TDlgNoticeBT.imgOkMouseLeave(Sender: TObject);
var
img: TImage;
begin
if Sender = nil then
exit;
if Sender is TImage then
img := TImage(Sender)
else if Sender = lbOk then
img := imgOk
else
img := imgSet;
SetImgBtn(img, img.Tag);
end;
procedure TDlgNoticeBT.imgSetClick(Sender: TObject);
var
sHlpExe: String;
begin
{$IFDEF _HE_}
if sCmdParam_ <> '' then
begin
if sCmdParam_ = 'ChangeEmpNo' then
begin
if gMain <> nil then
begin
gMain.imgChangeEmpNoClick(nil);
end;
end else
if sCmdParam_ = 'RegDevExcept' then
begin
if (IsApproveSupport and gMgSvc.UseApproval and gMgSvc.ModePolicy.UsbApproval and (ReqDevExceptInfo_.ReqDevType = rdtUsbDrive)) or
(IsApproveSupport and gMgSvc.UseApproval and gMgSvc.ModePolicy.CdApproval and (ReqDevExceptInfo_.ReqDevType = rdtCdrom)) or
(IsApproveSupport and gMgSvc.UseApproval and gMgSvc.ModePolicy.MtpApproval and (ReqDevExceptInfo_.ReqDevType = rdtMtp)) or
(IsApproveSupport and gMgSvc.UseApproval and gMgSvc.ModePolicy.BtApproval and (ReqDevExceptInfo_.ReqDevType = rdtBluetooth)) or
(IsApproveSupport and gMgSvc.UseApproval and gMgSvc.ModePolicy.ExFApproval and (ReqDevExceptInfo_.ReqDevType = rdtExpFile)) then
begin
var nType: Integer := -1;
ZeroMemory(@LogInfo, SizeOf(LogInfo));
LogInfo.sCode := REQUEST_APPROVAL;
LogInfo.sDevName := ReqDevExceptInfo_.sDevName;
LogInfo.sDevSerial := ReqDevExceptInfo_.sSerial;
case ReqDevExceptInfo_.ReqDevType of
rdtUsbDrive :
begin
nType := 1;
LogInfo.sSummary := 'Approval Request : USB';
end;
rdtExpFile :
begin
nType := 4;
LogInfo.sDevSerial := '';
var O: ISuperObject := nil;
try
O := SO(ReqDevExceptInfo_.sSerial);
except
end;
if (O <> nil) and (O.DataType = stArray) then
begin
LogInfo.sSummary := Format('Approval Request : File Export (%d)', [O.AsArray.Length]);
if O.AsArray.Length = 1 then
LogInfo.sPath := O.AsArray[0].S['filePath'];
end else
LogInfo.sSummary := 'Approval Request : File Export';
end;
rdtMtp :
begin
nType := 5;
LogInfo.sSummary := 'Approval Request : MTP';
end;
rdtBluetooth :
begin
nType := 6;
LogInfo.sSummary := 'Approval Request : Bluetooth';
end;
rdtCdrom :
begin
nType := 7;
LogInfo.sSummary := 'Approval Request : CD/DVD';
end;
end;
var sUrl: String := gMgSvc.SendApproval(nType, @ReqDevExceptInfo_);
if sUrl = '' then
begin
TTgTrace.T('Fail .. SendApproval(1)');
MessageBox(Handle, PChar(RS_NoApprovalInfo), PChar(APP_TITLE), MB_ICONWARNING or MB_OK);
end else begin
gMgSvc.SendEventLogEx(@LogInfo, false);
// ExecutePath(gMgSvc.DestIPort + sUrl);
sHlpExe := GetRunExePathDir + DIR_CONF + EXE_HLP;
if FileExists(sHlpExe) then
begin
var O: ISuperObject := SO;
O.I['RcvWnd'] := Handle;
O.I['Cmd'] := HPCMD_EXECUTE_FILE;
O.S['Path'] := gMgSvc.DestIPort + sUrl;
SaveJsonObjToFile(O, GetRunExePathDir + DIR_CONF + DAT_PARAM);
{$IFDEF DEBUG}
ExecutePath(sHlpExe);
{$ELSE}
ExecuteAppAsUser('explorer.exe', sHlpExe, '', SW_SHOWNORMAL);
{$ENDIF}
end else
ExecutePath(gMgSvc.DestIPort + sUrl);
end;
end else
if Pos('412', FreeLocalizer.LanguageFile) = 0 then
begin
TDlgReqDevExcept.Create(nil, ReqDevExceptInfo_).Show;
end else begin
var sExe: String := GetRunExePathDir + DIR_CONF + EXE_HLP;
if FileExists(sExe) then
begin
var O: ISuperObject := SO;
O.I['RcvWnd'] := gMgSvc.RcvHwnd;
O.I['Cmd'] := HPCMD_REQ_DEVICE_EXCEPT;
O.S['WinCap'] := APP_TITLE;
O.O['ReqInfo'] := TTgJson.ValueToJsonObject<TReqDevExceptInfo>(ReqDevExceptInfo_);
O.I['CT'] := CUSTOMER_TYPE;
SaveJsonObjToFile(O, GetRunExePathDir + DIR_CONF + DAT_PARAM);
{$IFDEF DEBUG}
ExecutePath(sExe);
{$ELSE}
ExecuteAppAsUser('explorer.exe', sExe, '', SW_SHOWNORMAL);
{$ENDIF}
end;
end;
end else
if (sCmdParam_ = 'RegUrlExcept') and IsApproveSupport and gMgSvc.UseApproval and gMgSvc.ModePolicy.WebUrlApproval then
begin
var sUrl: String := gMgSvc.SendApproval(2, @ReqDevExceptInfo_.sSerial[1]);
if sUrl = '' then
begin
TTgTrace.T('Fail .. SendApproval(2)');
MessageBox(Handle, PChar(RS_NoApprovalInfo), PChar(APP_TITLE), MB_ICONWARNING or MB_OK);
end else begin
LogInfo.sCode := REQUEST_APPROVAL;
LogInfo.sDestIpUrl := ReqDevExceptInfo_.sSerial;
LogInfo.sSummary := 'Approval Request : URL';
gMgSvc.SendEventLogEx(@LogInfo, false);
// ExecutePath(gMgSvc.DestIPort + sUrl);
sHlpExe := GetRunExePathDir + DIR_CONF + EXE_HLP;
if FileExists(sHlpExe) then
begin
var O: ISuperObject := SO;
O.I['RcvWnd'] := Handle;
O.I['Cmd'] := HPCMD_EXECUTE_FILE;
O.S['Path'] := gMgSvc.DestIPort + sUrl;
SaveJsonObjToFile(O, GetRunExePathDir + DIR_CONF + DAT_PARAM);
{$IFDEF DEBUG}
ExecutePath(sHlpExe);
{$ELSE}
ExecuteAppAsUser('explorer.exe', sHlpExe, '', SW_SHOWNORMAL);
{$ENDIF}
end else
ExecutePath(gMgSvc.DestIPort + sUrl);
end;
end else
if sCmdParam_ = 'CttSch' then
begin
gMain.lbCttSchRstClick(nil);
// TDlgViewCustomCttSchResult.Create(nil).Show;
end else
if sCmdParam_ = 'OutlookAddin' then
begin
sHlpExe := GetRunExePathDir + DIR_CONF + EXE_HP;
if FileExists(sHlpExe) then
begin
var O: ISuperObject := SO;
O.I['RcvWnd'] := gMain.Handle;
O.B['RunAs'] := true;
O.I['Cmd'] := HPCMD_INSTALL_OUTLOOK_ADDIN;
O.S['MdDir'] := GetRunExePathDir + DIR_CONF;
SaveJsonObjToFile(O, GetRunExePathDir + DIR_CONF + DAT_PARAM);
{$IFDEF DEBUG}
ExecutePath(sHlpExe);
{$ELSE}
ExecuteAppAsUser('explorer.exe', sHlpExe, '', SW_SHOWNORMAL);
{$ENDIF}
end;
end else
if sCmdParam_.StartsWith('http') then
begin
sHlpExe := GetRunExePathDir + DIR_CONF + EXE_HLP;
if FileExists(sHlpExe) then
begin
var O: ISuperObject := SO;
O.I['RcvWnd'] := Handle;
O.I['Cmd'] := HPCMD_EXECUTE_FILE;
O.S['Path'] := sCmdParam_;
SaveJsonObjToFile(O, GetRunExePathDir + DIR_CONF + DAT_PARAM);
{$IFDEF DEBUG}
ExecutePath(sHlpExe);
{$ELSE}
ExecuteAppAsUser('explorer.exe', sHlpExe, '', SW_SHOWNORMAL);
{$ENDIF}
end else
ExecutePath(sCmdParam_);
end else
if sCmdParam_.StartsWith('/c') then
ExecutePath_hide('cmd.exe', sCmdParam_)
end;
{$ENDIF}
Close;
end;
procedure TDlgNoticeBT.imgTopMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
SendMessage(Handle, WM_NCLBUTTONDOWN, HTCAPTION, 0);
end;
procedure TDlgNoticeBT.lbPiCntClick(Sender: TObject);
begin
{$IFDEF _HE_}
gMain.lbCttSchRstClick(nil);
{$ENDIF}
end;
procedure TDlgNoticeBT.lbPiCntMouseEnter(Sender: TObject);
begin
lbPiCnt.Font.Style := lbPiCnt.Font.Style + [fsUnderline];
lbPiCnt.Font.Color := clBlue;
end;
procedure TDlgNoticeBT.lbPiCntMouseLeave(Sender: TObject);
begin
lbPiCnt.Font.Style := lbPiCnt.Font.Style - [fsUnderline];
lbPiCnt.Font.Color := clBlack;
end;
procedure TDlgNoticeBT.SetImgBtn(imgBtn: TImage; nImgIdx: Integer);
begin
try
if imgBtnList.Count <= nImgIdx then
exit;
imgBtnList.GetIcon(nImgIdx, imgBtn.Picture.Icon);
imgBtn.Repaint;
case nImgIdx of
2, 3 :
begin
lbSet.Font.Color := clGreen;
if lbSet.Caption <> RS_Confirm then // 음.. 깔끔하진 않지만 일단 이렇게 처리 25_0218 11:29:22 kku
lbSet.Caption := RS_SetVul;
end;
4, 5 :
begin
lbSet.Font.Color := clPurple;
lbSet.Caption := RS_DevExcept;
end;
end;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. SetImgBtn()');
end;
end;
procedure TDlgNoticeBT.SetOneButtion;
begin
imgSet.Visible := false;
lbSet.Visible := imgSet.Visible;
imgOk.Left := (Width div 2) - (imgOk.Width div 2);
lbOk.Left := imgOk.Left;
end;
procedure TDlgNoticeBT.SetPiResult4HEC(nRstCnt: Integer);
begin
// lbTitle.Visible := false;
if lbTitle.Top = 193 then
begin
// Label1.Left := Label1.Left + 25;
Label2.Left := Label2.Left + 25;
lbGrade.Left := lbGrade.Left + 25;
lbPiCnt.Left := lbPiCnt.Left + 25;
Label5.Left := Label5.Left + 25;
end;
lbPiCnt.Caption := Format('(%d)', [nRstCnt]);
// if nRstCnt < gMgSvc.PrefModel.PersonalInfoFileMax then
{$IFDEF _HE_}
if (gMgSvc.ProcCampn <> nil) and (gMgSvc.ProcCampn.Info.nNotiWarIfCnt > nRstCnt) then
begin
lbGrade.Caption := '''양호''';
lbGrade.Font.Color := clBlue;
end;
{$ENDIF}
cpMain.ActiveCard := cdPI;
end;
procedure TDlgNoticeBT.tCloseTimer(Sender: TObject);
begin
tClose.Enabled := false;
btnClose.Click;
end;
procedure TDlgNoticeBT.tInitTimer(Sender: TObject);
begin
tInit.Enabled := false;
SetImgBtn(imgOk, imgOk.Tag);
SetImgBtn(imgSet, imgSet.Tag);
Application.ProcessMessages;
end;
procedure TDlgNoticeBT.btnCloseClick(Sender: TObject);
begin
Close;
end;
end.

View File

@ -0,0 +1,10 @@
unit Define;
interface
const
APP_TITLE = 'BlueMon';
implementation
end.

View File

@ -0,0 +1,16 @@
program BrowserMon;
uses
Vcl.Forms,
DBrowserMonMain in 'DBrowserMonMain.pas' {DlgBrowserMon};
{$R *.res}
begin
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgBrowserMon, DlgBrowserMon);
Application.Run;
end.

View File

@ -0,0 +1,975 @@
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<ProjectGuid>{769FA8B4-EBB5-46E1-BD9D-1B616F50A793}</ProjectGuid>
<ProjectVersion>19.5</ProjectVersion>
<FrameworkType>VCL</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win32</Platform>
<TargetedPlatforms>1</TargetedPlatforms>
<AppType>Application</AppType>
<MainSource>BrowserMon.dpr</MainSource>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Base' or '$(Base)'!=''">
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Base)'=='true') or '$(Base_Win32)'!=''">
<Base_Win32>true</Base_Win32>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win64' and '$(Base)'=='true') or '$(Base_Win64)'!=''">
<Base_Win64>true</Base_Win64>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Debug' or '$(Cfg_1)'!=''">
<Cfg_1>true</Cfg_1>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_1)'=='true') or '$(Cfg_1_Win32)'!=''">
<Cfg_1_Win32>true</Cfg_1_Win32>
<CfgParent>Cfg_1</CfgParent>
<Cfg_1>true</Cfg_1>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Config)'=='Release' or '$(Cfg_2)'!=''">
<Cfg_2>true</Cfg_2>
<CfgParent>Base</CfgParent>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="('$(Platform)'=='Win32' and '$(Cfg_2)'=='true') or '$(Cfg_2_Win32)'!=''">
<Cfg_2_Win32>true</Cfg_2_Win32>
<CfgParent>Cfg_2</CfgParent>
<Cfg_2>true</Cfg_2>
<Base>true</Base>
</PropertyGroup>
<PropertyGroup Condition="'$(Base)'!=''">
<DCC_DcuOutput>.\_OUT_Object\$(Platform)\$(Config)</DCC_DcuOutput>
<DCC_ExeOutput>.\OUT_$(Config) - $(Platform)</DCC_ExeOutput>
<DCC_E>false</DCC_E>
<DCC_N>false</DCC_N>
<DCC_S>false</DCC_S>
<DCC_F>false</DCC_F>
<DCC_K>false</DCC_K>
<DCC_Namespace>System;Xml;Data;Datasnap;Web;Soap;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace)</DCC_Namespace>
<Icon_MainIcon>$(BDS)\bin\delphi_PROJECTICON.ico</Icon_MainIcon>
<UWP_DelphiLogo44>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_44.png</UWP_DelphiLogo44>
<UWP_DelphiLogo150>$(BDS)\bin\Artwork\Windows\UWP\delphi_UwpDefault_150.png</UWP_DelphiLogo150>
<SanitizedProjectName>BrowserMon</SanitizedProjectName>
<DCC_Define>TRACE;TRACE_OBJ;TRACE_FILE;$(DCC_Define)</DCC_Define>
<VerInfo_Locale>1042</VerInfo_Locale>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win32)'!=''">
<DCC_UsePackage>vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;FFmpegRtl_DXT4;appanalytics;IndyProtocols;vclx;adxBuildD28;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;FFmpegVcl_DXT4;emsedge;bindcompfmx;hclcore_xe104;DBXFirebirdDriver;htmlreports_xe104;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;PKIECtrl24;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;AbbreviaVCLD;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;htmlcomp_xe104;FireDACMongoDBDriver;IndySystem;PngComponentsD;FireDACTDataDriver;vcldb;ibxbindings;VirtualTreesR;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;htmledit_xe104;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;htmleditcore_xe104;RESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;adxolBuildD28;vclib;fmxobj;bindcompvclsmp;FMXTee;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
<DCC_Namespace>Winapi;System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace)</DCC_Namespace>
<BT_BuildType>Debug</BT_BuildType>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Keys>CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments=</VerInfo_Keys>
<VerInfo_Locale>1033</VerInfo_Locale>
<Manifest_File>$(BDS)\bin\default_app.manifest</Manifest_File>
</PropertyGroup>
<PropertyGroup Condition="'$(Base_Win64)'!=''">
<DCC_UsePackage>vclwinx;DataSnapServer;fmx;emshosting;vclie;DbxCommonDriver;bindengine;IndyIPCommon;VCLRESTComponents;DBXMSSQLDriver;FireDACCommonODBC;emsclient;FireDACCommonDriver;FFmpegRtl_DXT4;appanalytics;IndyProtocols;vclx;adxBuildD28;IndyIPClient;dbxcds;vcledge;bindcompvclwinx;FmxTeeUI;FFmpegVcl_DXT4;emsedge;bindcompfmx;DBXFirebirdDriver;inetdb;ibmonitor;FireDACSqliteDriver;DbxClientDriver;PKIECtrl24;FireDACASADriver;Tee;soapmidas;vclactnband;TeeUI;fmxFireDAC;dbexpress;FireDACInfxDriver;DBXMySQLDriver;VclSmp;inet;DataSnapCommon;vcltouch;fmxase;DBXOdbcDriver;dbrtl;FireDACDBXDriver;FireDACOracleDriver;fmxdae;TeeDB;FireDACMSAccDriver;CustomIPTransport;FireDACMSSQLDriver;AbbreviaVCLD;DataSnapIndy10ServerTransport;DataSnapConnectors;vcldsnap;DBXInterBaseDriver;FireDACMongoDBDriver;IndySystem;PngComponentsD;FireDACTDataDriver;vcldb;ibxbindings;VirtualTreesR;vclFireDAC;bindcomp;FireDACCommon;DataSnapServerMidas;FireDACODBCDriver;emsserverresource;IndyCore;RESTBackendComponents;bindcompdbx;rtl;FireDACMySQLDriver;FireDACADSDriver;QESTComponents;DBXSqliteDriver;vcl;IndyIPServer;dsnapxml;dsnapcon;DataSnapClient;DataSnapProviderClient;adortl;DBXSybaseASEDriver;DBXDb2Driver;vclimg;DataSnapFireDAC;emsclientfiredac;FireDACPgDriver;FireDAC;FireDACDSDriver;inetdbxpress;xmlrtl;tethering;ibxpress;bindcompvcl;dsnap;CloudService;DBXSybaseASADriver;DBXOracleDriver;FireDACDb2Driver;DBXInformixDriver;adxolBuildD28;vclib;fmxobj;bindcompvclsmp;FMXTee;DataSnapNativeClient;DatasnapConnectorsFreePascal;soaprtl;soapserver;FireDACIBDriver;$(DCC_UsePackage)</DCC_UsePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1)'!=''">
<DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
<DCC_DebugDCUs>true</DCC_DebugDCUs>
<DCC_Optimize>false</DCC_Optimize>
<DCC_GenerateStackFrames>true</DCC_GenerateStackFrames>
<DCC_DebugInfoInExe>true</DCC_DebugInfoInExe>
<DCC_RemoteDebug>true</DCC_RemoteDebug>
<DCC_IntegerOverflowCheck>true</DCC_IntegerOverflowCheck>
<DCC_RangeChecking>true</DCC_RangeChecking>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_1_Win32)'!=''">
<DCC_RemoteDebug>false</DCC_RemoteDebug>
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
<VerInfo_IncludeVerInfo>true</VerInfo_IncludeVerInfo>
<VerInfo_Locale>1033</VerInfo_Locale>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2)'!=''">
<DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
<DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
<DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
<DCC_DebugInformation>0</DCC_DebugInformation>
</PropertyGroup>
<PropertyGroup Condition="'$(Cfg_2_Win32)'!=''">
<AppDPIAwarenessMode>PerMonitorV2</AppDPIAwarenessMode>
</PropertyGroup>
<ItemGroup>
<DelphiCompile Include="$(MainSource)">
<MainSource>MainSource</MainSource>
</DelphiCompile>
<DCCReference Include="DBrowserMonMain.pas">
<Form>DlgBrowserMon</Form>
<FormType>dfm</FormType>
</DCCReference>
<BuildConfiguration Include="Base">
<Key>Base</Key>
</BuildConfiguration>
<BuildConfiguration Include="Debug">
<Key>Cfg_1</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
<BuildConfiguration Include="Release">
<Key>Cfg_2</Key>
<CfgParent>Base</CfgParent>
</BuildConfiguration>
</ItemGroup>
<ProjectExtensions>
<Borland.Personality>Delphi.Personality.12</Borland.Personality>
<Borland.ProjectType>Application</Borland.ProjectType>
<BorlandProject>
<Delphi.Personality>
<Source>
<Source Name="MainSource">BrowserMon.dpr</Source>
</Source>
<Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dcloffice2k280.bpl">Microsoft Office 2000 Sample Automation Server Wrapper Components</Excluded_Packages>
<Excluded_Packages Name="$(BDSBIN)\dclofficexp280.bpl">Microsoft Office XP Sample Automation Server Wrapper Components</Excluded_Packages>
</Excluded_Packages>
</Delphi.Personality>
<Deployment Version="4">
<DeployFile LocalName="Win32\Debug\BrowserMon.exe" Configuration="Debug" Class="ProjectOutput">
<Platform Name="Win32">
<RemoteName>BrowserMon.exe</RemoteName>
<Overwrite>true</Overwrite>
</Platform>
</DeployFile>
<DeployClass Name="AdditionalDebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidClasses">
<Platform Name="Android">
<RemoteDir>classes</RemoteDir>
<Operation>64</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>classes</RemoteDir>
<Operation>64</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidFileProvider">
<Platform Name="Android">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\xml</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidGDBServer">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiFile">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeArmeabiv7aFile">
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidLibnativeMipsFile">
<Platform Name="Android">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\mips</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidServiceOutput_Android32">
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashImageDef">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStyles">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="AndroidSplashStylesV21">
<Platform Name="Android">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values-v21</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_Colors">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_DefaultAppIcon">
<Platform Name="Android">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon144">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon192">
<Platform Name="Android">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-ldpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_LauncherIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon24">
<Platform Name="Android">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-mdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon36">
<Platform Name="Android">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-hdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon48">
<Platform Name="Android">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon72">
<Platform Name="Android">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_NotificationIcon96">
<Platform Name="Android">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xxxhdpi</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage426">
<Platform Name="Android">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-small</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage470">
<Platform Name="Android">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-normal</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage640">
<Platform Name="Android">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-large</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_SplashImage960">
<Platform Name="Android">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\drawable-xlarge</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="Android_Strings">
<Platform Name="Android">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>res\values</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DebugSymbols">
<Platform Name="iOSSimulator">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyFramework">
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.framework</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="DependencyModule">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.dll;.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="DependencyPackage">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
<Extensions>.dylib</Extensions>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
<Extensions>.bpl</Extensions>
</Platform>
</DeployClass>
<DeployClass Name="File">
<Platform Name="Android">
<Operation>0</Operation>
</Platform>
<Platform Name="Android64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>0</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>0</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\Resources\StartUp\</RemoteDir>
<Operation>0</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iOS_AppStore1024">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_AppIcon152">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_AppIcon167">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Launch2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_LaunchDark2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Notification40">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_Setting58">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPad_SpotLight80">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_AppIcon120">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_AppIcon180">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Launch3x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_LaunchDark2x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_LaunchDark3x">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Notification40">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Notification60">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Setting58">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Setting87">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Spotlight120">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="iPhone_Spotlight80">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectAndroidManifest">
<Platform Name="Android">
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSDeviceDebug">
<Platform Name="iOSDevice32">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSEntitlements">
<Platform Name="iOSDevice32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSInfoPList">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSLaunchScreen">
<Platform Name="iOSDevice64">
<RemoteDir>..\$(PROJECTNAME).launchscreen</RemoteDir>
<Operation>64</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<RemoteDir>..\$(PROJECTNAME).launchscreen</RemoteDir>
<Operation>64</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectiOSResource">
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXDebug">
<Platform Name="OSX64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXEntitlements">
<Platform Name="OSX32">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>..\</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXInfoPList">
<Platform Name="OSX32">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOSXResource">
<Platform Name="OSX32">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\Resources</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Required="true" Name="ProjectOutput">
<Platform Name="Android">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Android64">
<RemoteDir>library\lib\arm64-v8a</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice32">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSDevice64">
<Operation>1</Operation>
</Platform>
<Platform Name="iOSSimARM64">
<Operation>1</Operation>
</Platform>
<Platform Name="Linux64">
<Operation>1</Operation>
</Platform>
<Platform Name="OSX32">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSX64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="OSXARM64">
<RemoteDir>Contents\MacOS</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win32">
<Operation>0</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectOutput_Android32">
<Platform Name="Android64">
<RemoteDir>library\lib\armeabi-v7a</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="ProjectUWPManifest">
<Platform Name="Win32">
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo150">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<DeployClass Name="UWP_DelphiLogo44">
<Platform Name="Win32">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
<Platform Name="Win64">
<RemoteDir>Assets</RemoteDir>
<Operation>1</Operation>
</Platform>
</DeployClass>
<ProjectRoot Platform="Android" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Android64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="iOSDevice32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSDevice64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="iOSSimARM64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Linux64" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="OSX32" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSX64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="OSXARM64" Name="$(PROJECTNAME).app"/>
<ProjectRoot Platform="Win32" Name="$(PROJECTNAME)"/>
<ProjectRoot Platform="Win64" Name="$(PROJECTNAME)"/>
</Deployment>
<Platforms>
<Platform value="Win32">True</Platform>
<Platform value="Win64">False</Platform>
</Platforms>
</BorlandProject>
<ProjectFileVersion>12</ProjectFileVersion>
</ProjectExtensions>
<Import Project="$(BDS)\Bin\CodeGear.Delphi.Targets" Condition="Exists('$(BDS)\Bin\CodeGear.Delphi.Targets')"/>
<Import Project="$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj" Condition="Exists('$(APPDATA)\Embarcadero\$(BDSAPPDATABASEDIR)\$(PRODUCTVERSION)\UserTools.proj')"/>
<Import Project="$(MSBuildProjectName).deployproj" Condition="Exists('$(MSBuildProjectName).deployproj')"/>
</Project>

View File

@ -0,0 +1,79 @@
object DlgBrowserMon: TDlgBrowserMon
Left = 0
Top = 0
Caption = 'BrowserMon'
ClientHeight = 441
ClientWidth = 624
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poScreenCenter
TextHeight = 15
object pnTop: TPanel
Left = 0
Top = 0
Width = 624
Height = 65
Align = alTop
BevelOuter = bvNone
TabOrder = 0
DesignSize = (
624
65)
object Label1: TLabel
Left = 8
Top = 13
Width = 81
Height = 15
Caption = #54532#47196#49464#49828' '#51060#47492' :'
end
object Label2: TLabel
Left = 20
Top = 40
Width = 69
Height = 15
Caption = #50952#46020#50864' '#52897#49496' :'
end
object lbPName: TLabel
Left = 104
Top = 13
Width = 51
Height = 15
Caption = 'Unknown'
end
object lbWndCaption: TLabel
Left = 104
Top = 40
Width = 51
Height = 15
Caption = 'Unknown'
end
object btnFind: TButton
Left = 430
Top = 6
Width = 185
Height = 25
Anchors = [akTop, akRight]
Caption = #48652#46972#50864#51200' '#52286#44256' '#53581#49828#53944' '#52628#52636
TabOrder = 0
OnClick = btnFindClick
end
end
object mmText: TMemo
Left = 0
Top = 65
Width = 624
Height = 376
Align = alClient
ReadOnly = True
ScrollBars = ssBoth
TabOrder = 1
ExplicitLeft = 216
ExplicitTop = 200
ExplicitWidth = 185
ExplicitHeight = 89
end
end

View File

@ -0,0 +1,157 @@
unit DBrowserMonMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, VirtualTrees, Vcl.ExtCtrls, Vcl.StdCtrls;
const
WEB_BROWSERS = 'iexplore.exe|msedge.exe|whale.exe|chrome.exe|firefox.exe|opera.exe|vivaldi.exe';
type
TDlgBrowserMon = class(TForm)
pnTop: TPanel;
btnFind: TButton;
Label1: TLabel;
Label2: TLabel;
lbPName: TLabel;
lbWndCaption: TLabel;
mmText: TMemo;
procedure btnFindClick(Sender: TObject);
private
{ Private declarations }
WebList_: TStringList;
procedure RefreshItems(hWebWnd: HWND);
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
Destructor Destroy; override;
end;
var
DlgBrowserMon: TDlgBrowserMon;
implementation
uses
Tocsg.Strings, Tocsg.Exception, Tocsg.WndUtil, Tocsg.Process, Tocsg.MSAA,
Winapi.oleacc, Winapi.ActiveX;
{$R *.dfm}
Constructor TDlgBrowserMon.Create(aOwner: TComponent);
begin
Inherited Create(aOwner);
WebList_ := TStringList.Create;
WebList_.CaseSensitive := false;
SplitString(WEB_BROWSERS, '|', WebList_);
CoInitialize(nil);
end;
Destructor TDlgBrowserMon.Destroy;
begin
CoUninitialize;
FreeAndNil(WebList_);
Inherited;
end;
procedure TDlgBrowserMon.btnFindClick(Sender: TObject);
var
h, hc: HWND;
sCap, sPName: String;
llStyle: LONGLONG;
begin
try
h := FindWindow(nil, nil);
while h <> 0 do
begin
llStyle := GetWindowStyle(h);
if ((llStyle and WS_VISIBLE) <> 0) then
begin
sCap := GetWindowCaption(h);
if sCap <> '' then
begin
sPName := GetProcessNameFromWndHandle(h);
if (sPName <> '') and (WebList_.IndexOf(sPName) <> -1) then
begin
lbPName.Caption := sPName;
lbWndCaption.Caption := sCap;
// if (sPName = 'chrome.exe') or then
begin
hc := GetWndChildClass(h, 'Chrome_RenderWidgetHostHWND');
if hc = 0 then
hc := GetWndChildClass(h, 'Chrome_WidgetWin');
end;
// else
// hc := 0;
if hc <> 0 then
RefreshItems(hc)
else
RefreshItems(h);
Application.ProcessMessages;
exit;
end;
end;
end;
h := GetWindow(h, GW_HWNDNEXT);
end;
except
on E: Exception do
ETgException.TraceException(Self, E, 'Fail .. btnFindClick()');
end;
end;
procedure TDlgBrowserMon.RefreshItems(hWebWnd: HWND);
var
ProcEnumAccessible: TProcessEnumAccessible;
arrRoleStr: array [0..300] of Char;
begin
try
mmText.Clear;
if hWebWnd = 0 then
exit;
ProcEnumAccessible :=
procedure(aAccObj: IAccessible; varChild: OleVariant; h: HWND; nLevel: Integer; var bContinue: Boolean)
var
sName,
sRole: String;
begin
bContinue := true;
try
if Assigned(aAccObj) then
begin
sName := Trim(LowerCase(GetObjectName(aAccObj, varChild)));
sRole := '';
ZeroMemory(@arrRoleStr, SizeOf(arrRoleStr));
if GetObjectRoleString(aAccObj, varChild, @arrRoleStr) then
sRole := DeleteNullTail(String(@arrRoleStr));
if not VarIsNull(varChild) and
(sName <> '') and
(sRole = '텍스트') then
begin
mmText.Lines.Add(sName);
end;
end;
except
// ..
end;
end;
EnumAccessible(hWebWnd, ProcEnumAccessible);
except
on E: Exception do
ETgException.TraceException(E, 'Fail .. GetCurBrowserUrl()');
end;
end;
end.

View File

@ -0,0 +1,14 @@
program CDRomBlock;
uses
Vcl.Forms,
DCdBlkMain in 'DCdBlkMain.pas' {DlgCdBlkMain};
{$R *.res}
begin
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgCdBlkMain, DlgCdBlkMain);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -0,0 +1,51 @@
object DlgCdBlkMain: TDlgCdBlkMain
Left = 0
Top = 0
BorderIcons = [biSystemMenu, biMinimize]
BorderStyle = bsSingle
Caption = 'CDRomBlock'
ClientHeight = 242
ClientWidth = 363
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -12
Font.Name = 'Segoe UI'
Font.Style = []
Position = poScreenCenter
TextHeight = 15
object btnFindBlock: TButton
Left = 8
Top = 8
Width = 145
Height = 25
Caption = 'CDROM '#52286#50500#49436' '#52264#45800
TabOrder = 0
OnClick = btnFindBlockClick
end
object mmInfo: TMemo
Left = 9
Top = 39
Width = 345
Height = 194
ReadOnly = True
ScrollBars = ssVertical
TabOrder = 1
end
object edDrive: TEdit
Left = 209
Top = 10
Width = 65
Height = 23
TabOrder = 2
end
object btnGetType: TButton
Left = 280
Top = 8
Width = 75
Height = 25
Caption = 'GetType'
TabOrder = 3
OnClick = btnGetTypeClick
end
end

View File

@ -0,0 +1,101 @@
unit DCdBlkMain;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Tocsg.Trace;
type
TDlgCdBlkMain = class(TForm)
btnFindBlock: TButton;
mmInfo: TMemo;
edDrive: TEdit;
btnGetType: TButton;
procedure btnFindBlockClick(Sender: TObject);
procedure btnGetTypeClick(Sender: TObject);
private
{ Private declarations }
Trace_: TTgTrace;
public
{ Public declarations }
Constructor Create(aOwner: TComponent); override;
Destructor Destroy; override;
end;
var
DlgCdBlkMain: TDlgCdBlkMain;
implementation
uses
Tocsg.Disk, Tocsg.Safe, Tocsg.Strings, Tocsg.Driver, Tocsg.Path;
{$R *.dfm}
Constructor TDlgCdBlkMain.Create(aOwner: TComponent);
begin
Inherited Create(aOwner);
DeleteFile(GetRunExePathDir + 'CDRomBlock.log');
Trace_ := TTgTrace.Create(GetRunExePathDir, 'CDRomBlock.log');
Trace_.Level := 99;
end;
Destructor TDlgCdBlkMain.Destroy;
begin
FreeAndNil(Trace_);
Inherited;
end;
procedure TDlgCdBlkMain.btnGetTypeClick(Sender: TObject);
begin
edDrive.Text := Trim(edDrive.Text);
if edDrive.Text = '' then
begin
MessageBox(Handle, PChar('드라이브를 입력해주십시오.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
if not DirectoryExists(edDrive.Text) then
begin
MessageBox(Handle, PChar('존재하지 않는 드라이브 입니다.'), PChar(Caption), MB_ICONWARNING or MB_OK);
exit;
end;
ShowMessage(Format('DriveType=%d', [GetDriveType(PChar(edDrive.Text))]));
end;
procedure TDlgCdBlkMain.btnFindBlockClick(Sender: TObject);
var
DriveList: TStringList;
i: Integer;
sDrive,
sResult: String;
begin
Guard(DriveList, TStringList.Create);
SplitString(GetDrivesFromMask(GetLogicalDrives), ',', DriveList);
for i := 0 to DriveList.Count - 1 do
begin
sDrive := DriveList[i];
case GetDriveType(PChar(sDrive)) of
DRIVE_CDROM :
begin
mmInfo.Lines.Add('CDROM : ' + sDrive);
mmInfo.Lines.Add(Format('"%s" 차단 시도...', [sDrive]));
sResult := EjectDrive(sDrive, nil, false, true);
if sResult = FAIL_EJECT then
sResult := EjectDrive2(sDrive, nil, false, true);
if (sResult = FAIL_EJECT) or (GetDriveType(PChar(sDrive)) = DRIVE_CDROM) then
mmInfo.Lines.Add('차단을 실패했습니다...')
else
mmInfo.Lines.Add('차단 성공!! - ' + sResult);
exit;
end;
end;
end;
mmInfo.Lines.Add('CDROM을 발견하지 못했습니다.')
end;
end.

Binary file not shown.

View File

@ -0,0 +1,19 @@
program COCrypto;
uses
Vcl.Forms,
System.TypInfo,
DCoCryptoMain in 'DCoCryptoMain.pas' {DlgCoCryptoMain},
Tocsg.COLib in 'Tocsg.COLib.pas',
Tocsg.COLib.Encrypt in 'Tocsg.COLib.Encrypt.pas';
{$R *.res}
begin
ReportMemoryLeaksOnShutdown := DebugHook <> 0;
Application.Initialize;
Application.MainFormOnTaskbar := True;
Application.CreateForm(TDlgCoCryptoMain, DlgCoCryptoMain);
Application.Run;
end.

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More