?? dll.dpr
字號:
library Dll;
{ Important note about DLL memory management: ShareMem must be the
first unit in your library's USES clause AND your project's (select
Project-View Source) USES clause if your DLL exports any procedures or
functions that pass strings as parameters or function results. This
applies to all strings passed to and from your DLL--even those that
are nested in records and classes. ShareMem is the interface unit to
the BORLNDMM.DLL shared memory manager, which must be deployed along
with your DLL. To avoid using BORLNDMM.DLL, pass string information
using PChar or ShortString parameters. }
{$IMAGEBASE $57800000}
uses
Windows, madCodeHook;
var
capCreateCaptureWindowANext: function(
lpszWindowName: PChar;
dwStyle: DWord;
x, y: Integer;
nWidth, nHeight: Integer;
hwndParent: THandle;
nID: Integer): THandle; stdcall;
capCreateCaptureWindowWNext: function(
lpszWindowName: PWideChar;
dwStyle: DWord;
x, y: Integer;
nWidth, nHeight: Integer;
hwndParent: THandle;
nID: Integer): THandle; stdcall;
function IsAllowed(lpszWindowNameA: PChar;lpszWindowNameW: PWideChar): boolean;
var
FileName: array[0..1023] of char;
begin
GetModuleFileName(0, FileName, sizeof(FileName));
if lpszWindowNameA<>nil then
Result := MessageBox(0, Pchar('程序"' + FileName + '"欲調(diào)用API函數(shù)capCreateCaptureWindowA創(chuàng)建攝像頭窗口進行捕獲,攝像頭窗口名稱:"'+lpszWindowNameA+'"是否允許?'), '信息', MB_ICONQUESTION + MB_YESNO + MB_TOPMOST) = ID_YES
else
Result := MessageBox(0, Pchar('程序"' + FileName + '"欲調(diào)用API函數(shù)capCreateCaptureWindowW創(chuàng)建攝像頭窗口進行捕獲,攝像頭窗口名稱:"'+WideCharToString(lpszWindowNameW)+'"是否允許?'), '信息', MB_ICONQUESTION + MB_YESNO + MB_TOPMOST) = ID_YES;
end;
function capCreateCaptureWindowACallback(
lpszWindowName: PChar;
dwStyle: DWord;
x, y: Integer;
nWidth, nHeight: Integer;
hwndParent: THandle;
nID: Integer): THandle; stdcall;
begin
if not IsAllowed(lpszWindowName,nil) then
begin
// the user doesn't like this capCreateCaptureWindow call, so we block it
result := 0;
SetLastError(ERROR_ACCESS_DENIED);
end else
begin
// this capCreateCaptureWindow call is okay
result := capCreateCaptureWindowANext(lpszWindowName,
dwStyle,
x, y,
nWidth, nHeight,
hwndParent,
nID);
// capCreateCaptureWindow hooks are used very often, so to be sure we renew the hook
RenewHook(@capCreateCaptureWindowANext);
end;
end;
function capCreateCaptureWindowWCallback(
lpszWindowName: PWideChar;
dwStyle: DWord;
x, y: Integer;
nWidth, nHeight: Integer;
hwndParent: THandle;
nID: Integer): THandle; stdcall;
begin
if not IsAllowed(nil,lpszWindowName) then
begin
// the user doesn't like this capCreateCaptureWindow call, so we block it
result := 0;
SetLastError(ERROR_ACCESS_DENIED);
end
else
begin
// this capCreateCaptureWindow call is okay
result := capCreateCaptureWindowWNext(lpszWindowName,
dwStyle,
x, y,
nWidth, nHeight,
hwndParent,
nID);
// capCreateCaptureWindow hooks are used very often, so to be sure we renew the hook
RenewHook(@capCreateCaptureWindowWNext);
end;
end;
begin
HookAPI('AVICAP32.dll', 'capCreateCaptureWindowA', @capCreateCaptureWindowACallback, @capCreateCaptureWindowANext);
HookAPI('AVICAP32.dll', 'capCreateCaptureWindowW', @capCreateCaptureWindowWCallback, @capCreateCaptureWindowWNext);
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -