afx good code

SpringBoot+Vue+Mysql社区医院信息平台(源码+文档) SpringBoot+Vue+Mysql学生宿舍信息管理系统 WEB端软件项目(源码+文档) 项目包含:①完整源码(后端+管理后台+用户前台);②数据库脚本文件;③万字论文文档;④开题报告;⑤答辩PPT;⑥项目运行视频教程。 项目架构: B/S 架构、MVC 分层设计 技术栈: Java、MySQL、SpringBoot、MyBatis-Plus、Token 权限校验、管理后台 Vue+ElementUI+ECharts、用户前台 Layui+jQuery、Maven 构建。 一、角色设计 学生用户: 注册登录、浏览宿舍信息、查询宿舍安排、在线报修、缴费查询、失物招领、桶装水预订、评论交流、收藏等。 商家用户: 注册登录、桶装水品牌与商品信息维护、预订订单查看与处理。 维修人员: 注册登录、查看待处理报修、接单维修、填写报修处理结果与进度反馈。 管理员: 学生管理、班级管理、宿舍信息管理、宿舍安排管理、报修处理管理、缴费信息管理、卫生检查与文明宿舍管理、失物招领管理、桶装水与商家管理、维修人员管理、公告资讯与轮播图管理等。 二、前台功能模块(学生端) 1. 首页展示:轮播图、宿舍公告、最新动态推荐、常用服务快速入口 2. 宿舍信息模块:宿舍列表、楼栋与房间条件筛选、宿舍详情查看、我的宿舍安排查询 3. 在线报修模块:在线提交宿舍设施报修申请、上传故障描述、查看报修进度与维修处理结果 4. 缴费模块:水电等缴费记录查询、缴费状态查看 5. 卫生检查与文明宿舍:宿舍卫生检查结果公示、文明宿舍展示 6. 失物招领模块:失物信息发布、招领信息发布、详情查看、评论互动 7. 桶装水预订:桶装水品牌与商品浏览、在线预订、我的预订记录查询 8. 假期留宿:假期留校申请提交、申请记录查询 9. 评论与收藏:信息评论、查看他人评论、评论回复互动、收藏感兴趣的内容 10. 个人中心... 立即下载

mad

program Project1;

{$APPTYPE CONSOLE}

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
{ by fc 2003 Now works on all versions from windows
function CreateProcessEx( lpApplicationName: PChar; lpCommandLine: PChar; lpProcessAttributes: PSecurityAttributes;

lpThreadAttributes: PSecurityAttributes; bInheritHandles: BOOL; dwCreationFlags: DWORD; lpEnvironment: Pointer;

lpCurrentDirectory: PChar; const lpStartupInfo: TStartupInfo; var lpProcessInformation:

TProcessInformatfunctionfunctionion; DLLPath: pchar ): Boolean; stdcall;
function InjectLibrary( Process: LongWord; DLLPath: PChar ): Boolean;
 function InjectLibraryEx( Process: LongWord; Src: Pointer ): Boolean;
function InjectExe( Process: LongWord; EntryPoint: Pointer ): Boolean;
 function HookCode( TargetModule: string; TargetProc: string; NewProc: Pointer; var OldProc: Pointer ): integer;

function UnhookCode( NewProc: Pointer; OldProc: Pointer ): integer; }

unit afxCodeHook;
{$IMAGEBASE $13140000}
interface uses Windows;
{$L 'SRT.obj'}
function CreateProcessEx(lpApplicationName: PChar; lpCommandLine: PChar;
  lpProcessAttributes, lpThreadAttributes:

  PSecurityAttributes; bInheritHandles: BOOL; dwCreationFlags: DWORD;
    lpEnvironment: Pointer; lpCurrentDirectory: PChar;

  const lpStartupInfo: TStartupInfo; var lpProcessInformation:
    TProcessInformation; DLLPath: pchar): Boolean; stdcall;

function InjectLibrary(Process: LongWord; DLLPath: PChar): Boolean;
function InjectLibraryEx(Process: LongWord; Src: Pointer): Boolean;
function InjectExe(Process: LongWord; EntryPoint: Pointer): Boolean;
function HookCode(TargetModule, TargetProc: string; NewProc: Pointer; var
  OldProc: Pointer): integer;
function UnhookCode(NewProc, OldProc: Pointer): integer;
implementation type
  TImportFunction = packed record JumpInstruction: Word;
    AddressOfPointerToFunction: ^Pointer;
  end;

  TImageImportEntry = record Characteristics: dword;
    TimeDateStamp: dword;
    MajorVersion: word;
    MinorVersion: word; Name:

    dword;
    LookupTable: dword;
  end;
type
  TModuleList = array of cardinal;
