delphi-2010

Hooking an App made on MSVC++ with __fastcall enabled from an injected Delphi dll

可紊 提交于 2021-01-27 14:37:26
问题 I am trying to hook a function within a application compiled with microsoft visual studio 2010, with __fastcall enabled from a delphi 2010 dll, but I am not to skilled to figure out how to detour the following problem: The C++ function is: void __fastcall function(int arg1; char* arg2); I was trying something like that (using uallHook): var FTextMessage : procedure(Modo: integer; Msg: pchar); register; procedure onTextMessage(Modo: integer; Msg: pchar); register; begin ShowMessage(inttostr

Delphi: invoke constructor raises EInvalidCast

橙三吉。 提交于 2021-01-27 06:53:54
问题 I'm trying to invoke a constructor obtained via RTTI (running D2010 version 14.0.3593.25826). The constructor takes a mixture of strings and objects as its arguments, all of which should be initialized to '' or nil . (Disclaimer: I know that the desired constructor will be the one with maximum number of parameters, hence the weird-looking, although suboptimal design.) The code goes as follows: program sb_rtti; {$APPTYPE CONSOLE} uses RTTI, TypInfo, SysUtils; type TMyClass = class (TObject)

TArray<Byte> VS TBytes VS PByteArray

假装没事ソ 提交于 2020-12-29 14:21:26
问题 Those 3 types are very similar... TArray is the generic version of TBytes. Both can be casted to PByteArray and used as buffer for calls to Windows API. (with the same restrictions as string to Pchar). What I would like to know: Is this behavior "by design" or "By Implementation". Or more specifically, could it break in future release? //Edit As stated lower... What I really want to know is: Is this as safe to typecast TBytes(or TArray) to PByteArray as it is to typecast String to PChar as

TArray<Byte> VS TBytes VS PByteArray

二次信任 提交于 2020-12-29 14:15:10
问题 Those 3 types are very similar... TArray is the generic version of TBytes. Both can be casted to PByteArray and used as buffer for calls to Windows API. (with the same restrictions as string to Pchar). What I would like to know: Is this behavior "by design" or "By Implementation". Or more specifically, could it break in future release? //Edit As stated lower... What I really want to know is: Is this as safe to typecast TBytes(or TArray) to PByteArray as it is to typecast String to PChar as

Saving a value even after program is closed and reopened

大憨熊 提交于 2020-08-20 11:24:46
问题 I would like to know how to save the contents of a "variable" after program is closed and reopened. for eg: iCount:=0; inc(iCount)=1; when i close the program and reopen i want iCount to contain 1. Thank you. 回答1: There are many ways to do this. You need to save the value somewhere: in a file, in the Windows registry, in the cloud, ... File Perhaps the easiest approach is to use an INI file. Try this: Create a new VCL application. Add a field FMyNumber: Integer to the main form. To the main

How to Open tables in EDIT/INSERT mode in Delphi

元气小坏坏 提交于 2020-06-18 12:10:38
问题 I tried to open my tables in Delphi with the following code: for I := 0 to Datamodule1.ComponentCount - 1 do if Datamodule1.Components[I] is TADOTable then Begin TADOTable(datamodule1.Components[i]).EDIT; End; But when I want to post it gives me an error that the tables is not in EDIT or INSERT mode. What have I done wrong here? 回答1: One sample of standard code is like this: // open the table ADOTable1.Open; // Mode = dsBrowse // Enter in Edit mode ADOTable1.Edit; //Mode = dsEdit // Change

How to Open tables in EDIT/INSERT mode in Delphi

孤街浪徒 提交于 2020-06-18 12:08:33
问题 I tried to open my tables in Delphi with the following code: for I := 0 to Datamodule1.ComponentCount - 1 do if Datamodule1.Components[I] is TADOTable then Begin TADOTable(datamodule1.Components[i]).EDIT; End; But when I want to post it gives me an error that the tables is not in EDIT or INSERT mode. What have I done wrong here? 回答1: One sample of standard code is like this: // open the table ADOTable1.Open; // Mode = dsBrowse // Enter in Edit mode ADOTable1.Edit; //Mode = dsEdit // Change

Expression illegal in evaluator (& Access Violation)

流过昼夜 提交于 2020-02-16 13:20:15
问题 Im trying to process a plain text file (loaded into a StringList), by using class Tbb2uc but getting AV at calling function GetAddress. TArrayQuotePositions = array[1..4] of integer; Tbb2uc = class(TObject) private Farrayquotes: TArrayQuotePositions; SlInput: TStringList; Inputfilename: TFileName; SlOutput: TStringList; function GetQuotePositions( aLine: string ): TArrayQuotePositions; function GetInvoice( aLine: string ): string; function GetName( aLine: string ): string; function GetAddress