Jump to content
Sign in to follow this  

Problems with Callback formats ?

Recommended Posts


Hi folks,

I'm trying to create a working callback for the latest WIMGAPI. The C style definition looks like this:

DWORD WINAPI SampleCallback(
   IN      DWORD msgId,    //message ID
   IN      WPARAM param1,   //usually file name
   INOUT   LPARAM param2,   //usually error code
   IN      void  *unused

I've been trying to use calback definitions like: $handle = DLLCallbackRegister("_DefaultCallBack", "ptr", "dword;wparam;lparam;ptr") or $handle = DLLCallbackRegister("_DefaultCallBack", "dword", "dword;uint;uint;ptr"), but the result has been (and still is) some memory corruption and due to that, program crashing. Funny thing is that capturing a WIM image seems to be working fine (?? I'm able to apply the resulting image successfully with the standard imagex.exe), but applying a created image (with Autoit script and callbacks) fails.

If I remove these callbacks completely, the program under work seems to be working, but I loose all the file skipping possibilities and progress information.

So please tell me what would be the correctly formatted DLLCallbackRegister command ? Or some other ideas to consider (except giving up .. :))

Share this post

Link to post
Share on other sites

I'm sorry, I didn't see any "edit" buttons to add some more poblem places.. Am I blind or what ;)

So, could it be that this is wrong? :)

Func _WIM_RegisterMessageCallback($hCreateFile, $WIM_MessageProc)
    Local $register

    $register = DllCall($ghWimgapi, "int", "WIMRegisterMessageCallback", "ptr", $hCreateFile, "ptr", $WIM_MessageProc, "long_ptr", 0)
    If $register[0]=$invalid_callback_value Then
        msgbox(0, "WIMRegisterMessageCallback error", _WinAPI_GetLastErrorMessage())

    Return $register[0]


The C style definition looks like this:

DWORD WINAPI WIMRegisterMessageCallback(
    HANDLE   hWim
    FARPROC  fpMessageProc,
    PVOID    pvUserData
Edited by asathatsme

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  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.