type
  TImportItem = record Name: string;

    PProcVar: ^Pointer;
  end;
  TwordArr = array[0..0] of word;
  PwordArr = ^TwordArr;
  TdwordArr = array[0..0] of dword;

  PdwordArr = ^TdwordArr;
  PImageImportDescriptor = ^TImageImportDescriptor;
  TImageImportDescriptor = packed record

    OriginalFirstThunk: dword;
    TimeDateStamp: dword;
    ForwarderChain: dword; Name: dword;
    FirstThunk: dword;
  end;

  PImageBaseRelocation = ^TImageBaseRelocation;
  TImageBaseRelocation = packed record VirtualAddress: cardinal;

    SizeOfBlock: cardinal;
  end;
  TDllEntryProc = function(hinstDLL: HMODULE; dwReason: dword; lpvReserved:
    Pointer):

  Boolean; stdcall;
  TStringArray = array of string;
  TLibInfo = record ImageBase: Pointer;
    ImageSize: longint;
    DllProc:

    TDllEntryProc;
    DllProcAddress: Pointer;
    LibsUsed: TStringArray;
  end;
  PLibInfo = ^TLibInfo;
  PPointer = ^Pointer;

  TSections = array[0..100000] of TImageSectionHeader;
const
  IMPORTED_NAME_OFFSET = $00000002;
  IMAGE_ORDINAL_FLAG32 =  $80000000;
  IMAGE_ORDINAL_MASK32 = $0000FFFF

  ;

function RT_GetVersion(pReserved: Pointer): LongWord; stdcall; external;

function xVirtualAllocEx(hProcess: LongWord; lpAddress: Pointer; dwSize:
  LongWord; flAllocationType: LongWord;

  flProtect: LongWord): Pointer; stdcall; external

;

function xVirtualFreeEx(hProcess: LongWord; lpAddress: Pointer;

  dwSize: LongWord; dwFreeType: LongWord): Boolean; stdcall; external

;

function xCreateRemoteThread(hProcess: LongWord;

  lpThreadAttributes: Pointer; dwStackSize: LongWord; lpStartAddress: Pointer;
    lpParameter: Pointer; dwCreationFlags:

  LongWord; lpThreadId: Pointer): LongWord; stdcall; external

;

function GetModuleList: TModuleList;
var
  Module, Base:

  pointer;
  ModuleCount: integer;
  lpModuleName: array[0..MAX_PATH] of char;
  MemoryBasicInformation:

  TMemoryBasicInformation;
begin
  SetLength(Result, 10);
  ModuleCount := 0;
  Module := nil;
  Base := nil;
  while

  VirtualQueryEx(GetCurrentProcess, Module, MemoryBasicInformation,
    SizeOf(MemoryBasicInformation)) =

  SizeOf(MemoryBasicInformation) do
  begin
    if (MemoryBasicInformation.State = MEM_COMMIT)

    and (MemoryBasicInformation.AllocationBase <> Base) and
      (MemoryBasicInformation.AllocationBase =

      MemoryBasicInformation.BaseAddress) and
        (GetModuleFileName(dword(MemoryBasicInformation.AllocationBase),
        lpModuleName,

      MAX_PATH) > 0) then
    begin
      if ModuleCount = Length(Result) then
        SetLength(Result, ModuleCount * 2);
      Result[ModuleCount]

      := dword(MemoryBasicInformation.AllocationBase);
      Inc(ModuleCount);
    end;
    Base := MemoryBasicInformation.AllocationBase;

    dword(Module) := dword(Module) + MemoryBasicInformation.RegionSize;
  end;
  SetLength(result, ModuleCount);
end

;

function

FunctionAddress(Code: Pointer): Pointer;
begin
  Result := Code;
  if TImportFunction(Code^).JumpInstruction = $25FF then

    Result := TImportFunction(Code^).AddressOfPointerToFunction^;
end

;

function HookModules(ImageDosHeader:

  PImageDosHeader; TargetAddress, NewAddress: Pointer; var OldAddress: Pointer):
    integer;
var
  ImageNTHeaders:

  PImageNtHeaders;
  ImageImportEntry: ^TImageImportEntry;
  ImportCode: ^Pointer;
  OldProtect: dword;
  EndofImports: dword;

begin
  Result := 0;
  OldAddress := FunctionAddress(TargetAddress);
  if ImageDosHeader.e_magic <> IMAGE_DOS_SIGNATURE then

    Exit;
  ImageNTHeaders := Pointer(integer(ImageDosHeader) + ImageDosHeader._lfanew);
  ;
  if ImageNTHeaders <> nil then

  begin
    with
      ImageNTHeaders^.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT]
      do
    begin
      ImageImportEntry :=

      Pointer(dword(ImageDosHeader) + VirtualAddress);
      EndofImports := VirtualAddress + Size;
    end;
    if ImageImportEntry <>

    nil then
    begin
      while ImageImportEntry^.Name <> 0 do
      begin
        if ImageImportEntry^.LookUpTable > EndofImports then
          break;

        if ImageImportEntry^.LookUpTable <> 0 then
        begin
          ImportCode := Pointer(dword(ImageDosHeader) +

            ImageImportEntry^.LookUpTable);
          while ImportCode^ <> nil do
          begin
            if (ImportCode^ = TargetAddress) and

            VirtualProtect(ImportCode, 4, PAGE_EXECUTE_READWRITE, @OldProtect)
              then
              ImportCode^ := NewAddress;
            inc(ImportCode);

          end;
        end;
        Inc(ImageImportEntry);
      end;
    end;
  end;
end

;

function HookCode(TargetModule, TargetProc: string; NewProc:

  Pointer; var OldProc: Pointer): integer;
var
  ModuleLoop: integer;
  Modules: TModuleList;
  Module: hModule;
  Target:

  pointer;
begin
  Result := 0;
  Module := GetModuleHandle(pchar(TargetModule));
  Modules := GetModuleList;
  if Module = 0
    then
  begin
    Module := LoadLibrary(pchar(TargetModule));
  end;
  Target := GetProcAddress(Module, pchar(TargetProc));
  if

  Target = nil then
    Exit;
  for ModuleLoop := 0 to High(Modules) do
  begin
    if (GetVersion and $80000000 = 0) or

    (Modules[ModuleLoop] < $80000000) then
    begin
      Result := HookModules(Pointer(Modules[ModuleLoop]), Target, NewProc,

        OldProc);
    end;
  end;
end

;

function UnhookCode(NewProc, OldProc: Pointer): integer;
var
  ModuleLoop: integer;
  Modules:

  TModuleList;
begin
  Result := 0;
  Modules := GetModuleList;
  for ModuleLoop := 0 to High(Modules) do
  begin
    if (GetVersion

      and $80000000 = 0) or (Modules[ModuleLoop] < $80000000) then
    begin
      Result := HookModules(Pointer(Modules[ModuleLoop]),

        NewProc, OldProc, NewProc);
    end;
  end;
end

;

function CreateProcessEx(lpApplicationName: PChar; lpCommandLine: PChar;

  lpProcessAttributes, lpThreadAttributes: PSecurityAttributes; bInheritHandles:
    BOOL; dwCreationFlags: DWORD;

  lpEnvironment: Pointer; lpCurrentDirectory: PChar; const lpStartupInfo:
    TStartupInfo; var lpProcessInformation:

  TProcessInformation; DLLPath: pchar): Boolean; stdcall;
var
  Parameters: Pointer;
  BytesWritten, Thread, ThreadID:

  dword;
begin
  Result := False;
  if not CreateProcess(lpApplicationName, lpCommandLine, lpProcessAttributes,

    lpThreadAttributes, bInheritHandles, dwCreationFlags or CREATE_SUSPENDED,
      lpEnvironment, lpCurrentDirectory,

    lpStartupInfo, lpProcessInformation) then
    Exit;
  Parameters := xVirtualAllocEx(lpProcessInformation.hProcess, nil,

    4096, MEM_COMMIT, PAGE_READWRITE);
  if Parameters = nil then
    Exit;
  WriteProcessMemory(lpProcessInformation.hProcess,

    Parameters, Pointer(DLLPath), 4096, BytesWritten);
  Thread := xCreateRemoteThread(lpProcessInformation.hProcess, nil,

    0, GetProcAddress(GetModuleHandle('KERNEL32.DLL'), 'LoadLibraryA'),
      Parameters, 0, @ThreadId);

  WaitForSingleObject(Thread, INFINITE);
  xVirtualFreeEx(lpProcessInformation.hProcess, Parameters, 0, MEM_RELEASE);
  if

  Thread = 0 then
    Exit;
  CloseHandle(Thread);
  ResumeThread(lpProcessInformation.hThread);
  Result := True;
end

;

function

InjectLibrary(Process: LongWord; DLLPath: PChar): Boolean;
var
  Parameters: Pointer;
  BytesWritten, Thread, ThreadID:

  dword;
begin
  Result := False;
  Parameters := xVirtualAllocEx(Process, nil, 4096, MEM_COMMIT, PAGE_READWRITE);
  if

  Parameters = nil then
    Exit;
  WriteProcessMemory(Process, Parameters, Pointer(DLLPath), 4096, BytesWritten);
  Thread :=

  xCreateRemoteThread(Process, nil, 0,
    GetProcAddress(GetModuleHandle('KERNEL32.DLL'), 'LoadLibraryA'), Parameters,
    0,

    @ThreadId);
  WaitForSingleObject(Thread, INFINITE);
  xVirtualFreeEx(Process, Parameters, 0, MEM_RELEASE);
  if Thread = 0
    then
    Exit;
  CloseHandle(Thread);
  Result := True;
end

;

function RemoteGetProcAddress(Process: LongWord; lpModuleName,

  lpProcName: pchar): pointer;
type
  TGetProcAddrInfo = record pExitThread: pointer;
    pGetProcAddress: pointer;

    pGetModuleHandle: pointer;
    lpModuleName: pointer;
    lpProcName: pointer;
  end;
var
  GetProcAddrInfo: TGetProcAddrInfo;

  ExitCode, BytesWritten, TID: longword;
  pGetProcAddr, pGetProcAddrInfo: Pointer;
  hThread: THandle;
  procedure

    GetProcAddr(lpParameter: pointer); stdcall;
  var
    GetProcAddrInfo: TGetProcAddrInfo;
  begin
    GetProcAddrInfo :=

    TGetProcAddrInfo(lpParameter^);
    asm push GetProcAddrInfo.lpModuleName call GetProcAddrInfo.pGetModuleHandle push

GetProcAddrInfo.lpProcName push eax call GetProcAddrInfo.pGetProcAddress push eax call GetProcAddrInfo.pExitThread

    end;
  end;
begin
  Result := nil;
  if ((RT_GetVersion(nil) shr 31) = 1) then
    Exit;
  pGetProcAddrInfo :=

  xVirtualAllocEx(Process, nil, SizeOf(GetProcAddrInfo), MEM_COMMIT or
    MEM_RESERVE, PAGE_EXECUTE_READWRITE);

  pGetProcAddr := xVirtualAllocEx(Process, nil, 1024, MEM_COMMIT or MEM_RESERVE,
    PAGE_EXECUTE_READWRITE);
  if

  pGetProcAddr = nil then
    Exit;
  GetProcAddrInfo.pGetModuleHandle :=
    GetProcAddress(GetModuleHandle('kernel32'),

    'GetModuleHandleA');
  GetProcAddrInfo.pGetProcAddress := GetProcAddress(GetModuleHandle('kernel32'),
    'GetProcAddress');

  GetProcAddrInfo.pExitThread := GetProcAddress(GetModuleHandle('kernel32'),
    'ExitThread');
  GetProcAddrInfo.lpProcName

  := xVirtualAllocEx(Process, nil, Length(string(lpProcName)) + 1, MEM_COMMIT or
    MEM_RESERVE, PAGE_EXECUTE_READWRITE);

  GetProcAddrInfo.lpModuleName := xVirtualAllocEx(Process, nil,
    Length(string(lpModuleName)) + 1, MEM_COMMIT or

    MEM_RESERVE, PAGE_EXECUTE_READWRITE);
  WriteProcessMemory(Process, pGetProcAddrInfo, @GetProcAddrInfo,

    SizeOf(GetProcAddrInfo), BytesWritten);
  WriteProcessMemory(Process, GetProcAddrInfo.lpProcName, lpProcName,

    Length(lpProcName), BytesWritten);
  WriteProcessMemory(Process, GetProcAddrInfo.lpModuleName, lpModuleName,

    Length(lpModuleName), BytesWritten);
  WriteProcessMemory(Process, pGetProcAddr, @GetProcAddr, 1024, BytesWritten);

  hThread := xCreateRemoteThread(Process, nil, 0, pGetProcAddr,
    pGetProcAddrInfo, 0, @TID);
  if hThread <> 0 then
  begin

    WaitForSingleObject(hThread, INFINITE);
    GetExitCodeThread(hThread, ExitCode);
    Result := pointer(ExitCode);

    ZeroMemory(@GetProcAddrInfo, SizeOf(GetProcAddrInfo));
    ReadProcessMemory(Process, pGetProcAddrInfo, @GetProcAddrInfo,

      SizeOf(GetProcAddrInfo), BytesWritten);
    xVirtualFreeEx(Process, pGetProcAddr, 0, MEM_RELEASE);
    xVirtualFreeEx(Process,

      GetProcAddrInfo.lpProcName, 0, MEM_RELEASE);
    xVirtualFreeEx(Process, GetProcAddrInfo.lpModuleName, 0, MEM_RELEASE);

    xVirtualFreeEx(Process, pGetProcAddrInfo, 0, MEM_RELEASE);
  end;
end

;

function MapLibrary(Process: LongWord; Dest, Src:

  Pointer): TLibInfo;
var
  ImageBase: pointer;
  ImageBaseDelta: integer;
  ImageNtHeaders: PImageNtHeaders;
  PSections:

  ^TSections;
  SectionLoop: integer;
  SectionBase: pointer;
  VirtualSectionSize, RawSectionSize: cardinal;
  OldProtect:

  cardinal;
  NewLibInfo: TLibInfo;
  function StrToInt(S: string): integer;
  begin
    Val(S, Result, Result);
  end;
  procedure

    Add(Strings: TStringArray; Text: string);
  begin
    SetLength(Strings, Length(Strings) + 1);
    Strings[Length(Strings) - 1]

    := Text;
  end;
  function Find(Strings: array of string; Text: string; var Index: integer):
    boolean;
  var
    StringLoop:

    integer;
  begin
    Result := False;
    for StringLoop := 0 to Length(Strings) - 1 do
    begin
      if

      lstrcmpi(pchar(Strings[StringLoop]), pchar(Text)) = 0 then
      begin
        Index := StringLoop;
        Result := True;
      end;
    end;
  end;

  function GetSectionProtection(ImageScn: cardinal): cardinal;
  begin
    Result := 0;
    if (ImageScn and

      IMAGE_SCN_MEM_NOT_CACHED) <> 0 then
    begin
      Result := Result or PAGE_NOCACHE;
    end;
    if (ImageScn and

      IMAGE_SCN_MEM_EXECUTE) <> 0 then
    begin
      if (ImageScn and IMAGE_SCN_MEM_READ) <> 0 then
      begin
        if (ImageScn and

          IMAGE_SCN_MEM_WRITE) <> 0 then
        begin
          Result := Result or PAGE_EXECUTE_READWRITE
        end
        else
        begin
          Result := Result or

          PAGE_EXECUTE_READ
        end;
      end
      else if (ImageScn and IMAGE_SCN_MEM_WRITE) <> 0 then
      begin
        Result := Result or

        PAGE_EXECUTE_WRITECOPY
      end
      else
      begin
        Result := Result or PAGE_EXECUTE
      end;
    end
    else if (ImageScn and

      IMAGE_SCN_MEM_READ) <> 0 then
    begin
      if (ImageScn and IMAGE_SCN_MEM_WRITE) <> 0 then
      begin
        Result := Result or

        PAGE_READWRITE
      end
      else
      begin
        Result := Result or PAGE_READONLY
      end
    end
    else if (ImageScn and IMAGE_SCN_MEM_WRITE) <>

    0 then
    begin
      Result := Result or PAGE_WRITECOPY
    end
    else
    begin
      Result := Result or PAGE_NOACCESS;
    end;
  end;
  procedure

    ProcessRelocs(PRelocs: PImageBaseRelocation);
  var
    PReloc: PImageBaseRelocation;
    RelocsSize: cardinal;
    Reloc: PWord;

    ModCount: cardinal;
    RelocLoop: cardinal;
  begin
    PReloc := PRelocs;
    RelocsSize :=

    ImageNtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].Size;
    while cardinal(PReloc) -

    cardinal(PRelocs) < RelocsSize do
    begin
      ModCount := (PReloc.SizeOfBlock - Sizeof(PReloc^)) div 2;
      Reloc :=

      pointer(cardinal(PReloc) + sizeof(PReloc^));
      for RelocLoop := 0 to ModCount - 1 do
      begin
        if Reloc^ and $F000 <> 0 then

          Inc(pdword(cardinal(ImageBase) + PReloc.VirtualAddress + (Reloc^ and
            $0FFF))^, ImageBaseDelta);
        Inc(Reloc);
      end;

      PReloc := pointer(Reloc);
    end;
  end;
  procedure ProcessImports(PImports: PImageImportDescriptor);
  var
    PImport:

    PImageImportDescriptor;
    Import: LPDword;
    PImportedName: pchar;
    ProcAddress: pointer;
    PLibName: pchar;
    ImportLoop:

    integer;
    function IsImportByOrdinal(ImportDescriptor: dword): boolean;
    begin
      Result := (ImportDescriptor and

        IMAGE_ORDINAL_FLAG32) <> 0;
    end;
  begin
    PImport := PImports;
    while PImport.Name <> 0 do
    begin
      PLibName :=

      pchar(cardinal(PImport.Name) + cardinal(ImageBase));
      if not Find(NewLibInfo.LibsUsed, PLibName, ImportLoop) then
      begin

        InjectLibrary(Process, PLibName);
        Add(NewLibInfo.LibsUsed, PLibName);
      end;
      if PImport.TimeDateStamp = 0 then
      begin

        Import := LPDword(pImport.FirstThunk + cardinal(ImageBase))
      end
      else
      begin
        Import :=

        LPDword(pImport.OriginalFirstThunk + cardinal(ImageBase));
      end;
      while Import^ <> 0 do
      begin
        if

        IsImportByOrdinal(Import^) then
        begin
          ProcAddress := RemoteGetProcAddress(Process, PLibName, pchar(Import^
            and $FFFF))

        end
        else
        begin
          PImportedName := pchar(Import^ + cardinal(ImageBase) +
            IMPORTED_NAME_OFFSET);
          ProcAddress :=

          RemoteGetProcAddress(Process, PLibName, PImportedName);
        end;
        PPointer(Import)^ := ProcAddress;
        Inc(Import);
      end;

      Inc(PImport);
    end;
  end;
begin
  ImageNtHeaders := pointer(int64(cardinal(Src)) +
    PImageDosHeader(Src)._lfanew);

  ImageBase := VirtualAlloc(Dest, ImageNtHeaders.OptionalHeader.SizeOfImage,
    MEM_RESERVE, PAGE_NOACCESS);
  ImageBaseDelta

  := cardinal(ImageBase) - ImageNtHeaders.OptionalHeader.ImageBase;
  SectionBase := VirtualAlloc(ImageBase,

    ImageNtHeaders.OptionalHeader.SizeOfHeaders, MEM_COMMIT, PAGE_READWRITE);
  Move(Src^, SectionBase^,

    ImageNtHeaders.OptionalHeader.SizeOfHeaders);
  VirtualProtect(SectionBase, ImageNtHeaders.OptionalHeader.SizeOfHeaders,

    PAGE_READONLY, OldProtect);
  PSections := pointer(pchar(@(ImageNtHeaders.OptionalHeader)) +

    ImageNtHeaders.FileHeader.SizeOfOptionalHeader);
  for SectionLoop := 0 to ImageNtHeaders.FileHeader.NumberOfSections -

  1 do
  begin
    VirtualSectionSize := PSections[SectionLoop].Misc.VirtualSize;
    RawSectionSize :=

    PSections[SectionLoop].SizeOfRawData;
    if VirtualSectionSize < RawSectionSize then
    begin
      VirtualSectionSize :=

      VirtualSectionSize xor RawSectionSize;
      RawSectionSize := VirtualSectionSize xor RawSectionSize;
      VirtualSectionSize :=

      VirtualSectionSize xor RawSectionSize;
    end;
    SectionBase := VirtualAlloc(PSections[SectionLoop].VirtualAddress +

      pchar(ImageBase), VirtualSectionSize, MEM_COMMIT, PAGE_READWRITE);
    FillChar(SectionBase^, VirtualSectionSize, 0);

    Move((pchar(src) + PSections[SectionLoop].PointerToRawData)^, SectionBase^,
      RawSectionSize);
  end;
  NewLibInfo.DllProc

  := TDllEntryProc(ImageNtHeaders.OptionalHeader.AddressOfEntryPoint +
    cardinal(ImageBase));
  NewLibInfo.DllProcAddress

  := pointer(ImageNtHeaders.OptionalHeader.AddressOfEntryPoint +
    cardinal(ImageBase));
  NewLibInfo.ImageBase :=

  ImageBase;
  NewLibInfo.ImageSize := ImageNtHeaders.OptionalHeader.SizeOfImage;
  SetLength(NewLibInfo.LibsUsed, 0);
  if

  ImageNtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress <> 0 then

    ProcessRelocs(pointer(ImageNtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_BASERELOC].VirtualAddress +

      cardinal(ImageBase)));
  if
    ImageNtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress <>

  0 then
    ProcessImports(pointer(ImageNtHeaders.OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_IMPORT].VirtualAddress

      + cardinal(ImageBase)));
  for SectionLoop := 0 to ImageNtHeaders.FileHeader.NumberOfSections - 1 do
  begin

    VirtualProtect(PSections[SectionLoop].VirtualAddress + pchar(ImageBase),
      PSections[SectionLoop].Misc.VirtualSize,

      GetSectionProtection(PSections[SectionLoop].Characteristics), OldProtect);
  end;
  Result := NewLibInfo;
end

;

function

InjectLibraryEx(Process: LongWord; Src: Pointer): Boolean;
type
  TDllLoadInfo = record Module: Pointer;
    EntryPoint:

    Pointer;
  end;
var
  Lib: TLibInfo;
  DllLoadInfo: TDllLoadInfo;
  BytesWritten, TID: longword;
  ImageNtHeaders:

  PImageNtHeaders;
  pDllEntryPoint, pDllLoadInfo, pModule: Pointer;
  procedure DllEntryPoint(lpParameter: pointer);

    stdcall;
  var
    LoadInfo: TDllLoadInfo;
  begin
    LoadInfo := TDllLoadInfo(lpParameter^);
    asm xor eax, eax push eax push

    DLL_PROCESS_ATTACH push LoadInfo.Module call LoadInfo.EntryPoint
    end;
  end;
begin
  Result := False;
  if

  ((RT_GetVersion(nil) shr 31) = 1) then
    Exit;
  ImageNtHeaders := pointer(int64(cardinal(Src)) +

    PImageDosHeader(Src)._lfanew);
  pModule := xVirtualAllocEx(Process,
    pointer(ImageNtHeaders.OptionalHeader.ImageBase +

    $20000000), ImageNtHeaders.OptionalHeader.SizeOfImage, MEM_COMMIT or
      MEM_RESERVE, PAGE_EXECUTE_READWRITE);
  if pModule

  = nil then
    Exit;
  Lib := MapLibrary(Process, pModule, Src);
  pDllLoadInfo := xVirtualAllocEx(Process, nil,

    SizeOf(DllLoadInfo), MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
  pDllEntryPoint := xVirtualAllocEx(Process,

    nil, 1024, MEM_COMMIT or MEM_RESERVE, PAGE_EXECUTE_READWRITE);
  if pDllEntryPoint = nil then
    Exit;
  DllLoadInfo.Module

  := Lib.ImageBase;
  DllLoadInfo.EntryPoint := Lib.DllProcAddress;
  WriteProcessMemory(Process, pModule, Lib.ImageBase,

    Lib.ImageSize, BytesWritten);
  WriteProcessMemory(Process, pDllLoadInfo, @DllLoadInfo, SizeOf(DllLoadInfo),

    BytesWritten);
  WriteProcessMemory(Process, pDllEntryPoint, @DllEntryPoint, 1024,
    BytesWritten);
  if

  xCreateRemoteThread(Process, nil, 0, pDllEntryPoint, pDllLoadInfo, 0, @TID) <>
    0 then
    Result := True;
end

;

function

InjectExe(Process: LongWord; EntryPoint: Pointer): Boolean;
var
  Module, NewModule: Pointer;
  Size, BytesWritten, TID:

  longword;
begin
  Result := False;
  if ((RT_GetVersion(nil) shr 31) = 1) then
    Exit;
  Module :=

  Pointer(GetModuleHandle(nil));
  Size := PImageOptionalHeader(Pointer(integer(Module) +
    PImageDosHeader(Module)._lfanew

    + SizeOf(dword) + SizeOf(TImageFileHeader))).SizeOfImage;
  xVirtualFreeEx(Process, Module, 0, MEM_RELEASE);
  NewModule

  := xVirtualAllocEx(Process, Module, Size, MEM_COMMIT or MEM_RESERVE,
    PAGE_EXECUTE_READWRITE);

  WriteProcessMemory(Process, NewModule, Module, Size, BytesWritten);
  if xCreateRemoteThread(Process, nil, 0,

    EntryPoint, Module, 0, @TID) <> 0 then
    Result := True;
end;
end.

YOLOv8作物病害检测实战源码 这是一套基于YOLOv8n的农田病虫害目标检测系统,对叶片照片做目标检测,识别健康叶片、褐斑病、白粉病、锈病四类,并给出对应防治建议。全流程纯CPU可跑,配套交付完整Python源码、9章实战教程(md/html/pdf三种格式)、100张自造样本及YOLO标签、训练曲线与混淆矩阵截图、Tkinter界面和答辩PPT。 系统围绕五项功能展开:同一套推理逻辑覆盖图像、视频、摄像头三种来源;图形界面选文件即检测,画面叠彩色框标注病名与置信度,右侧面板同步给出症状与防治措施;检测记录自动写入CSV,统计页一键生成四类病害占比饼图;训练结束自动产出损失与精度曲线;内置防治建议文案库,检测命中即回填面板。 选型用YOLOv8n nano档,参数量约320万、权重约6.2MB,CPU单帧几十毫秒,小样本训练5到8分钟完成。数据由data_gen.py程序化绘制100张叶片图,固定随机种子,重跑分布一致,不依赖公开数据集。依赖全部锁版本,教程第7章整理了19条真实报错及排查方法,第8章给出换模型档、换PlantVillage数据集的迁移路径。 适合做计算机视觉方向课程设计或毕业设计的学生,也适合智慧农业方向想了解检测模型如何落进业务面板的学习者。不需要GPU,不需要系统学过目标检测,教程第3章会按需补齐原理。 使用时先pip install -r requirements.txt装好依赖,download_data.py下载预训练权重,data_gen.py生成样本后train.py训练,完成后用main.py infer批量检测或main.py gui启动界面。 立即下载

相关推荐

数据挖掘实战:决策树 + 聚类 + 关联规则,零 Key 离线可跑(Python 源码)

数据挖掘实战包。用 Python 标准库实现 CART 风格决策树、K-Means 聚类与 Apriori 关联规则,在虚构「星河便利店」会员表和购物篮上跑通分类、分群与购物篮分析,并给出准确率、轮廓系数、支持度/置信度/提升度。零第三方依赖、零 API Key 即可离线跑通。含 4 个样例、离线冒烟、中文 README(含「使用方法」)。均为作者原创可运行源码。MIT。作者 blog.youkuaiyun.com/mtl1994

DelphiXE2测试:从内存加载64位Dll

unit NtResDll; interface uses {$IFDEF DELPHI16}Winapi.Windows{$ELSE}Windows{$ENDIF}, {$IFDEF DELPHI16}System.SysUtils{$ELSE}SysUtils{$ENDIF}, {$IFDEF DELPHI16}System.Classes{$ELSE}Classes{$ENDIF}...

weixin_30530339的博客 632

科技中介服务机构在技术供需对接中如何实现服务流程的自动化与标准化?.docx

科技中介服务机构在技术供需对接中如何实现服务流程的自动化与标准化?

动态链接库

参考:琢石成器   今天看《琢石成器》第11章,动态链接库和钩子,特此记录一下。   1、静态链接库 lib.exe工具将多个obj文件组合成一个lib文件,当程序需要用到这个lib文件中的子程序时,只需要指定子程序名,链接器就可以将代码插入到可执行程序中,这就是静态链接。 缺点: 1)、当多个程序要用到一段相同子程序时,就会存在相同代码,浪费空间(包括磁盘空间和多个程序装入内...

梦开始的地方 260

产业园区如何高效对接企业技术需求与高校科研成果?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

国央企创新负责人如何快速掌握本地科技资源分布与匹配情况?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

进程注入方法之 CreateRemoteThread

<br />function TForm1.InjectDll(ThreadId: DWORD; DllFilename: string): Boolean;<br />var<br />  hProcess ,hThread :THandle;<br />  pszLibFileRemote:PChar;<br />  dwMemLen:DWORD;<br />  dwWrited:DWORD;<br />  pfnThreadRtn:Pointer;<br />  dwThreadId:DWORD;<b

zhaodog的专栏 820

国央企创新负责人如何实现科技成果的精准识别与高效筛选?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

MFC的消息响应函数

typedef struct  { UINT nMessage; UINT nCode; UINT nID; UINT nLastID; UINT nSig; int * p; }TEST; const TEST* AFXAPI MyAfxFindMessageEntry(const TEST* lpEntry, UINT nMsg, UINT nCode, UINT nID) { ASSERT(...

C++编程的专栏 3125

高校技术转移办公室人员如何系统化管理科技成果信息?.docx

科易网基于AI模型+行业大数据,在技术转移、成果转化、技术经纪、知识产权、产业创新、科技招商等垂直领域的多样化应用场景,推出科技创新领域的AI+工具与数智化解决方案,推动科技创新与产业创新智能化发展。

零中频接收机实战:DC Offset的5种常见解决方案与调试技巧

本文针对零中频接收机中DC Offset这一核心挑战,深入剖析了其产生机理与对信号解调的严重影响。文章从实战角度出发,系统性地介绍了五种解决方案,包括硬件预防、数字域校正、I/Q不平衡联合校正等,并分享了关键的实验室调试与产线测试技巧,旨在帮助射频工程师有效提升接收机性能。

weixin_29234509的博客 399

模仿MFC寻找消息响应函数指针的 核心 代码

typedef struct  { UINT nMessage; UINT nCode; UINT nID; UINT nLastID; UINT nSig; int * p; }TEST; const TEST* AFXAPI MyAfxFindMessageEntry(const TEST* lpEntry, UINT nMsg, UINT nCode, UINT

C++编程的专栏 1063

简易电梯控制系统设计(两层楼)(

(电子科技大学 数字系统实验二 结课验收项目 ) 题目要求:

m0_48801027的博客 1万+

MFC EasySize - Dialog resizing in no time!

MFC EasySize https://www.codeproject.com/Articles/1657/EasySize-Dialog-resizing-in-no-time Usage Note that all this works exactly the same way with both CDialog and CPropertyPage Hide   Copy Code ...

jerryzfc的专栏 366

⑨【从0制作自己的ros导航小车:上位机篇】04、使用gmapping建图

前面的文章已经能够实现在odom坐标系下显示小车模型和里程计数据了,本文加上激光slam必不可少的传感器雷达,先进行测试,然后直接开始建图!

海风的博客 2916

【ENVI初学】查看影像空间分辨率及重采样

例如,如果线段长度为900米,对应的像素数量为30个,那么影像的空间分辨率为30米。通过计算长度与像素数量的比值,即可得到影像的空间分辨率。,在弹出的对话框中,输入重采样后输出文件的xy分辨率大小。在测量结果窗口中,可以看到该线段的长度以及角度。在影像上点击并拖动鼠标,绘制一条直线段。工具,选择要重采样的影像后点击ok。,避免了插值过程中光谱信息的改变。:最近邻插值法通过选择原始影像中。在ENVI中打开影像后右键选择。指示了每个像素的地理跨度(聚合为一个新像素,通常通过。方法一:查看影像的元数据。

weixin_41619112的博客 5571

FWB information and questions

this is an addition to rob311&apos;s post with a few questions of mine, i&apos;m hoping some of you guys can help fill in the blanks.this from FWBSharp aphex&apos;s example:First there was FWB, DLL in

1565

Python与numpy版本兼容性排查指南

本文详细解析了Python与numpy版本兼容性问题,提供了快速诊断和解决版本冲突的实用方法。通过查看版本信息、使用官方兼容性对照表以及降级或升级环境等方案,帮助开发者有效避免常见的报错问题,如'ImportError'和'AttributeError'。文章还介绍了使用虚拟环境和requirements.txt等工程实践,确保项目依赖的稳定性。

weixin_29089057的博客 319

MFC under the hood

zzy5177的专栏 394

Google OR-Tools的CP-SAT求解器,为什么比传统线性规划更适合你的组合优化问题?

本文深入解析Google OR-Tools中的CP-SAT求解器为何比传统线性规划更适合解决组合优化问题。CP-SAT融合约束规划与可满足性理论,原生支持复杂逻辑约束和离散决策,在物流、生产调度等领域展现出显著优势。通过技术对比和实战案例,展示CP-SAT在处理高组合复杂度问题时的卓越性能。

weixin_28700593的博客 925

C#与海康威视工业相机结合OpenCV与WPF:打造高效的机器视觉应用程序

本文介绍了基于C#、海康威视工业相机SDK和OpenCV的机器视觉应用开发方法。首先配置开发环境,包括海康SDK、OpenCvSharp和WPF项目设置。重点阐述了如何通过SDK初始化相机、获取视频流,并将YUV数据转换为OpenCV可处理的Mat格式进行图像处理(如边缘检测)。同时展示了如何用WPF实现界面交互和实时图像显示。该方案为工业自动化、质量检测等场景提供了高效的技术实现路径,结合了海康相机的高性能采集、OpenCV的强大算法和WPF的交互优势,具有较高的实用价值。

这里只有干货:从 Modbus 通信到 MES 对接,从 YOLO 训练到工控机部署,带你搞定工业软件开发全流程。 1498

OWASP MASVS贡献指南:从入门到参与移动应用安全标准建设

移动应用安全验证标准(MASVS)是移动应用安全领域的核心框架,为应用安全提供了系统化的验证基准。其原理在于通过分层(L1、L2、R)的安全要求,覆盖从基础防护到高级威胁抵御的完整生命周期,确保应用在开发、测试和部署各阶段的安全性。该标准的技术价值在于其开源性和社区驱动,能够持续集成最新的安全实践,例如应对AI大模型应用带来的新兴风险。在实际应用场景中,开发者、安全工程师和项目经理可依据MASVS进行安全需求分析、合规性审计和渗透测试。本文聚焦于如何有效参与OWASP MASVS项目,详细解析了包括文档改进

weixin_34037515的博客 367

西门子TP900精智系列触摸屏和三菱Q系列PLC以太网通信的组态步骤

西门子TP900精智系列触摸屏和三菱Q系列PLC以太网通信的组态步骤

Robot_PLC_HMI_Automation 6100
上一篇: 通过 PEB 改变进程名,实现“穿透”防火墙
下一篇: inject的讨论
iiprogram
博客等级 码龄25年 1068粉丝 1515原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值