解决方案 »

  1.   

    大概就是这个样子的。function bCompare(pData, bMask: PBYTE; szMask: PAnsiChar): Boolean;
    var
      I: Integer;
    begin
      Result := False;
      while szMask <> #0 do
      begin
        if (szMask = 'x') and (pData^ <> bMask^) then
          Exit;
      end;
      if szMask^ = #0 then
        Result := True;
    end;
    function FindPattern(dwAddress, dwLen: DWORD; bMask: PByte; szMask: PAnsiChar): DWORD;
    var
      I: DWORD;
    begin
      for I := 0 to dwLen - 1 do
      begin
        if (bCompare(PByte(dwAddress + I), bMask, szMask)) then
        begin
          Result := dwAddress + I;
          Exit;
        end;
      end;
      Result := 0;
    end;var
      VTableStart: PDWORD;
      hD3D9: HMODULE;
      VIRTUALTABLE: DWORD;
    const
      a: array[0..13] of Byte = ($C7, $06, $00, $00, $00, $00, $89, $86, $00, $00, $00, $00, $89, $86);
    begin
      hD3D9 := GetModuleHandle('xxxx.dll');
      VIRTUALTABLE := FindPattern(hD3D9, $128000, @a[0], PAnsiChar('xx????xx????xx'));
      CopyMemory(VTableStart, Ptr(VIRTUALTABLE + 2), 4);
      Inc(VTableStart, 44);
      dwStartCode := VTableStart^;
    end;