English
Forum

Speicheradressen in Longints on function transfer

 

Sven
Bader
Hello together,

the following Topic schiebe I already a while to me here, because it of course in none Profan Version of 10 To X4 functions but very well in Profan2CPP.

target is it, Ressourcen from the ongoing Program or of/ one DLL To loading, which but gepackt are and through RtlDecompressBuffer entpackt go must. this ought to everything should occur, without a File zwischenzuspeichern.

The problem is, that FindResource/LoadResource a Speicheradresse zurückgibt, which I in a Logint save and lest weiterarbeiten can.

the simpelste example, where it in XProfan already knallt is:
umcompressedSize& = Long(res2&,0)

In RtlDecompressBuffer then 2x for res1& and res2&, XProfan had here well gladly self dimensionierte reaches in shape of res1# and res2#.

Nochmal: in Profan2Cpp runs the code, The values (not The address!) the Integers go here correctly as Speicheradresse recognized.

helps me here a further Zuweisung, one copymemory, a Typenkonvertierung?

here the code and enclosed the View source + The Resources-DLL to that testing.
 $H opengl.ph
declare texture&,dll&
Def RtlCompressBuffer(8) !"ntdll.dll", "RtlCompressBuffer"
Def RtlDecompressBuffer(6) !"ntdll.dll", "RtlDecompressBuffer"
Def RtlGetCompressionWorkSpaceSize(3) !"ntdll.dll", "RtlGetCompressionWorkSpaceSize"
Def RtlMoveMemory(3) !"kernel32.dll", "RtlMoveMemory"
Def LoadResource(2) !"KERNEL32","LoadResource"
Def FindResource(3) !"KERNEL32","FindResourceA"
Def LockResource(1) !"KERNEL32","LockResource"
Def FreeResource(1) !"KERNEL32","FreeResource"
Def SizeofResource(2) !"KERNEL32","SizeofResource"
dll& = UseDLL("rgba.dll")
cls

Proc OpenResource

    parameters type$,name$

Endproc

