Re: Fastcode StrCopy B&V 2.0

From: Aleksandr Sharahov (alsha-on-mail333.com)
Date: 05/31/04

  • Next message: Aleksandr Sharahov: "Re: Fastcode StrCopy B&V 2.0"
    Date: Mon, 31 May 2004 15:58:52 +0400
    
    

    Some correctons:

    procedure TForm1.Button1Click(Sender: TObject);
    const
      block= 4*1024;
    var
      protect: dword;
      s: string;
      p: pointer;
    begin
      SetLength(s,2*block);
      FillChar(s[1],Length(s),0);
      //make p points at the end of first part of s
      p:=pointer(s);
      integer(p):=(integer(p) and -block) + block - 1;
      //protect the next block
      VirtualProtect(pchar(p)+1,1,PAGE_NOACCESS,@protect);
      try
        ShowMessage(IntToStr(integer(p^)));
      except
        VirtualProtect(pchar(p)+1,1,protect,@protect);
      end;
    end;


  • Next message: Aleksandr Sharahov: "Re: Fastcode StrCopy B&V 2.0"

    Relevant Pages

    • Re: creating registry entry
      ... It puts data OF ANY TYPE AT ALL into the registry. ... allow DWORD values less than 255 so you can pass the value as a byte? ... You pass a pointer to a DWORD, the call looks at the regType ... The call sees that you've told it that a string is coming ...
      (microsoft.public.windowsce.embedded.vc)
    • Re: Fastcode StrCopy B&V 2.0
      ... protect: dword; ... s: string; ... p: pointer; ...
      (borland.public.delphi.language.basm)
    • Re: Efficency and the standard library
      ... loop will dereference a null pointer if argument strInstring is ... this code, out of adversarial hatred, envy and malice. ... Some C programmers in these threads would suggest const ... the output string. ...
      (comp.lang.c)
    • Re: ptrdiff_t overflow/underflow
      ... satisfy the vast majority of trim() use cases. ... It may point to a valid string, ... If any pointer can be converted to a 'void *', assuming there isn't any meta-data outside of the pointer's object representation, and assuming an implementation must not allow two 'void *' values to represent two separate objects, it seems like a fair upper bound. ... And if a pointer value includes bounds information, perhaps the implementation would be kind enough to document either the representation or how to access the information. ...
      (comp.lang.c)
    • Problem converting string to bin/dec/hex
      ... This will require DWORD ... SetConsoleMode PROTO NEAR32 stdcall, ... OutputStr1 BYTE LF,CR,'Input string was: ... lea esi, InputAsStr ...
      (comp.lang.asm.x86)