EXE にリソースがあり、それを抽出したい場合、それは非常に簡単です。何かのようなもの:
stream := TResourceStream.Create(HInstance, ResourceName, RT_RCDATA);
これが機能するのは、グローバル変数 HInstance が EXE へのハンドルであるためです。BPL 内のコードがその一部であるパッケージへのハンドルを取得して、そこからリソースを抽出できる同様の方法はありますか?
HInstance is actually in the SysInit unit which is unique for each PE (package, exe, dll). System, where the bulk of the compiler RTL and helper functions live is shared among packages if using the rtl package.
So, the code you showed above should work fine from within a package. MainInstance is probably what you're thinking of as being the handle to the loading exe (or even DLL in some cases).