Proc LoadPackedBGRA

    Parameters name$,iWidth&,iHeight&
    Declare umcompressedSize&,umcompressed#,type$,res1&,res2&,bworkspaacesize&
    type$ ="PACKED"
    OpenResource("PACKED", name$)
    res1& = FindResource(dll&, addr(name$), addr(type$))
    res2& = LoadResource(dll&, res1&)
    LockResource(res2&)
    umcompressedSize& = Long(res2&,0)'<- here knallt it to that 1. time, one Lonint with Speicheradresse becomes not correctly processing
    'whom could one too yet to charge
    'umcompressedSize& = (iWidth& * iHeight& * 4)
    dim umcompressed#, umcompressedSize&
    'Gescheiteter attempt, it To saving
    'declare res2#,res1#
    'res2# =  res2&
    'res1# =  res1&
    'dim res1#, 100'???
    'dim res2#, umcompressedSize&
    'RtlDecompressBuffer(2,umcompressed#,umcompressedSize&,res2#+4,SizeofResource(%hInstance, res1#)-4,Addr(bworkspacesize&))
    'here knallt it presumably twice with res1& and res&, there here again Speicheradressen in a Longint stand
    RtlDecompressBuffer(2,umcompressed#,umcompressedSize&,res2&+4,SizeofResource(dll&, res1&)-4,Addr(bworkspacesize&))
    'in  USHORT CompressionFormat
    'out PUCHAR UncompressedBuffer
    'in  ULONG  UncompressedBufferSize
    'in  PUCHAR CompressedBuffer         <- a loning Variable
    'in  ULONG  CompressedBufferSize
    'out PULONG FinalUncompressedSize
    declare txID&
    txID& = 1
    ogl("glGenTextures",1, addr(txID&))
    ogl("glBindTexture",~GL_TEXTURE_2D, txID&)
    ogl("glEnable",~GL_ALPHA_TEST)'RGBA
    ogl("glTexEnvi",~GL_TEXTURE_ENV, ~GL_TEXTURE_ENV_MODE, ~GL_MODULATE)
    ogl("glTexImage2D",~GL_TEXTURE_2D,0,~GL_RGBA,iWidth&, iHeight&,0,~GL_BGRA,~GL_UNSIGNED_BYTE,umcompressed#)
    ogl("glTexParameteri",~GL_TEXTURE_2D, ~GL_TEXTURE_MAG_FILTER, ~GL_LINEAR)
    ogl("glTexParameteri",~GL_TEXTURE_2D, ~GL_TEXTURE_MIN_FILTER, ~GL_LINEAR)
    ogl("glBindTexture",~GL_TEXTURE_2D, 0)
    FreeResource(res2&)
    dispose umcompressed#
    Return txID&

ENDPROC

oGL("init",%hwnd,0,0,0,1)
oGL("glBlendFunc", ~GL_SRC_ALPHA, ~GL_ONE_MINUS_SRC_ALPHA)
oGL("glEnable",    ~GL_BLEND)
oGL("blendmode",    2)
oGL("posmode",    1)
texture&= LoadPackedBGRA("LOGO",128,128)

whilenot iskey(27)

    sleep 16
    oGL("clear")
    oGL("origin",0,0,-1)
    oGL("texture",texture&,1)
    ogl("Quad",0.5,0.5)
    oGL("show")

endwhile

FreeDLL dll&

29 kB
Hochgeladen:02/09/23
Downloadcounter49
Download
 
02/09/23  
 




H.Brill
by me runs it under X4.
Perhaps is correct the way the DLL not.
Überprüfe time, whether dll& one gültiges lever has,
means <> 0.

56 kB
Hochgeladen:02/10/23
Downloadcounter54
Download
 
Benutze XPROFAN X3 + FREEPROFAN
Wir sind die XProfaner.
Sie werden von uns assimiliert.
Widerstand ist zwecklos!
Wir werden alle ihre Funktionen und Algorithmen den unseren hinzufügen.

Was die Borg können, können wir schon lange.
02/10/23  
 




Sven
Bader
Oh man, you're right. the only, I only for Forenbeitrag made have is, a DLL instead of of/ one Ressource from the EXE To take, there shining The Ressource somehow defekt To his.

with following row goes it now too in the EXE, at least ex X3
$RES LOGO.res

The File create I beforehand with the Ressource Hacker.
 
02/10/23  
 



Answer


Topictitle, max. 100 characters.
 

Systemprofile:

no Systemprofil laid out. [anlegen]

XProfan:

 Posting  Font  Smilies  ▼ 

Please register circa a Posting To verfassen.
 

Topic-Options

1.442 Views

Untitledvor 0 min.
H.Brill06/16/24
Georg Teles01/02/24
funkheld09/25/23
Thomas Zielinski06/28/23
More...

Themeninformationen

this Topic has 2 subscriber:

Sven Bader (2x)
H.Brill (1x)


Admins  |  AGB  |  Applications  |  Authors  |  Chat  |  Privacy Policy  |  Download  |  Entrance  |  Help  |  Merchantportal  |  Imprint  |  Mart  |  Interfaces  |  SDK  |  Services  |  Games  |  Search  |  Support

One proposition all XProfan, The there's!


My XProfan
Private Messages
Own Storage Forum
Topics-Remember-List
Own Posts
Own Topics
Clipboard
Log off
 Deutsch English Français Español Italia
Translations

Privacy Policy


we use Cookies only as Session-Cookies because of the technical necessity and with us there no Cookies of Drittanbietern.

If you here on our Website click or navigate, stimmst You ours registration of Information in our Cookies on XProfan.Net To.

further Information To our Cookies and moreover, How You The control above keep, find You in ours nachfolgenden Datenschutzerklärung.


all rightDatenschutzerklärung
i want none Cookie