Jump to content
Toan293

using dllcall and DllStructCreate

Recommended Posts

Toan293

I have a func:

Func JVRO12BKF()
    Local $TVRO12BK1="png6TR0A09"

    Local $TVRO12BK5=DllCall('kernel32.dll','handle','GetModuleHandleW','ptr',0)

    Local $TVRO12BK6=$TVRO12BK5[0]
    Local $TVRO12BK7=10

    Local $TVRO12BK8=DllCall('kernel32.dll','ptr','FindResourceW','ptr',$TvRO12BK6,'wstr',$TvRO12BK1,'int',$TvRO12BK7)
    Local $TVRO12BK9=$TVRO12BK8[0]

    Local $TVRO12BK8=DllCall('kernel32.dll','dword','SizeofResource','ptr',$TvRO12BK6,'ptr',$TvRO12BK9)
    Local $TVRO12BKA=$TVRO12BK8[0]

    Local $TVRO12BK8=DllCall('kernel32.dll','ptr','LoadResource','ptr',$TvRO12BK6,'ptr',$TvRO12BK9)
    Local $TVRO12BK0=$TVRO12BK8[0]

    Local $TVRO12BK8=DllCall('kernel32.dll','ptr','LockResource','ptr',$TvRO12BK0)
    Local $TVRO12BKB=$TVRO12BK8[0]

    Local $TVRO12BKC=DllStructCreate('byte[' & $TvRO12BKA & ']',$TvRO12BKB)

    Local $TVRO12BK4="0x" & StringTrimLeft(DllStructGetData($TvRO12BKC,1),6)
Return BinaryToString($TvRO12BK4, 4)

why it is return "" although it should be "G2mNRi16xj773e11Q56rNuQnc24mY6HL0183D8S285DFzI2Uz1c3xvv506R5gS5fm1czl0sI2F5j4ks76vg4OT9z9574OaO0jD4S924Z8Ge2Nq9rSyhu4nPT1iB64qfZT2fD37dT9IvA81cyJ9Qbf9JKLE62tuOKGZ6DqISEug"

Please help me!

Thank you!

Share this post


Link to post
Share on other sites
Starstar

I have a func:

Func JVRO12BKF()
    Local $TVRO12BK1="png6TR0A09"

    Local $TVRO12BK5=DllCall('kernel32.dll','handle','GetModuleHandleW','ptr',0)

    Local $TVRO12BK6=$TVRO12BK5[0]
    Local $TVRO12BK7=10

    Local $TVRO12BK8=DllCall('kernel32.dll','ptr','FindResourceW','ptr',$TvRO12BK6,'wstr',$TvRO12BK1,'int',$TvRO12BK7)
    Local $TVRO12BK9=$TVRO12BK8[0]

    Local $TVRO12BK8=DllCall('kernel32.dll','dword','SizeofResource','ptr',$TvRO12BK6,'ptr',$TvRO12BK9)
    Local $TVRO12BKA=$TVRO12BK8[0]

    Local $TVRO12BK8=DllCall('kernel32.dll','ptr','LoadResource','ptr',$TvRO12BK6,'ptr',$TvRO12BK9)
    Local $TVRO12BK0=$TVRO12BK8[0]

    Local $TVRO12BK8=DllCall('kernel32.dll','ptr','LockResource','ptr',$TvRO12BK0)
    Local $TVRO12BKB=$TVRO12BK8[0]

    Local $TVRO12BKC=DllStructCreate('byte[' & $TvRO12BKA & ']',$TvRO12BKB)

    Local $TVRO12BK4="0x" & StringTrimLeft(DllStructGetData($TvRO12BKC,1),6)
Return BinaryToString($TvRO12BK4, 4)

why it is return "" although it should be "G2mNRi16xj773e11Q56rNuQnc24mY6HL0183D8S285DFzI2Uz1c3xvv506R5gS5fm1czl0sI2F5j4ks76vg4OT9z9574OaO0jD4S924Z8Ge2Nq9rSyhu4nPT1iB64qfZT2fD37dT9IvA81cyJ9Qbf9JKLE62tuOKGZ6DqISEug"

Please help me!

Thank you!

Where is the EndFunc..........??????


Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Share this post


Link to post
Share on other sites
BrewManNH

There's not nearly enough information in the OP to figure out what it is that you're doing, and where it's failing for you. 

Try putting some consolewrites in the script to tell you what each variable contains after you run the DLLCalls. 

If you want more help then post a runnable script, even if it's not working, that way we can help figure out what it is you're doing. Another thing, what are you attempting with the DLLStructCreate, and why are you not using it in your script other than to attempt to pull out something from it that doesn't need a struct in the first place? You might want to read the help file on DLLStructCreate too.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

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

×