BSOne.SFC/Tocsg.Module/AppCtrl/DLL_AppCtrl/AppHook.pas

627 lines
26 KiB
Plaintext

{*******************************************************}
{ }
{ 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.