Sign in to follow this  
Followers 0
Oxin8

Dll Sub Structs

7 posts in this topic

I was wondering if anyone in here had ideas for how I could create a DllStruct within another Struct and get the altered Struct returned and retrieve the data.

Little pseudo example:

struct1 = dwordA

struct2 = dwordB & struct1

dllcall(some function that alters the struct, ptr, dllstructgetptr(struct2)

now get the altered dwordA

sorry about crappy example...

Share this post


Link to post
Share on other sites



I was wondering if anyone in here had ideas for how I could create a DllStruct within another Struct and get the altered Struct returned and retrieve the data.

Little pseudo example:

struct1 = dwordA

struct2 = dwordB & struct1

dllcall(some function that alters the struct, ptr, dllstructgetptr(struct2)

now get the altered dwordA

sorry about crappy example...

first define the struct2 with the 2 dword

$struct2=DllStructCreate("dword;dword")

Then remap the second dword to struct1

$struct1=DllStructCreate("dword",DllStructGetPtr($struct2,2))

you can now use struct1 and struct2 when you need

Share this post


Link to post
Share on other sites

what if struct1 has multiple elements in it? i'm sorry i didn't make it clear or specify at all but struct1 contains about 5 different variables and i'm pretty sure i tried getting it to work with the best of my ability.

Share this post


Link to post
Share on other sites

:lmao:

What's the prototype for the function that you're calling? What's the prototype for the structure? Does the call to DllCall fail or succeed? If it succeeds have you tried a DllCall to GetLastError, a-la:

$errorCall = DllCall(@SystemDir & "\kernel32.dll", "int", "GetLastError")

...to get the last Win32 system error?

Please post enough of your code to show the building of the struct and tha calling of the DLL function; no one call steal your killer app if you post only that much...


Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Share this post


Link to post
Share on other sites

i haven't been home yet to try the get last error thing but the api call i'm talking about would be XInputGetState. It uses a XINPUT_STATE structure with a XINPUT_GAMEPAD structure within it. I know the function called correctly because the XINPUT_STATE packetnum changes when I press a button. This was awhile ago and since I've been getting more and more into API programming I wanted to see if it could be done. I ended up writting a vb wrapper dll and it works fine. All the code is in my _XInput UDF located at:

http://www.autoitscript.com/forum/index.php?showtopic=20161

Share this post


Link to post
Share on other sites

Ejoc, the original author of the DllStruct functions, posted this UDF for the purpose of accessing substructs. I haven't used it, so I can't attest to its functionality...


Yes yes yes, there it was. Youth must go, ah yes. But youth is only being in a way like it might be an animal. No, it is not just being an animal so much as being like one of these malenky toys you viddy being sold in the streets, like little chellovecks made out of tin and with a spring inside and then a winding handle on the outside and you wind it up grrr grrr grrr and off it itties, like walking, O my brothers. But it itties in a straight line and bangs straight into things bang bang and it cannot help what it is doing. Being young is like being like one of these malenky machines.

Share this post


Link to post
Share on other sites

That UDF doesn't work anymore, sadly. I did get it working though. Ended up using what jpm gave as a solution. Thanks you guys. Now I got to go to sleep but tomorrow I have a UDF to rewrite without a crappy vb wrapper.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0