2023年11月15日 星期三

winapi tresourcestream resources rcdata file delphi kernel32 system FindResourceA LoadResource WindowsBase

 winapi  resources rcdata  WinBase.h resource.h kernel32.dll" "system"   FindResourceA
winapi tresourcestream resources rcdata
delphi kernel32  system FindResourceA LoadResource WindowsBase

https://github.com/search?q=repo%3Amicrosoft%2Fwindows-rs%20FindResourceA&type=code

FindResource MAKEINTRESOURCE
https://learn.microsoft.com/zh-tw/windows/win32/menurc/using-resources

LoadLibrary  
FindResource
LoadResource
LockResource
BeginUpdateResource
UpdateResource
EndUpdateResource

https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.FindResource

https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.Classes.TResourceStream
http://docwiki.embarcadero.com/RADStudio/Alexandria/en/Streams,_Reader_and_Writers
https://docwiki.embarcadero.com/Libraries/Alexandria/en/System.Classes.ReadComponentRes

embarcadero TResourceStream
https://docwiki.embarcadero.com/Libraries/Alexandria/en/System

Lazarus FPC  TResourceStream
https://www.freepascal.org/docs-html/rtl/classes/tresourcestream.html

https://github.com/ultibohub/FPC/blob/3a6be9bc116ee0b22011b6a7234a78b455df2e15/source/rtl/objpas/classes/streams.inc#L890

delphi system FindResource LoadResource  LockResource
https://stackoverflow.com/questions/2374317/failed-to-extract-files-from-delphi-resource-file

https://rdk.deadbsd.org/fravia/71.6.196.237/fravia/aitodelp.htm
aitodelp.htm: Delphi Reverse Engineering DFM Files, Windows RCDATA and Object Conversion Routines
https://learn.microsoft.com/en-us/windows/win32/menurc/resource-types

procedure ObjectBinaryToText(Input, Output: TStream); procedure ObjectTextToBinary(Input, Output: TStream); procedure ObjectResourceToText(Input, Output: TStream); procedure ObjectTextToResource(Input, Output: TStream);

Delphi Reverse Engineering
DFM Files, Windows RCDATA and
Object Conversion Routines.


https://github.com/6700github/awesome-reverse-engineering/blob/master/Readme_full.md

delphi exe include  exe Tresourcestream  Embed another EXE file in the Delphi EXE file

Add executable to my resource file then shell execute it [Solved]
https://forum.lazarus.freepascal.org/index.php?topic=44067.0

uses LCLType, Classes, Process; procedure TMainForm.CRunButtonClick(Sender: TObject); var Output: TFileStream; Resource: TResourceStream; var Colorization: TProcess; begin Output := TFileStream.Create('colorization.exe', fmCreate); Resource := TResourceStream.Create(HINSTANCE, 'COLORIZATION', RT_RCDATA); try Output.CopyFrom(Resource, Resource.Size); finally Output.Free(); Resource.Free(); end; Colorization := TProcess.Create(nil); try Colorization.Executable := 'colorization.exe'; Colorization.Execute(); finally Colorization.Free(); end; end; 

 

program Launcher; {$R 'Program.res' 'Program.rc'} uses Windows, SysUtils, ShellAPI, Classes; {$R *.res} type TIsWOW64Process = function(hProcess:THandle;var IsWOW64:Boolean):Boolean;stdcall; const FileName = 'Program.exe'; Res32 = 'Program32'; Res64 = 'Program64'; function GetTempFolder: String; var Buffer: array [0..MAX_PATH+1] of WideChar; begin GetTempPath(MAX_PATH, Buffer); Result := IncludeTrailingPathDelimiter(String(Buffer)); end; function Is64Process:Boolean; var Kernel:HMODULE;IsWOW64Process:TIsWOW64Process;Temp:Boolean; begin Result := false; Kernel := LoadLibrary('kernel32'); if Kernel = 0 then Exit; IsWOW64Process := GetProcAddress(Kernel, 'IsWow64Process'); if not Assigned(IsWow64Process) then Exit; IsWOW64Process(GetCurrentProcess, Temp); Result := Temp; FreeLibrary(Kernel); end; var ResName, FilePath, Params:String; Source:TResourceStream;Dest:TStream; I:Integer;StartupInfo:TStartupInfo; ProcessInfo:TProcessInformation; begin if Is64Process then begin ResName := Res64; end else begin ResName := Res32; end; FilePath := GetTempFolder + FileName; Source := TResourceStream.Create(hInstance, ResName, RT_RCDATA); Dest := TFileStream.Create(FilePath, fmCreate); Dest.CopyFrom(Source, 0); Dest.Write(Source.Memory, Source.Size); Dest.Free; Source.Free; Params := '"'+FilePath+'"'; for I := 1 to ParamCount do begin Params := Params + ' ' + ParamStr(I); end; GetStartupInfo(StartupInfo); if CreateProcess(PWideChar(FilePath), PWideChar(Params), nil, nil, false, CREATE_UNICODE_ENVIRONMENT, nil, PWideChar(GetCurrentDir), StartupInfo, ProcessInfo) then begin if ProcessInfo.hProcess <> 0 then begin WaitForSingleObject(ProcessInfo.hProcess, INFINITE); end; end; DeleteFile(FilePath); end.

沒有留言: