in reply to Re: Windows Device Tree
in thread Windows Device Tree

Great idea.
When I use Win32::GetLastError I receive error value 1784 which means ERROR_INVALID_USER_BUFFER: The supplied user buffer is not valid for the requested operation

I guess that means that I did not define my structures correctly.

Can someone guide me? (all help is much appreciated).

The structures I found on MSDN are:
typedef struct _SP_CLASSIMAGE_DATA { DWORD cbSize; HIMAGELIST ImageList; DWORD Reserved; } SP_CLASSIMAGE_DATA, *PSP_CLASSIMAGE_DATA;
The once I found in CommCtrl.h are:
#ifndef HIMAGELIST struct _IMAGELIST; typedef struct _IMAGELIST* HIMAGELIST; #endif


Update:
I think I found the sollution to my problem.
The structures should be defined as:
Win32::API::Struct->typedef(ULONG_PTR => qw{ ULONG Value }); Win32::API::Struct->typedef(HIMAGELIST => qw{ LONG ImageList }); Win32::API::Struct->typedef(SP_CLASSIMAGE_DATA => qw{ DWORD cbSize; HIMAGELIST ImageList; DWORD Reserved; }); Win32::API::Struct->typedef(SP_CLASSIMAGELIST_DATA => qw{ DWORD cbSize; HIMAGELIST ImageList; ULONG_PTR Reserved; });

And the sizes of the of the structures should not be defined with length() but with sizeof():
$ClassImageListData->{cbSize} = $ClassImageListData->sizeof(); $ClassImageData->{cbSize} = $ClassImageData->sizeof();

I do get some warnings about uninitialized values, but that can be sorted out.